diff options
author | wm4 <wm4@nowhere> | 2017-05-05 00:44:03 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-05-05 00:48:53 +0200 |
commit | 5757db844a449ed6a1e0fadb2bd62bae6852c78a (patch) | |
tree | e22fdff215edd3c786c80a47c90bacbd4428e664 /video/decode/hw_cuda.c | |
parent | 0d122f8963c6ff43f2b7c9f5828163b07ef5febf (diff) | |
download | mpv-5757db844a449ed6a1e0fadb2bd62bae6852c78a.tar.bz2 mpv-5757db844a449ed6a1e0fadb2bd62bae6852c78a.tar.xz |
cuda: add new way to set cuda context on cuvid codecs
See FFmpeg commit c0f17a905f3588bf61ba6d86a83c6835d431ed3d.
Diffstat (limited to 'video/decode/hw_cuda.c')
-rw-r--r-- | video/decode/hw_cuda.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/video/decode/hw_cuda.c b/video/decode/hw_cuda.c index d0c7669f25..64ee08d427 100644 --- a/video/decode/hw_cuda.c +++ b/video/decode/hw_cuda.c @@ -28,6 +28,8 @@ typedef void * CUcontext; #include "video/fmt-conversion.h" #include "video/decode/lavc.h" +#if !NEW_CUDA_HWACCEL + static int probe(struct lavc_ctx *ctx, struct vd_lavc_hwdec *hwdec, const char *codec) { @@ -47,6 +49,8 @@ static int init_decoder(struct lavc_ctx *ctx, int w, int h) AVCodecContext *avctx = ctx->avctx; struct mp_hwdec_ctx *hwctx = ctx->hwdec_priv; + MP_VERBOSE(ctx, "Using old cuda API.\n"); + if (avctx->hw_frames_ctx) { MP_ERR(ctx, "hw_frames_ctx already initialised!\n"); return -1; @@ -63,7 +67,8 @@ static int init_decoder(struct lavc_ctx *ctx, int w, int h) // This is proper use of the hw_frames_ctx API, but it does not work // (appaears to work but fails e.g. with 10 bit). The cuvid wrapper - // does non-standard things, and it's a messy situation. + // does non-standard things, and it's a messy situation. This whole + // file is actually used only with older libavcodec versions. /* hwframe_ctx->width = w; hwframe_ctx->height = h; @@ -92,7 +97,7 @@ static struct mp_image *process_image(struct lavc_ctx *ctx, struct mp_image *img return img; } -const struct vd_lavc_hwdec mp_vd_lavc_cuda = { +const struct vd_lavc_hwdec mp_vd_lavc_cuda_old = { .type = HWDEC_CUDA, .image_format = IMGFMT_CUDA, .lavc_suffix = "_cuvid", @@ -102,3 +107,5 @@ const struct vd_lavc_hwdec mp_vd_lavc_cuda = { .init_decoder = init_decoder, .process_image = process_image, }; + +#endif |