X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Faudio_decoder_test.cc;h=44d0d60f416e664fa76faf9495b9e8601b4c4f1c;hb=9e171f83c256d2386d6ad4ce48bc06a1827ed724;hp=cd86b73e76942207c7580b28190fac23954673fc;hpb=bdbfd6b08856a445446bfd845f1c43109d184250;p=dcpomatic.git diff --git a/test/audio_decoder_test.cc b/test/audio_decoder_test.cc index cd86b73e7..44d0d60f4 100644 --- a/test/audio_decoder_test.cc +++ b/test/audio_decoder_test.cc @@ -26,6 +26,7 @@ #include "test.h" #include "lib/audio_decoder.h" #include "lib/single_stream_audio_content.h" +#include using std::string; using std::cout; @@ -49,9 +50,9 @@ public: DCPTime full_length () const { return DCPTime::from_seconds (float (audio_length()) / audio_stream()->frame_rate ()); } - + Frame audio_length () const { - return rint (61.2942 * audio_stream()->frame_rate ()); + return llrint (61.2942 * audio_stream()->frame_rate ()); } }; @@ -59,7 +60,7 @@ class TestAudioDecoder : public AudioDecoder { public: TestAudioDecoder (shared_ptr content) - : AudioDecoder (content) + : AudioDecoder (content, false) , _test_audio_content (content) , _position (0) {} @@ -87,7 +88,7 @@ public: void seek (ContentTime t, bool accurate) { AudioDecoder::seek (t, accurate); - _position = t.frames (_test_audio_content->resampled_audio_frame_rate ()); + _position = t.frames_round (_test_audio_content->resampled_audio_frame_rate ()); } private: @@ -125,7 +126,7 @@ BOOST_AUTO_TEST_CASE (audio_decoder_get_audio_test) content.reset (new TestAudioContent (film)); decoder.reset (new TestAudioDecoder (content)); - + /* Simple reads */ check (0, 48000); check (44, 9123); @@ -136,7 +137,7 @@ BOOST_AUTO_TEST_CASE (audio_decoder_get_audio_test) Frame const from = content->resampled_audio_frame_rate() * 61; Frame const length = content->resampled_audio_frame_rate() * 4; ContentAudio ca = get (from, length); - + for (int i = 0; i < content->audio_stream()->channels(); ++i) { for (int j = 0; j < ca.audio->frames(); ++j) { BOOST_REQUIRE_EQUAL (ca.audio->data(i)[j], j + from);