From f9068dcbfbb09082e29e2a779ef1a7a2f6ee849e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 12 Oct 2015 15:05:09 +0100 Subject: Rename split-by-video content slightly; fix referencing to multi-reel DCPs. --- src/lib/player.cc | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) (limited to 'src/lib/player.cc') diff --git a/src/lib/player.cc b/src/lib/player.cc index 0606a9340..c484ecc9a 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -46,6 +46,7 @@ #include "dcp_subtitle_decoder.h" #include "audio_processor.h" #include "playlist.h" +#include "referenced_reel_asset.h" #include #include #include @@ -741,26 +742,49 @@ Player::set_play_referenced () _have_valid_pieces = false; } -list > +list Player::get_reel_assets () { - list > a; + list a; BOOST_FOREACH (shared_ptr i, _playlist->content ()) { shared_ptr j = dynamic_pointer_cast (i); if (!j) { continue; } - /* XXX: hack hack hack */ DCPDecoder decoder (j, false); - if (j->reference_video ()) { - a.push_back (decoder.reels().front()->main_picture ()); - } - if (j->reference_audio ()) { - a.push_back (decoder.reels().front()->main_sound ()); - } - if (j->reference_subtitle ()) { - a.push_back (decoder.reels().front()->main_subtitle ()); + int64_t offset = 0; + BOOST_FOREACH (shared_ptr k, decoder.reels()) { + DCPTime const from = i->position() + DCPTime::from_frames (offset, _film->video_frame_rate()); + if (j->reference_video ()) { + a.push_back ( + ReferencedReelAsset ( + k->main_picture (), + DCPTimePeriod (from, from + DCPTime::from_frames (k->main_picture()->duration(), _film->video_frame_rate())) + ) + ); + } + + if (j->reference_audio ()) { + a.push_back ( + ReferencedReelAsset ( + k->main_sound (), + DCPTimePeriod (from, from + DCPTime::from_frames (k->main_sound()->duration(), _film->video_frame_rate())) + ) + ); + } + + if (j->reference_subtitle ()) { + a.push_back ( + ReferencedReelAsset ( + k->main_subtitle (), + DCPTimePeriod (from, from + DCPTime::from_frames (k->main_subtitle()->duration(), _film->video_frame_rate())) + ) + ); + } + + /* Assume that main picture duration is the length of the reel */ + offset += k->main_picture()->duration (); } } -- cgit v1.2.3