From bbdecb792a5d2bd8602e4934b4533d19ff868be1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 16 Jan 2017 15:31:54 +0100 Subject: [PATCH] hwdec: add a AVBufferRef(AVHWDeviceContext) field This makes "generic" interaction with libav* components easier. --- video/hwdec.h | 3 +++ video/vaapi.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/video/hwdec.h b/video/hwdec.h index 2d088399f1..9d1035cd6e 100644 --- a/video/hwdec.h +++ b/video/hwdec.h @@ -47,6 +47,9 @@ struct mp_hwdec_ctx { // HWDEC_CUDA: CUcontext* void *ctx; + // libavutil-wrapped context, if available. + struct AVBufferRef *av_device_ref; // AVVAAPIDeviceContext* + // List of IMGFMT_s, terminated with 0. NULL if N/A. int *supported_formats; diff --git a/video/vaapi.c b/video/vaapi.c index 69c0163972..6386660c8c 100644 --- a/video/vaapi.c +++ b/video/vaapi.c @@ -164,6 +164,8 @@ static void open_lavu_vaapi_device(struct mp_vaapi_ctx *ctx) if (av_hwdevice_ctx_init(ctx->av_device_ref) < 0) av_buffer_unref(&ctx->av_device_ref); + + ctx->hwctx.av_device_ref = ctx->av_device_ref; } struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog,