| 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 | |
| 26 | G_BEGIN_DECLS |
| 27 | |
| 28 | #define GST_TYPE_GL_RENDERBUFFER_ALLOCATOR (gst_gl_renderbuffer_allocator_get_type()) |
| 29 | GST_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 | */ |
| 56 | struct _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 | */ |
| 79 | struct _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 | */ |
| 92 | struct _GstGLRenderbufferAllocatorClass |
| 93 | { |
| 94 | GstGLBaseMemoryAllocatorClass parent_class; |
| 95 | |
| 96 | /*< private >*/ |
| 97 | gpointer _padding[GST_PADDING]; |
| 98 | }; |
| 99 | |
| 100 | #include <gst/gl/gstglbasememory.h> |
| 101 | |
| 102 | typedef struct _GstGLRenderbufferAllocationParams GstGLRenderbufferAllocationParams; |
| 103 | |
| 104 | GST_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 | */ |
| 115 | struct _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 | |
| 129 | GST_GL_API |
| 130 | GstGLRenderbufferAllocationParams * gst_gl_renderbuffer_allocation_params_new (GstGLContext * context, |
| 131 | const GstAllocationParams * alloc_params, |
| 132 | GstGLFormat renderbuffer_format, |
| 133 | guint width, |
| 134 | guint height); |
| 135 | |
| 136 | GST_GL_API |
| 137 | GstGLRenderbufferAllocationParams * 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()) |
| 152 | GST_GL_API |
| 153 | GType gst_gl_renderbuffer_get_type(void); |
| 154 | |
| 155 | GST_GL_API |
| 156 | void gst_gl_renderbuffer_init_once (void); |
| 157 | |
| 158 | GST_GL_API |
| 159 | gboolean gst_is_gl_renderbuffer (GstMemory * mem); |
| 160 | |
| 161 | /* accessors */ |
| 162 | GST_GL_API |
| 163 | gint gst_gl_renderbuffer_get_width (GstGLRenderbuffer * gl_mem); |
| 164 | |
| 165 | GST_GL_API |
| 166 | gint gst_gl_renderbuffer_get_height (GstGLRenderbuffer * gl_mem); |
| 167 | |
| 168 | GST_GL_API |
| 169 | GstGLFormat gst_gl_renderbuffer_get_format (GstGLRenderbuffer * gl_mem); |
| 170 | |
| 171 | GST_GL_API |
| 172 | guint gst_gl_renderbuffer_get_id (GstGLRenderbuffer * gl_mem); |
| 173 | |
| 174 | G_END_DECLS |
| 175 | |
| 176 | #endif /* _GST_GL_RENDERBUFFER_H_ */ |
| 177 | |