diff options
author | wm4 <wm4@nowhere> | 2015-10-06 17:55:15 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-10-06 18:19:20 +0200 |
commit | 8e654d3f78f95b0e3a5a41d41e1e8cafd8f365ec (patch) | |
tree | 02dd26704119721f968af19a108d2e7570286367 | |
parent | 0e245b37523c9808f91827f64f4a62812d2c733e (diff) | |
download | mpv-8e654d3f78f95b0e3a5a41d41e1e8cafd8f365ec.tar.bz2 mpv-8e654d3f78f95b0e3a5a41d41e1e8cafd8f365ec.tar.xz |
video: remove user-controllable PTS sorting (--pts-association-mode)
Useless. Sometimes it might be useful to make some extremely broken
files work, but on the other hand --no-correct-pts is sufficient for
these cases.
While we still need some of the code for AVI, the "auto" mode in
particular inflated the size of the code.
-rw-r--r-- | DOCS/man/input.rst | 3 | ||||
-rw-r--r-- | DOCS/man/options.rst | 14 | ||||
-rw-r--r-- | options/options.c | 3 | ||||
-rw-r--r-- | options/options.h | 1 | ||||
-rw-r--r-- | player/command.c | 2 | ||||
-rw-r--r-- | video/decode/dec_video.c | 55 | ||||
-rw-r--r-- | video/decode/dec_video.h | 7 |
7 files changed, 5 insertions, 80 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 6d8f5f9d11..d1d891227b 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -1171,9 +1171,6 @@ Property list is loaded, or when switching ordered chapter segments. This is because the same underlying code is used for seeking and resyncing.) -``pts-association-mode`` (RW) - See ``--pts-association-mode``. - ``hr-seek`` (RW) See ``--hr-seek``. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 2d11020be1..6122e3e4e8 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -3535,20 +3535,6 @@ Miscellaneous .. warning:: Using realtime priority can cause system lockup. -``--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. - - :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. - ``--force-media-title=<string>`` Force the contents of the ``media-title`` property to this value. Useful for scripts which want to set a title, without overriding the user's diff --git a/options/options.c b/options/options.c index 7c04342384..51d2c5ca82 100644 --- a/options/options.c +++ b/options/options.c @@ -521,8 +521,6 @@ const m_option_t mp_opts[] = { // a-v sync stuff: 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), OPT_CHOICE("video-sync", video_sync, 0, ({"audio", VS_DEFAULT}, @@ -754,7 +752,6 @@ 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, .frame_dropping = 1, .term_osd = 2, diff --git a/options/options.h b/options/options.h index 75156043b3..8d7246e8b9 100644 --- a/options/options.h +++ b/options/options.h @@ -144,7 +144,6 @@ typedef struct MPOpts { int chapterrange[2]; int edition_id; int correct_pts; - int user_pts_assoc_mode; int initial_audio_sync; int video_sync; double sync_max_video_change; diff --git a/player/command.c b/player/command.c index 44ffd170a6..87f4061fe6 100644 --- a/player/command.c +++ b/player/command.c @@ -3405,7 +3405,6 @@ static const struct m_property mp_properties[] = { {"demuxer-cache-idle", mp_property_demuxer_cache_idle}, {"cache-buffering-state", mp_property_cache_buffering}, {"paused-for-cache", mp_property_paused_for_cache}, - {"pts-association-mode", mp_property_generic_option}, {"hr-seek", mp_property_generic_option}, {"clock", mp_property_clock}, {"seekable", mp_property_seekable}, @@ -3734,7 +3733,6 @@ static const struct property_osd_display { { "chapter", .seek_msg = OSD_SEEK_INFO_CHAPTER_TEXT, .seek_bar = OSD_SEEK_INFO_BAR }, { "edition", .seek_msg = OSD_SEEK_INFO_EDITION }, - { "pts-association-mode", "PTS association mode" }, { "hr-seek", "hr-seek" }, { "speed", "Speed" }, { "clock", "Clock" }, diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index 384f1b2643..0d97e397b2 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -67,8 +67,6 @@ void video_reset_decoding(struct dec_video *d_video) d_video->decoded_pts = MP_NOPTS_VALUE; d_video->codec_pts = MP_NOPTS_VALUE; d_video->codec_dts = MP_NOPTS_VALUE; - d_video->sorted_pts = MP_NOPTS_VALUE; - d_video->unsorted_pts = MP_NOPTS_VALUE; } int video_vd_control(struct dec_video *d_video, int cmd, void *arg) @@ -228,57 +226,14 @@ static void add_pts_to_sort(struct dec_video *d_video, double pts) } } -// Return true if pts1 comes before pts2. pts1 can be MP_NOPTS_VALUE, but pts2 -// always has to be valid. pts1 can't be equal or larger than pts2. -#define PTS_IS_ORDERED(pts1, pts2) \ - ((pts2) != MP_NOPTS_VALUE && ((pts1) == MP_NOPTS_VALUE || ((pts1) < (pts2)))) - static double retrieve_sorted_pts(struct dec_video *d_video, double codec_pts) { - struct MPOpts *opts = d_video->opts; - - double sorted_pts; if (d_video->num_buffered_pts) { d_video->num_buffered_pts--; - sorted_pts = d_video->buffered_pts[d_video->num_buffered_pts]; - } else { - MP_ERR(d_video, "No pts value from demuxer to use for frame!\n"); - sorted_pts = MP_NOPTS_VALUE; - } - - if (!PTS_IS_ORDERED(d_video->sorted_pts, sorted_pts)) - d_video->num_sorted_pts_problems++; - d_video->sorted_pts = sorted_pts; - - if (!PTS_IS_ORDERED(d_video->unsorted_pts, codec_pts)) - d_video->num_unsorted_pts_problems++; - d_video->unsorted_pts = codec_pts; - - if (d_video->header->video->avi_dts) { - // Actually, they don't need to be sorted, we just reuse the buffering. - d_video->pts_assoc_mode = 2; - } else if (opts->user_pts_assoc_mode) { - d_video->pts_assoc_mode = opts->user_pts_assoc_mode; - } else if (d_video->pts_assoc_mode == 0) { - if (codec_pts != MP_NOPTS_VALUE) - d_video->pts_assoc_mode = 1; - else - d_video->pts_assoc_mode = 2; - } else { - int probcount1 = d_video->num_unsorted_pts_problems; - int probcount2 = d_video->num_sorted_pts_problems; - if (d_video->pts_assoc_mode == 2) { - int tmp = probcount1; - probcount1 = probcount2; - probcount2 = tmp; - } - if (probcount1 >= probcount2 * 1.5 + 2) { - d_video->pts_assoc_mode = 3 - d_video->pts_assoc_mode; - MP_WARN(d_video, "Switching to pts association mode %d.\n", - d_video->pts_assoc_mode); - } + return d_video->buffered_pts[d_video->num_buffered_pts]; } - return d_video->pts_assoc_mode == 1 ? codec_pts : sorted_pts; + MP_ERR(d_video, "No pts value from demuxer to use for frame!\n"); + return MP_NOPTS_VALUE; } struct mp_image *video_decode(struct dec_video *d_video, @@ -286,9 +241,7 @@ struct mp_image *video_decode(struct dec_video *d_video, int drop_frame) { struct MPOpts *opts = d_video->opts; - bool sort_pts = - (opts->user_pts_assoc_mode != 1 || d_video->header->video->avi_dts) - && opts->correct_pts; + bool sort_pts = d_video->header->video->avi_dts && opts->correct_pts; struct demux_packet packet_copy; if (packet && packet->dts == MP_NOPTS_VALUE) { diff --git a/video/decode/dec_video.h b/video/decode/dec_video.h index 69e2a44e40..d40405afb9 100644 --- a/video/decode/dec_video.h +++ b/video/decode/dec_video.h @@ -55,14 +55,9 @@ struct dec_video { double codec_dts; int num_codec_dts_problems; - // PTS sorting (obscure, non-default) + // PTS sorting (needed for AVI-style timestamps) double buffered_pts[32]; int num_buffered_pts; - double sorted_pts; - int num_sorted_pts_problems; - double unsorted_pts; - int num_unsorted_pts_problems; - int pts_assoc_mode; // PTS or DTS of packet last read double last_packet_pdts; |