Browse Source

gl: vlc_gl_Create() takes configuration struct

...pointer instead of window pointer.
pull/84/head
Rémi Denis-Courmont 7 years ago
parent
commit
886e0c2081
  1. 7
      include/vlc_opengl.h
  2. 2
      include/vlc_vout_display.h
  3. 2
      modules/video_output/android/display.c
  4. 2
      modules/video_output/opengl/display.c
  5. 2
      modules/video_output/win32/glwin32.c
  6. 10
      src/video_output/opengl.c

7
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 *);

2
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 */

2
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;

2
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;

2
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)
{

10
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;

Loading…
Cancel
Save