diff options
author | James Almer <jamrial@gmail.com> | 2023-05-11 14:34:57 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2023-05-12 16:21:18 -0300 |
commit | 7f890b2fbb75fa38e7b197cdd509afc7c391f998 (patch) | |
tree | 745329348e92c17b8f0b2cc378f31bb7d2d1f5cd /libavfilter/vf_ccrepack.c | |
parent | 86ee0317951d6793b83fce03942ee26177663cec (diff) | |
download | ffmpeg-7f890b2fbb75fa38e7b197cdd509afc7c391f998.tar.gz |
avfilter/ccfifo: remove unnecessary context allocations
This is not public API, no it has no need for an alloc() and free()
functions. The struct can reside on stack.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/vf_ccrepack.c')
-rw-r--r-- | libavfilter/vf_ccrepack.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libavfilter/vf_ccrepack.c b/libavfilter/vf_ccrepack.c index e3fd67f1b5..61eb2128ae 100644 --- a/libavfilter/vf_ccrepack.c +++ b/libavfilter/vf_ccrepack.c @@ -37,7 +37,7 @@ typedef struct CCRepackContext { const AVClass *class; - AVCCFifo *cc_fifo; + CCFifo cc_fifo; } CCRepackContext; static const AVOption ccrepack_options[] = { @@ -50,9 +50,10 @@ static int config_input(AVFilterLink *link) { CCRepackContext *ctx = link->dst->priv; - if (!(ctx->cc_fifo = ff_ccfifo_alloc(link->frame_rate, ctx))) { + int ret = ff_ccfifo_init(&ctx->cc_fifo, link->frame_rate, ctx); + if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Failure to setup CC FIFO queue\n"); - return AVERROR(ENOMEM); + return ret; } return 0; @@ -63,8 +64,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) CCRepackContext *ctx = inlink->dst->priv; AVFilterLink *outlink = inlink->dst->outputs[0]; - ff_ccfifo_extract(ctx->cc_fifo, frame); - ff_ccfifo_inject(ctx->cc_fifo, frame); + ff_ccfifo_extract(&ctx->cc_fifo, frame); + ff_ccfifo_inject(&ctx->cc_fifo, frame); return ff_filter_frame(outlink, frame); } @@ -72,7 +73,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) static av_cold void uninit(AVFilterContext *ctx) { CCRepackContext *s = ctx->priv; - ff_ccfifo_freep(&s->cc_fifo); + ff_ccfifo_uninit(&s->cc_fifo); } static const AVFilterPad avfilter_vf_ccrepack_inputs[] = { |