Remove unused Player::_ignore_audio. Ignore position
authorCarl Hetherington <cth@carlh.net>
Tue, 11 Jul 2017 13:46:52 +0000 (14:46 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 11 Jul 2017 13:46:52 +0000 (14:46 +0100)
of things that we are ignoring; this fixes strange behaviour (delays)
when analysing audio as it used to keep pass()ing decoders to get
data that would never come.

src/lib/analyse_audio_job.cc
src/lib/decoder.cc
src/lib/ffmpeg_decoder.cc
src/lib/player.cc
src/lib/player.h

index 1378b66a433fc0fa5a531d4db682f4f26ea3de31..fe56b3b6c9265005f8ba9c6e9dd427a6250246e1 100644 (file)
@@ -100,6 +100,7 @@ AnalyseAudioJob::run ()
 {
        shared_ptr<Player> player (new Player (_film, _playlist));
        player->set_ignore_video ();
+       player->set_ignore_subtitle ();
        player->set_fast ();
        player->set_play_referenced ();
        player->Audio.connect (bind (&AnalyseAudioJob::analyse, this, _1, _2));
index 1281897e011a6e8199347967fcee46ed6adf0763..0d4f4babfa9db0831650529ae4ead927260dc7f3 100644 (file)
@@ -34,15 +34,15 @@ Decoder::position () const
 {
        optional<ContentTime> pos;
 
-       if (video && (!pos || video->position() < *pos)) {
+       if (video && !video->ignore() && (!pos || video->position() < *pos)) {
                pos = video->position();
        }
 
-       if (audio && (!pos || audio->position() < *pos)) {
+       if (audio && !audio->ignore() && (!pos || audio->position() < *pos)) {
                pos = audio->position();
        }
 
-       if (subtitle && (!pos || subtitle->position() < *pos)) {
+       if (subtitle && !subtitle->ignore() && (!pos || subtitle->position() < *pos)) {
                pos = subtitle->position();
        }
 
index a54ac96addbd7dd158ea6d13f02d784065fd2e2c..a09eab68e12e11763436cd83db1378d710a632cc 100644 (file)
@@ -175,7 +175,7 @@ FFmpegDecoder::pass ()
 
        if (_video_stream && si == _video_stream.get() && !video->ignore()) {
                decode_video_packet ();
-       } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index (_format_context, si)) {
+       } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !subtitle->ignore()) {
                decode_subtitle_packet ();
        } else {
                decode_audio_packet ();
index fb9e208fa7d8992b0a9d99a91e41ed0cab316edb..adaee931e1dcb19347672a59a575df96c8fac614 100644 (file)
@@ -82,7 +82,7 @@ Player::Player (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist
        , _playlist (playlist)
        , _have_valid_pieces (false)
        , _ignore_video (false)
-       , _ignore_audio (false)
+       , _ignore_subtitle (false)
        , _always_burn_subtitles (false)
        , _fast (false)
        , _play_referenced (false)
@@ -121,8 +121,8 @@ Player::setup_pieces ()
                        decoder->video->set_ignore ();
                }
 
-               if (decoder->audio && _ignore_audio) {
-                       decoder->audio->set_ignore ();
+               if (decoder->subtitle && _ignore_subtitle) {
+                       decoder->subtitle->set_ignore ();
                }
 
                shared_ptr<DCPDecoder> dcp = dynamic_pointer_cast<DCPDecoder> (decoder);
@@ -406,6 +406,12 @@ Player::set_ignore_video ()
        _ignore_video = true;
 }
 
+void
+Player::set_ignore_subtitle ()
+{
+       _ignore_subtitle = true;
+}
+
 /** Set whether or not this player should always burn text subtitles into the image,
  *  regardless of the content settings.
  *  @param burn true to always burn subtitles, false to obey content settings.
index 0ceff016c48ea7e8deba6db1b9db558a53307290..230f7f4f8a7a041d7678ff61190a6247db097bdd 100644 (file)
@@ -63,6 +63,7 @@ public:
 
        void set_video_container_size (dcp::Size);
        void set_ignore_video ();
+       void set_ignore_subtitle ();
        void set_always_burn_subtitles (bool burn);
        void set_fast ();
        void set_play_referenced ();
@@ -130,7 +131,7 @@ private:
        /** true if the player should ignore all video; i.e. never produce any */
        bool _ignore_video;
        /** true if the player should ignore all audio; i.e. never produce any */
-       bool _ignore_audio;
+       bool _ignore_subtitle;
        /** true if the player should always burn subtitles into the video regardless
            of content settings
        */