avcodec/bsf_list: implement a AVBSFContext.flush callback
authorJames Almer <jamrial@gmail.com>
Sun, 6 Jan 2019 03:31:47 +0000 (00:31 -0300)
committerJames Almer <jamrial@gmail.com>
Sun, 6 Jan 2019 18:11:59 +0000 (15:11 -0300)
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/bsf.c

index 03841da..5081307 100644 (file)
@@ -350,6 +350,15 @@ static int bsf_list_filter(AVBSFContext *bsf, AVPacket *out)
     return ret;
 }
 
+static void bsf_list_flush(AVBSFContext *bsf)
+{
+    BSFListContext *lst = bsf->priv_data;
+
+    for (int i = 0; i < lst->nb_bsfs; i++)
+        av_bsf_flush(lst->bsfs[i]);
+    lst->idx = lst->flushed_idx = 0;
+}
+
 static void bsf_list_close(AVBSFContext *bsf)
 {
     BSFListContext *lst = bsf->priv_data;
@@ -398,6 +407,7 @@ const AVBitStreamFilter ff_list_bsf = {
         .priv_class     = &bsf_list_class,
         .init           = bsf_list_init,
         .filter         = bsf_list_filter,
+        .flush          = bsf_list_flush,
         .close          = bsf_list_close,
 };