1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-19 01:47:38 +00:00
mpv/demux
wm4 7165ebd0ba demux: add an explicit start state for backward demuxing
Yay, more subtle state on top of this nightmarish, fragile state
machine. But this is what happens when you subvert the laws of nature.

This simple checks where playback should "resume" from when no packets
were returned to the decoder yet after the seek that initiated backward
playback. The main purpose is to process the first returned keyframe
range in the same way like all other ranges. This ensures that things
like preroll are included properly.

Before this commit, it could for example have happened that the start of
the first audio frame was slightly broken, because no preroll was
included. Since the audio frame is reversed before sending it to the
audio output, it would have added an audible discontinuity before the
second frame was played; all subsequent frames would have been fine.
(Although I didn't test and confirm this particular issue.)

In future, this could be useful for certain other things.

At least the condition for delaying the backstep seek becomes simpler
and more explicit.

Move the code that attempts to start demuxing up in dequeue_packet.
Before, it was not called when the stream was in back_restarting state.
This commit makes streams be in back_restarting state at initialization,
so the demuxer would never have started reading.

Likewise, we need to call back_demux_see_packets() right after seek in
case the seek was within the cache. (We don't bother with checking
whether it was a cached seek; nothing happens if it was a normal one.)
There is nothing else that would process these cached packets
explicitly, although coincidences could sporadically trigger it.
2019-05-25 15:40:22 +02:00
..
codec_tags.c demux_mkv: simplify avi compat. codec_tags.c GUID lookup 2018-09-14 14:17:32 +02:00
codec_tags.h
cue.c cue: strip quotes and leading whitespace from tags 2018-01-30 14:01:15 +01:00
cue.h
demux_cue.c demux_edl, cue, mkv: slightly nicer file format indication 2019-01-11 15:12:30 +01:00
demux_edl.c demux_edl: fix assertion failure on exit in obscure ytdl cases 2019-01-20 15:46:09 +01:00
demux_lavf.c demux_lavf: also fix cachec seeking with large codec delay 2019-05-22 22:32:31 +02:00
demux_libarchive.c demux: change hack for closing subtitle files early 2018-09-07 23:02:36 +02:00
demux_mf.c demux: return packets directly from demuxer instead of using sh_stream 2018-09-07 15:20:32 +02:00
demux_mkv_timeline.c demux_edl, cue, mkv: slightly nicer file format indication 2019-01-11 15:12:30 +01:00
demux_mkv.c demux, demux_mkv: fix seeking in cache with large codec delay 2019-05-22 22:27:07 +02:00
demux_null.c demux_null: mark as seekable 2018-01-06 14:42:22 -08:00
demux_playlist.c demux: change hack for closing subtitle files early 2018-09-07 23:02:36 +02:00
demux_raw.c demux_raw: fix operation with demuxer cache and backward playback 2019-05-20 02:18:59 +02:00
demux_timeline.c demux_timeline: add heuristic to fix shifted seeks with separate audio 2019-01-11 15:12:30 +01:00
demux.c demux: add an explicit start state for backward demuxing 2019-05-25 15:40:22 +02:00
demux.h Implement backwards playback 2019-05-19 04:15:01 +02:00
ebml.c demux_mkv: adjust log verbosity levels 2018-04-29 02:21:32 +03:00
ebml.h demux_mkv: rewrite packet reading to avoid 1 memcpy() 2017-11-05 18:13:34 +01:00
matroska.h
packet.c Implement backwards playback 2019-05-19 04:15:01 +02:00
packet.h Implement backwards playback 2019-05-19 04:15:01 +02:00
stheader.h demux, demux_mkv: fix seeking in cache with large codec delay 2019-05-22 22:27:07 +02:00
timeline.c demux_edl, cue, mkv: slightly nicer file format indication 2019-01-11 15:12:30 +01:00
timeline.h demux_edl, cue, mkv: slightly nicer file format indication 2019-01-11 15:12:30 +01:00