From 3bddc16431f8d2e22b03154465e9c62bafd328f3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 26 Jul 2013 02:06:58 +0200 Subject: [PATCH] options: simplify --correct-pts handling Remove the (now unused) code for determining correct-pts mode based on the demuxer in use. Change its description in the manpage to reflect what this option does now. --- DOCS/man/en/options.rst | 13 ++++++------- core/mplayer.c | 8 -------- core/options.c | 4 ++-- core/options.h | 1 - demux/demux.h | 1 - demux/demux_lavf.c | 2 +- 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index 975139fdd9..7f5faa88fb 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -547,13 +547,12 @@ format. ``--correct-pts``, ``--no-correct-pts`` - Switches mpv to a mode where timestamps for video frames are calculated - differently and video filters which add new frames or modify timestamps of - existing ones are supported. Now enabled automatically for most common file - formats. The more accurate timestamps can be visible for example when - playing subtitles timed to scene changes with the ``--ass`` option. Without - ``--correct-pts``, the subtitle timing will typically be off by some frames. - This option does not work correctly with some demuxers and codecs. + ``--no-correct-pts`` switches mpv to a mode where video timing is + determined using a fixed framerate value (either using the ``--fps`` + option, or using file information). Sometimes, files with very broken + timestamps can be played somewhat well in this mode. Note that video + filters, subtitle rendering and audio synchronization can be completely + broken in this mode. ``--cursor-autohide=`` Make mouse cursor automatically hide after given number of milliseconds. diff --git a/core/mplayer.c b/core/mplayer.c index f1f1e81195..3e14abc499 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -4263,14 +4263,6 @@ goto_reopen_demuxer: ; if (mpctx->timeline) timeline_set_part(mpctx, mpctx->timeline_part, true); - // Decide correct-pts mode based on first segment of video track - opts->correct_pts = opts->user_correct_pts; - if (opts->correct_pts < 0) { - int val = 1; - demux_control(mpctx->demuxer, DEMUXER_CTRL_CORRECT_PTS, &val); - opts->correct_pts = val; - } - mpctx->initialized_flags |= INITIALIZED_DEMUXER; add_subtitle_fonts_from_sources(mpctx); diff --git a/core/options.c b/core/options.c index 03acdc570b..dd517dbb22 100644 --- a/core/options.c +++ b/core/options.c @@ -648,7 +648,7 @@ const m_option_t mp_opts[] = { OPT_INTRANGE("chapter-merge-threshold", chapter_merge_threshold, 0, 0, 10000), // a-v sync stuff: - OPT_FLAG("correct-pts", user_correct_pts, 0), + OPT_FLAG("correct-pts", correct_pts, 0), OPT_CHOICE("pts-association-mode", user_pts_assoc_mode, 0, ({"auto", 0}, {"decoder", 1}, {"sort", 2})), OPT_FLAG("initial-audio-sync", initial_audio_sync, 0), @@ -764,7 +764,7 @@ const struct MPOpts mp_default_opts = { .chapterrange = {-1, -1}, .edition_id = -1, .default_max_pts_correction = -1, - .user_correct_pts = -1, + .correct_pts = 1, .initial_audio_sync = 1, .term_osd = 2, .consolecontrols = 1, diff --git a/core/options.h b/core/options.h index fcb8002a42..45f3e858bb 100644 --- a/core/options.h +++ b/core/options.h @@ -94,7 +94,6 @@ typedef struct MPOpts { int chapterrange[2]; int edition_id; int correct_pts; - int user_correct_pts; int user_pts_assoc_mode; int initial_audio_sync; int hr_seek; diff --git a/demux/demux.h b/demux/demux.h index 85ee738137..4afd85f4a7 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -63,7 +63,6 @@ enum timestamp_type { #define DEMUXER_CTRL_RESYNC 13 #define DEMUXER_CTRL_SWITCH_VIDEO 14 #define DEMUXER_CTRL_IDENTIFY_PROGRAM 15 -#define DEMUXER_CTRL_CORRECT_PTS 16 // int* (write 1 for ok, 0 for no) #define SEEK_ABSOLUTE (1 << 0) #define SEEK_FACTOR (1 << 1) diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 350fe54b66..21b1cf8624 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -531,7 +531,7 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check) demuxer->timestamp_type = TIMESTAMP_TYPE_SORT; } else { int mode = lavfdopts->genptsmode; - if (mode == 0 && opts->user_correct_pts != 0) + if (mode == 0 && opts->correct_pts) mode = demuxer->stream->uncached_type == STREAMTYPE_DVD ? 2 : 1; if (mode == 1) avfc->flags |= AVFMT_FLAG_GENPTS;