summaryrefslogtreecommitdiff
path: root/test/audio_content_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-05-20 15:21:51 +0200
committerCarl Hetherington <cth@carlh.net>2024-05-21 09:38:03 +0200
commiteeef6e5e41163257145e5e6d4418c28b6970bae2 (patch)
treeaddb408bae65f4bb6a69d2437fd664f9ec891630 /test/audio_content_test.cc
parent27a0e4ef75533fb0fab182f998498a70bde06c9f (diff)
Fix stream length for DCP content (#2688).
Diffstat (limited to 'test/audio_content_test.cc')
-rw-r--r--test/audio_content_test.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/audio_content_test.cc b/test/audio_content_test.cc
index f2c095fab..97f55d53a 100644
--- a/test/audio_content_test.cc
+++ b/test/audio_content_test.cc
@@ -20,10 +20,14 @@
#include "lib/audio_content.h"
+#include "lib/dcp_content.h"
#include "lib/content_factory.h"
+#include "lib/film.h"
#include "lib/maths_util.h"
#include "lib/video_content.h"
#include "test.h"
+#include <dcp/sound_asset.h>
+#include <dcp/sound_asset_reader.h>
#include <boost/test/unit_test.hpp>
@@ -259,3 +263,27 @@ BOOST_AUTO_TEST_CASE (audio_content_fades_same_as_video)
BOOST_CHECK(content->audio->fade_out() == dcpomatic::ContentTime::from_frames(81 * 48000 / 24, 48000));
}
+
+
+BOOST_AUTO_TEST_CASE(fade_out_works_with_dcp_content)
+{
+ auto dcp = std::make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV");
+ auto film = new_test_film2("fade_out_works_with_dcp_content", { dcp });
+ dcp->audio->set_fade_out(dcpomatic::ContentTime::from_seconds(15));
+ make_and_verify_dcp(film);
+
+ int32_t max = 0;
+ dcp::SoundAsset sound(find_file(film->dir(film->dcp_name()), "pcm_"));
+ auto reader = sound.start_read();
+ for (auto i = 0; i < sound.intrinsic_duration(); ++i) {
+ auto frame = reader->get_frame(i);
+ for (auto j = 0; j < frame->channels(); ++j) {
+ for (auto k = 0; k < frame->samples(); ++k) {
+ max = std::max(max, frame->get(j, k));
+ }
+ }
+ }
+
+ BOOST_CHECK(max > 2000);
+}
+