X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=libavfilter%2Fvf_hwupload_cuda.c;h=138949a5ed648f258a1db527b56400bddf140b6b;hb=a04ad248a05e7b613abe09b3bb067f555108d794;hp=4d83e6c8f27edd4a6d9a2f67c2b18b6a67023260;hpb=022fa7a24ea8f5000e7b6a50e57cc752f417da47;p=ffmpeg diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c index 4d83e6c8f27..138949a5ed6 100644 --- a/libavfilter/vf_hwupload_cuda.c +++ b/libavfilter/vf_hwupload_cuda.c @@ -57,9 +57,12 @@ static int cudaupload_query_formats(AVFilterContext *ctx) int ret; static const enum AVPixelFormat input_pix_fmts[] = { - AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, + AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_P010, AV_PIX_FMT_P016, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_0RGB32, AV_PIX_FMT_0BGR32, +#if CONFIG_VULKAN + AV_PIX_FMT_VULKAN, +#endif AV_PIX_FMT_NONE, }; static const enum AVPixelFormat output_pix_fmts[] = { @@ -68,13 +71,13 @@ static int cudaupload_query_formats(AVFilterContext *ctx) AVFilterFormats *in_fmts = ff_make_format_list(input_pix_fmts); AVFilterFormats *out_fmts; - ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats); + ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->outcfg.formats); if (ret < 0) return ret; out_fmts = ff_make_format_list(output_pix_fmts); - ret = ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats); + ret = ff_formats_ref(out_fmts, &ctx->outputs[0]->incfg.formats); if (ret < 0) return ret; @@ -97,7 +100,12 @@ static int cudaupload_config_output(AVFilterLink *outlink) hwframe_ctx = (AVHWFramesContext*)s->hwframe->data; hwframe_ctx->format = AV_PIX_FMT_CUDA; - hwframe_ctx->sw_format = inlink->format; + if (inlink->hw_frames_ctx) { + AVHWFramesContext *in_hwframe_ctx = (AVHWFramesContext*)inlink->hw_frames_ctx->data; + hwframe_ctx->sw_format = in_hwframe_ctx->sw_format; + } else { + hwframe_ctx->sw_format = inlink->format; + } hwframe_ctx->width = inlink->w; hwframe_ctx->height = inlink->h; @@ -175,7 +183,7 @@ static const AVFilterPad cudaupload_outputs[] = { { NULL } }; -AVFilter ff_vf_hwupload_cuda = { +const AVFilter ff_vf_hwupload_cuda = { .name = "hwupload_cuda", .description = NULL_IF_CONFIG_SMALL("Upload a system memory frame to a CUDA device."),