summaryrefslogtreecommitdiffstats
path: root/video/decode
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-01-13 13:35:31 +0100
committerwm4 <wm4@nowhere>2017-01-13 13:35:31 +0100
commitd9376fc86ffec26f134e89293a4342c4b99f0e5b (patch)
tree1324eb804aa3c834b6fb6c39f1685c351ce89b78 /video/decode
parentb26ab4d08caeb487208271ac6f51c6e3f1c5e5e6 (diff)
downloadmpv-d9376fc86ffec26f134e89293a4342c4b99f0e5b.tar.bz2
mpv-d9376fc86ffec26f134e89293a4342c4b99f0e5b.tar.xz
vaapi: always create AVHWDeviceContext on init
For convenience. Since we still have code that works even if creating a AVHWDeviceContext fails, failure is ignored. (Although currently, it succeeds creation even with the stale/abandoned vdpau wrapper driver.)
Diffstat (limited to 'video/decode')
-rw-r--r--video/decode/vaapi.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c
index 604f4807cd..8a7331fc26 100644
--- a/video/decode/vaapi.c
+++ b/video/decode/vaapi.c
@@ -41,7 +41,6 @@ struct priv {
struct mp_vaapi_ctx *ctx;
bool own_ctx;
- AVBufferRef *device_ref;
AVBufferRef *frames_ref;
};
@@ -72,7 +71,7 @@ static int init_decoder(struct lavc_ctx *ctx, int w, int h)
}
if (!p->frames_ref) {
- p->frames_ref = av_hwframe_ctx_alloc(p->device_ref);
+ p->frames_ref = av_hwframe_ctx_alloc(p->ctx->av_device_ref);
if (!p->frames_ref)
return -1;
@@ -114,7 +113,6 @@ static void uninit(struct lavc_ctx *ctx)
return;
av_buffer_unref(&p->frames_ref);
- av_buffer_unref(&p->device_ref);
if (p->own_ctx)
va_destroy(p->ctx);
@@ -143,16 +141,7 @@ static int init(struct lavc_ctx *ctx, bool direct)
ctx->hwdec_priv = p;
- p->device_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VAAPI);
- if (!p->device_ref)
- return -1;
-
- AVHWDeviceContext *hwctx = (void *)p->device_ref->data;
- AVVAAPIDeviceContext *vactx = hwctx->hwctx;
-
- vactx->display = p->ctx->display;
-
- if (av_hwdevice_ctx_init(p->device_ref) < 0)
+ if (!p->ctx->av_device_ref)
return -1;
return 0;