applemedia: rename GstCoreVideoTextureCache to GstVideoTextureCache

First of a few commits to stop using CVOpenGLTextureCache on OSX and use
IOSurfaces directly instead. CVOpenGLTextureCache hasn't been updated for OpenGL
3 which is why texture sharing is currently disabled on OSX.
This commit is contained in:
Alessandro Decina 2015-12-10 16:22:08 +11:00
parent a8b01eb6d1
commit e730b0a8ab
6 changed files with 33 additions and 33 deletions

View file

@ -5,7 +5,7 @@ libgstapplemedia_la_SOURCES = \
vtutil.c \ vtutil.c \
corevideobuffer.c \ corevideobuffer.c \
coremediabuffer.c \ coremediabuffer.c \
corevideotexturecache.m \ videotexturecache.m \
atdec.c atdec.c
libgstapplemedia_la_CPPFLAGS = \ libgstapplemedia_la_CPPFLAGS = \
@ -62,7 +62,7 @@ noinst_HEADERS = \
vtutil.h \ vtutil.h \
corevideobuffer.h \ corevideobuffer.h \
coremediabuffer.h \ coremediabuffer.h \
corevideotexturecache.h \ videotexturecache.h \
atdec.h \ atdec.h \
iosassetsrc.h \ iosassetsrc.h \
avfassetsrc.h avfassetsrc.h

View file

