mpv/demux
wm4 ac1c5e6e18 demux_mkv: improve robustness against broken files
Fixes test7.mkv from the Matroska test file collection, as well as some
real broken files I've found in the wild. (Unfortunately, true recovery
requires resetting the decoders and playback state with a manual seek,
but it's still better than just exiting.)

If there are broken EBML elements, try harder to skip them correctly.
Do this by searching for the next cluster element. The cluster element
intentionally has a long ID, so it's a suitable element for
resynchronizing (mkvmerge does something similar).

We know that data is corrupt if the ID or length fields of an element
are malformed. Additionally, if skipping an unknown element goes past
the end of the file, we assume it's corrupt and undo the seek. Do this
because it often happens that corrupt data is interpreted as correct
EBML elements. Since these elements will have a ridiculous values in
their length fields due to the large value range that is possible
(0-2^56-2), they will go past the end of the file. So instead of
skipping them (which would result in playback termination), try to
find the next cluster instead. (We still skip unknown elements that
are within the file, as this is needed for correct operation. Also, we
first execute the seek, because we don't really know where the file
ends. Doing it this way is better for unseekable streams too, because
it will still work in the non-error case.)

This is done as special case in the packet reading function only. On
the other hand, that's the only part of the file that's read after
initialization is done.
2013-03-28 21:45:16 +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 demux_mkv: support ALAC 2013-03-15 12:17:39 +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: fix regressions by restricting cover art hack further 2013-03-19 02:27:47 +01:00
demux.h core: fix SEEK_FACTOR 2013-03-01 14:44:53 +01:00
demux_asf.c core: use playback time to determine playback percent position 2013-02-26 02:01:48 +01:00
demux_avi.c core: use playback time to determine playback percent position 2013-02-26 02:01:48 +01:00
demux_cue.c
demux_edl.c
demux_lavf.c demux_lavf: use avg_frame_rate instead of r_frame_rate 2013-03-13 23:51:30 +01:00
demux_mf.c demux_mf: fix crashes when '*' matches directories 2013-03-19 01:54:45 +01:00
demux_mkv.c demux_mkv: improve robustness against broken files 2013-03-28 21:45:16 +01:00
demux_mng.c core: use playback time to determine playback percent position 2013-02-26 02:01:48 +01:00
demux_mpg.c core: fix SEEK_FACTOR 2013-03-01 14:44:53 +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 demux_rawvideo: allow setting video codec 2013-02-24 16:46:35 +01:00
demux_ts.c core: fix SEEK_FACTOR 2013-03-01 14:44:53 +01:00
demux_ts.h
ebml.c demux_mkv: improve robustness against broken files 2013-03-28 21:45:16 +01:00
ebml.h demux_mkv: improve robustness against broken files 2013-03-28 21:45:16 +01:00
extension.c
matroska.h demux_mkv: support ALAC 2013-03-15 12:17:39 +01:00
mf.c demux_mf: fix crashes when '*' matches directories 2013-03-19 01:54:45 +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