summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-05-02 18:17:35 +0100
committerCarl Hetherington <cth@carlh.net>2014-05-02 18:17:35 +0100
commit40b3ced17b7fff8badfaa8ec2201a8186cdc7dc2 (patch)
tree38c13732a1d05e7b4c925e651caa25aa6f6edd4c /test
parent3967bd6a07b436a6b2eb8d0f8f634fdc11689c75 (diff)
Rename AudioContent frame_rate methods and move resampled_audio_frame_rate into AudioContent.
Diffstat (limited to 'test')
-rw-r--r--test/audio_decoder_test.cc18
-rw-r--r--test/frame_rate_test.cc20
2 files changed, 17 insertions, 21 deletions
diff --git a/test/audio_decoder_test.cc b/test/audio_decoder_test.cc
index 46f9d5ac6..a14e2f9be 100644
--- a/test/audio_decoder_test.cc
+++ b/test/audio_decoder_test.cc
@@ -44,7 +44,7 @@ public:
{
AudioFrame const N = min (
AudioFrame (2000),
- _audio_content->audio_length().frames (_audio_content->output_audio_frame_rate ()) - _position
+ _audio_content->audio_length().frames (_audio_content->resampled_audio_frame_rate ()) - _position
);
shared_ptr<AudioBuffers> buffers (new AudioBuffers (_audio_content->audio_channels(), N));
@@ -54,7 +54,7 @@ public:
}
}
- audio (buffers, ContentTime::from_frames (_position, _audio_content->output_audio_frame_rate ()));
+ audio (buffers, ContentTime::from_frames (_position, _audio_content->resampled_audio_frame_rate ()));
_position += N;
return N < 2000;
@@ -63,7 +63,7 @@ public:
void seek (ContentTime t, bool accurate)
{
AudioDecoder::seek (t, accurate);
- _position = t.frames (_audio_content->output_audio_frame_rate ());
+ _position = t.frames (_audio_content->resampled_audio_frame_rate ());
}
private:
@@ -98,11 +98,7 @@ public:
return ContentTime::from_seconds (61.2942);
}
- int content_audio_frame_rate () const {
- return 48000;
- }
-
- int output_audio_frame_rate () const {
+ int audio_frame_rate () const {
return 48000;
}
@@ -119,7 +115,7 @@ shared_ptr<TestAudioDecoder> decoder;
static shared_ptr<ContentAudio>
get (AudioFrame from, AudioFrame length)
{
- decoder->seek (ContentTime::from_frames (from, content->output_audio_frame_rate ()), true);
+ decoder->seek (ContentTime::from_frames (from, content->resampled_audio_frame_rate ()), true);
shared_ptr<ContentAudio> ca = decoder->get_audio (from, length, true);
BOOST_CHECK_EQUAL (ca->frame, from);
return ca;
@@ -152,8 +148,8 @@ BOOST_AUTO_TEST_CASE (audio_decoder_get_audio_test)
/* Read off the end */
- AudioFrame const from = content->output_audio_frame_rate() * 61;
- AudioFrame const length = content->output_audio_frame_rate() * 4;
+ AudioFrame const from = content->resampled_audio_frame_rate() * 61;
+ AudioFrame const length = content->resampled_audio_frame_rate() * 4;
shared_ptr<ContentAudio> ca = get (from, length);
for (int i = 0; i < content->audio_channels(); ++i) {
diff --git a/test/frame_rate_test.cc b/test/frame_rate_test.cc
index e710b0934..f2c46396c 100644
--- a/test/frame_rate_test.cc
+++ b/test/frame_rate_test.cc
@@ -241,7 +241,7 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)
shared_ptr<Film> film = new_test_film ("audio_sampling_rate_test");
/* Get any piece of content, it doesn't matter what */
shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
- film->add_content (content);
+ film->examine_and_add_content (content);
wait_for_jobs ();
std::list<int> afr;
@@ -253,43 +253,43 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)
content->_video_frame_rate = 24;
film->set_video_frame_rate (24);
content->set_audio_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream ("a", 42, 48000, 0)));
- BOOST_CHECK_EQUAL (content->output_audio_frame_rate(), 48000);
+ BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 48000);
content->set_audio_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream ("a", 42, 44100, 0)));
- BOOST_CHECK_EQUAL (content->output_audio_frame_rate(), 48000);
+ BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 48000);
content->set_audio_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream ("a", 42, 80000, 0)));
- BOOST_CHECK_EQUAL (content->output_audio_frame_rate(), 96000);
+ BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 96000);
content->_video_frame_rate = 23.976;
film->set_video_frame_rate (24);
content->set_audio_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream ("a", 42, 48000, 0)));
- BOOST_CHECK_EQUAL (content->output_audio_frame_rate(), 47952);
+ BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 47952);
content->_video_frame_rate = 29.97;
film->set_video_frame_rate (30);
BOOST_CHECK_EQUAL (film->video_frame_rate (), 30);
content->set_audio_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream ("a", 42, 48000, 0)));
- BOOST_CHECK_EQUAL (content->output_audio_frame_rate(), 47952);
+ BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 47952);
content->_video_frame_rate = 25;
film->set_video_frame_rate (24);
content->set_audio_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream ("a", 42, 48000, 0)));
- BOOST_CHECK_EQUAL (content->output_audio_frame_rate(), 50000);
+ BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 50000);
content->_video_frame_rate = 25;
film->set_video_frame_rate (24);
content->set_audio_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream ("a", 42, 44100, 0)));
- BOOST_CHECK_EQUAL (content->output_audio_frame_rate(), 50000);
+ BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 50000);
/* Check some out-there conversions (not the best) */
content->_video_frame_rate = 14.99;
film->set_video_frame_rate (25);
content->set_audio_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream ("a", 42, 16000, 0)));
- /* The FrameRateChange within output_audio_frame_rate should choose to double-up
+ /* The FrameRateChange within resampled_audio_frame_rate should choose to double-up
the 14.99 fps video to 30 and then run it slow at 25.
*/
- BOOST_CHECK_EQUAL (content->output_audio_frame_rate(), rint (48000 * 2 * 14.99 / 25));
+ BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), rint (48000 * 2 * 14.99 / 25));
}