@ -30,7 +30,7 @@
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/gl/gstglcontext.h> #include <gst/gl/gstglcontext.h>
#include "coremediabuffer.h" #include "coremediabuffer.h"
#include "corevideotexturecache.h" #include "videotexturecache.h"
#define DEFAULT_DEVICE_INDEX -1 #define DEFAULT_DEVICE_INDEX -1
#define DEFAULT_DO_STATS FALSE #define DEFAULT_DO_STATS FALSE
@ -107,7 +107,7 @@ G_DEFINE_TYPE (GstAVFVideoSrc, gst_avf_video_src, GST_TYPE_PUSH_SRC);
BOOL captureScreenMouseClicks; BOOL captureScreenMouseClicks;
BOOL useVideoMeta; BOOL useVideoMeta;
GstCoreVideoTextureCache *textureCache; GstVideoTextureCache *textureCache;
} }
- (id)init; - (id)init;
@ -765,7 +765,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
bufQueue = nil; bufQueue = nil;
if (textureCache) if (textureCache)
gst_core_video_texture_cache_free (textureCache); gst_video_texture_cache_free (textureCache);
textureCache = NULL; textureCache = NULL;
return YES; return YES;
@ -820,8 +820,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
if (glContext) { if (glContext) {
GST_INFO_OBJECT (element, "pushing textures. Internal format %s, context %p", GST_INFO_OBJECT (element, "pushing textures. Internal format %s, context %p",
gst_video_format_to_string (internalFormat), glContext); gst_video_format_to_string (internalFormat), glContext);
textureCache = gst_core_video_texture_cache_new (glContext); textureCache = gst_video_texture_cache_new (glContext);
gst_core_video_texture_cache_set_format (textureCache, internalFormat, caps); gst_video_texture_cache_set_format (textureCache, internalFormat, caps);
gst_object_unref (glContext); gst_object_unref (glContext);
} else { } else {
GST_WARNING_OBJECT (element, "got memory:GLMemory caps but not GL context from downstream element"); GST_WARNING_OBJECT (element, "got memory:GLMemory caps but not GL context from downstream element");
@ -959,7 +959,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
CFRelease (sbuf); CFRelease (sbuf);
if (textureCache != NULL) { if (textureCache != NULL) {
*buf = gst_core_video_texture_cache_get_gl_buffer (textureCache, *buf); *buf = gst_video_texture_cache_get_gl_buffer (textureCache, *buf);
if (*buf == NULL) if (*buf == NULL)
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }

View file

@ -22,11 +22,11 @@
#include <gst/video/gstvideometa.h> #include <gst/video/gstvideometa.h>
#include <gst/gl/gstglcontext.h> #include <gst/gl/gstglcontext.h>
#include "CoreVideo/CoreVideo.h" #include <CoreVideo/CoreVideo.h>
G_BEGIN_DECLS G_BEGIN_DECLS
typedef struct _GstCoreVideoTextureCache typedef struct _GstVideoTextureCache
{ {
GstGLContext *ctx; GstGLContext *ctx;
#if !HAVE_IOS #if !HAVE_IOS
@ -41,14 +41,14 @@ typedef struct _GstCoreVideoTextureCache
GstCaps *in_caps; GstCaps *in_caps;
GstCaps *out_caps; GstCaps *out_caps;
GstGLColorConvert *convert; GstGLColorConvert *convert;
} GstCoreVideoTextureCache; } GstVideoTextureCache;
GstCoreVideoTextureCache *gst_core_video_texture_cache_new (GstGLContext * ctx); GstVideoTextureCache *gst_video_texture_cache_new (GstGLContext * ctx);
void gst_core_video_texture_cache_free (GstCoreVideoTextureCache * cache); void gst_video_texture_cache_free (GstVideoTextureCache * cache);
void gst_core_video_texture_cache_set_format (GstCoreVideoTextureCache * cache, void gst_video_texture_cache_set_format (GstVideoTextureCache * cache,
GstVideoFormat in_format, GstCaps * out_caps); GstVideoFormat in_format, GstCaps * out_caps);
gboolean gst_core_video_texture_cache_upload (GstVideoGLTextureUploadMeta * meta, guint texture_id[4]); gboolean gst_video_texture_cache_upload (GstVideoGLTextureUploadMeta * meta, guint texture_id[4]);
GstBuffer * gst_core_video_texture_cache_get_gl_buffer (GstCoreVideoTextureCache * cache, GstBuffer * gst_video_texture_cache_get_gl_buffer (GstVideoTextureCache * cache,
GstBuffer * cv_buffer); GstBuffer * cv_buffer);
G_END_DECLS G_END_DECLS

View file

@ -25,24 +25,24 @@
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#include <gst/gl/cocoa/gstglcontext_cocoa.h> #include <gst/gl/cocoa/gstglcontext_cocoa.h>
#endif #endif
#include "corevideotexturecache.h" #include "videotexturecache.h"
#include "coremediabuffer.h" #include "coremediabuffer.h"
#include "corevideobuffer.h" #include "corevideobuffer.h"
#include "vtutil.h" #include "vtutil.h"
typedef struct _ContextThreadData typedef struct _ContextThreadData
{ {
GstCoreVideoTextureCache *cache; GstVideoTextureCache *cache;
GstBuffer *input_buffer; GstBuffer *input_buffer;
GstBuffer *output_buffer; GstBuffer *output_buffer;
} ContextThreadData; } ContextThreadData;
GstCoreVideoTextureCache * GstVideoTextureCache *
gst_core_video_texture_cache_new (GstGLContext * ctx) gst_video_texture_cache_new (GstGLContext * ctx)
{ {
g_return_val_if_fail (ctx != NULL, NULL); g_return_val_if_fail (ctx != NULL, NULL);
GstCoreVideoTextureCache *cache = g_new0 (GstCoreVideoTextureCache, 1); GstVideoTextureCache *cache = g_new0 (GstVideoTextureCache, 1);
cache->ctx = gst_object_ref (ctx); cache->ctx = gst_object_ref (ctx);
gst_video_info_init (&cache->input_info); gst_video_info_init (&cache->input_info);
cache->convert = gst_gl_color_convert_new (cache->ctx); cache->convert = gst_gl_color_convert_new (cache->ctx);
@ -69,7 +69,7 @@ gst_core_video_texture_cache_new (GstGLContext * ctx)
} }
void void
gst_core_video_texture_cache_free (GstCoreVideoTextureCache * cache) gst_video_texture_cache_free (GstVideoTextureCache * cache)
{ {
g_return_if_fail (cache != NULL); g_return_if_fail (cache != NULL);
@ -88,7 +88,7 @@ gst_core_video_texture_cache_free (GstCoreVideoTextureCache * cache)
} }
void void
gst_core_video_texture_cache_set_format (GstCoreVideoTextureCache * cache, gst_video_texture_cache_set_format (GstVideoTextureCache * cache,
GstVideoFormat in_format, GstCaps * out_caps) GstVideoFormat in_format, GstCaps * out_caps)
{ {
GstCaps *in_caps; GstCaps *in_caps;
@ -133,7 +133,7 @@ cv_pixel_buffer_from_gst_buffer (GstBuffer * buffer)
} }
static gboolean static gboolean
gl_mem_from_buffer (GstCoreVideoTextureCache * cache, gl_mem_from_buffer (GstVideoTextureCache * cache,
GstBuffer * buffer, GstMemory **mem1, GstMemory **mem2) GstBuffer * buffer, GstMemory **mem1, GstMemory **mem2)
{ {
gboolean ret = TRUE; gboolean ret = TRUE;
@ -255,7 +255,7 @@ static void
_do_get_gl_buffer (GstGLContext * context, ContextThreadData * data) _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
{ {
GstMemory *mem1 = NULL, *mem2 = NULL; GstMemory *mem1 = NULL, *mem2 = NULL;
GstCoreVideoTextureCache *cache = data->cache; GstVideoTextureCache *cache = data->cache;
GstBuffer *buffer = data->input_buffer; GstBuffer *buffer = data->input_buffer;
if (!gl_mem_from_buffer (cache, buffer, &mem1, &mem2)) { if (!gl_mem_from_buffer (cache, buffer, &mem1, &mem2)) {
@ -273,7 +273,7 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
} }
GstBuffer * GstBuffer *
gst_core_video_texture_cache_get_gl_buffer (GstCoreVideoTextureCache * cache, gst_video_texture_cache_get_gl_buffer (GstVideoTextureCache * cache,
GstBuffer * cv_buffer) GstBuffer * cv_buffer)
{ {
ContextThreadData data = {cache, cv_buffer, NULL}; ContextThreadData data = {cache, cv_buffer, NULL};

View file

@ -200,7 +200,7 @@ gst_vtdec_stop (GstVideoDecoder * decoder)
gst_vtdec_invalidate_session (vtdec); gst_vtdec_invalidate_session (vtdec);
if (vtdec->texture_cache) if (vtdec->texture_cache)
gst_core_video_texture_cache_free (vtdec->texture_cache); gst_video_texture_cache_free (vtdec->texture_cache);
vtdec->texture_cache = NULL; vtdec->texture_cache = NULL;
GST_DEBUG_OBJECT (vtdec, "stop"); GST_DEBUG_OBJECT (vtdec, "stop");
@ -244,8 +244,8 @@ setup_texture_cache (GstVtdec * vtdec, GstGLContext * context)
#else #else
internal_format = GST_VIDEO_FORMAT_UYVY; internal_format = GST_VIDEO_FORMAT_UYVY;
#endif #endif
vtdec->texture_cache = gst_core_video_texture_cache_new (context); vtdec->texture_cache = gst_video_texture_cache_new (context);
gst_core_video_texture_cache_set_format (vtdec->texture_cache, gst_video_texture_cache_set_format (vtdec->texture_cache,
internal_format, output_state->caps); internal_format, output_state->caps);
gst_video_codec_state_unref (output_state); gst_video_codec_state_unref (output_state);
} }
@ -309,7 +309,7 @@ gst_vtdec_negotiate (GstVideoDecoder * decoder)
ret = gst_vtdec_create_session (vtdec, format); ret = gst_vtdec_create_session (vtdec, format);
if (ret) { if (ret) {
if (vtdec->texture_cache) { if (vtdec->texture_cache) {
gst_core_video_texture_cache_free (vtdec->texture_cache); gst_video_texture_cache_free (vtdec->texture_cache);
vtdec->texture_cache = NULL; vtdec->texture_cache = NULL;
} }
@ -823,7 +823,7 @@ gst_vtdec_push_frames_if_needed (GstVtdec * vtdec, gboolean drain,
frame = (GstVideoCodecFrame *) g_async_queue_try_pop (vtdec->reorder_queue); frame = (GstVideoCodecFrame *) g_async_queue_try_pop (vtdec->reorder_queue);
if (frame && frame->output_buffer && vtdec->texture_cache != NULL) { if (frame && frame->output_buffer && vtdec->texture_cache != NULL) {
frame->output_buffer = frame->output_buffer =
gst_core_video_texture_cache_get_gl_buffer (vtdec->texture_cache, gst_video_texture_cache_get_gl_buffer (vtdec->texture_cache,
frame->output_buffer); frame->output_buffer);
if (!frame->output_buffer) if (!frame->output_buffer)
GST_ERROR_OBJECT (vtdec, "couldn't get textures from buffer"); GST_ERROR_OBJECT (vtdec, "couldn't get textures from buffer");

View file

@ -25,7 +25,7 @@
#include <gst/video/gstvideodecoder.h> #include <gst/video/gstvideodecoder.h>
#include <CoreMedia/CoreMedia.h> #include <CoreMedia/CoreMedia.h>
#include <VideoToolbox/VideoToolbox.h> #include <VideoToolbox/VideoToolbox.h>
#include "corevideotexturecache.h" #include "videotexturecache.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -47,7 +47,7 @@ struct _GstVtdec
VTDecompressionSessionRef session; VTDecompressionSessionRef session;
GAsyncQueue *reorder_queue; GAsyncQueue *reorder_queue;
gint reorder_queue_length; gint reorder_queue_length;
GstCoreVideoTextureCache *texture_cache; GstVideoTextureCache *texture_cache;
gboolean require_hardware; gboolean require_hardware;
}; };