diff options
author | wm4 <wm4@nowhere> | 2016-08-14 20:27:37 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-08-14 20:27:37 +0200 |
commit | 4a8647b6b85be7a514488f0b43cdc0bd199b2407 (patch) | |
tree | 4c9808a43197cc38ecde73e095326205fd198733 /sub/sd.h | |
parent | 4b5de33e89d54e6a53229035969790c0c8c76213 (diff) | |
download | mpv-4a8647b6b85be7a514488f0b43cdc0bd199b2407.tar.bz2 mpv-4a8647b6b85be7a514488f0b43cdc0bd199b2407.tar.xz |
sub: don't potentially discard too many subtitles on seek
The accepts_packet packet callback is supposed to deal with subtitle
decoders which have only a small queue of current subtitle events (i.e.
sd_lavc.c), in case feeding it too many packets would discard events
that are still needed.
Normally, the number of subtitles that need to be preserved is estimated
by the rendering pts (get_bitmaps() argument). Rendering lags behind
decoding, so normally the rendering pts is smaller than the next video
frame pts, and we simply discard all subtitle events until the rendering
pts.
This breaks down in some annoying corner cases. One of them is seeking
backwards: the VO will still try to render the old PTS during seeks,
which passes a high PTS to the subtitle renderer, which in turn would
discard more subtitles than it should. There is a similar issue with
forward seeks. Add hacks to deal with those issues.
There should be a better way to deal with the essentially unknown
"rendering position", which is made worse by screenshots or rendering
with vf_sub. At the very least, we could handle seeks better, and e.g.
either force the VO not to re-render subs after seeks (ugly), or
introduce seek sequence numbers to distinguish attempts to render
earlier subtitles when a seek is done.
Diffstat (limited to 'sub/sd.h')
-rw-r--r-- | sub/sd.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -34,7 +34,7 @@ struct sd_functions { void (*select)(struct sd *sd, bool selected); void (*uninit)(struct sd *sd); - bool (*accepts_packet)(struct sd *sd); // implicit default if NULL: true + bool (*accepts_packet)(struct sd *sd, double pts); // implicit default if NULL: true int (*control)(struct sd *sd, enum sd_ctrl cmd, void *arg); void (*get_bitmaps)(struct sd *sd, struct mp_osd_res dim, int format, |