aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2017-02-17 23:14:19 +0000
committerMark Thompson <sw@jkqxz.net>2017-02-18 19:53:20 +0000
commit7cb9296db872c4221453e5411f242ebcfca62664 (patch)
treeec917c72b6cee7d97ea7c3914c3be876f18bf067 /libavcodec
parent2d518aec4c781316092be65893b47922c8f71b67 (diff)
downloadffmpeg-7cb9296db872c4221453e5411f242ebcfca62664.tar.gz
webp: Fix alpha decoding
This was broken by 4e528206bc4d968706401206cf54471739250ec7 - 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.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/webp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index 4548e5fb3b..18d68e9140 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1288,6 +1288,16 @@ static int vp8_lossy_decode_alpha(AVCodecContext *avctx, AVFrame *p,
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,
int *got_frame, uint8_t *data_start,
unsigned int data_size)
@@ -1299,8 +1309,7 @@ static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p,
if (!s->initialized) {
ff_vp8_decode_init(avctx);
s->initialized = 1;
- if (s->has_alpha)
- avctx->pix_fmt = AV_PIX_FMT_YUVA420P;
+ avctx->get_format = webp_get_format;
}
s->lossless = 0;