summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-08-27 22:27:02 +0100
committerCarl Hetherington <cth@carlh.net>2013-08-27 22:27:02 +0100
commita9e6a22b0462451f1e533082ba588a2cf4ba2f86 (patch)
tree29a4d40ffc68417adfdaa54ff8db6a2e7c262bba /src
parentc9cf540a0fee44b724d1f879489dd7e7f51c60c7 (diff)
Fix paths in OV DCP searches.
Diffstat (limited to 'src')
-rw-r--r--src/cpl.cc43
-rw-r--r--src/cpl.h5
-rw-r--r--src/dcp.cc3
-rw-r--r--src/dcp.h2
-rw-r--r--src/types.h6
5 files changed, 39 insertions, 20 deletions
diff --git a/src/cpl.cc b/src/cpl.cc
index e22ddc71..b45e5892 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,8 +37,11 @@ using std::stringstream;
using std::ofstream;
using std::ostream;
using std::list;
+using std::pair;
+using std::make_pair;
using boost::shared_ptr;
using boost::lexical_cast;
+using boost::optional;
using namespace libdcp;
CPL::CPL (string directory, string name, ContentKind content_kind, int length, int frames_per_second)
@@ -57,7 +60,7 @@ CPL::CPL (string directory, string name, ContentKind content_kind, int length, i
* @param asset_maps AssetMaps to look for assets in.
* @param require_mxfs true to throw an exception if a required MXF file does not exist.
*/
-CPL::CPL (string directory, string file, list<shared_ptr<const parse::AssetMap> > asset_maps, bool require_mxfs)
+CPL::CPL (string directory, string file, list<PathAssetMap> asset_maps, bool require_mxfs)
: _directory (directory)
, _content_kind (FEATURE)
, _length (0)
@@ -104,10 +107,12 @@ CPL::CPL (string directory, string file, list<shared_ptr<const parse::AssetMap>
if (!(*i)->asset_list->main_stereoscopic_picture && p->edit_rate == p->frame_rate) {
+ pair<string, shared_ptr<const parse::AssetMapAsset> > asset = asset_from_id (asset_maps, p->id);
+
try {
picture.reset (new MonoPictureAsset (
- _directory,
- asset_from_id (asset_maps, p->id)->chunks.front()->path
+ asset.first,
+ asset.second->chunks.front()->path
)
);
@@ -125,9 +130,11 @@ CPL::CPL (string directory, string file, list<shared_ptr<const parse::AssetMap>
} else {
try {
+ pair<string, shared_ptr<const parse::AssetMapAsset> > asset = asset_from_id (asset_maps, p->id);
+
picture.reset (new StereoPictureAsset (
- _directory,
- asset_from_id (asset_maps, p->id)->chunks.front()->path,
+ asset.first,
+ asset.second->chunks.front()->path,
_fps,
p->duration
)
@@ -151,9 +158,11 @@ CPL::CPL (string directory, string file, list<shared_ptr<const parse::AssetMap>
if ((*i)->asset_list->main_sound) {
try {
+ pair<string, shared_ptr<const parse::AssetMapAsset> > asset = asset_from_id (asset_maps, (*i)->asset_list->main_sound->id);
+
sound.reset (new SoundAsset (
- _directory,
- asset_from_id (asset_maps, (*i)->asset_list->main_sound->id)->chunks.front()->path
+ asset.first,
+ asset.second->chunks.front()->path
)
);
@@ -174,9 +183,11 @@ CPL::CPL (string directory, string file, list<shared_ptr<const parse::AssetMap>
if ((*i)->asset_list->main_subtitle) {
+ pair<string, shared_ptr<const parse::AssetMapAsset> > asset = asset_from_id (asset_maps, (*i)->asset_list->main_subtitle->id);
+
subtitle.reset (new SubtitleAsset (
- _directory,
- asset_from_id (asset_maps, (*i)->asset_list->main_subtitle->id)->chunks.front()->path
+ asset.first,
+ asset.second->chunks.front()->path
)
);
@@ -509,15 +520,15 @@ CPL::add_kdm (KDM const & kdm)
}
}
-shared_ptr<parse::AssetMapAsset>
-CPL::asset_from_id (list<shared_ptr<const parse::AssetMap> > asset_maps, string id) const
+pair<string, shared_ptr<const parse::AssetMapAsset> >
+CPL::asset_from_id (list<PathAssetMap> asset_maps, string id) const
{
- for (list<shared_ptr<const parse::AssetMap> >::const_iterator i = asset_maps.begin(); i != asset_maps.end(); ++i) {
- shared_ptr<parse::AssetMapAsset> a = (*i)->asset_from_id (id);
+ for (list<PathAssetMap>::const_iterator i = asset_maps.begin(); i != asset_maps.end(); ++i) {
+ shared_ptr<parse::AssetMapAsset> a = i->second->asset_from_id (id);
if (a) {
- return a;
+ return make_pair (i->first, a);
}
}
- return shared_ptr<parse::AssetMapAsset> ();
+ return make_pair ("", shared_ptr<const parse::AssetMapAsset> ());
}
diff --git a/src/cpl.h b/src/cpl.h
index 57d4373f..95bcd03f 100644
--- a/src/cpl.h
+++ b/src/cpl.h
@@ -24,6 +24,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/optional.hpp>
#include <libxml++/libxml++.h>
#include "types.h"
#include "certificates.h"
@@ -47,7 +48,7 @@ class CPL
{
public:
CPL (std::string directory, std::string name, ContentKind content_kind, int length, int frames_per_second);
- CPL (std::string directory, std::string file, std::list<boost::shared_ptr<const parse::AssetMap> > asset_maps, bool require_mxfs = true);
+ CPL (std::string directory, std::string file, std::list<PathAssetMap> asset_maps, bool require_mxfs = true);
void add_reel (boost::shared_ptr<Reel> reel);
@@ -107,7 +108,7 @@ public:
void add_kdm (KDM const &);
private:
- boost::shared_ptr<parse::AssetMapAsset> asset_from_id (std::list<boost::shared_ptr<const parse::AssetMap> > asset_maps, std::string id) const;
+ std::pair<std::string, boost::shared_ptr<const parse::AssetMapAsset> > asset_from_id (std::list<PathAssetMap>, std::string id) const;
std::string _directory;
/** the name of the DCP */
diff --git a/src/dcp.cc b/src/dcp.cc
index b9f43472..9bed7e93 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -55,6 +55,7 @@ using std::ofstream;
using std::ostream;
using std::copy;
using std::back_inserter;
+using std::make_pair;
using boost::shared_ptr;
using boost::lexical_cast;
using namespace libdcp;
@@ -271,7 +272,7 @@ DCP::read (bool require_mxfs)
/* Cross-check */
/* XXX */
- _asset_maps.push_back (asset_map);
+ _asset_maps.push_back (make_pair (boost::filesystem::absolute (_directory).string(), asset_map));
for (list<string>::iterator i = files.cpls.begin(); i != files.cpls.end(); ++i) {
_cpls.push_back (shared_ptr<CPL> (new CPL (_directory, *i, _asset_maps, require_mxfs)));
diff --git a/src/dcp.h b/src/dcp.h
index 55d3d705..8086f4de 100644
--- a/src/dcp.h
+++ b/src/dcp.h
@@ -150,7 +150,7 @@ private:
/** our CPLs */
std::list<boost::shared_ptr<CPL> > _cpls;
- std::list<boost::shared_ptr<const parse::AssetMap> > _asset_maps;
+ std::list<PathAssetMap> _asset_maps;
};
}
diff --git a/src/types.h b/src/types.h
index edabb9e2..1a74039f 100644
--- a/src/types.h
+++ b/src/types.h
@@ -29,6 +29,10 @@
namespace libdcp
{
+namespace parse {
+ class AssetMap;
+}
+
/** Identifier for a sound channel */
enum Channel {
LEFT = 0, ///< left
@@ -141,6 +145,8 @@ extern bool operator== (Color const & a, Color const & b);
extern bool operator!= (Color const & a, Color const & b);
extern std::ostream & operator<< (std::ostream & s, Color const & c);
+typedef std::pair<std::string, boost::shared_ptr<const parse::AssetMap> > PathAssetMap;
+
}
#endif