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.
This commit is contained in:
wm4 2013-11-25 23:14:54 +01:00
parent 8743d3fbfa
commit b5b1692593
4 changed files with 13 additions and 6 deletions

View File

@ -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.

View File

@ -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);
}

View File

@ -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,

View File

@ -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 =