summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-06 17:55:15 +0200
committerwm4 <wm4@nowhere>2015-10-06 18:19:20 +0200
commit8e654d3f78f95b0e3a5a41d41e1e8cafd8f365ec (patch)
tree02dd26704119721f968af19a108d2e7570286367 /video
parent0e245b37523c9808f91827f64f4a62812d2c733e (diff)
downloadmpv-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.
Diffstat (limited to 'video')
-rw-r--r--video/decode/dec_video.c55
-rw-r--r--video/decode/dec_video.h7
2 files changed, 5 insertions, 57 deletions
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;