mpv/demux
wm4 dc0b2046cd video: add insane hack to work around FFmpeg/Libav insanity
So, FFmpeg/Libav requires us to figure out video timestamps ourselves
(see last 10 commits or so), but the methods it provides for this aren't
even sufficient. In particular, everything that uses AVI-style DTS (avi,
vfw-muxed mkv, possibly mpeg4-in-ogm) with a codec that has an internal
frame delay is broken. In this case, libavcodec will shift the packet-
to-image correspondence by the codec delay, meaning that with a delay=1,
the first AVFrame.pkt_dts is not 0, but that of the second packet. All
timestamps will appear shifted. The start time (e.g. the time displayed
when doing "mpv file.avi --pause") will not be exactly 0.

(According to Libav developers, this is how it's supposed to work; just
that the first DTS values are normally negative with formats that use
DTS "properly". Who cares if it doesn't work at all with very common
video formats? There's no indication that they'll fix this soon,
either. An elegant workaround is missing too.)

Add a hack to re-enable the old PTS code for AVI and vfw-muxed MKV.
Since these timestamps are not reorderd, we wouldn't need to sort them,
but it's less code this way (and possibly more robust, should a demuxer
unexpectedly output PTS).

The original intention of all the timestamp changes recently was
actually to get rid of demuxer-specific hacks and the old timestamp
sorting code, but it looks like this didn't work out. Yet another case
where trying to replace native MPlayer functionality with FFmpeg/Libav
led to disadvantages and bugs. (Note that the old PTS sorting code
doesn't and can't handle frame dropping correctly, though.)

Bug reports:

 https://trac.ffmpeg.org/ticket/3178

 https://bugzilla.libav.org/show_bug.cgi?id=600
2013-11-28 15:20:33 +01:00
..
codec_tags.c demux: remove gsh field from sh_audio/sh_video/sh_sub 2013-11-23 21:37:56 +01:00
codec_tags.h demux: remove gsh field from sh_audio/sh_video/sh_sub 2013-11-23 21:37:56 +01:00
demux.c player: move code for skipping 0-sized video packets to demuxer 2013-11-26 01:07:32 +01:00
demux.h demux: export dts from demux_lavf, use it for avi 2013-11-25 23:13:01 +01:00
demux_cue.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
demux_edl.c timeline: reject mplayer2 EDL files, change EDL header 2013-11-21 15:59:00 +01:00
demux_lavf.c video: add insane hack to work around FFmpeg/Libav insanity 2013-11-28 15:20:33 +01:00
demux_libass.c demux: make determining seek capability generic 2013-11-03 19:21:47 +01:00
demux_mf.c demux: remove gsh field from sh_audio/sh_video/sh_sub 2013-11-23 21:37:56 +01:00
demux_mkv.c video: add insane hack to work around FFmpeg/Libav insanity 2013-11-28 15:20:33 +01:00
demux_playlist.c playlist: rewrite PLS parser 2013-11-04 23:55:41 +01:00
demux_raw.c demux: remove gsh field from sh_audio/sh_video/sh_sub 2013-11-23 21:37:56 +01:00
demux_subreader.c demux: make determining seek capability generic 2013-11-03 19:21:47 +01:00
ebml.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
ebml.h core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
matroska.h demux_mkv: support some raw PCM variants 2013-11-11 18:40:59 +01:00
mf.c mf: silence compilation warning 2013-11-13 20:10:17 +01:00
mf.h mf: silence compilation warning 2013-11-13 20:10:17 +01:00
ms_hdr.h demux: rename Windows symbols 2013-11-02 15:14:12 +01:00
packet.h demux: export dts from demux_lavf, use it for avi 2013-11-25 23:13:01 +01:00
stheader.h video: add insane hack to work around FFmpeg/Libav insanity 2013-11-28 15:20:33 +01:00