summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-25 23:14:54 +0100
committerwm4 <wm4@nowhere>2013-11-25 23:14:54 +0100
commitb5b16925938fd37a604f5235afc7257f0b9bd6c7 (patch)
tree95b90e11cf5e42faa3c4336496bcf87e9c74ebed
parent8743d3fbfafe51a7aa3847663f6f6120438eb772 (diff)
downloadmpv-b5b16925938fd37a604f5235afc7257f0b9bd6c7.tar.bz2
mpv-b5b16925938fd37a604f5235afc7257f0b9bd6c7.tar.xz
video: disable PTS sorting fallback by default
It appears PTS sorting was useful only for avi files (and VfW-muxed mkv). Maybe it was historically also important for decoders with broken or non-existent PTS reordering (win32 codecs?). But now that we handle demuxers which outputs DTS only correctly, it just seems dead weight. Disable it by default. The --pts-association-mode option is now forced to always use the decoder's PTS value. You can still enable the old default (auto) or force sorting. But we will probably remove this option entirely at some point. Make demux_mkv export timestamps at DTS when it's in VfW mode. This is needed to get correct timestamps with the new default mode. demux_lavf already does that.
-rw-r--r--DOCS/man/en/options.rst11
-rw-r--r--demux/demux_mkv.c2
-rw-r--r--mpvcore/options.c1
-rw-r--r--video/decode/dec_video.c5
4 files changed, 13 insertions, 6 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 02be5b86f4..fec8aa0575 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -1630,16 +1630,19 @@ OPTIONS
Use the given profile(s), ``--profile=help`` displays a list of the
defined profiles.
-``--pts-association-mode=<auto|decode|sort>``
+``--pts-association-mode=<decode|sort|auto>``
Select the method used to determine which container packet timestamp
corresponds to a particular output frame from the video decoder. Normally
you should not need to change this option.
- :auto: Try to pick a working mode from the ones below automatically
- (default)
- :decoder: Use decoder reordering functionality.
+ :decoder: Use decoder reordering functionality. Unlike in classic MPlayer
+ and mplayer2, this includes a dTS fallback. (Default.)
:sort: Maintain a buffer of unused pts values and use the lowest value
for the frame.
+ :auto: Try to pick a working mode from the ones above automatically.
+
+ You can also try to use ``--no-correct-pts`` for files with completely
+ broken timestamps.
``--pvr=<option1:option2:...>``
This option tunes various encoding properties of the PVR capture module.
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 2199a9c932..ec98bc81a9 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -2373,6 +2373,8 @@ static int handle_block(demuxer_t *demuxer, struct block_info *block_info)
* values being the same) */
if (i == 0 || track->default_duration)
dp->pts = mkv_d->last_pts + i * track->default_duration;
+ if (track->ms_compat)
+ MPSWAP(double, dp->pts, dp->dts);
dp->duration = block_duration / 1e9;
demuxer_add_packet(demuxer, stream, dp);
}
diff --git a/mpvcore/options.c b/mpvcore/options.c
index 1eec14284d..11819c5286 100644
--- a/mpvcore/options.c
+++ b/mpvcore/options.c
@@ -811,6 +811,7 @@ const struct MPOpts mp_default_opts = {
.edition_id = -1,
.default_max_pts_correction = -1,
.correct_pts = 1,
+ .user_pts_assoc_mode = 1,
.initial_audio_sync = 1,
.term_osd = 2,
.consolecontrols = 1,
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index d2479a7610..d0d7355803 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -211,12 +211,13 @@ struct mp_image *video_decode(struct dec_video *d_video,
{
mp_image_t *mpi = NULL;
struct MPOpts *opts = d_video->opts;
+ bool sort_pts = opts->user_pts_assoc_mode != 1 && opts->correct_pts;
double pts = packet ? packet->pts : MP_NOPTS_VALUE;
if (pts != MP_NOPTS_VALUE)
d_video->last_packet_pts = pts;
- if (opts->correct_pts && pts != MP_NOPTS_VALUE) {
+ if (sort_pts && pts != MP_NOPTS_VALUE) {
int delay = -1;
video_vd_control(d_video, VDCTRL_QUERY_UNSEEN_FRAMES, &delay);
if (delay >= 0) {
@@ -270,7 +271,7 @@ struct mp_image *video_decode(struct dec_video *d_video,
|| pts == MP_NOPTS_VALUE)
d_video->num_reordered_pts_problems++;
prevpts = d_video->sorted_pts;
- if (opts->correct_pts) {
+ if (sort_pts) {
if (d_video->num_buffered_pts) {
d_video->num_buffered_pts--;
d_video->sorted_pts =