[vlc-commits] gl: vlc_gl_Create() takes configuration struct
Rémi Denis-Courmont
git at videolan.org
Thu Jan 31 19:00:03 CET 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jan 31 19:28:38 2019 +0200| [886e0c20810eddd61f3a79cfa2fc1a086f0f0d58] | committer: Rémi Denis-Courmont
gl: vlc_gl_Create() takes configuration struct
...pointer instead of window pointer.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=886e0c20810eddd61f3a79cfa2fc1a086f0f0d58
---
include/vlc_opengl.h | 7 ++++---
include/vlc_vout_display.h | 2 +-
modules/video_output/android/display.c | 2 +-
modules/video_output/opengl/display.c | 2 +-
modules/video_output/win32/glwin32.c | 2 +-
src/video_output/opengl.c | 10 +++++++---
6 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h
index f11cdd4c5d..c8e7de6d95 100644
--- a/include/vlc_opengl.h
+++ b/include/vlc_opengl.h
@@ -31,6 +31,7 @@
struct vout_window_t;
struct vout_window_cfg_t;
+struct vout_display_cfg;
/**
* A VLC GL context (and its underlying surface)
@@ -87,13 +88,13 @@ enum {
*
* @note In most cases, you should vlc_gl_MakeCurrent() afterward.
*
- * @param wnd window to use as OpenGL surface
+ * @param cfg initial configuration (including window to use as OpenGL surface)
* @param flags OpenGL context type
* @param name module name (or NULL for auto)
* @return a new context, or NULL on failure
*/
-VLC_API vlc_gl_t *vlc_gl_Create(struct vout_window_t *wnd, unsigned flags,
- const char *name) VLC_USED;
+VLC_API vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *cfg,
+ unsigned flags, const char *name) VLC_USED;
VLC_API void vlc_gl_Release(vlc_gl_t *);
VLC_API void vlc_gl_Hold(vlc_gl_t *);
diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index e7877f4ad0..eff57f2a13 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -64,7 +64,7 @@ typedef struct vlc_video_align {
/**
* Initial/Current configuration for a vout_display_t
*/
-typedef struct {
+typedef struct vout_display_cfg {
struct vout_window_t *window; /**< Window */
#if defined(_WIN32) || defined(__OS2__)
bool is_fullscreen VLC_DEPRECATED; /* Is the display fullscreen */
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index a6bdaf6683..73767fcd09 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -662,7 +662,7 @@ static void ClearSurface(vout_display_t *vd)
{
/* Clear the surface to black with OpenGL ES 2 */
char *modlist = var_InheritString(sys->embed, "gles2");
- vlc_gl_t *gl = vlc_gl_Create(sys->embed, VLC_OPENGL_ES2, modlist);
+ vlc_gl_t *gl = vlc_gl_Create(vd->cfg, VLC_OPENGL_ES2, modlist);
free(modlist);
if (gl == NULL)
return;
diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index 087e288034..d4f1875cca 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -125,7 +125,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
}
#endif
- sys->gl = vlc_gl_Create (surface, API, gl_name);
+ sys->gl = vlc_gl_Create(cfg, API, gl_name);
free(gl_name);
if (sys->gl == NULL)
goto error;
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index e7eeeb8319..c7db2cd759 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -132,7 +132,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
goto error;
char *modlist = var_InheritString(surface, "gl");
- sys->gl = vlc_gl_Create (surface, VLC_OPENGL, modlist);
+ sys->gl = vlc_gl_Create(cfg, VLC_OPENGL, modlist);
free(modlist);
if (!sys->gl)
{
diff --git a/src/video_output/opengl.c b/src/video_output/opengl.c
index a4bb7fc153..d2a296ce93 100644
--- a/src/video_output/opengl.c
+++ b/src/video_output/opengl.c
@@ -28,6 +28,7 @@
#include <vlc_common.h>
#include <vlc_atomic.h>
#include <vlc_opengl.h>
+#include <vlc_vout_display.h>
#include "libvlc.h"
#include <vlc_modules.h>
@@ -55,9 +56,10 @@ static void vlc_gl_stop(void *func, va_list ap)
deactivate(gl);
}
-vlc_gl_t *vlc_gl_Create(struct vout_window_t *wnd, unsigned flags,
- const char *name)
+vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg,
+ unsigned flags, const char *name)
{
+ vout_window_t *wnd = cfg->window;
vlc_object_t *parent = (vlc_object_t *)wnd;
struct vlc_gl_priv_t *glpriv;
const char *type;
@@ -166,7 +168,9 @@ vlc_gl_t *vlc_gl_surface_Create(vlc_object_t *obj,
*wp = surface;
/* TODO: support ES? */
- vlc_gl_t *gl = vlc_gl_Create(surface, VLC_OPENGL, NULL);
+ struct vout_display_cfg dcfg = { .window = surface };
+
+ vlc_gl_t *gl = vlc_gl_Create(&dcfg, VLC_OPENGL, NULL);
if (gl == NULL) {
vout_window_Delete(surface);
goto error;
More information about the vlc-commits
mailing list