1 /* 2 * GStreamer 3 * Copyright (C) 2016 Alessandro Decina <twi@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_IOS_GL_MEMORY_H_ 22 #define _GST_IOS_GL_MEMORY_H_ 23 24 #include <gst/gst.h> 25 #include <gst/gstallocator.h> 26 #include <gst/video/video.h> 27 #include <gst/gl/gl.h> 28 #include <gst/gl/gstglfuncs.h> 29 #include "corevideomemory.h" 30 31 G_BEGIN_DECLS 32 33 #define GST_TYPE_IOS_GL_MEMORY_ALLOCATOR (gst_ios_gl_memory_allocator_get_type()) 34 GType gst_ios_gl_memory_allocator_get_type(void); 35 36 #define GST_IS_IOS_GL_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_IOS_GL_MEMORY_ALLOCATOR)) 37 #define GST_IS_IOS_GL_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_IOS_GL_MEMORY_ALLOCATOR)) 38 #define GST_IOS_GL_MEMORY_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_IOS_GL_MEMORY_ALLOCATOR, GstIOSGLMemoryAllocatorClass)) 39 #define GST_IOS_GL_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_IOS_GL_MEMORY_ALLOCATOR, GstIOSGLMemoryAllocator)) 40 #define GST_IOS_GL_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_IOS_GL_MEMORY_ALLOCATOR, GstIOSGLMemoryAllocatorClass)) 41 #define GST_IOS_GL_MEMORY_ALLOCATOR_CAST(obj) ((GstIOSGLMemoryAllocator *)(obj)) 42 43 typedef struct _GstIOSGLMemory 44 { 45 GstGLMemory gl_mem; 46 GstAppleCoreVideoMemory *cv_mem; 47 gpointer gl_data; 48 GDestroyNotify gl_notify; 49 } GstIOSGLMemory; 50 51 #define GST_IOS_GL_MEMORY_ALLOCATOR_NAME "IOSGLMemory" 52 53 void gst_ios_gl_memory_init (void); 54 55 GstIOSGLMemory * 56 gst_ios_gl_memory_new_wrapped (GstGLContext * context, 57 GstAppleCoreVideoMemory *cv_mem, 58 GstGLTextureTarget target, 59 GstGLFormat tex_format, 60 guint tex_id, 61 GstVideoInfo * info, 62 guint plane, 63 GstVideoAlignment *valign, 64 gpointer gl_data, 65 GDestroyNotify gl_notify); 66 67 gboolean gst_is_ios_gl_memory (GstMemory * mem); 68 69 typedef struct _GstIOSGLMemoryAllocator 70 { 71 GstGLMemoryAllocator allocator; 72 } GstIOSGLMemoryAllocator; 73 74 typedef struct _GstIOSGLMemoryAllocatorClass 75 { 76 GstGLMemoryAllocatorClass parent_class; 77 } GstIOSGLMemoryAllocatorClass; 78 79 G_END_DECLS 80 81 #endif /* _GST_IOS_GL_MEMORY_H_ */ 82