summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-09-08 22:05:48 +0100
committerCarl Hetherington <cth@carlh.net>2012-09-08 22:05:48 +0100
commit0dfba123cbfe59395c894af6acb1e49801bd9c26 (patch)
treefeb996e2afa212afa15257239d63ac8e372d78e8 /src
parent3e651bb96a19bb5603eeb1318528b4a8c636c06c (diff)
Ignore Language tag in subtitles. Get MXF/XML filenames from the asset map.
Diffstat (limited to 'src')
-rw-r--r--src/asset_map.cc12
-rw-r--r--src/asset_map.h2
-rw-r--r--src/cpl.cc1
-rw-r--r--src/dcp.cc32
-rw-r--r--src/pkl.cc13
-rw-r--r--src/pkl.h2
6 files changed, 21 insertions, 41 deletions
diff --git a/src/asset_map.cc b/src/asset_map.cc
index 3af2d6f8..31809c9b 100644
--- a/src/asset_map.cc
+++ b/src/asset_map.cc
@@ -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> ();
+}
diff --git a/src/asset_map.h b/src/asset_map.h
index 430cb5aa..10a0915f 100644
--- a/src/asset_map.h
+++ b/src/asset_map.h
@@ -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;
diff --git a/src/cpl.cc b/src/cpl.cc
index 93deedf8..c135db3c 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -142,6 +142,7 @@ MainSubtitle::MainSubtitle (xmlpp::Node const * node)
duration = int64_node ("Duration");
ignore_node ("Hash");
+ ignore_node ("Language");
done ();
}
diff --git a/src/dcp.cc b/src/dcp.cc
index d9604bef..29479481 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -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
+ )
);
}
diff --git a/src/pkl.cc b/src/pkl.cc
index 51e75818..41c44734 100644
--- a/src/pkl.cc
+++ b/src/pkl.cc
@@ -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> ();
-}
-
diff --git a/src/pkl.h b/src/pkl.h
index ed1bcd61..a0a8cb75 100644
--- 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;