-
- /* Now cherry-pick the required bits into our own data structure */
-
- _name = cpl->annotation_text;
- _content_kind = cpl->content_kind;
-
- for (list<shared_ptr<libdcp::parse::Reel> >::iterator i = cpl->reels.begin(); i != cpl->reels.end(); ++i) {
-
- shared_ptr<parse::Picture> p;
-
- if ((*i)->asset_list->main_picture) {
- p = (*i)->asset_list->main_picture;
- } else {
- p = (*i)->asset_list->main_stereoscopic_picture;
- }
-
- _fps = p->edit_rate.numerator;
- _length += p->duration;
-
- shared_ptr<PictureAsset> picture;
- shared_ptr<SoundAsset> sound;
- shared_ptr<SubtitleAsset> subtitle;
-
- /* Some rather twisted logic to decide if we are 3D or not;
- some DCPs give a MainStereoscopicPicture to indicate 3D, others
- just have a FrameRate twice the EditRate and apparently
- expect you to divine the fact that they are hence 3D.
- */
-
- if (!(*i)->asset_list->main_stereoscopic_picture && p->edit_rate == p->frame_rate) {
-
- try {
- picture.reset (new MonoPictureAsset (
- _directory,
- asset_map->asset_from_id (p->id)->chunks.front()->path
- )
- );
-
- picture->set_entry_point (p->entry_point);
- picture->set_duration (p->duration);
- } catch (MXFFileError) {
- if (require_mxfs) {
- throw;
- }
- }
-
- } else {
- try {
- picture.reset (new StereoPictureAsset (
- _directory,
- asset_map->asset_from_id (p->id)->chunks.front()->path,
- _fps,
- p->duration
- )
- );
-
- picture->set_entry_point (p->entry_point);
- picture->set_duration (p->duration);
-
- } catch (MXFFileError) {
- if (require_mxfs) {
- throw;
- }
- }
-
- }
-
- if ((*i)->asset_list->main_sound) {
-
- try {
- sound.reset (new SoundAsset (
- _directory,
- asset_map->asset_from_id ((*i)->asset_list->main_sound->id)->chunks.front()->path
- )
- );
-
- sound->set_entry_point ((*i)->asset_list->main_sound->entry_point);
- sound->set_duration ((*i)->asset_list->main_sound->duration);
- } catch (MXFFileError) {
- if (require_mxfs) {
- throw;
- }
- }
- }