]> git.sesse.net Git - vlc/blob - modules/video_output/opengl.h
decoder: fix data race in input_DecoderFrameNext()
[vlc] / modules / video_output / opengl.h
1 /*****************************************************************************
2  * opengl.h: OpenGL vout_display helpers
3  *****************************************************************************
4  * Copyright (C) 2004-2013 VLC authors and VideoLAN
5  * Copyright (C) 2009 Laurent Aimar
6  *
7  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
8  *          Rémi Denis-Courmont
9  *          Jean-Baptiste Kempf <jb@videolan.org>
10  *          Ilkka Ollakka <ileoo@videolan.org>
11  *          Felix Paul Kühne <fkuehne at videolan dot org>
12  *          Rafaël Carré <funman@videolanorg>
13  *
14  * This program is free software; you can redistribute it and/or modify it
15  * under the terms of the GNU Lesser General Public License as published by
16  * the Free Software Foundation; either version 2.1 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with this program; if not, write to the Free Software Foundation,
26  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
27  *****************************************************************************/
28
29 #ifndef VLC_OPENGL_H
30 #define VLC_OPENGL_H
31
32 #include <vlc_common.h>
33 #include <vlc_picture_pool.h>
34 #include <vlc_opengl.h>
35
36 /* Change USE_OPENGL_ES value to set the OpenGL ES version (1, 2) you want to use
37  * A value of 0 will activate normal OpenGL */
38 #ifdef __APPLE__
39 # include <TargetConditionals.h>
40 # if !TARGET_OS_IPHONE
41 #  define USE_OPENGL_ES 0
42 #  define MACOS_OPENGL
43 #  include <OpenGL/gl.h>
44 # else /* Force ESv2 on iOS */
45 #  define USE_OPENGL_ES 2
46 #  include <OpenGLES/ES1/gl.h>
47 #  include <OpenGLES/ES2/gl.h>
48 #  include <OpenGLES/ES2/glext.h>
49 # endif
50 #else /* !defined (__APPLE__) */
51 # ifndef USE_OPENGL_ES
52 #  define USE_OPENGL_ES 0
53 # endif
54 # if USE_OPENGL_ES == 2
55 #  include <GLES2/gl2.h>
56 # elif USE_OPENGL_ES == 1
57 #  include <GLES/gl.h>
58 # else
59 #  ifdef _WIN32
60 #   include <GL/glew.h>
61 #   undef glClientActiveTexture
62 #   undef glActiveTexture
63     PFNGLACTIVETEXTUREPROC glActiveTexture;
64     PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture;
65 #  endif
66 #  include <GL/gl.h>
67 # endif
68 #endif
69
70 static inline bool HasExtension(const char *apis, const char *api)
71 {
72     size_t apilen = strlen(api);
73     while (apis) {
74         while (*apis == ' ')
75             apis++;
76         if (!strncmp(apis, api, apilen) && memchr(" ", apis[apilen], 2))
77             return true;
78         apis = strchr(apis, ' ');
79     }
80     return false;
81 }
82
83 typedef struct vout_display_opengl_t vout_display_opengl_t;
84
85 vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
86                                                const vlc_fourcc_t **subpicture_chromas,
87                                                vlc_gl_t *gl);
88 void vout_display_opengl_Delete(vout_display_opengl_t *vgl);
89
90 picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned);
91
92 int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
93                                 picture_t *picture, subpicture_t *subpicture);
94 int vout_display_opengl_Display(vout_display_opengl_t *vgl,
95                                 const video_format_t *source);
96
97 #endif