Add option to stop the player using any audio processor.
[dcpomatic.git] / src / lib / player.cc
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;
+}
+