summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-05-29 21:12:17 +0200
committerCarl Hetherington <cth@carlh.net>2024-05-29 21:12:17 +0200
commit07aa4852acfd908c4e3a92f7bed2c7328cfcf123 (patch)
treebe9642b5202a0342be268f6e4b9f93c684bab347
parentbfac1d7cfec57b225a0257d2fa0172efe7fbd08b (diff)
parent78dc1250feed93df7f519c559949d4fac4cc5b1a (diff)
Merge remote-tracking branch 'origin/main' into v2.17.x
-rw-r--r--cscript2
-rwxr-xr-xrun/tests2
-rw-r--r--src/lib/content.cc8
-rw-r--r--src/lib/content.h2
-rw-r--r--src/lib/dcp_content.cc2
-rw-r--r--src/lib/dcp_decoder.cc2
-rw-r--r--src/lib/dcp_examiner.cc3
-rw-r--r--src/lib/ffmpeg_decoder.cc11
-rw-r--r--src/lib/hints.cc2
-rw-r--r--src/lib/player.cc4
-rw-r--r--src/wx/content_timeline.cc2
-rw-r--r--src/wx/content_timeline_audio_view.cc2
-rw-r--r--test/audio_content_test.cc28
-rw-r--r--wscript2
14 files changed, 53 insertions, 19 deletions
diff --git a/cscript b/cscript
index 60d1825ca..4612c7d5d 100644
--- a/cscript
+++ b/cscript
@@ -534,7 +534,7 @@ def make_spec(filename, version, target, options, requires=None):
def dependencies(target, options):
deps = [('libdcp', 'v1.9.8', {'c++17': target.platform == 'osx'})]
- deps.append(('libsub', 'v1.6.47'))
+ deps.append(('libsub', 'v1.6.49'))
deps.append(('leqm-nrt', '30dcaea1373ac62fba050e02ce5b0c1085797a23'))
deps.append(('rtaudio', 'f619b76'))
# We get our OpenSSL libraries from the environment, but we
diff --git a/run/tests b/run/tests
index cb42a22e5..cbc64759e 100755
--- a/run/tests
+++ b/run/tests
@@ -85,7 +85,7 @@ if [ "$(uname)" == "Darwin" ]; then
rm -f build/test/openssl
ln -s ../../../openssl/apps/openssl build/test/openssl
# We need to find ffcmp in here
- export PATH=$PATH:/Users/ci/workspace/bin
+ export PATH=$PATH:$HOME/workspace/bin
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$environment/x86_64/10.10/lib
fi
diff --git a/src/lib/content.cc b/src/lib/content.cc
index 6743705d9..496a68a63 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -570,3 +570,11 @@ Content::changed () const
return (write_time_changed || calculate_digest() != digest());
}
+
+
+bool
+Content::has_mapped_audio() const
+{
+ return audio && !audio->mapping().mapped_output_channels().empty();
+}
+
diff --git a/src/lib/content.h b/src/lib/content.h
index 3753c84d7..d4b99d39e 100644
--- a/src/lib/content.h
+++ b/src/lib/content.h
@@ -203,6 +203,8 @@ public:
return true;
}
+ bool has_mapped_audio() const;
+
/* ChangeType::PENDING and ChangeType::CANCELLED may be emitted from any thread; ChangeType::DONE always from GUI thread */
boost::signals2::signal<void (ChangeType, std::weak_ptr<Content>, int, bool)> Change;
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index e9afa04cc..465eff706 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -736,7 +736,7 @@ DCPContent::can_reference_audio (shared_ptr<const Film> film, string& why_not) c
}
auto part = [](shared_ptr<const Content> c) {
- return static_cast<bool>(c->audio) && !c->audio->mapping().mapped_output_channels().empty();
+ return c->has_mapped_audio();
};
if (overlaps(film, part)) {
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc
index e9db479d1..abbaaf15d 100644
--- a/src/lib/dcp_decoder.cc
+++ b/src/lib/dcp_decoder.cc
@@ -81,7 +81,7 @@ DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent
if (content->video) {
video = make_shared<VideoDecoder>(this, content);
}
- if (content->audio && !content->audio->mapping().mapped_output_channels().empty()) {
+ if (content->has_mapped_audio()) {
audio = make_shared<AudioDecoder>(this, content->audio, fast);
}
for (auto i: content->text) {
diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc
index 229786868..ae885c140 100644
--- a/src/lib/dcp_examiner.cc
+++ b/src/lib/dcp_examiner.cc
@@ -173,7 +173,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
if (reel->main_sound()) {
_has_audio = true;
- _audio_length += reel->main_sound()->actual_duration();
+ auto const edit_rate = reel->main_sound()->edit_rate();
if (!reel->main_sound()->asset_ref().resolved()) {
LOG_GENERAL("Main sound %1 of reel %2 is missing", reel->main_sound()->id(), reel->id());
@@ -198,6 +198,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
}
_audio_language = try_to_parse_language (asset->language());
+ _audio_length += reel->main_sound()->actual_duration() * (asset->sampling_rate() * edit_rate.denominator / edit_rate.numerator);
}
}
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index e80cb92e5..29ab5aaf8 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -89,7 +89,7 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> film, shared_ptr<const FFmp
_pts_offset = {};
}
- if (c->audio && !c->audio->mapping().mapped_output_channels().empty()) {
+ if (c->has_mapped_audio()) {
audio = make_shared<AudioDecoder>(this, c->audio, fast);
}
@@ -830,13 +830,8 @@ FFmpegDecoder::process_ass_subtitle (string ass, ContentTime from)
auto video_size = _ffmpeg_content->video->size();
DCPOMATIC_ASSERT(video_size);
- auto raw = sub::SSAReader::parse_line (
- base,
- text,
- video_size->width,
- video_size->height,
- sub::Colour(1, 1, 1)
- );
+ sub::SSAReader::Context context(video_size->width, video_size->height, sub::Colour(1, 1, 1));
+ auto const raw = sub::SSAReader::parse_line(base, text, context);
for (auto const& i: sub::collect<vector<sub::Subtitle>>(raw)) {
only_text()->emit_plain_start (from, i);
diff --git a/src/lib/hints.cc b/src/lib/hints.cc
index f9f87221e..e7a393103 100644
--- a/src/lib/hints.cc
+++ b/src/lib/hints.cc
@@ -710,7 +710,7 @@ Hints::check_audio_language ()
auto content = film()->content();
auto mapped_audio =
std::find_if(content.begin(), content.end(), [](shared_ptr<const Content> c) {
- return c->audio && !c->audio->mapping().mapped_output_channels().empty();
+ return c->has_mapped_audio();
});
if (mapped_audio != content.end() && !film()->audio_language()) {
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 98f0b027a..ea236db39 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -249,7 +249,7 @@ have_video (shared_ptr<const Content> content)
bool
have_audio (shared_ptr<const Content> content)
{
- return static_cast<bool>(content->audio) && !content->audio->mapping().mapped_output_channels().empty() && content->can_be_played();
+ return content->has_mapped_audio() && content->can_be_played();
}
@@ -367,7 +367,7 @@ Player::setup_pieces ()
_stream_states.clear ();
for (auto i: _pieces) {
- if (i->content->audio) {
+ if (i->content->has_mapped_audio()) {
for (auto j: i->content->audio->streams()) {
_stream_states[j] = StreamState(i);
}
diff --git a/src/wx/content_timeline.cc b/src/wx/content_timeline.cc
index 663f93030..7200bf076 100644
--- a/src/wx/content_timeline.cc
+++ b/src/wx/content_timeline.cc
@@ -307,7 +307,7 @@ ContentTimeline::recreate_views()
_views.push_back(make_shared<ContentTimelineVideoView>(*this, i));
}
- if (i->audio && !i->audio->mapping().mapped_output_channels().empty ()) {
+ if (i->has_mapped_audio()) {
_views.push_back(make_shared<ContentTimelineAudioView>(*this, i));
}
diff --git a/src/wx/content_timeline_audio_view.cc b/src/wx/content_timeline_audio_view.cc
index 600e39057..cff0b5ed5 100644
--- a/src/wx/content_timeline_audio_view.cc
+++ b/src/wx/content_timeline_audio_view.cc
@@ -73,7 +73,7 @@ ContentTimelineAudioView::label () const
s += wxString::Format (_(" advanced by %dms"), -ac->delay());
}
- list<int> mapped = ac->mapping().mapped_output_channels();
+ auto mapped = ac->mapping().mapped_output_channels();
if (!mapped.empty ()) {
s += wxString::FromUTF8(" → ");
for (auto i: mapped) {
diff --git a/test/audio_content_test.cc b/test/audio_content_test.cc
index 72023a66f..465109259 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);
+}
+
diff --git a/wscript b/wscript
index 0fae054bf..97fbc3fa2 100644
--- a/wscript
+++ b/wscript
@@ -36,7 +36,7 @@ from waflib import Logs, Context
APPNAME = 'dcpomatic'
libdcp_version = '1.8.100'
-libsub_version = '1.6.42'
+libsub_version = '1.6.49'
this_version = subprocess.Popen(['git', 'tag', '-l', '--points-at', 'HEAD'], stdout=subprocess.PIPE).communicate()[0]
git_head = subprocess.Popen(['git', 'rev-parse', '--short=9', 'HEAD'], stdout=subprocess.PIPE).communicate()[0]