summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-23 20:14:08 +0200
committerwm4 <wm4@nowhere>2015-10-23 20:14:08 +0200
commit252dcdcc999115f52dc11b0fcf41367a54df8eab (patch)
treed1933bca58ff63cb469098070e34cbd14e65cee3
parent97fc4f4a85cc62c3de34eb2d54ccf79cb76f101d (diff)
downloadmpv-252dcdcc999115f52dc11b0fcf41367a54df8eab.tar.bz2
mpv-252dcdcc999115f52dc11b0fcf41367a54df8eab.tar.xz
sd_lavc: take care of AVPicture deprecation
-rwxr-xr-xTOOLS/old-configure6
-rw-r--r--sub/sd_lavc.c15
-rw-r--r--wscript6
3 files changed, 24 insertions, 3 deletions
diff --git a/TOOLS/old-configure b/TOOLS/old-configure
index 4ae6c72f26..a4d3cee0cb 100755
--- a/TOOLS/old-configure
+++ b/TOOLS/old-configure
@@ -816,6 +816,12 @@ api_statement_check \
libavcodec/avcodec.h \
'int x[(int)sizeof(((AVPacket){0}).duration) - 7]'
+api_statement_check \
+ "libavcodec AVSubtitleRect AVPicture removal" \
+ HAVE_AV_SUBTITLE_NOPICT \
+ libavcodec/avcodec.h \
+ 'AVSubtitleRect r = {.linesize={0}}'
+
check_pkg_config "libavfilter" $_libavfilter LIBAVFILTER 'libavfilter >= 5.0.0'
check_pkg_config "libavdevice" $_libavdevice LIBAVDEVICE 'libavdevice >= 55.0.0'
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index d038bfbfdf..88c45856b4 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -23,6 +23,8 @@
#include <libavutil/common.h>
#include <libavutil/intreadwrite.h>
+#include "config.h"
+
#include "talloc.h"
#include "common/msg.h"
#include "common/av_common.h"
@@ -210,12 +212,19 @@ static void decode(struct sd *sd, struct demux_packet *packet)
continue;
if (r->w <= 0 || r->h <= 0)
continue;
- img->bitmap = r->pict.data[0];
+#if HAVE_AV_SUBTITLE_NOPICT
+ uint8_t **data = r->data;
+ int *linesize = r->linesize;
+#else
+ uint8_t **data = r->pict.data;
+ int *linesize = r->pict.linesize;
+#endif
+ img->bitmap = data[0];
assert(r->nb_colors > 0);
assert(r->nb_colors * 4 <= sizeof(img->palette));
- memcpy(img->palette, r->pict.data[1], r->nb_colors * 4);
+ memcpy(img->palette, data[1], r->nb_colors * 4);
b->bitmap = img;
- b->stride = r->pict.linesize[0];
+ b->stride = linesize[0];
b->w = r->w;
b->h = r->h;
b->x = r->x;
diff --git a/wscript b/wscript
index 2aac0f552d..470c046b01 100644
--- a/wscript
+++ b/wscript
@@ -464,6 +464,12 @@ FFmpeg/Libav libraries. You need at least {0}. Aborting.".format(libav_versions_
'func': check_statement('libavcodec/avcodec.h',
'int x[(int)sizeof(((AVPacket){0}).duration) - 7]',
use='libav'),
+ }, {
+ 'name': 'av-subtitle-nopict',
+ 'desc': 'libavcodec AVSubtitleRect AVPicture removal',
+ 'func': check_statement('libavcodec/avcodec.h',
+ 'AVSubtitleRect r = {.linesize={0}}',
+ use='libav'),
},
]