diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-08-05 18:00:30 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-08-15 19:34:24 +0200 |
commit | 7f17e0e6dd0b28b29295c1eeb1a38546eebc3946 (patch) | |
tree | 450c2507aab591b2428f63f0860be3c9fa155846 /libavfilter/vf_transpose_npp.c | |
parent | ce24b5ba8f8d61eae518809e1188f74614db73d5 (diff) | |
download | ffmpeg-7f17e0e6dd0b28b29295c1eeb1a38546eebc3946.tar.gz |
lavfi: move AVFilterLink.hw_frames_ctx to FilterLink
Diffstat (limited to 'libavfilter/vf_transpose_npp.c')
-rw-r--r-- | libavfilter/vf_transpose_npp.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/libavfilter/vf_transpose_npp.c b/libavfilter/vf_transpose_npp.c index 96c008cda9..2e3a0296f5 100644 --- a/libavfilter/vf_transpose_npp.c +++ b/libavfilter/vf_transpose_npp.c @@ -29,6 +29,7 @@ #include "libavutil/pixdesc.h" #include "avfilter.h" +#include "filters.h" #include "formats.h" #include "internal.h" #include "video.h" @@ -178,6 +179,8 @@ static int format_is_supported(enum AVPixelFormat fmt) static int init_processing_chain(AVFilterContext *ctx, int in_width, int in_height, int out_width, int out_height) { + FilterLink *inl = ff_filter_link(ctx->inputs[0]); + FilterLink *outl = ff_filter_link(ctx->outputs[0]); NPPTransposeContext *s = ctx->priv; AVHWFramesContext *in_frames_ctx; enum AVPixelFormat format; @@ -185,12 +188,12 @@ static int init_processing_chain(AVFilterContext *ctx, int in_width, int in_heig int rot_width = out_width, rot_height = out_height; /* check that we have a hw context */ - if (!ctx->inputs[0]->hw_frames_ctx) { + if (!inl->hw_frames_ctx) { av_log(ctx, AV_LOG_ERROR, "No hw context provided on input\n"); return AVERROR(EINVAL); } - in_frames_ctx = (AVHWFramesContext*)ctx->inputs[0]->hw_frames_ctx->data; + in_frames_ctx = (AVHWFramesContext*)inl->hw_frames_ctx->data; format = in_frames_ctx->sw_format; if (!format_is_supported(format)) { @@ -235,13 +238,13 @@ static int init_processing_chain(AVFilterContext *ctx, int in_width, int in_heig } if (last_stage >= 0) { - ctx->outputs[0]->hw_frames_ctx = av_buffer_ref(s->stages[last_stage].frames_ctx); + outl->hw_frames_ctx = av_buffer_ref(s->stages[last_stage].frames_ctx); } else { - ctx->outputs[0]->hw_frames_ctx = av_buffer_ref(ctx->inputs[0]->hw_frames_ctx); + outl->hw_frames_ctx = av_buffer_ref(inl->hw_frames_ctx); s->passthrough = 1; } - if (!ctx->outputs[0]->hw_frames_ctx) + if (!outl->hw_frames_ctx) return AVERROR(ENOMEM); return 0; @@ -249,17 +252,19 @@ static int init_processing_chain(AVFilterContext *ctx, int in_width, int in_heig static int npptranspose_config_props(AVFilterLink *outlink) { + FilterLink *outl = ff_filter_link(outlink); AVFilterContext *ctx = outlink->src; AVFilterLink *inlink = ctx->inputs[0]; + FilterLink *inl = ff_filter_link(inlink); NPPTransposeContext *s = ctx->priv; int ret; if ((inlink->w >= inlink->h && s->passthrough == NPP_TRANSPOSE_PT_TYPE_LANDSCAPE) || (inlink->w <= inlink->h && s->passthrough == NPP_TRANSPOSE_PT_TYPE_PORTRAIT)) { - if (inlink->hw_frames_ctx) { - outlink->hw_frames_ctx = av_buffer_ref(inlink->hw_frames_ctx); - if (!outlink->hw_frames_ctx) + if (inl->hw_frames_ctx) { + outl->hw_frames_ctx = av_buffer_ref(inl->hw_frames_ctx); + if (!outl->hw_frames_ctx) return AVERROR(ENOMEM); } @@ -387,7 +392,8 @@ static int npptranspose_filter_frame(AVFilterLink *link, AVFrame *in) AVFilterContext *ctx = link->dst; NPPTransposeContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; - AVHWFramesContext *frames_ctx = (AVHWFramesContext*)outlink->hw_frames_ctx->data; + FilterLink *outl = ff_filter_link(outlink); + AVHWFramesContext *frames_ctx = (AVHWFramesContext*)outl->hw_frames_ctx->data; AVCUDADeviceContext *device_hwctx = frames_ctx->device_ctx->hwctx; AVFrame *out = NULL; CUcontext dummy; |