summaryrefslogtreecommitdiff
path: root/gst-libs/gst/gl/gstglapi.c
blob: 86ff505cca2f3b05a23da873e23ee6d3e6360dba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
 * GStreamer
 * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#include "gstglapi.h"

#define GST_GL_EXT_BEGIN(name, min_gl, maj_gl, in_gles, ext_suf, ext_name)
#define GST_GL_EXT_FUNCTION(ret, name, args) \
  NULL,
#define GST_GL_EXT_END()

#if HAVE_OPENGL
static GstGLFuncs gst_gl = {
#include "glprototypes/opengl.h"
  {NULL,},
#include "glprototypes/gles1opengl.h"
  {NULL,},
#include "glprototypes/gles2opengl.h"
  {NULL,},
#include "glprototypes/gles1gles2opengl.h"
  {NULL,},
};

const GstGLFuncs *
gst_gl_get_opengl_vtable (void)
{
  return &gst_gl;
}
#endif

#if HAVE_GLES2
static GstGLES2Funcs gst_gles2 = {
#include "glprototypes/gles1gles2.h"
  {NULL,},
#include "glprototypes/gles1gles2opengl.h"
  {NULL,},
#include "glprototypes/gles2.h"
  {NULL,},
#include "glprototypes/gles2opengl.h"
  {NULL,},
};

const GstGLES2Funcs *
gst_gl_get_gles2_vtable (void)
{
  return &gst_gles2;
}
#endif

#undef GST_GL_EXT_BEGIN
#undef GST_GL_EXT_FUNCTION
#undef GST_GL_EXT_END

gchar *
gst_gl_api_string (GstGLAPI api)
{
  GString *str = NULL;

  if (api == GST_GL_API_NONE) {
    str = g_string_new ("none");
    return str->str;
  } else if (api == GST_GL_API_ANY) {
    str = g_string_new ("any");
    return str->str;
  }

  if (api & GST_GL_API_OPENGL) {
    str = g_string_new ("opengl");
  }
  if (api & GST_GL_API_OPENGL3) {
    if (str) {
      g_string_append (str, " opengl3");
    } else {
      str = g_string_new ("opengl3");
    }
  }
  if (api & GST_GL_API_GLES) {
    if (str) {
      g_string_append (str, " gles1");
    } else {
      str = g_string_new ("gles1");
    }
  }
  if (api & GST_GL_API_GLES2) {
    if (str) {
      g_string_append (str, " gles2");
    } else {
      str = g_string_new ("gles2");
    }
  }
  if (api & GST_GL_API_GLES3) {
    if (str) {
      g_string_append (str, " gles3");
    } else {
      str = g_string_new ("gles3");
    }
  }

  return str->str;
}