summaryrefslogtreecommitdiffstats
path: root/video/out/gl_common.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-04 00:43:06 +0100
committerwm4 <wm4@nowhere>2013-11-04 00:43:06 +0100
commitf7b2d644eff7fae2d74259ae14ec2b05b00c9b9b (patch)
treeca5462391d6a8f7b8e254c51c88f30efea91b90f /video/out/gl_common.h
parent37388ebb0ef9085c841d7f94e665a5a77cfe0e92 (diff)
parent25affdcc886ce010995804553396d81d90a321d3 (diff)
downloadmpv-f7b2d644eff7fae2d74259ae14ec2b05b00c9b9b.tar.bz2
mpv-f7b2d644eff7fae2d74259ae14ec2b05b00c9b9b.tar.xz
Merge branch 'master' into have_configure
Conflicts: configure
Diffstat (limited to 'video/out/gl_common.h')
-rw-r--r--video/out/gl_common.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/video/out/gl_common.h b/video/out/gl_common.h
index 41d30bb001..4722f3d52e 100644
--- a/video/out/gl_common.h
+++ b/video/out/gl_common.h
@@ -164,6 +164,45 @@ void mpgl_set_backend_w32(MPGLContext *ctx);
void mpgl_set_backend_x11(MPGLContext *ctx);
void mpgl_set_backend_wayland(MPGLContext *ctx);
+struct mp_hwdec_info;
+
+struct gl_hwdec {
+ const struct gl_hwdec_driver *driver;
+ struct mp_log *log;
+ struct MPGLContext *mpgl;
+ struct mp_hwdec_info *info;
+ // For free use by hwdec driver
+ void *priv;
+ // hwdec backends must set this to an IMGFMT_ that has an equivalent
+ // internal representation in gl_video.c as the hardware texture.
+ // It's used to build the rendering chain, and also as screenshot format.
+ int converted_imgfmt;
+};
+
+struct gl_hwdec_driver {
+ // Same name as used by mp_hwdec_info->load_api()
+ const char *api_name;
+ // Test whether the given IMGFMT_ is supported.
+ bool (*query_format)(int imgfmt);
+ // Create the hwdec device. It must fill in hw->info, if applicable.
+ // This also must set hw->converted_imgfmt.
+ int (*create)(struct gl_hwdec *hw);
+ // Prepare for rendering video. (E.g. create textures.)
+ // Called on initialization, and every time the video size changes.
+ int (*reinit)(struct gl_hwdec *hw, int w, int h);
+ // Return textures that contain the given hw_image.
+ // Note that the caller keeps a reference to hw_image until unbind_image
+ // is called, so the callee doesn't need to do that.
+ int (*load_image)(struct gl_hwdec *hw, struct mp_image *hw_image,
+ GLuint *out_textures);
+ // Undo load_image(). The user of load_image() calls this when the textures
+ // are not needed anymore.
+ void (*unload_image)(struct gl_hwdec *hw);
+ void (*destroy)(struct gl_hwdec *hw);
+};
+
+extern const struct gl_hwdec_driver *mpgl_hwdec_drivers[];
+
void *mp_getdladdr(const char *s);
void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *),