From 6aa4efd1e3205c9b1385865df1b5b09646d2160c Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 20 Feb 2017 08:39:55 +0100 Subject: vd_lavc, vaapi: move hw device creation to generic code hw_vaapi.c didn't do much interesting anymore. Other than the function to create a device for decoding with vaapi-copy, everything can be done by generic code. Other libavcodec hwaccels are planned to provide the same API as vaapi. It will be possible to drop the other hw_ files in the future. They will use this generic code instead. --- video/vaapi.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'video/vaapi.c') diff --git a/video/vaapi.c b/video/vaapi.c index 5c8ce4c693..171ccdfcbd 100644 --- a/video/vaapi.c +++ b/video/vaapi.c @@ -210,6 +210,8 @@ struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog, // libva drivers (such as the vdpau wraper). So don't error out on failure. open_lavu_vaapi_device(res); + res->hwctx.emulated = va_guess_if_emulated(res); + return res; error: @@ -716,7 +718,13 @@ static const struct va_native_display *const native_displays[] = { NULL }; -struct mp_vaapi_ctx *va_create_standalone(struct mp_log *plog, bool probing) +static void va_destroy_ctx(struct mp_hwdec_ctx *ctx) +{ + va_destroy(ctx->ctx); +} + +struct mp_hwdec_ctx *va_create_standalone(struct mpv_global *global, + struct mp_log *plog, bool probing) { for (int n = 0; native_displays[n]; n++) { VADisplay *display = NULL; @@ -731,7 +739,8 @@ struct mp_vaapi_ctx *va_create_standalone(struct mp_log *plog, bool probing) } ctx->native_ctx = native_ctx; ctx->destroy_native_ctx = native_displays[n]->destroy; - return ctx; + ctx->hwctx.destroy = va_destroy_ctx; + return &ctx->hwctx; } } return NULL; -- cgit v1.2.3