#include "decrypted_kdm.h"
#include "decrypted_kdm_key.h"
#include "dcp_assert.h"
+#include "reel_asset.h"
#include <xmlsec/xmldsig.h>
#include <xmlsec/app.h>
#include <libxml++/libxml++.h>
/* 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
+ from the CPL.
+ */
+ list<shared_ptr<Asset> > other_assets;
+
for (map<string, boost::filesystem::path>::const_iterator i = paths.begin(); i != paths.end(); ++i) {
boost::filesystem::path path = _directory / i->second;
delete p;
if (root == "CompositionPlaylist") {
- _assets.push_back (shared_ptr<CPL> (new CPL (path)));
+ _cpls.push_back (shared_ptr<CPL> (new CPL (path)));
} else if (root == "DCSubtitle") {
- _assets.push_back (shared_ptr<InteropSubtitleAsset> (new InteropSubtitleAsset (path)));
+ other_assets.push_back (shared_ptr<InteropSubtitleAsset> (new InteropSubtitleAsset (path)));
}
} else if (boost::filesystem::extension (path) == ".mxf") {
ASDCP::EssenceType_t type;
case ASDCP::ESS_MPEG2_VES:
throw DCPReadError ("MPEG2 video essences are not supported");
case ASDCP::ESS_JPEG_2000:
- _assets.push_back (shared_ptr<MonoPictureAsset> (new MonoPictureAsset (path)));
+ other_assets.push_back (shared_ptr<MonoPictureAsset> (new MonoPictureAsset (path)));
break;
case ASDCP::ESS_PCM_24b_48k:
case ASDCP::ESS_PCM_24b_96k:
- _assets.push_back (shared_ptr<SoundAsset> (new SoundAsset (path)));
+ other_assets.push_back (shared_ptr<SoundAsset> (new SoundAsset (path)));
break;
case ASDCP::ESS_JPEG_2000_S:
- _assets.push_back (shared_ptr<StereoPictureAsset> (new StereoPictureAsset (path)));
+ other_assets.push_back (shared_ptr<StereoPictureAsset> (new StereoPictureAsset (path)));
break;
case ASDCP::ESS_TIMED_TEXT:
- _assets.push_back (shared_ptr<SMPTESubtitleAsset> (new SMPTESubtitleAsset (path)));
+ other_assets.push_back (shared_ptr<SMPTESubtitleAsset> (new SMPTESubtitleAsset (path)));
break;
default:
throw DCPReadError ("Unknown MXF essence type");
}
BOOST_FOREACH (shared_ptr<CPL> i, cpls ()) {
- i->resolve_refs (list_of_type<Asset, Object> (assets ()));
+ i->resolve_refs (list_of_type<Asset, Object> (other_assets));
}
}
}
void
-DCP::add (boost::shared_ptr<Asset> asset)
+DCP::add (boost::shared_ptr<CPL> cpl)
{
- _assets.push_back (asset);
+ _cpls.push_back (cpl);
}
bool
pkl->add_child("Creator")->add_child_text (metadata.creator);
xmlpp::Element* asset_list = pkl->add_child("AssetList");
- BOOST_FOREACH (shared_ptr<Asset> i, _assets) {
+ BOOST_FOREACH (shared_ptr<Asset> i, assets ()) {
i->write_to_pkl (asset_list, standard);
}
chunk->add_child("Offset")->add_child_text ("0");
chunk->add_child("Length")->add_child_text (raw_convert<string> (pkl_length));
- BOOST_FOREACH (shared_ptr<Asset> i, _assets) {
+ BOOST_FOREACH (shared_ptr<Asset> i, assets ()) {
i->write_to_assetmap (asset_list, _directory);
}
list<shared_ptr<CPL> >
DCP::cpls () const
{
- return list_of_type<Asset, CPL> (_assets);
+ return _cpls;
+}
+
+/** @return All assest (including CPLs) */
+list<shared_ptr<Asset> >
+DCP::assets () const
+{
+ list<shared_ptr<Asset> > assets;
+ BOOST_FOREACH (shared_ptr<CPL> i, cpls ()) {
+ assets.push_back (i);
+ BOOST_FOREACH (shared_ptr<const ReelAsset> j, i->reel_assets ()) {
+ assets.push_back (j->asset_ref().object ());
+ }
+ }
+
+ return assets;
}
*/
bool equals (DCP const & other, EqualityOptions options, NoteHandler note) const;
- void add (boost::shared_ptr<Asset> asset);
+ void add (boost::shared_ptr<CPL> cpl);
std::list<boost::shared_ptr<CPL> > cpls () const;
-
- /** @return All this DCP's assets (note that CPLs are assets) */
- std::list<boost::shared_ptr<Asset> > assets () const {
- return _assets;
- }
+ std::list<boost::shared_ptr<Asset> > assets () const;
bool encrypted () const;
/** the directory that we are writing to */
boost::filesystem::path _directory;
- /** the assets that make up this DCP */
- std::list<boost::shared_ptr<Asset> > _assets;
+ /** the CPLs that make up this DCP */
+ std::list<boost::shared_ptr<CPL> > _cpls;
};
}