summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-12-05 23:36:51 +0100
committerCarl Hetherington <cth@carlh.net>2024-12-05 23:37:22 +0100
commitf485d588bebc4bc4039701bb04d7dc83f025d107 (patch)
treecfd246ab29ed14202eac53e24010d348a6a85aa2
parent1e9a08adcf5928a5999d01e9ecac885d07f057e1 (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.
-rw-r--r--src/lib/ffmpeg_decoder.cc9
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);
}