From 5356f5ed23677d9ed683154b03760ed003ec7f25 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 30 Apr 2023 12:26:51 +0200 Subject: [PATCH] fftools/ffmpeg_filter: move InputFilter.hw_frames_ctx to private data It is not used outside of ffmpeg_filter. --- fftools/ffmpeg.h | 2 -- fftools/ffmpeg_filter.c | 16 +++++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index af1ba49771..47358170e7 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -286,8 +286,6 @@ typedef struct InputFilter { int sample_rate; AVChannelLayout ch_layout; - - AVBufferRef *hw_frames_ctx; } InputFilter; typedef struct OutputFilter { diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 087ef8b894..34c51c23d9 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -61,6 +61,8 @@ typedef struct InputFilterPriv { AVFifo *frame_queue; + AVBufferRef *hw_frames_ctx; + int32_t *displaymatrix; // fallback parameters to use when no input is ever sent @@ -282,7 +284,7 @@ void fg_free(FilterGraph **pfg) av_channel_layout_uninit(&ifp->fallback.ch_layout); - av_buffer_unref(&ifilter->hw_frames_ctx); + av_buffer_unref(&ifp->hw_frames_ctx); av_freep(&ifilter->name); av_freep(&fg->inputs[j]); } @@ -1051,7 +1053,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, if ((ret = avfilter_graph_create_filter(&ifilter->filter, buffer_filt, name, args.str, NULL, fg->graph)) < 0) goto fail; - par->hw_frames_ctx = ifilter->hw_frames_ctx; + par->hw_frames_ctx = ifp->hw_frames_ctx; ret = av_buffersrc_parameters_set(ifilter->filter, par); if (ret < 0) goto fail; @@ -1413,7 +1415,7 @@ static int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *fr AVFrameSideData *sd; int ret; - av_buffer_unref(&ifilter->hw_frames_ctx); + av_buffer_unref(&ifp->hw_frames_ctx); ifilter->format = frame->format; @@ -1432,8 +1434,8 @@ static int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *fr ifp->displaymatrix = av_memdup(sd->data, sizeof(int32_t) * 9); if (frame->hw_frames_ctx) { - ifilter->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx); - if (!ifilter->hw_frames_ctx) + ifp->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx); + if (!ifp->hw_frames_ctx) return AVERROR(ENOMEM); } @@ -1565,8 +1567,8 @@ int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference) if (!ifilter->ist->reinit_filters && fg->graph) need_reinit = 0; - if (!!ifilter->hw_frames_ctx != !!frame->hw_frames_ctx || - (ifilter->hw_frames_ctx && ifilter->hw_frames_ctx->data != frame->hw_frames_ctx->data)) + if (!!ifp->hw_frames_ctx != !!frame->hw_frames_ctx || + (ifp->hw_frames_ctx && ifp->hw_frames_ctx->data != frame->hw_frames_ctx->data)) need_reinit = 1; if (sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX)) {