summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-07-26 20:32:13 -0300
committerJames Almer <jamrial@gmail.com>2018-08-16 23:43:10 -0300
commitb33f5299a59f5f155a4df5cb630b1de2acdb25b2 (patch)
tree35c60b6520607a44e92b46ca5f2abc155310966e /libavcodec
parentfe06ed22e6e0a8c2995818c4532eb6f4ec9320b9 (diff)
downloadffmpeg-streaming-b33f5299a59f5f155a4df5cb630b1de2acdb25b2.zip
ffmpeg-streaming-b33f5299a59f5f155a4df5cb630b1de2acdb25b2.tar.gz
avcodec/bsf: add a flushing mechanism to AVBSFContext
Meant to reset the internal bsf state without the need to reinitialize it. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h6
-rw-r--r--libavcodec/bsf.c10
-rw-r--r--libavcodec/version.h4
3 files changed, 18 insertions, 2 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1266879..56be65b 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -5769,6 +5769,7 @@ typedef struct AVBitStreamFilter {
int (*init)(AVBSFContext *ctx);
int (*filter)(AVBSFContext *ctx, AVPacket *pkt);
void (*close)(AVBSFContext *ctx);
+ void (*flush)(AVBSFContext *ctx);
} AVBitStreamFilter;
#if FF_API_OLD_BSF
@@ -5896,6 +5897,11 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
/**
+ * Reset the internal bitstream filter state / flush internal buffers.
+ */
+void av_bsf_flush(AVBSFContext *ctx);
+
+/**
* Free a bitstream filter context and everything associated with it; write NULL
* into the supplied pointer.
*/
diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index bd611ea..03841da 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -172,6 +172,16 @@ int av_bsf_init(AVBSFContext *ctx)
return 0;
}
+void av_bsf_flush(AVBSFContext *ctx)
+{
+ ctx->internal->eof = 0;
+
+ av_packet_unref(ctx->internal->buffer_pkt);
+
+ if (ctx->filter->flush)
+ ctx->filter->flush(ctx);
+}
+
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
{
int ret;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 907c6fb..a91e5f0 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 58
-#define LIBAVCODEC_VERSION_MINOR 22
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR 23
+#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
OpenPOWER on IntegriCloud