mpv/demux
wm4 a090c07453 demux_lavf: add workaround for broken libavformat seek behavior
Seeking before the start of a .flac file (such as seeking backwards when
the file just started) generates a bunch of decoding errors and audible
artifacts. Also, the audio output doesn't match the reported playback
position. The errors printed to the terminal are:

[flac @ 0x8aca1c0]invalid sync code
[flac @ 0x8aca1c0]invalid frame header
[flac @ 0x8aca1c0]decode_frame() failed

This is most likely a problem with the libavformat API. When seeking
with av_seek_frame() fails, the demuxer can be left in an inconsistent
state. ffplay has the same issue [1].

Older versions of mpv somehow handled this fine. Bisection shows that
commit b3fb7c2 caused this regression by removing code that retried
failed seeks with an inverted AVSEEK_FLAG_BACKWARD flag. This code was
removed because it made it harder to stop playback of a file by seeking
past the end of the file (expecting this is rather natural when skipping
through multiple files by seeking, and the internal mplayer demuxers
also did this).

As a workaround, re-add the original code, but only for the backwards
seeking case.

Also note that the original intention of the code removed in b3fb7c2 was
not dealing with this case, but something else. It also had to do with
working around weird libavformat situations, though. It's not perfectly
clear what exactly. See commit 1ad332f.

[1] https://ffmpeg.org/trac/ffmpeg/ticket/2282
2013-02-19 01:49:01 +01:00
..
asf.h
asfguid.h
asfheader.c core: redo how codecs are mapped, remove codecs.conf 2013-02-10 17:25:56 +01:00
asfheader.h
aviheader.c core: redo how codecs are mapped, remove codecs.conf 2013-02-10 17:25:56 +01:00
aviheader.h stream, demux: replace off_t with int64_t 2012-11-20 18:00:15 +01:00
aviprint.c
aviprint.h
codec_tags.c core: redo how codecs are mapped, remove codecs.conf 2013-02-10 17:25:56 +01:00
codec_tags.h core: redo how codecs are mapped, remove codecs.conf 2013-02-10 17:25:56 +01:00
demux.c demux: apply sparse video hack only to demux_lavf and demux_mkv 2013-02-14 19:53:15 +01:00
demux.h demux: restructure code that warns about packet buffer overflows 2013-02-14 19:53:06 +01:00
demux_asf.c stream, demux: replace off_t with int64_t 2012-11-20 18:00:15 +01:00
demux_avi.c stream, demux: replace off_t with int64_t 2012-11-20 18:00:15 +01:00
demux_cue.c
demux_edl.c
demux_lavf.c demux_lavf: add workaround for broken libavformat seek behavior 2013-02-19 01:49:01 +01:00
demux_mf.c demux_mf: fix breakage after commit 4d016a9 2013-02-17 21:06:26 +01:00
demux_mkv.c demux_lavf: remove code duplication 2013-02-10 17:25:57 +01:00
demux_mng.c core: redo how codecs are mapped, remove codecs.conf 2013-02-10 17:25:56 +01:00
demux_mpg.c demux_mpg: fix setting codec 2013-02-14 19:52:34 +01:00
demux_packet.h stream, demux: replace off_t with int64_t 2012-11-20 18:00:15 +01:00
demux_rawaudio.c core: redo how codecs are mapped, remove codecs.conf 2013-02-10 17:25:56 +01:00
demux_rawvideo.c core: redo how codecs are mapped, remove codecs.conf 2013-02-10 17:25:56 +01:00
demux_ts.c core: redo how codecs are mapped, remove codecs.conf 2013-02-10 17:25:56 +01:00
demux_ts.h
ebml.c
ebml.h
extension.c
matroska.h demux_mkv: support V_UNCOMPRESSED video tracks 2013-01-24 17:45:13 +01:00
mf.c Replace strsep() uses 2013-01-13 17:32:39 +01:00
mf.h demux_mf: allow displaying single image files, various cleanups 2012-11-16 21:21:16 +01:00
mp3_hdr.c
mp3_hdr.h
mpeg_hdr.c
mpeg_hdr.h
ms_hdr.h
parse_es.c
parse_es.h
stheader.h demux_lavf, ad_lavc, vd_lavc: pass codec header data directly 2013-02-10 17:25:57 +01:00
video.c demux: apply sparse video hack only to demux_lavf and demux_mkv 2013-02-14 19:53:15 +01:00