1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-19 09:57:34 +00:00

vd_lavc: cuda requires setting hw_device_ctx

This restores cuda/cuvid under Windows.

Cuvid is relatively useless under Windows, but this was requested.
This commit is contained in:
wm4 2017-09-26 23:20:08 +02:00
parent 2f5ba78a0b
commit dc5fcced23
2 changed files with 4 additions and 1 deletions

View File

@ -593,7 +593,7 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
if (ctx->hwdec_dev->restore_device) if (ctx->hwdec_dev->restore_device)
ctx->hwdec_dev->restore_device(ctx->hwdec_dev); ctx->hwdec_dev->restore_device(ctx->hwdec_dev);
if (!ctx->hwdec->set_hwframes) { 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); avctx->hw_device_ctx = av_buffer_ref(ctx->hwdec_dev->av_device_ref);
#else #else
goto error; goto error;

View File

@ -2,11 +2,14 @@
typedef void * CUcontext; typedef void * CUcontext;
#include <libavcodec/avcodec.h>
#include <libavutil/hwcontext.h> #include <libavutil/hwcontext.h>
#include <libavutil/hwcontext_cuda.h> #include <libavutil/hwcontext_cuda.h>
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
enum AVHWDeviceType type = AV_HWDEVICE_TYPE_CUDA; enum AVHWDeviceType type = AV_HWDEVICE_TYPE_CUDA;
AVCUDADeviceContextInternal *foo; AVCUDADeviceContextInternal *foo;
AVCodecContext *avctx = avcodec_alloc_context3(NULL);
avctx->hw_device_ctx = NULL;
return 0; return 0;
} }