[3/7] avcodec/vp9_superframe_split_bsf: implement a AVBSFContext.flush() callback

Message ID 20180727175957.116-3-jamrial@gmail.com
State New
Headers show
Series
  • Untitled series #120
Related show

Commit Message

James Almer July 27, 2018, 5:59 p.m.
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/vp9_superframe_split_bsf.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch

diff --git a/libavcodec/vp9_superframe_split_bsf.c b/libavcodec/vp9_superframe_split_bsf.c
index 4e635a307..4e6e7ff08 100644
--- a/libavcodec/vp9_superframe_split_bsf.c
+++ b/libavcodec/vp9_superframe_split_bsf.c
@@ -131,6 +131,14 @@  fail:
     return ret;
 }
 
+static void vp9_superframe_split_flush(AVBSFContext *ctx)
+{
+    VP9SFSplitContext *s = ctx->priv_data;
+
+    av_packet_free(&s->buffer_pkt);
+    memset(s, 0, sizeof(*s));
+}
+
 static void vp9_superframe_split_uninit(AVBSFContext *ctx)
 {
     VP9SFSplitContext *s = ctx->priv_data;
@@ -142,5 +150,6 @@  const AVBitStreamFilter ff_vp9_superframe_split_bsf = {
     .priv_data_size = sizeof(VP9SFSplitContext),
     .close          = vp9_superframe_split_uninit,
     .filter         = vp9_superframe_split_filter,
+    .flush          = vp9_superframe_split_flush,
     .codec_ids      = (const enum AVCodecID []){ AV_CODEC_ID_VP9, AV_CODEC_ID_NONE },
 };