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/hwdec.h | |
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/hwdec.h')
-rw-r--r-- | video/hwdec.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/video/hwdec.h b/video/hwdec.h index ca18340ae1..149cd81bae 100644 --- a/video/hwdec.h +++ b/video/hwdec.h @@ -1,14 +1,26 @@ #ifndef MP_HWDEC_H_ #define MP_HWDEC_H_ +struct mp_image_pool; + +struct mp_hwdec_ctx { + void *priv; // for free use by hwdec implementation + + // API-specific, not needed by all backends. + struct mp_vdpau_ctx *vdpau_ctx; + struct mp_vaapi_ctx *vaapi_ctx; +}; + // Used to communicate hardware decoder API handles from VO to video decoder. // The VO can set the context pointer for supported APIs. struct mp_hwdec_info { - struct mp_vdpau_ctx *vdpau_ctx; - struct mp_vaapi_ctx *vaapi_ctx; + // (Since currently only 1 hwdec API is loaded at a time, this pointer + // simply maps to the loaded one.) + struct mp_hwdec_ctx *hwctx; + // Can be used to lazily load a requested API. // api_name is e.g. "vdpau" (like the fields above, without "_ctx") - // Can be NULL, is idempotent, caller checks _ctx fields for success/access. + // Can be NULL, is idempotent, caller checks hwctx fields for success/access. // Due to threading, the callback is the only code that is allowed to // change fields in this struct after initialization. void (*load_api)(struct mp_hwdec_info *info, const char *api_name); |