fftools/ffmpeg_filter: move InputFilter.hw_frames_ctx to private data

It is not used outside of ffmpeg_filter.
pull/389/head
Anton Khirnov 2 years ago
parent 71d7e9bbec
commit 5356f5ed23
  1. 2
      fftools/ffmpeg.h
  2. 16
      fftools/ffmpeg_filter.c

@ -286,8 +286,6 @@ typedef struct InputFilter {
int sample_rate;
AVChannelLayout ch_layout;
AVBufferRef *hw_frames_ctx;
} InputFilter;
typedef struct OutputFilter {

@ -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)) {

Loading…
Cancel
Save