lavc: move bitstream filter args to the bsf ctx
[ffmpeg.git] / libavcodec / bitstream_filter.c
index a4e437df5fd78c17782666e2dc91ac1b43d60d1f..fb690b68217739b4fab86b6c2f33f7c9759aca00 100644 (file)
@@ -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);
 }