On Tue, Nov 08, 2016 at 09:46:23AM +0000, Ruta Gadkari wrote: > From a4d39730fc6b4b0be80483d349cb367992d979ad Mon Sep 17 00:00:00 2001 > From: Timo Rothenpieler <t...@rothenpieler.org> > Date: Tue, 8 Nov 2016 14:13:23 +0530 > Subject: [PATCH 1/1] CUVID: Add support for CUVID decode > > --- a/configure > +++ b/configure > @@ -4614,6 +4662,7 @@ enabled avisynth && { check_lib > "avisynth/avisynth_c.h windows.h" LoadL > check_lib "avxsynth/avxsynth_c.h dlfcn.h" > dlopen -ldl || > die "ERROR: LoadLibrary/dlopen not found, or > avisynth header not found"; } > enabled cuda && check_lib cuda.h cuInit -lcuda > +enabled cuvid && require libnvcuvid cuviddec.h > cuvidCreateDecoder -lnvcuvid
This does not work like you think it does. When cuvid was requested you check whether or not libnvcuvid is available. Settle on one name and use that throughout. > --- /dev/null > +++ b/libavcodec/cuvid.c > @@ -0,0 +1,906 @@ > + > +#define CUVID_CODEC(x, X) \ > + static const AVClass x ## _cuvid_class = { \ > + .class_name = #x "_cuvid", \ > + .item_name = av_default_item_name, \ > + .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, \ > + }; \ > + AVCodec ff_ ## x ## _cuvid_decoder = { \ > + .name = #x "_cuvid", \ > + .long_name = NULL_IF_CONFIG_SMALL("Nvidia CUVID " #X " > decoder"), \ > + .type = AVMEDIA_TYPE_VIDEO, \ > + .id = AV_CODEC_ID_ ## X, \ > + .priv_data_size = sizeof(CuvidContext), \ > + .priv_class = &x ## _cuvid_class, \ > + .init = cuvid_decode_init, \ > + .close = cuvid_decode_end, \ > + .decode = cuvid_decode_frame, \ > + .send_packet = cuvid_decode_packet, \ > + .receive_frame = cuvid_output_frame, \ > + .flush = cuvid_flush, \ > + .capabilities = AV_CODEC_CAP_DELAY, \ > + .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_CUDA, \ > + AV_PIX_FMT_NV12, \ > + AV_PIX_FMT_NONE }, \ > + }; > + > +#define CUVID_HWACCEL(x, X) \ > + AVHWAccel ff_ ## x ## _cuvid_hwaccel = { \ > + .name = #x "_cuvid", \ > + .type = AVMEDIA_TYPE_VIDEO, \ > + .id = AV_CODEC_ID_ ## X, \ > + .pix_fmt = AV_PIX_FMT_CUDA, \ > + }; nit: This would look prettier with the \ aligned vertically. > +#if CONFIG_H264_CUVID_DECODER > +CUVID_CODEC(h264, H264) > +#elif CONFIG_H264_CUVID_HWACCEL > +CUVID_HWACCEL(h264, H264) > +#endif I think you believe that this file gets compiled multiple times, for each decoder and hwaccel. It does not, it gets compiled once. So the #elif is never hit if the decoder is enabled. Thus none of the hwaccel declarations are ever taking effect. Have you tested the hwaccels at all? How? Diego _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel