1/*
2 * GStreamer
3 * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifndef _GST_GL_RENDERBUFFER_H_
22#define _GST_GL_RENDERBUFFER_H_
23
24#include <gst/gl/gstglbasememory.h>
25
26G_BEGIN_DECLS
27
28#define GST_TYPE_GL_RENDERBUFFER_ALLOCATOR (gst_gl_renderbuffer_allocator_get_type())
29GST_GL_API GType gst_gl_renderbuffer_allocator_get_type(void);
30
31#define GST_IS_GL_RENDERBUFFER_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR))
32#define GST_IS_GL_RENDERBUFFER_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR))
33#define GST_GL_RENDERBUFFER_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, GstGLRenderbufferAllocatorClass))
34#define GST_GL_RENDERBUFFER_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, GstGLRenderbufferAllocator))
35#define GST_GL_RENDERBUFFER_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, GstGLRenderbufferAllocatorClass))
36#define GST_GL_RENDERBUFFER_ALLOCATOR_CAST(obj) ((GstGLRenderbufferAllocator *)(obj))
37
38#define GST_GL_RENDERBUFFER_CAST(obj) ((GstGLRenderbuffer *) obj)
39
40/**
41 * GST_GL_RENDERBUFFER_ALLOCATOR_NAME:
42 *
43 * The name of the GL renderbuffer allocator
44 */
45#define GST_GL_RENDERBUFFER_ALLOCATOR_NAME "GLRenderbuffer"
46
47/**
48 * GstGLRenderbuffer:
49 * @renderbuffer_id: the GL texture id for this memory
50 * @renderbuffer_format: the texture type
51 * @width: the width
52 * @height: the height
53 *
54 * Represents information about a GL renderbuffer
55 */
56struct _GstGLRenderbuffer
57{
58 /*< private >*/
59 GstGLBaseMemory mem;
60
61 /*< public >*/
62 guint renderbuffer_id;
63 GstGLFormat renderbuffer_format;
64 guint width;
65 guint height;
66
67 /*< protected >*/
68 gboolean renderbuffer_wrapped;
69
70 /*< private >*/
71 gpointer _padding[GST_PADDING];
72};
73
74/**
75 * GstGLRenderbufferAllocator:
76 *
77 * Opaque #GstGLRenderbufferAllocator struct
78 */
79struct _GstGLRenderbufferAllocator
80{
81 GstGLBaseMemoryAllocator parent;
82
83 /*< private >*/
84 gpointer _padding[GST_PADDING];
85};
86
87/**
88 * GstGLRenderbufferAllocatorClass:
89 *
90 * The #GstGLRenderbufferAllocatorClass only contains private data
91 */
92struct _GstGLRenderbufferAllocatorClass
93{
94 GstGLBaseMemoryAllocatorClass parent_class;
95
96 /*< private >*/
97 gpointer _padding[GST_PADDING];
98};
99
100#include <gst/gl/gstglbasememory.h>
101
102typedef struct _GstGLRenderbufferAllocationParams GstGLRenderbufferAllocationParams;
103
104GST_GL_API GType gst_gl_renderbuffer_allocation_params_get_type (void);
105#define GST_TYPE_RENDERBUFFER_ALLOCATION_PARAMS (gst_gl_renderbuffer_allocation_params_get_type)
106
107/**
108 * GstGLRenderbufferAllocationParams:
109 * @renderbuffer_format: the #GstGLFormat
110 * @width: the width
111 * @height: the height
112 *
113 * Allocation parameters
114 */
115struct _GstGLRenderbufferAllocationParams
116{
117 /*< private >*/
118 GstGLAllocationParams parent;
119
120 /*< public >*/
121 GstGLFormat renderbuffer_format;
122 guint width;
123 guint height;
124
125 /*< private >*/
126 gpointer _padding[GST_PADDING];
127};
128
129GST_GL_API
130GstGLRenderbufferAllocationParams * gst_gl_renderbuffer_allocation_params_new (GstGLContext * context,
131 const GstAllocationParams * alloc_params,
132 GstGLFormat renderbuffer_format,
133 guint width,
134 guint height);
135
136GST_GL_API
137GstGLRenderbufferAllocationParams * gst_gl_renderbuffer_allocation_params_new_wrapped (GstGLContext * context,
138 const GstAllocationParams * alloc_params,
139 GstGLFormat renderbuffer_format,
140 guint width,
141 guint height,
142 gpointer gl_handle,
143 gpointer user_data,
144 GDestroyNotify notify);
145
146/**
147 * GST_TYPE_GL_RENDERBUFFER:
148 *
149 * Since: 1.20
150 */
151#define GST_TYPE_GL_RENDERBUFFER (gst_gl_renderbuffer_get_type())
152GST_GL_API
153GType gst_gl_renderbuffer_get_type(void);
154
155GST_GL_API
156void gst_gl_renderbuffer_init_once (void);
157
158GST_GL_API
159gboolean gst_is_gl_renderbuffer (GstMemory * mem);
160
161/* accessors */
162GST_GL_API
163gint gst_gl_renderbuffer_get_width (GstGLRenderbuffer * gl_mem);
164
165GST_GL_API
166gint gst_gl_renderbuffer_get_height (GstGLRenderbuffer * gl_mem);
167
168GST_GL_API
169GstGLFormat gst_gl_renderbuffer_get_format (GstGLRenderbuffer * gl_mem);
170
171GST_GL_API
172guint gst_gl_renderbuffer_get_id (GstGLRenderbuffer * gl_mem);
173
174G_END_DECLS
175
176#endif /* _GST_GL_RENDERBUFFER_H_ */
177

source code of include/gstreamer-1.0/gst/gl/gstglrenderbuffer.h