[vlc-commits] Revert "vlc_opengl: refactor vlc_gl_t creation"
Thomas Guillem
git at videolan.org
Mon Dec 19 19:26:52 CET 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Dec 19 19:20:34 2016 +0100| [5b4e4f28a5b8ac275e52ee9bf2dce1b12523d407] | committer: Thomas Guillem
Revert "vlc_opengl: refactor vlc_gl_t creation"
And use vlc_object_create() instead of the newly reverted vlc_gl_Create().
This reverts commit 79b2187631f2786f46a8225b538f3ec7ae7d1c9e.
refs #17795
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5b4e4f28a5b8ac275e52ee9bf2dce1b12523d407
---
include/vlc_opengl.h | 22 +--------------
modules/video_output/caopengllayer.m | 2 +-
modules/video_output/macosx.m | 2 +-
modules/video_output/opengl/display.c | 2 +-
modules/video_output/win32/glwin32.c | 2 +-
src/libvlccore.sym | 1 -
src/video_output/opengl.c | 51 +++++++++++++++++++----------------
7 files changed, 33 insertions(+), 49 deletions(-)
diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h
index f7704bc..53d73d0 100644
--- a/include/vlc_opengl.h
+++ b/include/vlc_opengl.h
@@ -58,27 +58,7 @@ enum {
VLC_OPENGL_ES2,
};
-/**
- * Create a VLC OpenGL object
- *
- * @note The allocated resource, if any, shall be released
- * with a call to \ref vlc_gl_Destroy.
- * @return a created object on success, NULL on failure.
- **/
-VLC_API vlc_gl_t *vlc_gl_Create(vlc_object_t* parent);
-
-/**
- * Creates a VLC OpenGL object with associated surface and module
- *
- * @note In most cases, you should vlc_gl_MakeCurrent() afterward.
- *
- * @param wnd 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_ModuleCreate(struct vout_window_t *wnd, unsigned flags,
- const char *name) VLC_USED;
+VLC_API vlc_gl_t *vlc_gl_Create(struct vout_window_t *, unsigned, const char *) VLC_USED;
VLC_API void vlc_gl_Destroy(vlc_gl_t *);
static inline int vlc_gl_MakeCurrent(vlc_gl_t *gl)
diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 33abaf1..aa7257b 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -171,7 +171,7 @@ static int Open (vlc_object_t *p_this)
msg_Warn(vd, "we might not have an OpenGL context yet");
/* Initialize common OpenGL video display */
- sys->gl = vlc_gl_Create(vd);
+ sys->gl = vlc_object_create(vd, sizeof(*sys->gl));
if (unlikely(!sys->gl))
goto bailout;
sys->gl->makeCurrent = OpenglLock;
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index a3ae7ba..a29da9a 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -254,7 +254,7 @@ static int Open (vlc_object_t *this)
}
/* Initialize common OpenGL video display */
- sys->gl = vlc_gl_Create(this);
+ sys->gl = vlc_object_create(this, sizeof(*sys->gl));
if( unlikely( !sys->gl ) )
goto error;
diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index 62b6f6f..281ed71 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -103,7 +103,7 @@ static int Open (vlc_object_t *obj)
goto error;
}
- sys->gl = vlc_gl_ModuleCreate (surface, API, "$" MODULE_VARNAME);
+ sys->gl = vlc_gl_Create (surface, API, "$" MODULE_VARNAME);
if (sys->gl == NULL)
goto error;
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index c8e2429..96ee332 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -215,7 +215,7 @@ static int Open(vlc_object_t *object)
#endif
/* */
- sys->gl = vlc_gl_Create(object);
+ sys->gl = vlc_object_create(object, sizeof(*sys->gl));
if (unlikely(!sys->gl))
goto error;
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index b65f538..7b9657a 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -691,7 +691,6 @@ vlc_fifo_GetCount
vlc_fifo_GetBytes
vlc_gl_Create
vlc_gl_Destroy
-vlc_gl_ModuleCreate
vlc_gl_surface_Create
vlc_gl_surface_CheckSize
vlc_gl_surface_Destroy
diff --git a/src/video_output/opengl.c b/src/video_output/opengl.c
index 6459cbf..ac16c3f 100644
--- a/src/video_output/opengl.c
+++ b/src/video_output/opengl.c
@@ -29,43 +29,47 @@
#include <vlc_opengl.h>
#include "libvlc.h"
#include <vlc_modules.h>
-#include <vlc_vout_window.h>
-
-vlc_gl_t *vlc_gl_Create(vlc_object_t* parent)
-{
- return vlc_custom_create(parent, sizeof(vlc_gl_t), "gl");
-}
-vlc_gl_t *vlc_gl_ModuleCreate(struct vout_window_t *wnd, unsigned flags,
- const char *module_name)
+#undef vlc_gl_Create
+/**
+ * Creates an OpenGL context (and its underlying surface).
+ *
+ * @note In most cases, you should vlc_gl_MakeCurrent() afterward.
+ *
+ * @param wnd 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_gl_t *vlc_gl_Create(struct vout_window_t *wnd, unsigned flags,
+ const char *name)
{
- const char *module_type;
+ vlc_object_t *parent = (vlc_object_t *)wnd;
+ vlc_gl_t *gl;
+ const char *type;
- switch (flags)
+ switch (flags /*& VLC_OPENGL_API_MASK*/)
{
case VLC_OPENGL:
- module_type = "opengl";
+ type = "opengl";
break;
case VLC_OPENGL_ES:
- module_type = "opengl es";
+ type = "opengl es";
break;
case VLC_OPENGL_ES2:
- module_type = "opengl es2";
+ type = "opengl es2";
break;
-
default:
return NULL;
}
- vlc_gl_t *gl = vlc_gl_Create(VLC_OBJECT(wnd));
-
- if( unlikely( !gl ) )
+ gl = vlc_custom_create(parent, sizeof (*gl), "gl");
+ if (unlikely(gl == NULL))
return NULL;
gl->surface = wnd;
- gl->module = module_need(gl, module_type, module_name, true);
-
- if (gl->module == NULL )
+ gl->module = module_need(gl, type, name, true);
+ if (gl->module == NULL)
{
vlc_object_release(gl);
return NULL;
@@ -76,11 +80,12 @@ vlc_gl_t *vlc_gl_ModuleCreate(struct vout_window_t *wnd, unsigned flags,
void vlc_gl_Destroy(vlc_gl_t *gl)
{
- if(gl->module)
- module_unneed(gl, gl->module);
+ module_unneed(gl, gl->module);
vlc_object_release(gl);
}
+#include <vlc_vout_window.h>
+
typedef struct vlc_gl_surface
{
int width;
@@ -125,7 +130,7 @@ vlc_gl_t *vlc_gl_surface_Create(vlc_object_t *obj,
*wp = surface;
/* TODO: support ES? */
- vlc_gl_t *gl = vlc_gl_ModuleCreate(surface, VLC_OPENGL, NULL);
+ vlc_gl_t *gl = vlc_gl_Create(surface, VLC_OPENGL, NULL);
if (gl == NULL) {
vout_window_Delete(surface);
return NULL;
More information about the vlc-commits
mailing list