summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-02-11 13:09:30 +0100
committerCarl Hetherington <cth@carlh.net>2024-02-11 22:55:26 +0100
commit4d49c6e02b5226147058ca8015acf0ad1f440e9b (patch)
tree1bca4c0a55ecf53aefc7d9cff297fad363fd0e83
parentcbeedf8849de63c7601d6c5a194cb60ed583c7a0 (diff)
Add option to stop the player using any audio processor.
-rw-r--r--src/lib/player.cc12
-rw-r--r--src/lib/player.h2
2 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 79b48ea71..0796fbceb 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -191,6 +191,7 @@ Player::Player(Player&& other)
, _silent(std::move(other._silent))
, _active_texts(std::move(other._active_texts))
, _audio_processor(std::move(other._audio_processor))
+ , _disable_audio_processor(other._disable_audio_processor)
, _playback_length(other._playback_length.load())
, _subtitle_alignment(other._subtitle_alignment)
{
@@ -230,6 +231,7 @@ Player::operator=(Player&& other)
_silent = std::move(other._silent);
_active_texts = std::move(other._active_texts);
_audio_processor = std::move(other._audio_processor);
+ _disable_audio_processor = other._disable_audio_processor;
_playback_length = other._playback_length.load();
_subtitle_alignment = other._subtitle_alignment;
@@ -1207,7 +1209,7 @@ Player::audio (weak_ptr<Piece> weak_piece, AudioStreamPtr stream, ContentAudio c
/* Process */
- if (_audio_processor) {
+ if (_audio_processor && !_disable_audio_processor) {
content_audio.audio = _audio_processor->run(content_audio.audio, film->audio_channels());
}
@@ -1631,3 +1633,11 @@ Player::signal_change(ChangeType type, int property)
Change(type, property, false);
}
+
+/** Must be called from the same thread that calls ::pass() */
+void
+Player::set_disable_audio_processor()
+{
+ _disable_audio_processor = true;
+}
+
diff --git a/src/lib/player.h b/src/lib/player.h
index 5950b95a3..94e41bbca 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -105,6 +105,7 @@ public:
void set_fast ();
void set_play_referenced ();
void set_dcp_decode_reduction (boost::optional<int> reduction);
+ void set_disable_audio_processor();
boost::optional<dcpomatic::DCPTime> content_time_to_dcp (std::shared_ptr<const Content> content, dcpomatic::ContentTime t) const;
boost::optional<dcpomatic::ContentTime> dcp_to_content_time (std::shared_ptr<const Content> content, dcpomatic::DCPTime t) const;
@@ -243,6 +244,7 @@ private:
EnumIndexedVector<ActiveText, TextType> _active_texts;
std::shared_ptr<AudioProcessor> _audio_processor;
+ bool _disable_audio_processor = false;
boost::atomic<dcpomatic::DCPTime> _playback_length;