[FFmpeg-devel] [PATCH 1/2] vp8: WebP decoding support
Michael Niedermayer
michaelni at gmx.at
Fri Mar 22 03:51:01 CET 2013
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavcodec/vp8.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index ac929d0..1dbe959 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -304,6 +304,25 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size)
int width = s->avctx->width;
int height = s->avctx->height;
+ if ( AV_RL32(buf ) == AV_RL32("RIFF")
+ && AV_RL32(buf+ 8) == AV_RL32("WEBP")) {
+ if (AV_RL32(buf+12) == AV_RL32("VP8X") && AV_RL32(buf+16) < (unsigned)buf_size) {
+ unsigned size = AV_RL32(buf+16) + 8;
+ buf += size;
+ buf_size -= size;
+ }
+ if (AV_RL32(buf+12) == AV_RL32("ALPH") && AV_RL32(buf+16) < (unsigned)buf_size) {
+ unsigned size = AV_RL32(buf+16) + 8 + 1;
+ buf += size;
+ buf_size -= size;
+ av_log(s->avctx, AV_LOG_WARNING, "Skiping alpha plane\n");
+ }
+ if (AV_RL32(buf+12) == AV_RL32("VP8 ")) {
+ buf += 20;
+ buf_size -= 20;
+ }
+ }
+
s->keyframe = !(buf[0] & 1);
s->profile = (buf[0]>>1) & 7;
s->invisible = !(buf[0] & 0x10);
--
1.7.9.5
More information about the ffmpeg-devel
mailing list