summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-10-17 19:18:03 +0200
committerwm4 <wm4@nowhere>2016-10-17 19:18:03 +0200
commit139f6b5de738a3a4746c9dc991e0bee17bda4b17 (patch)
tree732dcaeb19b0cfc8c1437bcb6911661de0c00ee0 /common
parent118d7a310e4eacc657f6656bf5769d356bb45438 (diff)
downloadmpv-139f6b5de738a3a4746c9dc991e0bee17bda4b17.tar.bz2
mpv-139f6b5de738a3a4746c9dc991e0bee17bda4b17.tar.xz
ad_lavc, vd_lavc: fix a recent libavcodec deprecation warning
Both AVFrame.pts and AVFrame.pkt_pts have existed for a long time. Until now, decoders always returned the pts via the pkt_pts field, while the pts field was used for encoding and libavfilter only. Recently, pkt_pts was deprecated, and pts was switched to always carry the pts. This means we have to be careful not to accidentally use the wrong field, depending on the libavcodec version. We have to explicitly check the version numbers. Of course the version numbers are completely idiotic, because idiotically the pkg-config and library names are the same for FFmpeg and Libav, so we have to deal with this explicitly as well.
Diffstat (limited to 'common')
-rw-r--r--common/av_common.h9
1 files changed, 9 insertions, 0 deletions
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