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/snappy.h | |
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/snappy.h')
-rw-r--r-- | libavcodec/snappy.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libavcodec/snappy.h b/libavcodec/snappy.h index b283183cb6..a65cb3aa1b 100644 --- a/libavcodec/snappy.h +++ b/libavcodec/snappy.h @@ -38,14 +38,23 @@ #include "bytestream.h" /** - * Decompress an input buffer using Snappy algorithm. Caller is - * responsible of freeing the memory allocated in buf. + * Get the uncompressed length of an input buffer compressed using the Snappy + * algorithm. The GetByteContext is not advanced. * * @param gb input GetByteContext. - * @param buf output buffer pointer. - * @param size output buffer size. + * @return A positive length on success, AVERROR otherwise. + */ + int64_t ff_snappy_peek_uncompressed_length(GetByteContext *gb); + +/** + * Decompress an input buffer using Snappy algorithm. + * + * @param gb input GetByteContext. + * @param buf input buffer pointer. + * @param size input/output on input, the size of buffer, on output, the size + * of the uncompressed data. * @return 0 if success, AVERROR otherwise. */ -int ff_snappy_uncompress(GetByteContext *gb, uint8_t **buf, int64_t *size); +int ff_snappy_uncompress(GetByteContext *gb, uint8_t *buf, int64_t *size); #endif /* AVCODEC_SNAPPY_H */ |