mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
applemedia: rename IOSurfaceMemory -> IOSurfaceGLMemory
This commit is contained in:
parent
0560946c82
commit
acac78c1ce
6 changed files with 137 additions and 134 deletions
|
@ -23,7 +23,7 @@
|
||||||
#include "corevideobuffer.h"
|
#include "corevideobuffer.h"
|
||||||
#include "corevideomemory.h"
|
#include "corevideomemory.h"
|
||||||
#if !HAVE_IOS
|
#if !HAVE_IOS
|
||||||
#include "iosurfacememory.h"
|
#include "iosurfaceglmemory.h"
|
||||||
#endif
|
#endif
|
||||||
#include "videotexturecache-gl.h"
|
#include "videotexturecache-gl.h"
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ _create_glmem (GstAppleCoreVideoPixelBuffer * gpixbuf,
|
||||||
#if HAVE_IOS
|
#if HAVE_IOS
|
||||||
return gst_video_texture_cache_create_memory (cache, gpixbuf, plane, size);
|
return gst_video_texture_cache_create_memory (cache, gpixbuf, plane, size);
|
||||||
#else
|
#else
|
||||||
GstIOSurfaceMemory *mem;
|
GstIOSurfaceGLMemory *mem;
|
||||||
CVPixelBufferRef pixel_buf = gpixbuf->buf;
|
CVPixelBufferRef pixel_buf = gpixbuf->buf;
|
||||||
IOSurfaceRef surface = CVPixelBufferGetIOSurface (pixel_buf);
|
IOSurfaceRef surface = CVPixelBufferGetIOSurface (pixel_buf);
|
||||||
GstGLFormat tex_format;
|
GstGLFormat tex_format;
|
||||||
|
@ -116,7 +116,7 @@ _create_glmem (GstAppleCoreVideoPixelBuffer * gpixbuf,
|
||||||
tex_format = gst_gl_format_from_video_info (cache_gl->ctx, info, plane);
|
tex_format = gst_gl_format_from_video_info (cache_gl->ctx, info, plane);
|
||||||
|
|
||||||
CFRetain (pixel_buf);
|
CFRetain (pixel_buf);
|
||||||
mem = gst_io_surface_memory_wrapped (cache_gl->ctx,
|
mem = gst_io_surface_gl_memory_wrapped (cache_gl->ctx,
|
||||||
surface, GST_GL_TEXTURE_TARGET_RECTANGLE, tex_format,
|
surface, GST_GL_TEXTURE_TARGET_RECTANGLE, tex_format,
|
||||||
info, plane, NULL, pixel_buf, (GDestroyNotify) CFRelease);
|
info, plane, NULL, pixel_buf, (GDestroyNotify) CFRelease);
|
||||||
return GST_MEMORY_CAST (mem);
|
return GST_MEMORY_CAST (mem);
|
||||||
|
|
|
@ -22,27 +22,27 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "iosurfacememory.h"
|
#include "iosurfaceglmemory.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_IO_SURFACE_MEMORY);
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_IO_SURFACE_GL_MEMORY);
|
||||||
#define GST_CAT_DEFAULT GST_CAT_IO_SURFACE_MEMORY
|
#define GST_CAT_DEFAULT GST_CAT_IO_SURFACE_GL_MEMORY
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstIOSurfaceMemoryAllocator, gst_io_surface_memory_allocator,
|
G_DEFINE_TYPE (GstIOSurfaceGLMemoryAllocator,
|
||||||
GST_TYPE_GL_MEMORY_ALLOCATOR);
|
gst_io_surface_gl_memory_allocator, GST_TYPE_GL_MEMORY_ALLOCATOR);
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GstIOSurfaceMemory *memory;
|
GstIOSurfaceGLMemory *memory;
|
||||||
IOSurfaceRef surface;
|
IOSurfaceRef surface;
|
||||||
} ContextThreadData;
|
} ContextThreadData;
|
||||||
|
|
||||||
static void _io_surface_memory_set_surface (GstIOSurfaceMemory * memory,
|
static void _io_surface_gl_memory_set_surface (GstIOSurfaceGLMemory * memory,
|
||||||
IOSurfaceRef surface);
|
IOSurfaceRef surface);
|
||||||
|
|
||||||
static GstAllocator *_io_surface_memory_allocator;
|
static GstAllocator *_io_surface_gl_memory_allocator;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_io_surface_memory_create (GstGLBaseMemory * bmem, GError ** error)
|
_io_surface_gl_memory_create (GstGLBaseMemory * bmem, GError ** error)
|
||||||
{
|
{
|
||||||
GstGLMemory *gl_mem = (GstGLMemory *) bmem;
|
GstGLMemory *gl_mem = (GstGLMemory *) bmem;
|
||||||
GstGLContext *context = gl_mem->mem.context;
|
GstGLContext *context = gl_mem->mem.context;
|
||||||
|
@ -60,19 +60,19 @@ _io_surface_memory_create (GstGLBaseMemory * bmem, GError ** error)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_io_surface_memory_destroy (GstGLBaseMemory * gl_mem)
|
_io_surface_gl_memory_destroy (GstGLBaseMemory * gl_mem)
|
||||||
{
|
{
|
||||||
GST_GL_BASE_MEMORY_ALLOCATOR_CLASS
|
GST_GL_BASE_MEMORY_ALLOCATOR_CLASS
|
||||||
(gst_io_surface_memory_allocator_parent_class)->destroy (gl_mem);
|
(gst_io_surface_gl_memory_allocator_parent_class)->destroy (gl_mem);
|
||||||
_io_surface_memory_set_surface ((GstIOSurfaceMemory *) gl_mem, NULL);
|
_io_surface_gl_memory_set_surface ((GstIOSurfaceGLMemory *) gl_mem, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
_io_surface_memory_allocator_map (GstGLBaseMemory * bmem,
|
_io_surface_gl_memory_allocator_map (GstGLBaseMemory * bmem,
|
||||||
GstMapInfo * info, gsize size)
|
GstMapInfo * info, gsize size)
|
||||||
{
|
{
|
||||||
GstGLMemory *gl_mem = (GstGLMemory *) bmem;
|
GstGLMemory *gl_mem = (GstGLMemory *) bmem;
|
||||||
GstIOSurfaceMemory *mem = (GstIOSurfaceMemory *) gl_mem;
|
GstIOSurfaceGLMemory *mem = (GstIOSurfaceGLMemory *) gl_mem;
|
||||||
|
|
||||||
GST_LOG ("mapping surface %p flags %d gl? %d",
|
GST_LOG ("mapping surface %p flags %d gl? %d",
|
||||||
mem->surface, info->flags, ((info->flags & GST_MAP_GL) != 0));
|
mem->surface, info->flags, ((info->flags & GST_MAP_GL) != 0));
|
||||||
|
@ -89,10 +89,11 @@ _io_surface_memory_allocator_map (GstGLBaseMemory * bmem,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_io_surface_memory_allocator_unmap (GstGLBaseMemory * bmem, GstMapInfo * info)
|
_io_surface_gl_memory_allocator_unmap (GstGLBaseMemory * bmem,
|
||||||
|
GstMapInfo * info)
|
||||||
{
|
{
|
||||||
GstGLMemory *gl_mem = (GstGLMemory *) bmem;
|
GstGLMemory *gl_mem = (GstGLMemory *) bmem;
|
||||||
GstIOSurfaceMemory *mem = (GstIOSurfaceMemory *) gl_mem;
|
GstIOSurfaceGLMemory *mem = (GstIOSurfaceGLMemory *) gl_mem;
|
||||||
|
|
||||||
GST_LOG ("unmapping surface %p flags %d gl? %d",
|
GST_LOG ("unmapping surface %p flags %d gl? %d",
|
||||||
mem->surface, info->flags, ((info->flags & GST_MAP_GL) != 0));
|
mem->surface, info->flags, ((info->flags & GST_MAP_GL) != 0));
|
||||||
|
@ -105,15 +106,15 @@ _io_surface_memory_allocator_unmap (GstGLBaseMemory * bmem, GstMapInfo * info)
|
||||||
static GstMemory *
|
static GstMemory *
|
||||||
_mem_alloc (GstAllocator * allocator, gsize size, GstAllocationParams * params)
|
_mem_alloc (GstAllocator * allocator, gsize size, GstAllocationParams * params)
|
||||||
{
|
{
|
||||||
g_warning ("use gst_io_surface_memory_wrapped () to allocate from this "
|
g_warning ("use gst_io_surface_gl_memory_wrapped () to allocate from this "
|
||||||
"IOSurface allocator");
|
"IOSurface allocator");
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_io_surface_memory_allocator_class_init (GstIOSurfaceMemoryAllocatorClass *
|
gst_io_surface_gl_memory_allocator_class_init
|
||||||
klass)
|
(GstIOSurfaceGLMemoryAllocatorClass * klass)
|
||||||
{
|
{
|
||||||
GstAllocatorClass *allocator_class = (GstAllocatorClass *) klass;
|
GstAllocatorClass *allocator_class = (GstAllocatorClass *) klass;
|
||||||
GstGLBaseMemoryAllocatorClass *gl_base_allocator_class =
|
GstGLBaseMemoryAllocatorClass *gl_base_allocator_class =
|
||||||
|
@ -121,50 +122,51 @@ gst_io_surface_memory_allocator_class_init (GstIOSurfaceMemoryAllocatorClass *
|
||||||
|
|
||||||
allocator_class->alloc = _mem_alloc;
|
allocator_class->alloc = _mem_alloc;
|
||||||
|
|
||||||
gl_base_allocator_class->create = _io_surface_memory_create;
|
gl_base_allocator_class->create = _io_surface_gl_memory_create;
|
||||||
gl_base_allocator_class->destroy = _io_surface_memory_destroy;
|
gl_base_allocator_class->destroy = _io_surface_gl_memory_destroy;
|
||||||
gl_base_allocator_class->map = _io_surface_memory_allocator_map;
|
gl_base_allocator_class->map = _io_surface_gl_memory_allocator_map;
|
||||||
gl_base_allocator_class->unmap = _io_surface_memory_allocator_unmap;
|
gl_base_allocator_class->unmap = _io_surface_gl_memory_allocator_unmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_io_surface_memory_allocator_init (GstIOSurfaceMemoryAllocator * allocator)
|
gst_io_surface_gl_memory_allocator_init (GstIOSurfaceGLMemoryAllocator *
|
||||||
|
allocator)
|
||||||
{
|
{
|
||||||
GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
|
GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
|
||||||
|
|
||||||
alloc->mem_type = GST_IO_SURFACE_MEMORY_ALLOCATOR_NAME;
|
alloc->mem_type = GST_IO_SURFACE_GL_MEMORY_ALLOCATOR_NAME;
|
||||||
GST_OBJECT_FLAG_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC);
|
GST_OBJECT_FLAG_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_ios_surface_memory_init (void)
|
gst_ios_surface_gl_memory_init (void)
|
||||||
{
|
{
|
||||||
static volatile gsize _init = 0;
|
static volatile gsize _init = 0;
|
||||||
|
|
||||||
if (g_once_init_enter (&_init)) {
|
if (g_once_init_enter (&_init)) {
|
||||||
GST_DEBUG_CATEGORY_INIT (GST_CAT_IO_SURFACE_MEMORY, "iosurface", 0,
|
GST_DEBUG_CATEGORY_INIT (GST_CAT_IO_SURFACE_GL_MEMORY, "iosurfacegl", 0,
|
||||||
"IOSurface Buffer");
|
"IOSurface Buffer");
|
||||||
|
|
||||||
_io_surface_memory_allocator =
|
_io_surface_gl_memory_allocator =
|
||||||
g_object_new (GST_TYPE_IO_SURFACE_MEMORY_ALLOCATOR, NULL);
|
g_object_new (GST_TYPE_IO_SURFACE_GL_MEMORY_ALLOCATOR, NULL);
|
||||||
gst_object_ref_sink (_io_surface_memory_allocator);
|
gst_object_ref_sink (_io_surface_gl_memory_allocator);
|
||||||
|
|
||||||
gst_allocator_register (GST_IO_SURFACE_MEMORY_ALLOCATOR_NAME,
|
gst_allocator_register (GST_IO_SURFACE_GL_MEMORY_ALLOCATOR_NAME,
|
||||||
gst_object_ref (_io_surface_memory_allocator));
|
gst_object_ref (_io_surface_gl_memory_allocator));
|
||||||
g_once_init_leave (&_init, 1);
|
g_once_init_leave (&_init, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_is_io_surface_memory (GstMemory * mem)
|
gst_is_io_surface_gl_memory (GstMemory * mem)
|
||||||
{
|
{
|
||||||
return mem != NULL && mem->allocator != NULL &&
|
return mem != NULL && mem->allocator != NULL &&
|
||||||
g_type_is_a (G_OBJECT_TYPE (mem->allocator),
|
g_type_is_a (G_OBJECT_TYPE (mem->allocator),
|
||||||
GST_TYPE_IO_SURFACE_MEMORY_ALLOCATOR);
|
GST_TYPE_IO_SURFACE_GL_MEMORY_ALLOCATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstIOSurfaceMemory *
|
static GstIOSurfaceGLMemory *
|
||||||
_io_surface_memory_new (GstGLContext * context,
|
_io_surface_gl_memory_new (GstGLContext * context,
|
||||||
IOSurfaceRef surface,
|
IOSurfaceRef surface,
|
||||||
GstGLTextureTarget target,
|
GstGLTextureTarget target,
|
||||||
GstGLFormat tex_format,
|
GstGLFormat tex_format,
|
||||||
|
@ -172,24 +174,25 @@ _io_surface_memory_new (GstGLContext * context,
|
||||||
guint plane,
|
guint plane,
|
||||||
GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify)
|
GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify)
|
||||||
{
|
{
|
||||||
GstIOSurfaceMemory *mem;
|
GstIOSurfaceGLMemory *mem;
|
||||||
|
|
||||||
g_return_val_if_fail (target == GST_GL_TEXTURE_TARGET_RECTANGLE, NULL);
|
g_return_val_if_fail (target == GST_GL_TEXTURE_TARGET_RECTANGLE, NULL);
|
||||||
|
|
||||||
mem = g_new0 (GstIOSurfaceMemory, 1);
|
mem = g_new0 (GstIOSurfaceGLMemory, 1);
|
||||||
gst_gl_memory_init (&mem->gl_mem, _io_surface_memory_allocator, NULL, context,
|
gst_gl_memory_init (&mem->gl_mem, _io_surface_gl_memory_allocator, NULL,
|
||||||
target, tex_format, NULL, info, plane, valign, user_data, notify);
|
context, target, tex_format, NULL, info, plane, valign, user_data,
|
||||||
|
notify);
|
||||||
|
|
||||||
GST_MINI_OBJECT_FLAG_SET (mem, GST_MEMORY_FLAG_READONLY);
|
GST_MINI_OBJECT_FLAG_SET (mem, GST_MEMORY_FLAG_READONLY);
|
||||||
|
|
||||||
mem->surface = NULL;
|
mem->surface = NULL;
|
||||||
gst_io_surface_memory_set_surface (mem, surface);
|
gst_io_surface_gl_memory_set_surface (mem, surface);
|
||||||
|
|
||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstIOSurfaceMemory *
|
GstIOSurfaceGLMemory *
|
||||||
gst_io_surface_memory_wrapped (GstGLContext * context,
|
gst_io_surface_gl_memory_wrapped (GstGLContext * context,
|
||||||
IOSurfaceRef surface,
|
IOSurfaceRef surface,
|
||||||
GstGLTextureTarget target,
|
GstGLTextureTarget target,
|
||||||
GstGLFormat tex_format,
|
GstGLFormat tex_format,
|
||||||
|
@ -197,12 +200,12 @@ gst_io_surface_memory_wrapped (GstGLContext * context,
|
||||||
guint plane,
|
guint plane,
|
||||||
GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify)
|
GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify)
|
||||||
{
|
{
|
||||||
return _io_surface_memory_new (context, surface, target, tex_format, info,
|
return _io_surface_gl_memory_new (context, surface, target, tex_format, info,
|
||||||
plane, valign, user_data, notify);
|
plane, valign, user_data, notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_io_surface_memory_set_surface (GstIOSurfaceMemory * memory,
|
_io_surface_gl_memory_set_surface (GstIOSurfaceGLMemory * memory,
|
||||||
IOSurfaceRef surface)
|
IOSurfaceRef surface)
|
||||||
{
|
{
|
||||||
GstGLMemory *gl_mem = (GstGLMemory *) memory;
|
GstGLMemory *gl_mem = (GstGLMemory *) memory;
|
||||||
|
@ -239,17 +242,17 @@ _io_surface_memory_set_surface (GstIOSurfaceMemory * memory,
|
||||||
static void
|
static void
|
||||||
_do_set_surface (GstGLContext * context, ContextThreadData * data)
|
_do_set_surface (GstGLContext * context, ContextThreadData * data)
|
||||||
{
|
{
|
||||||
_io_surface_memory_set_surface (data->memory, data->surface);
|
_io_surface_gl_memory_set_surface (data->memory, data->surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_io_surface_memory_set_surface (GstIOSurfaceMemory * memory,
|
gst_io_surface_gl_memory_set_surface (GstIOSurfaceGLMemory * memory,
|
||||||
IOSurfaceRef surface)
|
IOSurfaceRef surface)
|
||||||
{
|
{
|
||||||
GstGLContext *context;
|
GstGLContext *context;
|
||||||
ContextThreadData data = { memory, surface };
|
ContextThreadData data = { memory, surface };
|
||||||
|
|
||||||
g_return_if_fail (gst_is_io_surface_memory ((GstMemory *) memory));
|
g_return_if_fail (gst_is_io_surface_gl_memory ((GstMemory *) memory));
|
||||||
|
|
||||||
context = memory->gl_mem.mem.context;
|
context = memory->gl_mem.mem.context;
|
||||||
gst_gl_context_thread_add (context,
|
gst_gl_context_thread_add (context,
|
80
sys/applemedia/iosurfaceglmemory.h
Normal file
80
sys/applemedia/iosurfaceglmemory.h
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* GStreamer
|
||||||
|
* Copyright (C) 2015 Alessandro Decina <twi@centricular.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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GST_IO_SURFACE_GL_MEMORY_H_
|
||||||
|
#define _GST_IO_SURFACE_GL_MEMORY_H_
|
||||||
|
|
||||||
|
#include <IOSurface/IOSurface.h>
|
||||||
|
#include <gst/gst.h>
|
||||||
|
#include <gst/gstallocator.h>
|
||||||
|
#include <gst/video/video.h>
|
||||||
|
#include <gst/gl/gl.h>
|
||||||
|
#include <gst/gl/gstglfuncs.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GST_TYPE_IO_SURFACE_GL_MEMORY_ALLOCATOR (gst_io_surface_gl_memory_allocator_get_type())
|
||||||
|
GType gst_io_surface_gl_memory_allocator_get_type(void);
|
||||||
|
|
||||||
|
#define GST_IS_IO_SURFACE_GL_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_IO_SURFACE_GL_MEMORY_ALLOCATOR))
|
||||||
|
#define GST_IS_IO_SURFACE_GL_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_IO_SURFACE_GL_MEMORY_ALLOCATOR))
|
||||||
|
#define GST_IO_SURFACE_GL_MEMORY_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_IO_SURFACE_GL_MEMORY_ALLOCATOR, GstIOSurfaceGLMemoryAllocatorClass))
|
||||||
|
#define GST_IO_SURFACE_GL_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_IO_SURFACE_GL_MEMORY_ALLOCATOR, GstIOSurfaceGLMemoryAllocator))
|
||||||
|
#define GST_IO_SURFACE_GL_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_IO_SURFACE_GL_MEMORY_ALLOCATOR, GstIOSurfaceGLMemoryAllocatorClass))
|
||||||
|
#define GST_IO_SURFACE_GL_MEMORY_ALLOCATOR_CAST(obj) ((GstIOSurfaceGLMemoryAllocator *)(obj))
|
||||||
|
|
||||||
|
typedef struct _GstIOSurfaceGLMemory
|
||||||
|
{
|
||||||
|
GstGLMemory gl_mem;
|
||||||
|
IOSurfaceRef surface;
|
||||||
|
} GstIOSurfaceGLMemory;
|
||||||
|
|
||||||
|
#define GST_IO_SURFACE_GL_MEMORY_ALLOCATOR_NAME "IOSurfaceGLMemory"
|
||||||
|
|
||||||
|
void gst_ios_surface_gl_memory_init (void);
|
||||||
|
|
||||||
|
GstIOSurfaceGLMemory *
|
||||||
|
gst_io_surface_gl_memory_wrapped (GstGLContext * context,
|
||||||
|
IOSurfaceRef surface,
|
||||||
|
GstGLTextureTarget target,
|
||||||
|
GstGLFormat tex_format,
|
||||||
|
GstVideoInfo * info,
|
||||||
|
guint plane,
|
||||||
|
GstVideoAlignment *valign,
|
||||||
|
gpointer user_data,
|
||||||
|
GDestroyNotify notify);
|
||||||
|
|
||||||
|
void gst_io_surface_gl_memory_set_surface (GstIOSurfaceGLMemory *memory, IOSurfaceRef surface);
|
||||||
|
|
||||||
|
gboolean gst_is_io_surface_gl_memory (GstMemory * mem);
|
||||||
|
|
||||||
|
typedef struct _GstIOSurfaceGLMemoryAllocator
|
||||||
|
{
|
||||||
|
GstGLMemoryAllocator allocator;
|
||||||
|
} GstIOSurfaceGLMemoryAllocator;
|
||||||
|
|
||||||
|
typedef struct _GstIOSurfaceGLMemoryAllocatorClass
|
||||||
|
{
|
||||||
|
GstGLMemoryAllocatorClass parent_class;
|
||||||
|
} GstIOSurfaceGLMemoryAllocatorClass;
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* _GST_IO_SURFACE_MEMORY_H_ */
|
|
@ -1,80 +0,0 @@
|
||||||
/*
|
|
||||||
* GStreamer
|
|
||||||
* Copyright (C) 2015 Alessandro Decina <twi@centricular.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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _GST_IO_SURFACE_MEMORY_H_
|
|
||||||
#define _GST_IO_SURFACE_MEMORY_H_
|
|
||||||
|
|
||||||
#include <IOSurface/IOSurface.h>
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/gstallocator.h>
|
|
||||||
#include <gst/video/video.h>
|
|
||||||
#include <gst/gl/gl.h>
|
|
||||||
#include <gst/gl/gstglfuncs.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define GST_TYPE_IO_SURFACE_MEMORY_ALLOCATOR (gst_io_surface_memory_allocator_get_type())
|
|
||||||
GType gst_io_surface_memory_allocator_get_type(void);
|
|
||||||
|
|
||||||
#define GST_IS_IO_SURFACE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_IO_SURFACE_MEMORY_ALLOCATOR))
|
|
||||||
#define GST_IS_IO_SURFACE_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_IO_SURFACE_MEMORY_ALLOCATOR))
|
|
||||||
#define GST_IO_SURFACE_MEMORY_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_IO_SURFACE_MEMORY_ALLOCATOR, GstIOSurfaceMemoryAllocatorClass))
|
|
||||||
#define GST_IO_SURFACE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_IO_SURFACE_MEMORY_ALLOCATOR, GstIOSurfaceMemoryAllocator))
|
|
||||||
#define GST_IO_SURFACE_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_IO_SURFACE_MEMORY_ALLOCATOR, GstIOSurfaceMemoryAllocatorClass))
|
|
||||||
#define GST_IO_SURFACE_MEMORY_ALLOCATOR_CAST(obj) ((GstIOSurfaceMemoryAllocator *)(obj))
|
|
||||||
|
|
||||||
typedef struct _GstIOSurfaceMemory
|
|
||||||
{
|
|
||||||
GstGLMemory gl_mem;
|
|
||||||
IOSurfaceRef surface;
|
|
||||||
} GstIOSurfaceMemory;
|
|
||||||
|
|
||||||
#define GST_IO_SURFACE_MEMORY_ALLOCATOR_NAME "IOSurfaceMemory"
|
|
||||||
|
|
||||||
void gst_ios_surface_memory_init (void);
|
|
||||||
|
|
||||||
GstIOSurfaceMemory *
|
|
||||||
gst_io_surface_memory_wrapped (GstGLContext * context,
|
|
||||||
IOSurfaceRef surface,
|
|
||||||
GstGLTextureTarget target,
|
|
||||||
GstGLFormat tex_format,
|
|
||||||
GstVideoInfo * info,
|
|
||||||
guint plane,
|
|
||||||
GstVideoAlignment *valign,
|
|
||||||
gpointer user_data,
|
|
||||||
GDestroyNotify notify);
|
|
||||||
|
|
||||||
void gst_io_surface_memory_set_surface (GstIOSurfaceMemory *memory, IOSurfaceRef surface);
|
|
||||||
|
|
||||||
gboolean gst_is_io_surface_memory (GstMemory * mem);
|
|
||||||
|
|
||||||
typedef struct _GstIOSurfaceMemoryAllocator
|
|
||||||
{
|
|
||||||
GstGLMemoryAllocator allocator;
|
|
||||||
} GstIOSurfaceMemoryAllocator;
|
|
||||||
|
|
||||||
typedef struct _GstIOSurfaceMemoryAllocatorClass
|
|
||||||
{
|
|
||||||
GstGLMemoryAllocatorClass parent_class;
|
|
||||||
} GstIOSurfaceMemoryAllocatorClass;
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* _GST_IO_SURFACE_MEMORY_H_ */
|
|
|
@ -71,7 +71,7 @@ if host_system == 'ios'
|
||||||
applemedia_frameworks += [ios_media_dep]
|
applemedia_frameworks += [ios_media_dep]
|
||||||
else
|
else
|
||||||
applemedia_sources += [
|
applemedia_sources += [
|
||||||
'iosurfacememory.c'
|
'iosurfaceglmemory.c'
|
||||||
]
|
]
|
||||||
applemedia_objc_args += ['-mmacosx-version-min=10.8']
|
applemedia_objc_args += ['-mmacosx-version-min=10.8']
|
||||||
cocoa_dep = dependency('Cocoa', required : applemedia_option)
|
cocoa_dep = dependency('Cocoa', required : applemedia_option)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#if !HAVE_IOS
|
#if !HAVE_IOS
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
#include "iosurfacememory.h"
|
#include "iosurfaceglmemory.h"
|
||||||
#endif
|
#endif
|
||||||
#include "iosglmemory.h"
|
#include "iosglmemory.h"
|
||||||
#include "videotexturecache-gl.h"
|
#include "videotexturecache-gl.h"
|
||||||
|
@ -135,7 +135,7 @@ gst_video_texture_cache_gl_constructed (GObject * object)
|
||||||
CVOpenGLESTextureCacheCreate (kCFAllocatorDefault, (CFDictionaryRef) cache_attrs,
|
CVOpenGLESTextureCacheCreate (kCFAllocatorDefault, (CFDictionaryRef) cache_attrs,
|
||||||
(__bridge CVEAGLContext) (gpointer) gst_gl_context_get_gl_context (cache_gl->ctx), NULL, &cache_gl->cache);
|
(__bridge CVEAGLContext) (gpointer) gst_gl_context_get_gl_context (cache_gl->ctx), NULL, &cache_gl->cache);
|
||||||
#else
|
#else
|
||||||
gst_ios_surface_memory_init ();
|
gst_ios_surface_gl_memory_init ();
|
||||||
#if 0
|
#if 0
|
||||||
cache->pool = GST_BUFFER_POOL (gst_gl_buffer_pool_new (ctx));
|
cache->pool = GST_BUFFER_POOL (gst_gl_buffer_pool_new (ctx));
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue