X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fplayer.cc;h=a7cd0fd94ce93bf402b2ac152d4f9842c09f694e;hp=32c2dfdfde2bd0d49f07d0d994d9849b60439d3d;hb=9cb73fbc0fa4643612f01665bc6d9fc430656f32;hpb=ae95d9cab28e414245e15ddeae20e96735594a8b diff --git a/src/lib/player.cc b/src/lib/player.cc index 32c2dfdfd..a7cd0fd94 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -168,7 +168,7 @@ Player::setup_pieces () if (decoder->subtitle) { decoder->subtitle->BitmapStart.connect (bind (&Player::bitmap_text_start, this, weak_ptr (piece), _1)); decoder->subtitle->PlainStart.connect (bind (&Player::plain_text_start, this, weak_ptr (piece), _1)); - decoder->subtitle->Stop.connect (bind (&Player::subtitle_stop, this, weak_ptr (piece), _1)); + decoder->subtitle->Stop.connect (bind (&Player::subtitle_stop, this, weak_ptr (piece), _1, _2)); } } @@ -663,7 +663,7 @@ Player::subtitles_for_frame (DCPTime time) const int const vfr = _film->video_frame_rate(); - BOOST_FOREACH (PlayerText i, _active_subtitles.get_burnt (DCPTimePeriod(time, time + DCPTime::from_frames(1, vfr)), _always_burn_subtitles)) { + BOOST_FOREACH (PlayerCaption i, _active_text[TEXT_SUBTITLE].get_burnt (DCPTimePeriod(time, time + DCPTime::from_frames(1, vfr)), _always_burn_subtitles)) { /* Image subtitles */ list c = transform_bitmap_texts (i.image); @@ -839,7 +839,7 @@ Player::audio (weak_ptr wp, AudioStreamPtr stream, ContentAudio content_a } void -Player::bitmap_text_start (weak_ptr wp, ContentBitmapText subtitle) +Player::bitmap_text_start (weak_ptr wp, ContentBitmapCaption subtitle) { shared_ptr piece = wp.lock (); if (!piece) { @@ -858,22 +858,22 @@ Player::bitmap_text_start (weak_ptr wp, ContentBitmapText subtitle) subtitle.sub.rectangle.width *= piece->content->subtitle->x_scale (); subtitle.sub.rectangle.height *= piece->content->subtitle->y_scale (); - PlayerText ps; + PlayerCaption ps; ps.image.push_back (subtitle.sub); DCPTime from (content_time_to_dcp (piece, subtitle.from())); - _active_subtitles.add_from (wp, ps, from); + _active_text[subtitle.type()].add_from (wp, ps, from); } void -Player::plain_text_start (weak_ptr wp, ContentPlainText subtitle) +Player::plain_text_start (weak_ptr wp, ContentTextCaption subtitle) { shared_ptr piece = wp.lock (); if (!piece) { return; } - PlayerText ps; + PlayerCaption ps; DCPTime const from (content_time_to_dcp (piece, subtitle.from())); if (from > piece->content->end()) { @@ -901,17 +901,17 @@ Player::plain_text_start (weak_ptr wp, ContentPlainText subtitle) } s.set_in (dcp::Time(from.seconds(), 1000)); - ps.text.push_back (SubtitleString (s, piece->content->subtitle->outline_width())); + ps.text.push_back (TextCaption (s, piece->content->subtitle->outline_width())); ps.add_fonts (piece->content->subtitle->fonts ()); } - _active_subtitles.add_from (wp, ps, from); + _active_text[subtitle.type()].add_from (wp, ps, from); } void -Player::subtitle_stop (weak_ptr wp, ContentTime to) +Player::subtitle_stop (weak_ptr wp, ContentTime to, TextType type) { - if (!_active_subtitles.have (wp)) { + if (!_active_text[type].have (wp)) { return; } @@ -926,10 +926,10 @@ Player::subtitle_stop (weak_ptr wp, ContentTime to) return; } - pair from = _active_subtitles.add_to (wp, dcp_to); + pair from = _active_text[type].add_to (wp, dcp_to); if (piece->content->subtitle->use() && !_always_burn_subtitles && !piece->content->subtitle->burn()) { - Subtitle (from.first, DCPTimePeriod (from.second, dcp_to)); + Text (from.first, type, DCPTimePeriod (from.second, dcp_to)); } } @@ -951,7 +951,9 @@ Player::seek (DCPTime time, bool accurate) } _audio_merger.clear (); - _active_subtitles.clear (); + for (int i = 0; i < TEXT_COUNT; ++i) { + _active_text[i].clear (); + } BOOST_FOREACH (shared_ptr i, _pieces) { if (time < i->content->position()) { @@ -1010,7 +1012,9 @@ void Player::do_emit_video (shared_ptr pv, DCPTime time) { if (pv->eyes() == EYES_BOTH || pv->eyes() == EYES_RIGHT) { - _active_subtitles.clear_before (time); + for (int i = 0; i < TEXT_COUNT; ++i) { + _active_text[i].clear_before (time); + } } optional subtitles = subtitles_for_frame (time);