X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_content.cc;h=9acc883fd0c306ebb01db70206b3693940e54f6a;hb=387304bc9147933b68eda2b38ba8cac0d250e87e;hp=187d61953d34f1e5c1472a8d468f29206187d87f;hpb=8167d04e4dde6297ad936dca5dc691818a4dae41;p=dcpomatic.git diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 187d61953..9acc883fd 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -249,14 +249,18 @@ FFmpegContent::set_audio_stream (shared_ptr s) signal_changed (FFmpegContentProperty::AUDIO_STREAM); } -ContentTime +Frame FFmpegContent::audio_length () const { if (!audio_stream ()) { - return ContentTime (); + return 0; } - return video_length (); + /* We're talking about the content's audio length here, at the content's frame + rate. We assume it's the same as the video's length, and we can just convert + using the content's rates. + */ + return (video_length () / video_frame_rate ()) * audio_frame_rate (); } int @@ -300,7 +304,8 @@ FFmpegContent::full_length () const { shared_ptr film = _film.lock (); DCPOMATIC_ASSERT (film); - return DCPTime (video_length_after_3d_combine(), FrameRateChange (video_frame_rate (), film->video_frame_rate ())); + FrameRateChange const frc (video_frame_rate (), film->video_frame_rate ()); + return DCPTime::from_frames (rint (video_length_after_3d_combine() * frc.factor()), film->video_frame_rate()); } AudioMapping