Ignore Language tag in subtitles. Get MXF/XML filenames from the asset map.
authorCarl Hetherington <cth@carlh.net>
Sat, 8 Sep 2012 21:05:48 +0000 (22:05 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 8 Sep 2012 21:05:48 +0000 (22:05 +0100)
src/asset_map.cc
src/asset_map.h
src/cpl.cc
src/dcp.cc
src/pkl.cc
src/pkl.h
test/ref/info.log

index 3af2d6f8df4cd4e1b5c3bf9f56ac3f766784560b..31809c9b0a71a01d9230fc06298a6e9d65cfe5f5 100644 (file)
@@ -24,6 +24,7 @@
 #include "asset_map.h"
 
 using namespace std;
+using namespace boost;
 using namespace libdcp;
 
 AssetMap::AssetMap (string file)
@@ -54,3 +55,14 @@ Chunk::Chunk (xmlpp::Node const * node)
        length = optional_int64_node ("Length");
 }
 
+shared_ptr<AssetMapAsset>
+AssetMap::asset_from_id (string id) const
+{
+       for (list<shared_ptr<AssetMapAsset> >::const_iterator i = assets.begin (); i != assets.end(); ++i) {
+               if ((*i)->id == id) {
+                       return *i;
+               }
+       }
+
+       return shared_ptr<AssetMapAsset> ();
+}
index 430cb5aa9e96e770470dd9734f19ac8d873e3f8c..10a0915f23643c7ada179b77b78abc696937a7d6 100644 (file)
@@ -55,6 +55,8 @@ class AssetMap : public XMLFile
 public:
        AssetMap (std::string file);
 
+       boost::shared_ptr<AssetMapAsset> asset_from_id (std::string id) const;
+       
        std::string id;
        std::string creator;
        int64_t volume_count;
index 93deedf8945488a3b44910a1e7919206ab61dda9..c135db3c07acb3020e21d04bb052b1ef652fc769 100644 (file)
@@ -142,6 +142,7 @@ MainSubtitle::MainSubtitle (xmlpp::Node const * node)
        duration = int64_node ("Duration");
 
        ignore_node ("Hash");
+       ignore_node ("Language");
        
        done ();
 }
index d9604bef9e09608132e85fa810cfc3e336151a0b..294794818e0862cc4193885fc6fead8106f42c52 100644 (file)
@@ -332,15 +332,10 @@ DCP::DCP (string directory, bool require_mxfs)
 
                if ((*i)->asset_list->main_picture) {
 
-                       string n = pkl->asset_from_id (p->id)->original_file_name;
-                       if (n.empty ()) {
-                               n = p->annotation_text;
-                       }
-
                        try {
                                picture.reset (new MonoPictureAsset (
                                                       _directory,
-                                                      n,
+                                                      asset_map->asset_from_id ((*i)->asset_list->main_picture->id)->chunks.front()->path,
                                                       _fps,
                                                       (*i)->asset_list->main_picture->entry_point,
                                                       (*i)->asset_list->main_picture->duration
@@ -354,15 +349,10 @@ DCP::DCP (string directory, bool require_mxfs)
                        
                } else if ((*i)->asset_list->main_stereoscopic_picture) {
                        
-                       string n = pkl->asset_from_id (p->id)->original_file_name;
-                       if (n.empty ()) {
-                               n = p->annotation_text;
-                       }
-                       
                        try {
                                picture.reset (new StereoPictureAsset (
                                                       _directory,
-                                                      n,
+                                                      asset_map->asset_from_id ((*i)->asset_list->main_stereoscopic_picture->id)->chunks.front()->path,
                                                       _fps,
                                                       (*i)->asset_list->main_stereoscopic_picture->entry_point,
                                                       (*i)->asset_list->main_stereoscopic_picture->duration
@@ -378,15 +368,10 @@ DCP::DCP (string directory, bool require_mxfs)
                
                if ((*i)->asset_list->main_sound) {
                        
-                       string n = pkl->asset_from_id ((*i)->asset_list->main_sound->id)->original_file_name;
-                       if (n.empty ()) {
-                               n = (*i)->asset_list->main_sound->annotation_text;
-                       }
-                       
                        try {
                                sound.reset (new SoundAsset (
                                                     _directory,
-                                                    n,
+                                                    asset_map->asset_from_id ((*i)->asset_list->main_sound->id)->chunks.front()->path,
                                                     _fps,
                                                     (*i)->asset_list->main_sound->entry_point,
                                                     (*i)->asset_list->main_sound->duration
@@ -400,16 +385,11 @@ DCP::DCP (string directory, bool require_mxfs)
                }
 
                if ((*i)->asset_list->main_subtitle) {
-
-                       string n = pkl->asset_from_id ((*i)->asset_list->main_subtitle->id)->original_file_name;
-                       if (n.empty ()) {
-                               n = (*i)->asset_list->main_subtitle->annotation_text;
-                       }
                        
                        subtitle.reset (new SubtitleAsset (
-                                            _directory,
-                                            n
-                                            )
+                                               _directory,
+                                               asset_map->asset_from_id ((*i)->asset_list->main_subtitle->id)->chunks.front()->path
+                                               )
                                );
                }
                        
index 51e75818c2b57b5760c1acf49b970be788ba600d..41c44734d9a6dbc1e03ec23784248b981b6c3041 100644 (file)
@@ -49,16 +49,3 @@ PKLAsset::PKLAsset (xmlpp::Node const * node)
        type = string_node ("Type");
        original_file_name = optional_string_node ("OriginalFileName");
 }
-       
-shared_ptr<PKLAsset>
-PKL::asset_from_id (string id) const
-{
-       for (list<shared_ptr<PKLAsset> >::const_iterator i = assets.begin (); i != assets.end(); ++i) {
-               if ((*i)->id == id) {
-                       return *i;
-               }
-       }
-
-       return shared_ptr<PKLAsset> ();
-}
-
index ed1bcd61fcf6c9f6dac1daba208738c85227681f..a0a8cb758374a7de221fde8a089d6d3729666a9d 100644 (file)
--- a/src/pkl.h
+++ b/src/pkl.h
@@ -45,8 +45,6 @@ class PKL : public XMLFile
 public:
        PKL (std::string file);
 
-       boost::shared_ptr<PKLAsset> asset_from_id (std::string id) const;
-
        std::string id;
        std::string annotation_text;
        std::string issue_date;
index 8f14a881587b87be9c3f03150e4203953960c9c5..ba0c9991d4882755b0e82cc93a54fbdbcbac9022 100644 (file)
@@ -26,6 +26,11 @@ DCP: ../libdcp-test/BARBARA_TLR_F_DE-FR_CH_51_2K_LOK_20120410_OV
        Frames per second: 24
 Reel 1
        Subtitle: 31 subtitles in French
+DCP: ../libdcp-test/MACHINE-GUN-PREACH_TLR-1_F_EN-de-fr_CH_51_2K_TIT_20111107
+       Length: 3513
+       Frames per second: 24
+Reel 1
+       Subtitle: 94 subtitles in English
 DCP: ../libdcp-test/ASTERIX_TLR-01_F_FR-DE_CH_51_2K_FRE_20120730_DGL_OV
        Length: 3080
        Frames per second: 24