From 0303a96b66eaf85060ce02d85cc36067f34b1051 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 29 Sep 2022 10:17:50 +0200 Subject: Change how video timing is done. This commit changes the approach with video timing. Previously, we would (more-or-less) try to use every video frame from the content in the output, hoping that they come at a constant frame rate. This is not always the case, however. Here we preserve the PTS of video frames, and then when one arrives we output whatever DCP video frames we can (at the regular DCP frame rate). Hopefully this will solve a range of sync problems, but it could also introduce new ones. --- src/lib/player.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/lib/player.h') diff --git a/src/lib/player.h b/src/lib/player.h index b6ee4e9c6..71daf4b32 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -137,6 +137,8 @@ private: dcpomatic::ContentTime dcp_to_content_time (std::shared_ptr piece, dcpomatic::DCPTime t) const; dcpomatic::DCPTime content_time_to_dcp (std::shared_ptr piece, dcpomatic::ContentTime t) const; std::shared_ptr black_player_video_frame (Eyes eyes) const; + void emit_video_until(dcpomatic::DCPTime time); + void insert_video(std::shared_ptr pv, dcpomatic::DCPTime time, dcpomatic::DCPTime end); void video (std::weak_ptr, ContentVideo); void audio (std::weak_ptr, AudioStreamPtr, ContentAudio); @@ -151,8 +153,8 @@ private: std::shared_ptr audio, dcpomatic::DCPTime time, dcpomatic::DCPTime discard_to ) const; boost::optional open_subtitles_for_frame (dcpomatic::DCPTime time) const; - void emit_video (std::shared_ptr pv, dcpomatic::DCPTime time); - void do_emit_video (std::shared_ptr pv, dcpomatic::DCPTime time); + void emit_video(std::shared_ptr pv, dcpomatic::DCPTime time); + void use_video(std::shared_ptr pv, dcpomatic::DCPTime time, dcpomatic::DCPTime end); void emit_audio (std::shared_ptr data, dcpomatic::DCPTime time); std::shared_ptr playlist () const; @@ -193,15 +195,12 @@ private: /** Time of the next video that we will emit, or the time of the last accurate seek */ boost::optional _next_video_time; - /** Eyes of the next video that we will emit */ - boost::optional _next_video_eyes; /** Time of the next audio that we will emit, or the time of the last accurate seek */ boost::optional _next_audio_time; boost::atomic> _dcp_decode_reduction; - typedef std::map, std::shared_ptr, std::owner_less>> LastVideoMap; - LastVideoMap _last_video; + EnumIndexedVector, dcpomatic::DCPTime>, Eyes> _last_video; AudioMerger _audio_merger; std::unique_ptr _shuffler; -- cgit v1.2.3