X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_decoder.cc;h=9064627ba9cd937a4930631e17f4665837553ee6;hb=refs%2Fheads%2Fvideo-range-bug;hp=85c5d3297d0d6a8acb704f523bf70d01524446e4;hpb=d311043bf3c1e3e7f41b314f7ab7c91ed7e5aa7f;p=dcpomatic.git diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 85c5d3297..9064627ba 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -68,8 +69,8 @@ using namespace dcpomatic; DCPDecoder::DCPDecoder (shared_ptr film, shared_ptr content, bool fast, bool tolerant, shared_ptr old) - : DCP (content, tolerant) - , Decoder (film) + : Decoder (film) + , _dcp_content (content) { if (content->can_be_played()) { if (content->video) { @@ -79,8 +80,11 @@ DCPDecoder::DCPDecoder (shared_ptr film, shared_ptr(this, content->audio, fast); } for (auto i: content->text) { - /* XXX: this time here should be the time of the first subtitle, not 0 */ - text.push_back (make_shared(this, i, ContentTime())); + text.push_back (make_shared(this, i)); + /* We should really call maybe_set_position() on this TextDecoder to set the time + * of the first subtitle, but it probably doesn't matter since we'll always + * have regularly occurring video (and maybe audio) content. + */ } if (content->atmos) { atmos = make_shared(this, content); @@ -101,7 +105,7 @@ DCPDecoder::DCPDecoder (shared_ptr film, shared_ptr_reels; } else { - auto cpl_list = cpls (); + auto cpl_list = dcp::find_and_resolve_cpls(content->directories(), tolerant); if (cpl_list.empty()) { throw DCPError (_("No CPLs found in DCP.")); @@ -118,7 +122,11 @@ DCPDecoder::DCPDecoder (shared_ptr film, shared_ptrkdm()) { + cpl->add (decrypt_kdm_with_helpful_error(content->kdm().get())); } _reels = cpl->reels (); @@ -283,7 +291,7 @@ DCPDecoder::pass_texts ( true ); - list strings; + vector strings; for (auto i: subs) { auto is = dynamic_pointer_cast(i); @@ -295,12 +303,15 @@ DCPDecoder::pass_texts ( ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.in().as_seconds()), ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.out().as_seconds()) ), - strings + strings, + _dcp_content->standard() ); strings.clear (); } - strings.push_back (*is); + dcp::SubtitleString is_copy = *is; + is_copy.set_font(id_for_font_in_reel(is_copy.font().get_value_or(""), _reel - _reels.begin())); + strings.push_back(is_copy); } /* XXX: perhaps these image subs should also be collected together like the string ones are; @@ -328,7 +339,8 @@ DCPDecoder::pass_texts ( ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.in().as_seconds()), ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.out().as_seconds()) ), - strings + strings, + _dcp_content->standard() ); strings.clear (); } @@ -497,18 +509,3 @@ DCPDecoder::position () const return ContentTime::from_frames(_offset, _dcp_content->active_video_frame_rate(film())) + _next; } - -vector -DCPDecoder::fonts () const -{ - vector data; - for (auto i: _reels) { - if (i->main_subtitle() && i->main_subtitle()->asset()) { - for (auto const& j: i->main_subtitle()->asset()->font_data()) { - data.push_back (FontData(j.first, j.second)); - } - } - } - return data; -} -