From 252dcdcc999115f52dc11b0fcf41367a54df8eab Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 23 Oct 2015 20:14:08 +0200 Subject: sd_lavc: take care of AVPicture deprecation --- TOOLS/old-configure | 6 ++++++ sub/sd_lavc.c | 15 ++++++++++++--- wscript | 6 ++++++ 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 #include +#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'), }, ] -- cgit v1.2.3