diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-12-05 23:36:51 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-12-09 01:40:29 +0100 |
| commit | 5a980207377e67b6aa3595d0cde441ae7659f5a6 (patch) | |
| tree | 98a64ab389712cb2e90b76a0e8473f139926f31e /src/lib/ffmpeg_decoder.cc | |
| parent | 42fa4dea81483359bf67676e2a931db103531a69 (diff) | |
Fix doubled subtitles (again).
This was re-introduced when
94618a724124cbf5fe9f0b47a3fdce601fcd5581
reverted a previous attempt at a fix.
At the time I couldn't understand the doubled-subtitles problem,
but it's apparent in the test introduced in the next commit.
This is another attempt to fix it by only sending a "stop" for
a subtitle if we didn't already stop the subtitle because the
next one arrived.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 09d1e2786..f57c9efe8 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -243,6 +243,11 @@ FFmpegDecoder::pass () decode_and_process_audio_packet (packet); } + if (_have_current_subtitle && _current_subtitle_to && position() > *_current_subtitle_to) { + only_text()->emit_stop(*_current_subtitle_to); + _have_current_subtitle = false; + } + av_packet_free (&packet); return false; } @@ -697,10 +702,6 @@ FFmpegDecoder::decode_and_process_subtitle_packet (AVPacket* packet) only_text()->emit_bitmap_start(bitmap_text); } - if (_current_subtitle_to) { - only_text()->emit_stop (*_current_subtitle_to); - } - avsubtitle_free (&sub); } |
