vlc_opengl.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * vlc_opengl.h: VLC GL API
00003  *****************************************************************************
00004  * Copyright (C) 2009 Laurent Aimar
00005  * Copyright (C) 2011 Rémi Denis-Courmont
00006  *
00007  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
00008  *
00009  * This program is free software; you can redistribute it and/or modify it
00010  * under the terms of the GNU Lesser General Public License as published by
00011  * the Free Software Foundation; either version 2.1 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00017  * GNU Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public License
00020  * along with this program; if not, write to the Free Software Foundation,
00021  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef VLC_GL_H
00025 #define VLC_GL_H 1
00026 
00027 /**
00028  * \file
00029  * This file defines GL structures and functions.
00030  */
00031 
00032 struct vout_window_t;
00033 
00034 /**
00035  * A VLC GL context (and its underlying surface)
00036  */
00037 typedef struct vlc_gl_t vlc_gl_t;
00038 
00039 struct vlc_gl_t
00040 {
00041     VLC_COMMON_MEMBERS
00042 
00043     struct vout_window_t *surface;
00044     module_t *module;
00045     void *sys;
00046 
00047     int  (*makeCurrent)(vlc_gl_t *);
00048     void (*swap)(vlc_gl_t *);
00049     int  (*lock)(vlc_gl_t *);
00050     void (*unlock)(vlc_gl_t *);
00051     void*(*getProcAddress)(vlc_gl_t *, const char *);
00052 };
00053 
00054 enum {
00055     VLC_OPENGL,
00056     VLC_OPENGL_ES,
00057     VLC_OPENGL_ES2,
00058 };
00059 
00060 VLC_API vlc_gl_t *vlc_gl_Create(struct vout_window_t *, unsigned, const char *) VLC_USED;
00061 VLC_API void vlc_gl_Destroy(vlc_gl_t *);
00062 
00063 static inline int vlc_gl_MakeCurrent(vlc_gl_t *gl)
00064 {
00065     return gl->makeCurrent(gl);
00066 }
00067 
00068 static inline int vlc_gl_Lock(vlc_gl_t *gl)
00069 {
00070     return (gl->lock != NULL) ? gl->lock(gl) : VLC_SUCCESS;
00071 }
00072 
00073 static inline void vlc_gl_Unlock(vlc_gl_t *gl)
00074 {
00075     if (gl->unlock != NULL)
00076         gl->unlock(gl);
00077 }
00078 
00079 static inline void vlc_gl_Swap(vlc_gl_t *gl)
00080 {
00081     gl->swap(gl);
00082 }
00083 
00084 static inline void *vlc_gl_GetProcAddress(vlc_gl_t *gl, const char *name)
00085 {
00086     return (gl->getProcAddress != NULL) ? gl->getProcAddress(gl, name) : NULL;
00087 }
00088 
00089 #endif /* VLC_GL_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines