Add option to stop the player using any audio processor.
authorCarl Hetherington <cth@carlh.net>
Sun, 11 Feb 2024 12:09:30 +0000 (13:09 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 11 Feb 2024 21:55:26 +0000 (22:55 +0100)
src/lib/player.cc
src/lib/player.h

index 79b48ea71cd13f70191bba0690d3969eea2b68b4..0796fbceb118323890583014fbbbb104e412dab1 100644 (file)
@@ -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;
+}
+
index 5950b95a39d03ca5b96a1e2b037f150135e0403c..94e41bbcace5aceab2ea56c05ef88c7f83166e9f 100644 (file)
@@ -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;