/*****************************************************************************
- * vlc_opengl.h: OpenGL provider interface
+ * vlc_gl.h: VLC GL API
*****************************************************************************
- * Copyright (C) 2004 VideoLAN
- * $Id$
+ * Copyright (C) 2009 Laurent Aimar
+ * Copyright (C) 2011 RĂ©mi Denis-Courmont
*
- * Authors: Cyril Deguet <asmax@videolan.org>
+ * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#ifndef _VLC_OPENGL_H
-#define _VLC_OPENGL_H 1
+#ifndef VLC_GL_H
+#define VLC_GL_H 1
+/**
+ * \file
+ * This file defines GL structures and functions.
+ */
-struct opengl_t
+struct vout_window_t;
+
+/**
+ * A VLC GL context (and its underlying surface)
+ */
+typedef struct vlc_gl_t vlc_gl_t;
+
+struct vlc_gl_t
{
VLC_COMMON_MEMBERS
- int i_width; /* window width */
- int i_height; /* window height */
- int b_fullscreen; /* fullscreen flag */
+ struct vout_window_t *surface;
+ module_t *module;
+ void *sys;
- opengl_sys_t *p_sys; /* private data */
+ int (*makeCurrent)(vlc_gl_t *);
+ void (*swap)(vlc_gl_t *);
+ int (*lock)(vlc_gl_t *);
+ void (*unlock)(vlc_gl_t *);
+};
- /* Create an OpenGL window of the requested size (if possible) */
- int ( *pf_init )( opengl_t *, int i_width, int i_height );
+enum {
+ VLC_OPENGL,
+ VLC_OPENGL_ES,
+ VLC_OPENGL_ES2,
+};
- /* Swap front/back buffers */
- void ( *pf_swap )( opengl_t * );
+VLC_EXPORT( vlc_gl_t *, vlc_gl_Create, (struct vout_window_t *, unsigned, const char *) ) LIBVLC_USED;
+VLC_EXPORT( void, vlc_gl_Destroy, (vlc_gl_t *) );
- /* Handle window events */
- int ( *pf_handle_events )( opengl_t * );
-};
+static inline int vlc_gl_MakeCurrent(vlc_gl_t *gl)
+{
+ return gl->makeCurrent(gl);
+}
+
+static inline int vlc_gl_Lock(vlc_gl_t *gl)
+{
+ return (gl->lock != NULL) ? gl->lock(gl) : VLC_SUCCESS;
+}
+
+static inline void vlc_gl_Unlock(vlc_gl_t *gl)
+{
+ if (gl->unlock != NULL)
+ gl->unlock(gl);
+}
+
+static inline void vlc_gl_Swap(vlc_gl_t *gl)
+{
+ gl->swap(gl);
+}
-#endif
+#endif /* VLC_GL_H */