You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-11 14:30:22 +02:00
webp: Fix alpha decoding
This was broken by 4e528206bc
- the webp
decoder was assuming that it could set the output pixfmt of the vp8
decoder directly, but after that change it no longer could because
ff_get_format() was used instead. This adds an internal get_format()
callback to webp use of the vp8 decoder to override the pixfmt
appropriately.
This commit is contained in:
@ -1288,6 +1288,16 @@ static int vp8_lossy_decode_alpha(AVCodecContext *avctx, AVFrame *p,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum AVPixelFormat webp_get_format(AVCodecContext *avctx,
|
||||||
|
const enum AVPixelFormat *formats)
|
||||||
|
{
|
||||||
|
WebPContext *s = avctx->priv_data;
|
||||||
|
if (s->has_alpha)
|
||||||
|
return AV_PIX_FMT_YUVA420P;
|
||||||
|
else
|
||||||
|
return AV_PIX_FMT_YUV420P;
|
||||||
|
}
|
||||||
|
|
||||||
static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||||
int *got_frame, uint8_t *data_start,
|
int *got_frame, uint8_t *data_start,
|
||||||
unsigned int data_size)
|
unsigned int data_size)
|
||||||
@ -1299,8 +1309,7 @@ static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
|||||||
if (!s->initialized) {
|
if (!s->initialized) {
|
||||||
ff_vp8_decode_init(avctx);
|
ff_vp8_decode_init(avctx);
|
||||||
s->initialized = 1;
|
s->initialized = 1;
|
||||||
if (s->has_alpha)
|
avctx->get_format = webp_get_format;
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUVA420P;
|
|
||||||
}
|
}
|
||||||
s->lossless = 0;
|
s->lossless = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user