diff options
author | wm4 <wm4@nowhere> | 2015-01-22 15:32:23 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-22 15:32:23 +0100 |
commit | aae9af348e62d5feba6547855003df0d954cb3ae (patch) | |
tree | dd0d28655c65e1f814bec3ef537ea377a941b9b7 /video/decode | |
parent | 29cf62d20133b32e1514a315b4f7e013ed9cb768 (diff) | |
download | mpv-aae9af348e62d5feba6547855003df0d954cb3ae.tar.bz2 mpv-aae9af348e62d5feba6547855003df0d954cb3ae.tar.xz |
video: have a generic context struct for hwdec backends
Before this commit, each hw backend had their own specific struct types
for context, and some, like VDA, had none at all. Add a context struct
(mp_hwdec_ctx) that provides a somewhat generic way to pass the hwdec
context around. Some things get slightly better, some slightly more
verbose.
mp_hwdec_info is still around; it's still needed, but is reduced to its
role of handling delayed loading of the hwdec backend.
Diffstat (limited to 'video/decode')
-rw-r--r-- | video/decode/vaapi.c | 8 | ||||
-rw-r--r-- | video/decode/vdpau.c | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c index de26ac2955..82de0a667e 100644 --- a/video/decode/vaapi.c +++ b/video/decode/vaapi.c @@ -408,20 +408,18 @@ static int init_with_vactx(struct lavc_ctx *ctx, struct mp_vaapi_ctx *vactx) static int init(struct lavc_ctx *ctx) { - if (!ctx->hwdec_info->vaapi_ctx) - return -1; - return init_with_vactx(ctx, ctx->hwdec_info->vaapi_ctx); + return init_with_vactx(ctx, ctx->hwdec_info->hwctx->vaapi_ctx); } static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info, const char *decoder) { hwdec_request_api(info, "vaapi"); - if (!info || !info->vaapi_ctx) + if (!info || !info->hwctx || !info->hwctx->vaapi_ctx) return HWDEC_ERR_NO_CTX; if (!hwdec_check_codec_support(decoder, profiles)) return HWDEC_ERR_NO_CODEC; - if (va_guess_if_emulated(info->vaapi_ctx)) + if (va_guess_if_emulated(info->hwctx->vaapi_ctx)) return HWDEC_ERR_EMULATED; return 0; } diff --git a/video/decode/vdpau.c b/video/decode/vdpau.c index f144176520..92ea401750 100644 --- a/video/decode/vdpau.c +++ b/video/decode/vdpau.c @@ -153,7 +153,7 @@ static int init(struct lavc_ctx *ctx) struct priv *p = talloc_ptrtype(NULL, p); *p = (struct priv) { .log = mp_log_new(p, ctx->log, "vdpau"), - .mpvdp = ctx->hwdec_info->vdpau_ctx, + .mpvdp = ctx->hwdec_info->hwctx->vdpau_ctx, }; ctx->hwdec_priv = p; @@ -185,11 +185,11 @@ static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info, const char *decoder) { hwdec_request_api(info, "vdpau"); - if (!info || !info->vdpau_ctx) + if (!info || !info->hwctx || !info->hwctx->vdpau_ctx) return HWDEC_ERR_NO_CTX; if (!hwdec_check_codec_support(decoder, profiles)) return HWDEC_ERR_NO_CODEC; - if (mp_vdpau_guess_if_emulated(info->vdpau_ctx)) + if (mp_vdpau_guess_if_emulated(info->hwctx->vdpau_ctx)) return HWDEC_ERR_EMULATED; return 0; } |