X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fffmpeg_pts_offset.cc;h=dc391ed46c5b94f4633b40cfd320f39ba0ae4d6c;hb=ab024ff6eff0b5dceff800189b1ad9f3f7a546f8;hp=53303f1543bcda650274f7d2736a1668a7691af8;hpb=015fe447cfe25babc55cf8ed282bb909e4713aa0;p=dcpomatic.git diff --git a/test/ffmpeg_pts_offset.cc b/test/ffmpeg_pts_offset.cc index 53303f154..dc391ed46 100644 --- a/test/ffmpeg_pts_offset.cc +++ b/test/ffmpeg_pts_offset.cc @@ -34,43 +34,43 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test) { /* Sound == video so no offset required */ - content->_first_video = 0; - content->_audio_stream->first_audio = 0; - FFmpegDecoder decoder (film, content, true, true); - BOOST_CHECK_EQUAL (decoder._pts_offset, 0); + content->_first_video = ContentTime (); + content->_audio_stream->first_audio = ContentTime (); + FFmpegDecoder decoder (content, film->log()); + BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ()); } { /* Common offset should be removed */ - content->_first_video = 600; - content->_audio_stream->first_audio = 600; - FFmpegDecoder decoder (film, content, true, true); - BOOST_CHECK_EQUAL (decoder._pts_offset, -600); + content->_first_video = ContentTime::from_seconds (600); + content->_audio_stream->first_audio = ContentTime::from_seconds (600); + FFmpegDecoder decoder (content, film->log()); + BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime::from_seconds (-600)); } { /* Video is on a frame boundary */ - content->_first_video = 1.0 / 24.0; - content->_audio_stream->first_audio = 0; - FFmpegDecoder decoder (film, content, true, true); - BOOST_CHECK_EQUAL (decoder._pts_offset, 0); + content->_first_video = ContentTime::from_frames (1, 24); + content->_audio_stream->first_audio = ContentTime (); + FFmpegDecoder decoder (content, film->log()); + BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ()); } { /* Video is off a frame boundary */ double const frame = 1.0 / 24.0; - content->_first_video = frame + 0.0215; - content->_audio_stream->first_audio = 0; - FFmpegDecoder decoder (film, content, true, true); - BOOST_CHECK_CLOSE (decoder._pts_offset, (frame - 0.0215), 0.00001); + content->_first_video = ContentTime::from_seconds (frame + 0.0215); + content->_audio_stream->first_audio = ContentTime (); + FFmpegDecoder decoder (content, film->log()); + BOOST_CHECK_CLOSE (decoder._pts_offset.seconds(), (frame - 0.0215), 0.00001); } { /* Video is off a frame boundary and both have a common offset */ double const frame = 1.0 / 24.0; - content->_first_video = frame + 0.0215 + 4.1; - content->_audio_stream->first_audio = 4.1; - FFmpegDecoder decoder (film, content, true, true); - BOOST_CHECK_EQUAL (decoder._pts_offset, (frame - 0.0215) - 4.1); + content->_first_video = ContentTime::from_seconds (frame + 0.0215 + 4.1); + content->_audio_stream->first_audio = ContentTime::from_seconds (4.1); + FFmpegDecoder decoder (content, film->log()); + BOOST_CHECK_EQUAL (decoder._pts_offset.seconds(), (frame - 0.0215) - 4.1); } }