}
}
+ if (cpl_file.empty ()) {
+ throw FileError ("no CPL file found", "");
+ }
+
+ if (pkl_file.empty ()) {
+ throw FileError ("no PKL file found", "");
+ }
+
+ if (asset_map_file.empty ()) {
+ throw FileError ("no AssetMap file found", "");
+ }
+
/* Read the XML */
- CPL cpl (cpl_file);
- PKL pkl (pkl_file);
- AssetMap asset_map (asset_map_file);
+ shared_ptr<CPL> cpl;
+ try {
+ cpl.reset (new CPL (cpl_file));
+ } catch (FileError& e) {
+ throw FileError ("could not load CPL file", cpl_file);
+ }
+
+ shared_ptr<PKL> pkl;
+ try {
+ pkl.reset (new PKL (pkl_file));
+ } catch (FileError& e) {
+ throw FileError ("could not load PKL file", pkl_file);
+ }
+
+ shared_ptr<AssetMap> asset_map;
+ try {
+ asset_map.reset (new AssetMap (asset_map_file));
+ } catch (FileError& e) {
+ throw FileError ("could not load AssetMap file", asset_map_file);
+ }
/* Cross-check */
/* XXX */
/* Now cherry-pick the required bits into our own data structure */
- _name = cpl.annotation_text;
- _content_kind = cpl.content_kind;
+ _name = cpl->annotation_text;
+ _content_kind = cpl->content_kind;
+
+ shared_ptr<CPLAssetList> cpl_assets = cpl->reels.front()->asset_list;
- shared_ptr<CPLAssetList> cpl_assets = cpl.reels.front()->asset_list;
-
/* XXX */
_fps = cpl_assets->main_picture->frame_rate.numerator;
_length = cpl_assets->main_picture->duration;
_assets.push_back (shared_ptr<SoundAsset> (
new SoundAsset (
_directory,
- cpl_assets->main_picture->annotation_text,
+ cpl_assets->main_sound->annotation_text,
_fps,
_length
)
}
list<string>
-DCP::equals (DCP const & other, EqualityFlags flags) const
+DCP::equals (DCP const & other, EqualityOptions opt) const
{
list<string> notes;
- if (flags & LIBDCP_METADATA) {
+ if (opt.flags & LIBDCP_METADATA) {
if (_name != other._name) {
notes.push_back ("names differ");
}
list<shared_ptr<Asset> >::const_iterator b = other._assets.begin ();
while (a != _assets.end ()) {
- list<string> n = (*a)->equals (*b->get(), flags);
+ list<string> n = (*a)->equals (*b, opt);
notes.merge (n);
++a;
++b;
return notes;
}
+
+shared_ptr<const PictureAsset>
+DCP::picture_asset () const
+{
+ for (list<shared_ptr<Asset> >::const_iterator i = _assets.begin(); i != _assets.end(); ++i) {
+ shared_ptr<PictureAsset> p = dynamic_pointer_cast<PictureAsset> (*i);
+ if (p) {
+ return p;
+ }
+ }
+
+ return shared_ptr<const PictureAsset> ();
+}