diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-07-11 14:46:52 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-07-11 14:46:52 +0100 |
| commit | 081f974c2c75c306d07d5a6f5da6847826a05a9c (patch) | |
| tree | f3c77f02b24b0d835efc6a61a8fe86bc3dd6a970 /src/lib | |
| parent | b242f871b4da75572bb0d5bf111ae6103bf669b7 (diff) | |
Remove unused Player::_ignore_audio. Ignore position
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.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/analyse_audio_job.cc | 1 | ||||
| -rw-r--r-- | src/lib/decoder.cc | 6 | ||||
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 2 | ||||
| -rw-r--r-- | src/lib/player.cc | 12 | ||||
| -rw-r--r-- | src/lib/player.h | 3 |
5 files changed, 16 insertions, 8 deletions
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 1378b66a4..fe56b3b6c 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -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)); diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index 1281897e0..0d4f4babf 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -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(); } diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index a54ac96ad..a09eab68e 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -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 (); diff --git a/src/lib/player.cc b/src/lib/player.cc index fb9e208fa..adaee931e 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -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. diff --git a/src/lib/player.h b/src/lib/player.h index 0ceff016c..230f7f4f8 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -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 */ |
