And make the encoder depend on libsnappy for now.
---
configure | 6 +++---
libavcodec/hap.h | 1 +
libavcodec/hapdec.c | 26 +++++++-------------------
3 files changed, 11 insertions(+), 22 deletions(-)
diff --git a/configure b/configure
index 3c110b3..6f3b4f8 100755
--- a/configure
+++ b/configure
@@ -1190,7 +1190,7 @@ EXTERNAL_LIBRARY_LIST="
libxvid
mmal
openssl
- snappy
+ libsnappy
x11grab
zlib
"
@@ -1846,7 +1846,7 @@ h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser
qsvdec h264_qsv_hwacce
h264_qsv_encoder_deps="libmfx"
h264_qsv_encoder_select="qsvenc"
hap_decoder_deps="snappy"
-hap_encoder_deps="snappy"
+hap_encoder_deps="libsnappy"
hevc_decoder_select="bswapdsp cabac golomb videodsp"
huffyuv_decoder_select="bswapdsp huffyuvdsp"
huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp"
@@ -4288,7 +4288,7 @@ enabled openssl && { check_lib openssl/ssl.h
SSL_library_init -lssl -l
check_lib openssl/ssl.h SSL_library_init
-lssl32 -leay32 ||
check_lib openssl/ssl.h SSL_library_init -lssl
-lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
-enabled snappy && require snappy snappy-c.h snappy_uncompress
-lsnappy
+enabled libsnappy && require snappy snappy-c.h snappy_uncompress
-lsnappy
if enabled gnutls; then
diff --git a/libavcodec/hap.h b/libavcodec/hap.h
index 1b01c92..db97fff 100644
--- a/libavcodec/hap.h
+++ b/libavcodec/hap.h
@@ -44,6 +44,7 @@ typedef struct HAPContext {
size_t tex_size; /* Size of the compressed texture */
uint8_t *snappied; /* Buffer interacting with snappy */
+ uint64_t snappy_size; /* Current snappy buffer size */
size_t max_snappy; /* Maximum compressed size for snappy buffer */
/* Pointer to the selected compress or decompress function */
diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index 1d8e89e..134ba42 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -29,7 +29,6 @@
*/
#include <stdint.h>
-#include "snappy-c.h"
#include "libavutil/imgutils.h"
@@ -38,6 +37,7 @@
#include "dxtc.h"
#include "hap.h"
#include "internal.h"
+#include "snappy.h"
#include "thread.h"
/* Texture blocks are 4x4 */
@@ -74,7 +74,6 @@ static int setup_texture(AVCodecContext *avctx, size_t length)
{
HAPContext *ctx = avctx->priv_data;
GetByteContext *gbc = &ctx->gbc;
- size_t snappy_size;
const char *texture_name;
const char *compressor_name;
int ret;
@@ -109,29 +108,18 @@ static int setup_texture(AVCodecContext *avctx, size_t
length)
compressor_name = "none";
break;
case COMP_SNAPPY:
- /* Get the size of the output buffer */
- ret = snappy_uncompressed_length(gbc->buffer, length, &snappy_size);
- if (ret != SNAPPY_OK) {
- av_log(avctx, AV_LOG_ERROR, "Snappy size error\n");
- return AVERROR_BUG;
- }
-
- /* Resize as needed */
- ret = av_reallocp(&ctx->snappied, snappy_size);
- if (ret < 0)
- return ret;
-
/* Uncompress */
- ret = snappy_uncompress(gbc->buffer, length,
- ctx->snappied, &snappy_size);
- if (ret != SNAPPY_OK) {
+ ret = ff_snappy_uncompress(gbc,
+ &ctx->snappied,
+ &ctx->snappy_size);
+ if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Snappy uncompress error\n");
- return AVERROR_BUG;
+ return ret;
}
/* Set the pointers */
ctx->tex_data = ctx->snappied;
- ctx->tex_size = snappy_size;
+ ctx->tex_size = ctx->snappy_size;
compressor_name = "snappy";
break;
case COMP_COMPLEX:
--
1.9.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel