projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
operator bool on Time is a really bad idea; removed it and fixed lots of bugs.
[dcpomatic.git]
/
test
/
ffmpeg_pts_offset.cc
diff --git
a/test/ffmpeg_pts_offset.cc
b/test/ffmpeg_pts_offset.cc
index 65cc28a841a63b9d2d41d090b791d340920b0552..4a9a57b402295e52d6668fec3b2e1ef92ed06109 100644
(file)
--- a/
test/ffmpeg_pts_offset.cc
+++ b/
test/ffmpeg_pts_offset.cc
@@
-20,6
+20,7
@@
#include <boost/test/unit_test.hpp>
#include "lib/film.h"
#include "lib/ffmpeg_decoder.h"
#include <boost/test/unit_test.hpp>
#include "lib/film.h"
#include "lib/ffmpeg_decoder.h"
+#include "lib/ffmpeg_content.h"
#include "test.h"
using boost::shared_ptr;
#include "test.h"
using boost::shared_ptr;
@@
-33,48
+34,43
@@
BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
{
/* Sound == video so no offset required */
{
/* Sound == video so no offset required */
- content->_first_video =
0
;
- content->_audio_stream->first_audio =
0
;
+ content->_first_video =
ContentTime ()
;
+ content->_audio_stream->first_audio =
ContentTime ()
;
FFmpegDecoder decoder (film, content, true, true);
FFmpegDecoder decoder (film, content, true, true);
- BOOST_CHECK_EQUAL (decoder._video_pts_offset, 0);
- BOOST_CHECK_EQUAL (decoder._audio_pts_offset, 0);
+ BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ());
}
{
/* Common offset should be removed */
}
{
/* Common offset should be removed */
- content->_first_video =
600
;
- content->_audio_stream->first_audio =
600
;
+ content->_first_video =
ContentTime::from_seconds (600)
;
+ content->_audio_stream->first_audio =
ContentTime::from_seconds (600)
;
FFmpegDecoder decoder (film, content, true, true);
FFmpegDecoder decoder (film, content, true, true);
- BOOST_CHECK_EQUAL (decoder._video_pts_offset, -600);
- BOOST_CHECK_EQUAL (decoder._audio_pts_offset, -600);
+ BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime::from_seconds (-600));
}
{
/* Video is on a frame boundary */
}
{
/* Video is on a frame boundary */
- content->_first_video =
1.0 / 24.0
;
- content->_audio_stream->first_audio =
0
;
+ content->_first_video =
ContentTime::from_frames (1, 24)
;
+ content->_audio_stream->first_audio =
ContentTime ()
;
FFmpegDecoder decoder (film, content, true, true);
FFmpegDecoder decoder (film, content, true, true);
- BOOST_CHECK_EQUAL (decoder._video_pts_offset, 0);
- BOOST_CHECK_EQUAL (decoder._audio_pts_offset, 0);
+ BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ());
}
{
/* Video is off a frame boundary */
double const frame = 1.0 / 24.0;
}
{
/* 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
;
+ content->_first_video =
ContentTime::from_seconds (frame + 0.0215)
;
+ content->_audio_stream->first_audio =
ContentTime ()
;
FFmpegDecoder decoder (film, content, true, true);
FFmpegDecoder decoder (film, content, true, true);
- BOOST_CHECK_EQUAL (decoder._video_pts_offset, (frame - 0.0215));
- BOOST_CHECK_EQUAL (decoder._audio_pts_offset, (frame - 0.0215));
+ 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;
}
{
/* 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
;
+ content->_first_video =
ContentTime::from_seconds (frame + 0.0215 + 4.1)
;
+ content->_audio_stream->first_audio =
ContentTime::from_seconds (4.1)
;
FFmpegDecoder decoder (film, content, true, true);
FFmpegDecoder decoder (film, content, true, true);
- BOOST_CHECK_EQUAL (decoder._video_pts_offset, (frame - 0.0215) - 4.1);
- BOOST_CHECK_EQUAL (decoder._audio_pts_offset, (frame - 0.0215) - 4.1);
+ BOOST_CHECK_EQUAL (decoder._pts_offset.seconds(), (frame - 0.0215) - 4.1);
}
}
}
}