summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio/decode/ad_lavc.c3
-rw-r--r--common/av_common.h9
-rw-r--r--video/decode/vd_lavc.c2
3 files changed, 12 insertions, 2 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index e5c426e912..e28558414d 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -245,7 +245,8 @@ static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt,
if (!got_frame)
return 0;
- double out_pts = mp_pts_from_av(priv->avframe->pkt_pts, &priv->codec_timebase);
+ double out_pts = mp_pts_from_av(MP_AVFRAME_DEC_PTS(priv->avframe),
+ &priv->codec_timebase);
struct mp_audio *mpframe = mp_audio_from_avframe(priv->avframe);
if (!mpframe)
diff --git a/common/av_common.h b/common/av_common.h
index 4b13dcdd0c..b5ca034def 100644
--- a/common/av_common.h
+++ b/common/av_common.h
@@ -46,4 +46,13 @@ void mp_set_avdict(struct AVDictionary **dict, char **kv);
void mp_avdict_print_unset(struct mp_log *log, int msgl, struct AVDictionary *d);
int mp_set_avopts(struct mp_log *log, void *avobj, char **kv);
+#if (LIBAVCODEC_VERSION_MICRO >= 100 && \
+ LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 61, 100)) || \
+ (LIBAVCODEC_VERSION_MICRO < 100 && \
+ LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 24, 0))
+#define MP_AVFRAME_DEC_PTS(frame) ((frame)->pts)
+#else
+#define MP_AVFRAME_DEC_PTS(frame) ((frame)->pkt_pts)
+#endif
+
#endif
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 86cf815320..12e60483ee 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -861,7 +861,7 @@ static void decode(struct dec_video *vd, struct demux_packet *packet,
return;
}
assert(mpi->planes[0] || mpi->planes[3]);
- mpi->pts = mp_pts_from_av(ctx->pic->pkt_pts, &ctx->codec_timebase);
+ mpi->pts = mp_pts_from_av(MP_AVFRAME_DEC_PTS(ctx->pic), &ctx->codec_timebase);
mpi->dts = mp_pts_from_av(ctx->pic->pkt_dts, &ctx->codec_timebase);
struct mp_image_params params;