}
string
-AtmosAsset::pkl_type (Standard) const
+AtmosAsset::static_pkl_type (Standard)
{
return "application/mxf";
}
boost::shared_ptr<AtmosAssetWriter> start_write (boost::filesystem::path file);
boost::shared_ptr<AtmosAssetReader> start_read () const;
- std::string pkl_type (Standard) const;
+ static std::string static_pkl_type (Standard);
+ std::string pkl_type (Standard s) const {
+ return static_pkl_type (s);
+ }
Fraction edit_rate () const {
return _edit_rate;
string
CPL::pkl_type (Standard standard) const
+{
+ return static_pkl_type (standard);
+}
+
+string
+CPL::static_pkl_type (Standard standard)
{
switch (standard) {
case INTEROP:
return _standard;
}
+ static std::string static_pkl_type (Standard standard);
+
protected:
/** @return type string for PKLs for this asset */
std::string pkl_type (Standard standard) const;
void
DCP::read (bool keep_going, ReadErrors* errors, bool ignore_incorrect_picture_mxf_type)
{
- /* Read the ASSETMAP */
+ /* Read the ASSETMAP and PKL */
boost::filesystem::path asset_map_file;
if (boost::filesystem::exists (_directory / "ASSETMAP")) {
if (starts_with (p, "file://")) {
p = p.substr (7);
}
- paths.insert (make_pair (remove_urn_uuid (i->string_child ("Id")), p));
optional<string> pkl_bool = i->optional_string_child("PackingList");
if (pkl_bool && *pkl_bool == "true") {
pkl_path = p;
+ } else {
+ paths.insert (make_pair (remove_urn_uuid (i->string_child ("Id")), p));
}
}
_pkl.reset (new PKL (_directory / *pkl_path));
/* Read all the assets from the asset map */
- /* XXX: I think we should be looking at the PKL here to decide type, not
- the extension of the file.
- */
- /* Make a list of non-CPL assets so that we can resolve the references
+ /* Make a list of non-CPL/PKL assets so that we can resolve the references
from the CPLs.
*/
list<shared_ptr<Asset> > other_assets;
continue;
}
- if (boost::filesystem::extension (path) == ".xml") {
+ string const pkl_type = _pkl->type(i->first);
+
+ if (pkl_type == CPL::static_pkl_type(*_standard) || pkl_type == InteropSubtitleAsset::static_pkl_type(*_standard)) {
xmlpp::DomParser* p = new xmlpp::DomParser;
try {
p->parse_file (path.string());
}
other_assets.push_back (shared_ptr<InteropSubtitleAsset> (new InteropSubtitleAsset (path)));
}
- } else if (boost::filesystem::extension (path) == ".mxf") {
+ } else if (
+ pkl_type == PictureAsset::static_pkl_type(*_standard) ||
+ pkl_type == SoundAsset::static_pkl_type(*_standard) ||
+ pkl_type == AtmosAsset::static_pkl_type(*_standard) ||
+ pkl_type == SMPTESubtitleAsset::static_pkl_type(*_standard)
+ ) {
/* XXX: asdcplib does not appear to support discovery of read MXFs standard
(Interop / SMPTE)
default:
throw DCPReadError (String::compose ("Unknown MXF essence type %1 in %2", int(type), path.string()));
}
- } else if (boost::filesystem::extension (path) == ".ttf") {
+ } else if (pkl_type == FontAsset::static_pkl_type(*_standard)) {
other_assets.push_back (shared_ptr<FontAsset> (new FontAsset (i->first, path)));
}
}
}
string
-FontAsset::pkl_type (Standard) const
+FontAsset::static_pkl_type (Standard)
{
return "application/ttf";
}
public:
FontAsset (std::string id, boost::filesystem::path file);
+ static std::string static_pkl_type (Standard standard);
+
private:
- std::string pkl_type (Standard standard) const;
+ std::string pkl_type (Standard standard) const {
+ return static_pkl_type (standard);
+ }
};
}
return _movie_title;
}
+ static std::string static_pkl_type (Standard) {
+ return "text/xml;asdcpKind=Subtitle";
+ }
+
protected:
- std::string pkl_type (Standard) const {
- return "text/xml;asdcpKind=Subtitle";
+ std::string pkl_type (Standard s) const {
+ return static_pkl_type (s);
}
private:
}
string
-PictureAsset::pkl_type (Standard standard) const
+PictureAsset::static_pkl_type (Standard standard)
{
switch (standard) {
case INTEROP:
DCP_ASSERT (false);
}
}
+
+string
+PictureAsset::pkl_type (Standard standard) const
+{
+ return static_pkl_type (standard);
+}
return _intrinsic_duration;
}
+ static std::string static_pkl_type (Standard standard);
+
protected:
friend class MonoPictureAssetWriter;
friend class StereoPictureAssetWriter;
#include "dcp_assert.h"
#include <libxml++/libxml++.h>
#include <boost/foreach.hpp>
+#include <iostream>
using std::string;
using boost::shared_ptr;
DCP_ASSERT (false);
}
+
+string
+PKL::type (string id) const
+{
+ BOOST_FOREACH (shared_ptr<Asset> i, _asset_list) {
+ if (i->id() == id) {
+ return i->type;
+ }
+ }
+
+ DCP_ASSERT (false);
+}
}
std::string hash (std::string id) const;
+ std::string type (std::string id) const;
void add_asset (std::string id, boost::optional<std::string> annotation_text, std::string hash, int64_t size, std::string type);
void write (boost::filesystem::path file, boost::shared_ptr<const CertificateChain> signer) const;
}
static bool valid_mxf (boost::filesystem::path);
+ static std::string static_pkl_type (Standard) {
+ return "application/mxf";
+ }
protected:
- std::string pkl_type (Standard) const {
- return "application/mxf";
+ std::string pkl_type (Standard s) const {
+ return static_pkl_type (s);
}
private:
}
string
-SoundAsset::pkl_type (Standard standard) const
+SoundAsset::static_pkl_type (Standard standard)
{
switch (standard) {
case INTEROP:
}
static bool valid_mxf (boost::filesystem::path);
+ static std::string static_pkl_type (Standard standard);
private:
friend class SoundAssetWriter;
- std::string pkl_type (Standard standard) const;
+ std::string pkl_type (Standard standard) const {
+ return static_pkl_type (standard);
+ }
Fraction _edit_rate;
/** The total length of this content in video frames. The amount of