1 /*
2  * GStreamer
3  * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
4  * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef _GST_GL_MEMORY_PBO_H_
23 #define _GST_GL_MEMORY_PBO_H_
24 
25 #include <gst/gl/gstglmemory.h>
26 
27 G_BEGIN_DECLS
28 
29 #define GST_TYPE_GL_MEMORY_PBO_ALLOCATOR (gst_gl_memory_pbo_allocator_get_type())
30 GST_GL_API
31 GType gst_gl_memory_pbo_allocator_get_type(void);
32 
33 #define GST_IS_GL_MEMORY_PBO_ALLOCATOR(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR))
34 #define GST_IS_GL_MEMORY_PBO_ALLOCATOR_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR))
35 #define GST_GL_MEMORY_PBO_ALLOCATOR_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, GstGLMemoryPBOAllocatorClass))
36 #define GST_GL_MEMORY_PBO_ALLOCATOR(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, GstGLMemoryPBOAllocator))
37 #define GST_GL_MEMORY_PBO_ALLOCATOR_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, GstGLMemoryPBOAllocatorClass))
38 #define GST_GL_MEMORY_PBO_ALLOCATOR_CAST(obj)            ((GstGLMemoryPBOAllocator *)(obj))
39 
40 /**
41  * GstGLMemoryPBO:
42  *
43  * Private instance
44  */
45 struct _GstGLMemoryPBO
46 {
47   /* <private> */
48   GstGLMemory      mem;
49 
50   GstGLBuffer          *pbo;
51 
52   gpointer                  _padding[GST_PADDING];
53 };
54 
55 /**
56  * GST_GL_MEMORY_PBO_ALLOCATOR_NAME:
57  *
58  * The name of the GL Memory PBO allocator
59  */
60 #define GST_GL_MEMORY_PBO_ALLOCATOR_NAME   "GLMemoryPBO"
61 
62 GST_GL_API
63 void          gst_gl_memory_pbo_init_once               (void);
64 GST_GL_API
65 gboolean      gst_is_gl_memory_pbo                      (GstMemory * mem);
66 
67 GST_GL_API
68 void          gst_gl_memory_pbo_download_transfer       (GstGLMemoryPBO * gl_mem);
69 GST_GL_API
70 void          gst_gl_memory_pbo_upload_transfer         (GstGLMemoryPBO * gl_mem);
71 
72 GST_GL_API
73 gboolean      gst_gl_memory_pbo_copy_into_texture       (GstGLMemoryPBO *gl_mem,
74                                                          guint tex_id,
75                                                          GstGLTextureTarget target,
76                                                          GstGLFormat tex_format,
77                                                          gint width,
78                                                          gint height,
79                                                          gint stride,
80                                                          gboolean respecify);
81 
82 /**
83  * GstGLMemoryPBOAllocator:
84  *
85  * Opaque #GstGLMemoryPBOAllocator struct
86  */
87 struct _GstGLMemoryPBOAllocator
88 {
89   GstGLMemoryAllocator parent;
90 
91   /* <private> */
92   gpointer             _padding[GST_PADDING];
93 };
94 
95 /**
96  * GstGLMemoryPBOAllocatorClass:
97  *
98  * Only contains private data
99  */
100 struct _GstGLMemoryPBOAllocatorClass
101 {
102   GstGLMemoryAllocatorClass parent_class;
103 
104   /* <private> */
105   gpointer                  _padding[GST_PADDING];
106 };
107 
108 G_END_DECLS
109 
110 #endif /* _GST_GL_MEMORY_PBO_H_ */
111