summaryrefslogtreecommitdiff
path: root/src/dcp.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-01-04 14:45:31 +0000
committerCarl Hetherington <cth@carlh.net>2016-01-04 14:45:31 +0000
commite18e48ce04852c5418099a9f1e4c6928eb03cbd7 (patch)
tree916c7f7594e6b0da74162366545d36976f7171c3 /src/dcp.cc
parent59e8364fd9390d3285e15a5491c7b1876fe9696b (diff)
Make specific DCP CPL class.
Diffstat (limited to 'src/dcp.cc')
-rw-r--r--src/dcp.cc45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index 7d9d2c20..7393b18f 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -18,12 +18,16 @@
*/
#include "dcp.h"
-#include "cpl.h"
+#include "dcp_cpl.h"
+#include "reel_asset.h"
+#include "interop_subtitle_asset.h"
#include "util.h"
#include <boost/foreach.hpp>
using std::string;
+using std::list;
using boost::shared_ptr;
+using boost::dynamic_pointer_cast;
using namespace dcp;
DCP::DCP (boost::filesystem::path directory)
@@ -44,7 +48,7 @@ DCP::write_xml (
shared_ptr<const CertificateChain> signer
)
{
- BOOST_FOREACH (shared_ptr<CPL> i, cpls ()) {
+ BOOST_FOREACH (shared_ptr<DCPCPL> i, cpls ()) {
string const filename = "cpl_" + i->id() + ".xml";
i->write_xml (_directory / filename, standard, signer);
}
@@ -55,3 +59,40 @@ DCP::write_xml (
write_volindex (standard);
write_assetmap (standard, pkl_uuid, boost::filesystem::file_size (pkl_path), metadata);
}
+
+list<shared_ptr<DCPCPL> >
+DCP::cpls () const
+{
+ list<shared_ptr<DCPCPL> > d;
+ BOOST_FOREACH (shared_ptr<CPL> i, _cpls) {
+ d.push_back (dynamic_pointer_cast<DCPCPL> (i));
+ }
+ return d;
+}
+
+shared_ptr<CPL>
+DCP::read_cpl (boost::filesystem::path file) const
+{
+ return shared_ptr<CPL> (new DCPCPL (file));
+}
+
+/** @return All assets (including CPLs) */
+list<shared_ptr<Asset> >
+DCP::assets () const
+{
+ list<shared_ptr<Asset> > assets;
+ BOOST_FOREACH (shared_ptr<DCPCPL> i, cpls()) {
+ assets.push_back (i);
+ BOOST_FOREACH (shared_ptr<const ReelAsset> j, i->reel_assets ()) {
+ shared_ptr<Asset> o = j->asset_ref().asset ();
+ assets.push_back (o);
+ /* More Interop special-casing */
+ shared_ptr<InteropSubtitleAsset> sub = dynamic_pointer_cast<InteropSubtitleAsset> (o);
+ if (sub) {
+ sub->add_font_assets (assets);
+ }
+ }
+ }
+
+ return assets;
+}