From 4d49c6e02b5226147058ca8015acf0ad1f440e9b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 11 Feb 2024 13:09:30 +0100 Subject: Add option to stop the player using any audio processor. --- src/lib/player.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/lib/player.cc') 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 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; +} + -- cgit v1.2.3