VLC  3.0.15
vlc_opengl.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vlc_opengl.h: VLC GL API
3  *****************************************************************************
4  * Copyright (C) 2009 Laurent Aimar
5  * Copyright (C) 2011 RĂ©mi Denis-Courmont
6  *
7  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23 
24 #ifndef VLC_GL_H
25 #define VLC_GL_H 1
26 
27 /**
28  * \file
29  * This file defines GL structures and functions.
30  */
31 
32 struct vout_window_t;
33 struct vout_window_cfg_t;
34 
35 /**
36  * A VLC GL context (and its underlying surface)
37  */
38 typedef struct vlc_gl_t vlc_gl_t;
39 
40 struct vlc_gl_t
41 {
43 
46  void *sys;
47 
48  int (*makeCurrent)(vlc_gl_t *);
50  void (*resize)(vlc_gl_t *, unsigned, unsigned);
51  void (*swap)(vlc_gl_t *);
52  void*(*getProcAddress)(vlc_gl_t *, const char *);
53 
54  enum {
58  } ext;
59 
60  union {
61  /* if ext == VLC_GL_EXT_EGL */
62  struct {
63  /* call eglQueryString() with current display */
64  const char *(*queryString)(vlc_gl_t *, int32_t name);
65  /* call eglCreateImageKHR() with current display and context, can
66  * be NULL */
67  void *(*createImageKHR)(vlc_gl_t *, unsigned target, void *buffer,
68  const int32_t *attrib_list);
69  /* call eglDestroyImageKHR() with current display, can be NULL */
70  bool (*destroyImageKHR)(vlc_gl_t *, void *image);
71  } egl;
72  /* if ext == VLC_GL_EXT_WGL */
73  struct
74  {
75  const char *(*getExtensionsString)(vlc_gl_t *);
76  } wgl;
77  };
78 };
79 
80 enum {
83 };
84 
85 VLC_API vlc_gl_t *vlc_gl_Create(struct vout_window_t *, unsigned, const char *) VLC_USED;
88 
89 static inline int vlc_gl_MakeCurrent(vlc_gl_t *gl)
90 {
91  return gl->makeCurrent(gl);
92 }
93 
94 static inline void vlc_gl_ReleaseCurrent(vlc_gl_t *gl)
95 {
96  gl->releaseCurrent(gl);
97 }
98 
99 static inline void vlc_gl_Resize(vlc_gl_t *gl, unsigned w, unsigned h)
100 {
101  if (gl->resize != NULL)
102  gl->resize(gl, w, h);
103 }
104 
105 static inline void vlc_gl_Swap(vlc_gl_t *gl)
106 {
107  gl->swap(gl);
108 }
109 
110 static inline void *vlc_gl_GetProcAddress(vlc_gl_t *gl, const char *name)
111 {
112  return (gl->getProcAddress != NULL) ? gl->getProcAddress(gl, name) : NULL;
113 }
114 
116  const struct vout_window_cfg_t *,
117  struct vout_window_t **) VLC_USED;
118 VLC_API bool vlc_gl_surface_CheckSize(vlc_gl_t *, unsigned *w, unsigned *h);
120 
121 #endif /* VLC_GL_H */
VLC_API
#define VLC_API
Definition: fourcc_gen.c:30
vlc_gl_ReleaseCurrent
static void vlc_gl_ReleaseCurrent(vlc_gl_t *gl)
Definition: vlc_opengl.h:94
vlc_gl_t::egl
struct vlc_gl_t::@190::@192 egl
VLC_COMMON_MEMBERS
#define VLC_COMMON_MEMBERS
Backward compatibility macro.
Definition: vlc_common.h:453
vlc_gl_Swap
static void vlc_gl_Swap(vlc_gl_t *gl)
Definition: vlc_opengl.h:105
vlc_gl_Create
vlc_gl_t * vlc_gl_Create(struct vout_window_t *, unsigned, const char *)
Creates an OpenGL context (and its underlying surface).
Definition: opengl.c:50
vout_window_t
Graphical window.
Definition: vlc_vout_window.h:130
vlc_gl_t::VLC_GL_EXT_WGL
Definition: vlc_opengl.h:57
vlc_common.h
vlc_gl_t::VLC_GL_EXT_DEFAULT
Definition: vlc_opengl.h:55
vlc_gl_t::sys
void * sys
Definition: vlc_opengl.h:46
vlc_gl_Resize
static void vlc_gl_Resize(vlc_gl_t *gl, unsigned w, unsigned h)
Definition: vlc_opengl.h:99
VLC_OPENGL_ES2
Definition: vlc_opengl.h:82
vlc_gl_MakeCurrent
static int vlc_gl_MakeCurrent(vlc_gl_t *gl)
Definition: vlc_opengl.h:89
vlc_gl_t::swap
void(* swap)(vlc_gl_t *)
Definition: vlc_opengl.h:51
vlc_gl_t::module
module_t * module
Definition: vlc_opengl.h:45
vlc_gl_t::VLC_GL_EXT_EGL
Definition: vlc_opengl.h:56
module_t
Internal module descriptor.
Definition: modules.h:79
vlc_gl_surface_CheckSize
bool vlc_gl_surface_CheckSize(vlc_gl_t *, unsigned *w, unsigned *h)
vlc_gl_Hold
void vlc_gl_Hold(vlc_gl_t *)
Definition: opengl.c:85
vlc_gl_t
Definition: vlc_opengl.h:40
vlc_gl_Release
void vlc_gl_Release(vlc_gl_t *)
Definition: opengl.c:91
vlc_gl_surface_Create
vlc_gl_t * vlc_gl_surface_Create(vlc_object_t *, const struct vout_window_cfg_t *, struct vout_window_t **)
vlc_gl_surface_Destroy
void vlc_gl_surface_Destroy(vlc_gl_t *)
Definition: opengl.c:191
vlc_gl_t::makeCurrent
int(* makeCurrent)(vlc_gl_t *)
Definition: vlc_opengl.h:48
vlc_object_t
The main vlc_object_t structure.
Definition: vlc_objects.h:39
vlc_gl_GetProcAddress
static void * vlc_gl_GetProcAddress(vlc_gl_t *gl, const char *name)
Definition: vlc_opengl.h:110
vlc_gl_t::resize
void(* resize)(vlc_gl_t *, unsigned, unsigned)
Definition: vlc_opengl.h:50
VLC_USED
#define VLC_USED
Definition: fourcc_gen.c:31
vlc_gl_t::ext
enum vlc_gl_t::@189 ext
vout_window_cfg_t
Definition: vlc_vout_window.h:90
name
const char name[16]
Definition: httpd.c:1249
VLC_OPENGL
Definition: vlc_opengl.h:81
vlc_gl_t::destroyImageKHR
bool(* destroyImageKHR)(vlc_gl_t *, void *image)
Definition: vlc_opengl.h:70
vlc_gl_t::getProcAddress
void *(* getProcAddress)(vlc_gl_t *, const char *)
Definition: vlc_opengl.h:52
vlc_gl_t::releaseCurrent
void(* releaseCurrent)(vlc_gl_t *)
Definition: vlc_opengl.h:49
vlc_gl_t::wgl
struct vlc_gl_t::@190::@193 wgl
vlc_gl_t::surface
struct vout_window_t * surface
Definition: vlc_opengl.h:44