diff options
author | Tom Butterworth <bangnoise@gmail.com> | 2015-07-16 13:23:22 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-16 20:41:07 +0200 |
commit | 17ee24af7e5f7112fe25c734236d521f9e35d80d (patch) | |
tree | 272bb8fb9c8f1792fccf287a138e09e064425e71 /libavcodec/hapdec.c | |
parent | c4dfb76fa7e4d51fd4ca686a63499245c0687a84 (diff) | |
download | ffmpeg-17ee24af7e5f7112fe25c734236d521f9e35d80d.tar.gz |
avcodec/snappy: refactor so ff_snappy_uncompress uses an existing buffer
Some uses of Snappy require uncompressing to positions within an existing buffer. Also adds a function to get the uncompressed length of Snappy data.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/hapdec.c')
-rw-r--r-- | libavcodec/hapdec.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c index 5986a3f208..7eff9e0273 100644 --- a/libavcodec/hapdec.c +++ b/libavcodec/hapdec.c @@ -107,8 +107,13 @@ static int setup_texture(AVCodecContext *avctx, size_t length) compressorstr = "none"; break; case HAP_COMP_SNAPPY: + snappy_size = ff_snappy_peek_uncompressed_length(gbc); + ret = av_reallocp(&ctx->snappied, snappy_size); + if (ret < 0) { + return ret; + } /* Uncompress the frame */ - ret = ff_snappy_uncompress(gbc, &ctx->snappied, &snappy_size); + ret = ff_snappy_uncompress(gbc, ctx->snappied, &snappy_size); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Snappy uncompress error\n"); return ret; |