X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplayer.cc;h=b634028ba3a99ab6b8455041882c8b7eaa6c01fb;hb=15f23b356b757a9697bf1a9ec30c243ab8070404;hp=418f360fec496b732c44e44697d9353038eeeab9;hpb=ab011bbc0d68ff676a672c7c4c1bef81e84a5007;p=dcpomatic.git diff --git a/src/lib/player.cc b/src/lib/player.cc index 418f360fe..b634028ba 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -41,7 +41,7 @@ #include "render_subtitles.h" #include "config.h" #include "content_video.h" -#include "player_video_frame.h" +#include "player_video.h" #include "frame_rate_change.h" #define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL); @@ -179,6 +179,7 @@ Player::content_changed (weak_ptr w, int property, bool frequent) Changed (frequent); } else if ( + property == SubtitleContentProperty::SUBTITLE_USE || property == SubtitleContentProperty::SUBTITLE_X_OFFSET || property == SubtitleContentProperty::SUBTITLE_Y_OFFSET || property == SubtitleContentProperty::SUBTITLE_SCALE || @@ -216,7 +217,7 @@ Player::film_changed (Film::Property p) last time we were run. */ - if (p == Film::SCALER || p == Film::WITH_SUBTITLES || p == Film::CONTAINER || p == Film::VIDEO_FRAME_RATE) { + if (p == Film::SCALER || p == Film::CONTAINER || p == Film::VIDEO_FRAME_RATE) { Changed (false); } } @@ -291,11 +292,11 @@ Player::set_approximate_size () _approximate_size = true; } -shared_ptr +shared_ptr Player::black_player_video_frame () const { - return shared_ptr ( - new PlayerVideoFrame ( + return shared_ptr ( + new PlayerVideo ( shared_ptr (new RawImageProxy (_black_image, _film->log ())), Crop (), _video_container_size, @@ -308,8 +309,8 @@ Player::black_player_video_frame () const ); } -/** @return All PlayerVideoFrames at the given time (there may be two frames for 3D) */ -list > +/** @return All PlayerVideos at the given time (there may be two frames for 3D) */ +list > Player::get_video (DCPTime time, bool accurate) { if (!_have_valid_pieces) { @@ -321,13 +322,13 @@ Player::get_video (DCPTime time, bool accurate) time + DCPTime::from_frames (1, _film->video_frame_rate ()) ); - list > pvf; + list > pvf; if (ov.empty ()) { /* No video content at this time */ pvf.push_back (black_player_video_frame ()); } else { - /* Create a PlayerVideoFrame from the content's video at this time */ + /* Create a PlayerVideo from the content's video at this time */ shared_ptr piece = ov.back (); shared_ptr decoder = dynamic_pointer_cast (piece->decoder); @@ -349,8 +350,8 @@ Player::get_video (DCPTime time, bool accurate) for (list::const_iterator i = content_video.begin(); i != content_video.end(); ++i) { pvf.push_back ( - shared_ptr ( - new PlayerVideoFrame ( + shared_ptr ( + new PlayerVideo ( i->image, content->crop (), image_size, @@ -365,7 +366,7 @@ Player::get_video (DCPTime time, bool accurate) } } - /* Add subtitles to whatever PlayerVideoFrames we got */ + /* Add subtitles to whatever PlayerVideos we got */ list > subs = overlaps ( time, @@ -375,8 +376,12 @@ Player::get_video (DCPTime time, bool accurate) list sub_images; for (list >::const_iterator j = subs.begin(); j != subs.end(); ++j) { - shared_ptr subtitle_decoder = dynamic_pointer_cast ((*j)->decoder); shared_ptr subtitle_content = dynamic_pointer_cast ((*j)->content); + if (!subtitle_content->subtitle_use ()) { + continue; + } + + shared_ptr subtitle_decoder = dynamic_pointer_cast ((*j)->decoder); ContentTime const from = dcp_to_content_subtitle (*j, time); /* XXX: this video_frame_rate() should be the rate that the subtitle content has been prepared for */ ContentTime const to = from + ContentTime::from_frames (1, _film->video_frame_rate ()); @@ -399,7 +404,7 @@ Player::get_video (DCPTime time, bool accurate) } if (!sub_images.empty ()) { - for (list >::const_iterator i = pvf.begin(); i != pvf.end(); ++i) { + for (list >::const_iterator i = pvf.begin(); i != pvf.end(); ++i) { (*i)->set_subtitle (merge (sub_images)); } } @@ -496,7 +501,7 @@ Player::dcp_to_content_video (shared_ptr piece, DCPTime t) const { /* s is the offset of t from the start position of this content */ DCPTime s = t - piece->content->position (); - s = DCPTime (max (int64_t (0), s.get ())); + s = DCPTime (max (DCPTime::Type (0), s.get ())); s = DCPTime (min (piece->content->length_after_trim().get(), s.get())); /* Convert this to the content frame */ @@ -508,7 +513,7 @@ Player::dcp_to_content_audio (shared_ptr piece, DCPTime t) const { /* s is the offset of t from the start position of this content */ DCPTime s = t - piece->content->position (); - s = DCPTime (max (int64_t (0), s.get ())); + s = DCPTime (max (DCPTime::Type (0), s.get ())); s = DCPTime (min (piece->content->length_after_trim().get(), s.get())); /* Convert this to the content frame */ @@ -520,7 +525,7 @@ Player::dcp_to_content_subtitle (shared_ptr piece, DCPTime t) const { /* s is the offset of t from the start position of this content */ DCPTime s = t - piece->content->position (); - s = DCPTime (max (int64_t (0), s.get ())); + s = DCPTime (max (DCPTime::Type (0), s.get ())); s = DCPTime (min (piece->content->length_after_trim().get(), s.get())); return ContentTime (s + piece->content->trim_start(), piece->frc);