summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-04-14 03:28:38 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-18 11:50:29 +0100
commit150f708d27b25d5b5d4e486d03c5bc4078027997 (patch)
tree56b65e0d0f11f1f9f469d6069985f5f1a1c3b831 /test
parenta4ad6395a27e8ccb25af3b05f815d318312ae1b7 (diff)
Fix some confusions with FFmpeg audio streams.
Diffstat (limited to 'test')
-rw-r--r--test/ffmpeg_pts_offset_test.cc13
-rw-r--r--test/frame_rate_test.cc2
-rw-r--r--test/time_calculation_test.cc3
3 files changed, 10 insertions, 8 deletions
diff --git a/test/ffmpeg_pts_offset_test.cc b/test/ffmpeg_pts_offset_test.cc
index 7e3cd9cfd..5b1821dae 100644
--- a/test/ffmpeg_pts_offset_test.cc
+++ b/test/ffmpeg_pts_offset_test.cc
@@ -26,6 +26,7 @@
#include "lib/ffmpeg_decoder.h"
#include "lib/ffmpeg_content.h"
#include "lib/ffmpeg_audio_stream.h"
+#include "lib/audio_content.h"
#include "test.h"
using boost::shared_ptr;
@@ -34,13 +35,13 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
{
shared_ptr<Film> film = new_test_film ("ffmpeg_pts_offset_test");
shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
- content->_audio_streams.push_back (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream));
+ content->audio->add_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream));
content->video->_frame_rate = 24;
{
/* Sound == video so no offset required */
content->_first_video = ContentTime ();
- content->_audio_streams.front()->first_audio = ContentTime ();
+ content->ffmpeg_audio_streams().front()->first_audio = ContentTime ();
FFmpegDecoder decoder (content, film->log(), false);
BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ());
}
@@ -48,7 +49,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
{
/* Common offset should be removed */
content->_first_video = ContentTime::from_seconds (600);
- content->_audio_streams.front()->first_audio = ContentTime::from_seconds (600);
+ content->ffmpeg_audio_streams().front()->first_audio = ContentTime::from_seconds (600);
FFmpegDecoder decoder (content, film->log(), false);
BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime::from_seconds (-600));
}
@@ -56,7 +57,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
{
/* Video is on a frame boundary */
content->_first_video = ContentTime::from_frames (1, 24);
- content->_audio_streams.front()->first_audio = ContentTime ();
+ content->ffmpeg_audio_streams().front()->first_audio = ContentTime ();
FFmpegDecoder decoder (content, film->log(), false);
BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ());
}
@@ -65,7 +66,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
/* Video is off a frame boundary */
double const frame = 1.0 / 24.0;
content->_first_video = ContentTime::from_seconds (frame + 0.0215);
- content->_audio_streams.front()->first_audio = ContentTime ();
+ content->ffmpeg_audio_streams().front()->first_audio = ContentTime ();
FFmpegDecoder decoder (content, film->log(), false);
BOOST_CHECK_CLOSE (decoder._pts_offset.seconds(), (frame - 0.0215), 0.00001);
}
@@ -74,7 +75,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
/* Video is off a frame boundary and both have a common offset */
double const frame = 1.0 / 24.0;
content->_first_video = ContentTime::from_seconds (frame + 0.0215 + 4.1);
- content->_audio_streams.front()->first_audio = ContentTime::from_seconds (4.1);
+ content->ffmpeg_audio_streams().front()->first_audio = ContentTime::from_seconds (4.1);
FFmpegDecoder decoder (content, film->log(), false);
BOOST_CHECK_CLOSE (decoder._pts_offset.seconds(), (frame - 0.0215) - 4.1, 0.1);
}
diff --git a/test/frame_rate_test.cc b/test/frame_rate_test.cc
index 68a6ffa2d..35cd5523a 100644
--- a/test/frame_rate_test.cc
+++ b/test/frame_rate_test.cc
@@ -262,7 +262,7 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)
Config::instance()->set_allowed_dcp_frame_rates (afr);
shared_ptr<FFmpegAudioStream> stream (new FFmpegAudioStream ("foo", 0, 0, 0));
- content->_audio_streams.push_back (stream);
+ content->audio->add_stream (stream);
content->video->_frame_rate = 24;
film->set_video_frame_rate (24);
stream->_frame_rate = 48000;
diff --git a/test/time_calculation_test.cc b/test/time_calculation_test.cc
index 353a97dd0..7f13e6c0e 100644
--- a/test/time_calculation_test.cc
+++ b/test/time_calculation_test.cc
@@ -21,6 +21,7 @@
#include "lib/ffmpeg_content.h"
#include "lib/video_content.h"
#include "lib/player.h"
+#include "lib/audio_content.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
@@ -534,7 +535,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3)
list<string> notes;
shared_ptr<FFmpegContent> content (new FFmpegContent (film, doc, film->state_version(), notes));
- AudioStreamPtr stream = content->audio_streams().front();
+ AudioStreamPtr stream = content->audio->streams().front();
film->set_sequence (false);
film->add_content (content);