0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00
mpv/sub
wm4 2c7db48195 sub: do not clear subtitle list on seeking
This affects non-ASS text subtitles (those which go through libavcodec's
subtitle converter), which are muxed with video/audio. (Typically srt
subs in mkv.)

The problem is that seeking in the file can send a subtitle packet to
the decoder multiple times. These packets are interlaved with video,
and thus can't be all read when opening the file. Rather, subtitle
packets can essentially be randomly skipped or repeated (by seeking).
Until recently, this was solved by scanning the libass event list for
duplicates. Then our builtin srt-to-ass converter was removed, and
the problem was handled by fully clearing the subtitle list on each
seek.

This resulted in sub-seek not working properly for this type of file.
Since the subtitle list was cleared on seek, it was not possible to
do e.g. sub-seeks to subtitles before the current playback position.

Fix this by not clearing the list, and intead explicitly rejecting
duplicate packets. We use the packet file position was unique ID for
subtitles; this is confirmed working for most file formats (although
it is slightly risky - new demuxers may not necessarily set the file
position to something unique, or at all).

The list of seen packets is sorted, and the lookup uses binary search.
This is to avoid quadratic complexity when subtitles are added in
bulks, such as when opening a text subtitle file.

In some places, the code has to be adjusted to pass through the packet
file position correctly.
2015-12-18 03:52:57 +01:00
..
ass_mp.c sub: remove unused function, move another one 2015-11-29 17:55:02 +01:00
ass_mp.h sub: remove unused function, move another one 2015-11-29 17:55:02 +01:00
dec_sub.c sub: do not clear subtitle list on seeking 2015-12-18 03:52:57 +01:00
dec_sub.h sub: allow feeding bitmap subs in advance 2015-12-05 23:54:00 +01:00
draw_bmp.c csputils: rename "yuv2rgb" functions 2015-12-09 00:23:36 +01:00
draw_bmp.h csputils: get rid of mp_csp_details 2015-01-06 16:50:58 +01:00
img_convert.c Update license headers 2015-04-13 12:10:01 +02:00
img_convert.h Revert "sub: support straight alpha additionally to premultiplied alpha" 2013-08-12 02:49:22 +02:00
osd_dummy.c Add some missing "const"s 2014-10-10 13:44:08 +02:00
osd_font.otf osd+osc: Add left-arrow to osd-font 2014-08-21 18:45:41 +02:00
osd_libass.c osd: fix and cleanup font style management 2015-11-29 17:55:02 +01:00
osd_state.h osd: use the same ASS_Renderer for OSD text and progbar 2015-11-28 19:24:31 +01:00
osd.c osd: use the same ASS_Renderer for OSD text and progbar 2015-11-28 19:24:31 +01:00
osd.h osd: use the same ASS_Renderer for OSD text and progbar 2015-11-28 19:24:31 +01:00
sd_ass.c sub: do not clear subtitle list on seeking 2015-12-18 03:52:57 +01:00
sd_lavc_conv.c sub: do not clear subtitle list on seeking 2015-12-18 03:52:57 +01:00
sd_lavc.c sd_lavc: remove small gaps between subtitles 2015-12-05 23:55:56 +01:00
sd.h sub: do not clear subtitle list on seeking 2015-12-18 03:52:57 +01:00