X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fcuviddec.c;h=96d56f406a936d5e6bcf581504db01907fdbc24d;hb=95bacb521af8cd28f146f045437c9f75717a493a;hp=6370348639776f2c830712c77751949e05f2c05b;hpb=ab7c8e1d6cc976c796735caa1e9210cf06792111;p=ffmpeg diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c index 63703486397..96d56f406a9 100644 --- a/libavcodec/cuviddec.c +++ b/libavcodec/cuviddec.c @@ -32,6 +32,7 @@ #include "avcodec.h" #include "decode.h" +#include "hwaccel.h" #include "internal.h" typedef struct CuvidContext @@ -835,7 +836,7 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx) goto error; } - ret = cuvid_load_functions(&ctx->cvdl); + ret = cuvid_load_functions(&ctx->cvdl, avctx); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Failed loading nvcuvid.\n"); goto error; @@ -1094,6 +1095,19 @@ static const AVOption options[] = { { NULL } }; +static const AVCodecHWConfigInternal *cuvid_hw_configs[] = { + &(const AVCodecHWConfigInternal) { + .public = { + .pix_fmt = AV_PIX_FMT_CUDA, + .methods = AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX | + AV_CODEC_HW_CONFIG_METHOD_INTERNAL, + .device_type = AV_HWDEVICE_TYPE_CUDA + }, + .hwaccel = NULL, + }, + NULL +}; + #define DEFINE_CUVID_CODEC(x, X) \ static const AVClass x##_cuvid_class = { \ .class_name = #x "_cuvid", \ @@ -1101,13 +1115,6 @@ static const AVOption options[] = { .option = options, \ .version = LIBAVUTIL_VERSION_INT, \ }; \ - AVHWAccel ff_##x##_cuvid_hwaccel = { \ - .name = #x "_cuvid", \ - .type = AVMEDIA_TYPE_VIDEO, \ - .id = AV_CODEC_ID_##X, \ - .pix_fmt = AV_PIX_FMT_CUDA, \ - .decoder_class = &x##_cuvid_class, \ - }; \ AVCodec ff_##x##_cuvid_decoder = { \ .name = #x "_cuvid", \ .long_name = NULL_IF_CONFIG_SMALL("Nvidia CUVID " #X " decoder"), \ @@ -1121,12 +1128,12 @@ static const AVOption options[] = { .receive_frame = cuvid_output_frame, \ .flush = cuvid_flush, \ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \ - .caps_internal = FF_CODEC_CAP_HWACCEL_REQUIRE_CLASS, \ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_CUDA, \ AV_PIX_FMT_NV12, \ AV_PIX_FMT_P010, \ AV_PIX_FMT_P016, \ AV_PIX_FMT_NONE }, \ + .hw_configs = cuvid_hw_configs, \ }; #if CONFIG_HEVC_CUVID_DECODER