diff options
Diffstat (limited to 'libs/ffvpx/libavcodec/bsf.c')
-rw-r--r-- | libs/ffvpx/libavcodec/bsf.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/libs/ffvpx/libavcodec/bsf.c b/libs/ffvpx/libavcodec/bsf.c index bd611ea16..e17dc854f 100644 --- a/libs/ffvpx/libavcodec/bsf.c +++ b/libs/ffvpx/libavcodec/bsf.c @@ -47,7 +47,8 @@ void av_bsf_free(AVBSFContext **pctx) av_opt_free(ctx); - av_packet_free(&ctx->internal->buffer_pkt); + if (ctx->internal) + av_packet_free(&ctx->internal->buffer_pkt); av_freep(&ctx->internal); av_freep(&ctx->priv_data); @@ -172,6 +173,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; @@ -340,6 +351,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; @@ -388,6 +408,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, }; |