summaryrefslogtreecommitdiffstats
path: root/video/decode/dec_video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-25 23:08:29 +0100
committerwm4 <wm4@nowhere>2013-11-25 23:08:29 +0100
commit4205bbf243227bf151f2439ecb7772c41ecbfd12 (patch)
tree141fa5f769a6bd5eb5a3b5095ba9c36e85666cd9 /video/decode/dec_video.c
parent51bce52d57467cffba040cf926708befb3d6633b (diff)
downloadmpv-4205bbf243227bf151f2439ecb7772c41ecbfd12.tar.bz2
mpv-4205bbf243227bf151f2439ecb7772c41ecbfd12.tar.xz
video: pass PTS as part of demux_packet/AVPacket and mp_image/AVFrame
Instead of passing the PTS as separate field, pass it as part of the usual data structures. Basically, this removes strange artifacts from the API. (It's not finished, though: the final decoded PTS goes through strange paths, and filter_video() finally overwrites the decoded mp_image's pts field with it.) We also stop using libavcodec's reordered_opaque fields, and use AVPacket.pts and AVFrame.pkt_pts. This is slightly unorthodox, because these pts fields are not "really" opaque anymore, yet we treat them as such. But the end result should be the same, and reordered_opaque is marked as partially deprecated (it's not clear whether it's really deprecated).
Diffstat (limited to 'video/decode/dec_video.c')
-rw-r--r--video/decode/dec_video.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index 34dc9bd073..e9a59da255 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -206,10 +206,11 @@ bool video_init_best_codec(struct dec_video *d_video, char* video_decoders)
}
void *video_decode(struct dec_video *d_video, struct demux_packet *packet,
- int drop_frame, double pts)
+ int drop_frame)
{
mp_image_t *mpi = NULL;
struct MPOpts *opts = d_video->opts;
+ double pts = packet ? packet->pts : MP_NOPTS_VALUE;
if (opts->correct_pts && pts != MP_NOPTS_VALUE) {
int delay = -1;
@@ -242,7 +243,7 @@ void *video_decode(struct dec_video *d_video, struct demux_packet *packet,
}
}
- mpi = d_video->vd_driver->decode(d_video, packet, drop_frame, &pts);
+ mpi = d_video->vd_driver->decode(d_video, packet, drop_frame);
//------------------------ frame decoded. --------------------
@@ -256,6 +257,8 @@ void *video_decode(struct dec_video *d_video, struct demux_packet *packet,
else if (opts->field_dominance == 1)
mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
+ pts = mpi->pts;
+
double prevpts = d_video->codec_reordered_pts;
d_video->prev_codec_reordered_pts = prevpts;
d_video->codec_reordered_pts = pts;