summaryrefslogtreecommitdiff
path: root/libavcodec/snappy.h
diff options
context:
space:
mode:
authorTom Butterworth <bangnoise@gmail.com>2015-07-21 01:21:38 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-07-23 13:35:16 +0100
commit083cbc930d077651ea7e3fbc32ec45352cfed7e7 (patch)
tree80029690588869a1d9609d4c4ac6bd6ab880bcfe /libavcodec/snappy.h
parent7f388c0fabc51eca3106e7cc443393269435ab52 (diff)
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.
Diffstat (limited to 'libavcodec/snappy.h')
-rw-r--r--libavcodec/snappy.h19
1 files changed, 14 insertions, 5 deletions
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 */