From 083cbc930d077651ea7e3fbc32ec45352cfed7e7 Mon Sep 17 00:00:00 2001 From: Tom Butterworth Date: Tue, 21 Jul 2015 01:21:38 +0100 Subject: 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. --- libavcodec/snappy.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'libavcodec/snappy.h') diff --git a/libavcodec/snappy.h b/libavcodec/snappy.h index 96666a814d..8d365c0f8e 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 */ -- cgit v1.2.3