Skip to content

Instantly share code, notes, and snippets.

@rcombs

rcombs/stdin Secret

Created October 10, 2015 13:37
Show Gist options
  • Save rcombs/283badea2fc5d6d09a63 to your computer and use it in GitHub Desktop.
Save rcombs/283badea2fc5d6d09a63 to your computer and use it in GitHub Desktop.
commit e9ba2b53c648a64c49eee8fdf3e61bdae9994221
Author: Rodger Combs <rodger.combs@gmail.com>
Date: Wed Oct 7 21:09:26 2015 -0500
lavc: move bitstream filter args to the bsf ctx
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ff70d25..d90b1ef 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -5026,6 +5026,12 @@ typedef struct AVBitStreamFilterContext {
struct AVBitStreamFilter *filter;
AVCodecParserContext *parser;
struct AVBitStreamFilterContext *next;
+ /**
+ * Default arguments, used if NULL is passed to av_bitstream_filter_filter().
+ * Set by consumer; freed in av_bitstream_filter_close(). Must be allocated with
+ * av_malloc().
+ */
+ char *args;
} AVBitStreamFilterContext;
diff --git a/libavcodec/bitstream_filter.c b/libavcodec/bitstream_filter.c
index a4e437d..fb690b6 100644
--- a/libavcodec/bitstream_filter.c
+++ b/libavcodec/bitstream_filter.c
@@ -73,6 +73,7 @@ void av_bitstream_filter_close(AVBitStreamFilterContext *bsfc)
if (bsfc->filter->close)
bsfc->filter->close(bsfc);
av_freep(&bsfc->priv_data);
+ av_freep(&bsfc->args);
av_parser_close(bsfc->parser);
av_free(bsfc);
}
@@ -84,6 +85,6 @@ int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
{
*poutbuf = (uint8_t *)buf;
*poutbuf_size = buf_size;
- return bsfc->filter->filter(bsfc, avctx, args, poutbuf, poutbuf_size,
- buf, buf_size, keyframe);
+ return bsfc->filter->filter(bsfc, avctx, args ? args : bsfc->args,
+ poutbuf, poutbuf_size, buf, buf_size, keyframe);
}
diff --git a/libavcodec/version.h b/libavcodec/version.h
index a89ad91..c7fc1f1 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,8 +29,8 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
-#define LIBAVCODEC_VERSION_MINOR 4
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR 5
+#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment