summaryrefslogtreecommitdiff
path: root/fftools
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-04-30 12:26:51 +0200
committerAnton Khirnov <anton@khirnov.net>2023-05-08 10:38:59 +0200
commit5356f5ed23677d9ed683154b03760ed003ec7f25 (patch)
tree51330e62e08dc5b600259931df65245851238776 /fftools
parent71d7e9bbeca9574f29b63f3d1ab6b7ad450a8e67 (diff)
downloadffmpeg-5356f5ed23677d9ed683154b03760ed003ec7f25.tar.gz
fftools/ffmpeg_filter: move InputFilter.hw_frames_ctx to private data
It is not used outside of ffmpeg_filter.
Diffstat (limited to 'fftools')
-rw-r--r--fftools/ffmpeg.h2
-rw-r--r--fftools/ffmpeg_filter.c16
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)) {