summaryrefslogtreecommitdiffstats
path: root/video/vaapi.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-02-20 08:39:55 +0100
committerwm4 <wm4@nowhere>2017-02-20 08:39:55 +0100
commit6aa4efd1e3205c9b1385865df1b5b09646d2160c (patch)
tree4a0f78718f21f7f644f9ca7de4fbcfb8a83aafa9 /video/vaapi.c
parent6e2d3d991912f230ee66448307e8e2657237ffd2 (diff)
downloadmpv-6aa4efd1e3205c9b1385865df1b5b09646d2160c.tar.bz2
mpv-6aa4efd1e3205c9b1385865df1b5b09646d2160c.tar.xz
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.
Diffstat (limited to 'video/vaapi.c')
-rw-r--r--video/vaapi.c13
1 files changed, 11 insertions, 2 deletions
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;