From dc5fcced233ac4c9f2d644cbfc246644a095f673 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 26 Sep 2017 23:20:08 +0200 Subject: [PATCH] vd_lavc: cuda requires setting hw_device_ctx This restores cuda/cuvid under Windows. Cuvid is relatively useless under Windows, but this was requested. --- video/decode/vd_lavc.c | 2 +- waftools/fragments/cuda.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 5d3f77b746..ae79554edd 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -593,7 +593,7 @@ static void init_avctx(struct dec_video *vd, const char *decoder, if (ctx->hwdec_dev->restore_device) ctx->hwdec_dev->restore_device(ctx->hwdec_dev); if (!ctx->hwdec->set_hwframes) { -#if HAVE_VDPAU_HWACCEL +#if HAVE_VDPAU_HWACCEL || HAVE_CUDA_HWACCEL avctx->hw_device_ctx = av_buffer_ref(ctx->hwdec_dev->av_device_ref); #else goto error; diff --git a/waftools/fragments/cuda.c b/waftools/fragments/cuda.c index c63ec2945d..1d534f62d3 100644 --- a/waftools/fragments/cuda.c +++ b/waftools/fragments/cuda.c @@ -2,11 +2,14 @@ typedef void * CUcontext; +#include #include #include int main(int argc, char *argv[]) { enum AVHWDeviceType type = AV_HWDEVICE_TYPE_CUDA; AVCUDADeviceContextInternal *foo; + AVCodecContext *avctx = avcodec_alloc_context3(NULL); + avctx->hw_device_ctx = NULL; return 0; }