aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2015-09-29 18:43:28 +0200
committerGravatar wm4 <wm4@nowhere>2015-09-29 18:43:28 +0200
commitb4491c00c4b514e925b6bbf501e26de801f28a39 (patch)
tree9659ab40a27704295ed377f14e2d904df47f70d9
parent12cd48a8a9be94612a6645f27fc971d0aac985ff (diff)
Take care of libavcodec convergence_duration deprecation
This AVPacket field was a hack against the fact that the duration field was merely an int (too small for things like subtitle durations). Newer libavcodec drops this field and makes duration 64 bit.
-rwxr-xr-xTOOLS/old-configure6
-rw-r--r--demux/demux_lavf.c2
-rw-r--r--sub/sd_lavc_conv.c2
-rw-r--r--wscript8
4 files changed, 17 insertions, 1 deletions
diff --git a/TOOLS/old-configure b/TOOLS/old-configure
index f8f432824e..9d8bd2f8f9 100755
--- a/TOOLS/old-configure
+++ b/TOOLS/old-configure
@@ -816,6 +816,12 @@ api_statement_check \
libavutil/pixdesc.h \
'AVComponentDescriptor d; int x = d.depth'
+api_statement_check \
+ "libavcodec 64 bit AVPacket.duration" \
+ HAVE_AV_AVPACKET_INT64_DURATION \
+ libavcodec/avcodec.h \
+ 'int x[(int)sizeof(((AVPacket){0}).duration) - 7]'
+
check_pkg_config "libavfilter" $_libavfilter LIBAVFILTER 'libavfilter >= 5.0.0'
check_pkg_config "libavdevice" $_libavdevice LIBAVDEVICE 'libavdevice >= 55.0.0'
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 8978ebf69e..f73c8693ba 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -882,8 +882,10 @@ static int demux_lavf_fill_buffer(demuxer_t *demux)
if (pkt->dts != AV_NOPTS_VALUE)
dp->dts = pkt->dts * av_q2d(st->time_base);
dp->duration = pkt->duration * av_q2d(st->time_base);
+#if !HAVE_AV_AVPACKET_INT64_DURATION
if (pkt->convergence_duration > 0)
dp->duration = pkt->convergence_duration * av_q2d(st->time_base);
+#endif
dp->pos = pkt->pos;
dp->keyframe = pkt->flags & AV_PKT_FLAG_KEY;
if (dp->pts != MP_NOPTS_VALUE) {
diff --git a/sub/sd_lavc_conv.c b/sub/sd_lavc_conv.c
index 9da679905b..244c26e2dc 100644
--- a/sub/sd_lavc_conv.c
+++ b/sub/sd_lavc_conv.c
@@ -202,7 +202,9 @@ static int parse_webvtt(AVPacket *in, AVPacket *pkt)
pkt->pts = in->pts;
pkt->duration = in->duration;
+#if !HAVE_AV_AVPACKET_INT64_DURATION
pkt->convergence_duration = in->convergence_duration;
+#endif
return 0;
}
diff --git a/wscript b/wscript
index f9f21c2be3..7de1c5855d 100644
--- a/wscript
+++ b/wscript
@@ -458,7 +458,13 @@ FFmpeg/Libav libraries. You need at least {0}. Aborting.".format(libav_versions_
'func': check_statement('libavutil/pixdesc.h',
'AVComponentDescriptor d; int x = d.depth',
use='libav'),
- }
+ }, {
+ 'name': 'av-avpacket-int64-duration',
+ 'desc': 'libavcodec 64 bit AVPacket.duration',
+ 'func': check_statement('libavcodec/avcodec.h',
+ 'int x[(int)sizeof(((AVPacket){0}).duration) - 7]',
+ use='libav'),
+ },
]
audio_output_features = [