1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-24 16:43:28 +00:00

sd_lavc: take care of AVPicture deprecation

This commit is contained in:
wm4 2015-10-23 20:14:08 +02:00
parent 97fc4f4a85
commit 252dcdcc99
3 changed files with 24 additions and 3 deletions

View File

@ -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'

View File

@ -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;

View File

@ -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'),
},
]