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_fps.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_fps.c')
-rw-r--r-- | libavfilter/vf_fps.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index 824e7a128d..2bfb6d29e7 100644 --- a/libavfilter/vf_fps.c +++ b/libavfilter/vf_fps.c @@ -86,7 +86,7 @@ typedef struct FPSContext { AVFrame *frames[2]; ///< buffered frames int frames_count; ///< number of buffered frames - AVCCFifo *cc_fifo; ///< closed captions + CCFifo cc_fifo; ///< closed captions int64_t next_pts; ///< pts of the next frame to output @@ -167,7 +167,7 @@ static av_cold void uninit(AVFilterContext *ctx) frame = shift_frame(ctx, s); av_frame_free(&frame); } - ff_ccfifo_freep(&s->cc_fifo); + ff_ccfifo_uninit(&s->cc_fifo); av_log(ctx, AV_LOG_VERBOSE, "%d frames in, %d frames out; %d frames dropped, " "%d frames duplicated.\n", s->frames_in, s->frames_out, s->drop, s->dup); @@ -213,9 +213,10 @@ static int config_props(AVFilterLink* outlink) s->in_pts_off, s->out_pts_off, s->start_time); } - if (!(s->cc_fifo = ff_ccfifo_alloc(outlink->frame_rate, ctx))) { + ret = ff_ccfifo_init(&s->cc_fifo, outlink->frame_rate, ctx); + if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Failure to setup CC FIFO queue\n"); - return AVERROR(ENOMEM); + return ret; } av_log(ctx, AV_LOG_VERBOSE, "fps=%d/%d\n", outlink->frame_rate.num, outlink->frame_rate.den); @@ -250,7 +251,7 @@ static int read_frame(AVFilterContext *ctx, FPSContext *s, AVFilterLink *inlink, av_log(ctx, AV_LOG_DEBUG, "Read frame with in pts %"PRId64", out pts %"PRId64"\n", in_pts, frame->pts); - ff_ccfifo_extract(s->cc_fifo, frame); + ff_ccfifo_extract(&s->cc_fifo, frame); s->frames[s->frames_count++] = frame; s->frames_in++; @@ -298,7 +299,7 @@ static int write_frame(AVFilterContext *ctx, FPSContext *s, AVFilterLink *outlin if (!frame) return AVERROR(ENOMEM); // Make sure Closed Captions will not be duplicated - ff_ccfifo_inject(s->cc_fifo, frame); + ff_ccfifo_inject(&s->cc_fifo, frame); frame->pts = s->next_pts++; frame->duration = 1; |