1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-30 11:42:04 +00:00
mpv/video/decode
wm4 f5219720f8 video: refactor PTS code, add fall back heuristic to DTS
Refactor the PTS handling code to make it cleaner, and to separate the
bits that use PTS sorting.

Add a heuristic to fall back to DTS if the PTS us non-monotonic. This
code is based on what FFmpeg/Libav use for ffplay/avplay and also
best_effort_timestamp (which is only in FFmpeg). Basically, this 1. just
uses the DTS if PTS is unset, and 2. ignores PTS entirely if PTS is non-
monotonic, but DTS is sorted.

The code is pretty much the same as in Libav [1]. I'm not sure if all of
it is really needed, or if it does more than what the paragraph above
mentions. But maybe it's fine to cargo-cult this.

This heuristic fixes playback of mpeg4 in ogm, which returns packets
with PTS==DTS, even though the PTS timestamps should follow codec
reordering. This is probably a libavformat demuxer bug, but good luck
trying to fix it.

The way vd_lavc.c returns the frame PTS and DTS to dec_video.c is a bit
inelegant, but maybe better than trying to mess the PTS back into the
decoder callback again.

[1] https://git.libav.org/?p=libav.git;a=blob;f=cmdutils.c;h=3f1c667075724c5cde69d840ed5ed7d992898334;hb=fa515c2088e1d082d45741bbd5c05e13b0500804#l1431
2013-11-27 21:14:39 +01:00
..
dec_video.c video: refactor PTS code, add fall back heuristic to DTS 2013-11-27 21:14:39 +01:00
dec_video.h video: refactor PTS code, add fall back heuristic to DTS 2013-11-27 21:14:39 +01:00
lavc_dr1.c Attempt to fix build on older libavcodec versions 2013-11-23 22:08:18 +01:00
lavc.h video: move handling of container vs. stream AR out of vd_lavc.c 2013-11-23 21:40:51 +01:00
vaapi.c video: move struct mp_hwdec_info into its own header file 2013-11-23 21:26:31 +01:00
vd_lavc.c video: refactor PTS code, add fall back heuristic to DTS 2013-11-27 21:14:39 +01:00
vd.h cosmetics: rename video/audio reset functions 2013-11-27 21:14:39 +01:00
vda.c
vdpau_old.c Attempt to fix build on older libavcodec versions 2013-11-23 22:08:18 +01:00
vdpau.c video: move struct mp_hwdec_info into its own header file 2013-11-23 21:26:31 +01:00