mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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:
parent
a8b01eb6d1
commit
e730b0a8ab
6 changed files with 33 additions and 33 deletions
|
@ -5,7 +5,7 @@ libgstapplemedia_la_SOURCES = \
|
|||
vtutil.c \
|
||||
corevideobuffer.c \
|
||||
coremediabuffer.c \
|
||||
corevideotexturecache.m \
|
||||
videotexturecache.m \
|
||||
atdec.c
|
||||
|
||||
libgstapplemedia_la_CPPFLAGS = \
|
||||
|
@ -62,7 +62,7 @@ noinst_HEADERS = \
|
|||
vtutil.h \
|
||||
corevideobuffer.h \
|
||||
coremediabuffer.h \
|
||||
corevideotexturecache.h \
|
||||
videotexturecache.h \
|
||||
atdec.h \
|
||||
iosassetsrc.h \
|
||||
avfassetsrc.h
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <gst/video/video.h>
|
||||
#include <gst/gl/gstglcontext.h>
|
||||
#include "coremediabuffer.h"
|
||||
#include "corevideotexturecache.h"
|
||||
#include "videotexturecache.h"
|
||||
|
||||
#define DEFAULT_DEVICE_INDEX -1
|
||||
#define DEFAULT_DO_STATS FALSE
|
||||
|
@ -107,7 +107,7 @@ G_DEFINE_TYPE (GstAVFVideoSrc, gst_avf_video_src, GST_TYPE_PUSH_SRC);
|
|||
BOOL captureScreenMouseClicks;
|
||||
|
||||
BOOL useVideoMeta;
|
||||
GstCoreVideoTextureCache *textureCache;
|
||||
GstVideoTextureCache *textureCache;
|
||||
}
|
||||
|
||||
- (id)init;
|
||||
|
@ -765,7 +765,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
|||
bufQueue = nil;
|
||||
|
||||
if (textureCache)
|
||||
gst_core_video_texture_cache_free (textureCache);
|
||||
gst_video_texture_cache_free (textureCache);
|
||||
textureCache = NULL;
|
||||
|
||||
return YES;
|
||||
|
@ -820,8 +820,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
|||
if (glContext) {
|
||||
GST_INFO_OBJECT (element, "pushing textures. Internal format %s, context %p",
|
||||
gst_video_format_to_string (internalFormat), glContext);
|
||||
textureCache = gst_core_video_texture_cache_new (glContext);
|
||||
gst_core_video_texture_cache_set_format (textureCache, internalFormat, caps);
|
||||
textureCache = gst_video_texture_cache_new (glContext);
|
||||
gst_video_texture_cache_set_format (textureCache, internalFormat, caps);
|
||||
gst_object_unref (glContext);
|
||||
} else {
|
||||
GST_WARNING_OBJECT (element, "got memory:GLMemory caps but not GL context from downstream element");
|
||||
|
@ -959,7 +959,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
|||
CFRelease (sbuf);
|
||||
|
||||
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)
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
|
||||
#include <gst/video/gstvideometa.h>
|
||||
#include <gst/gl/gstglcontext.h>
|
||||
#include "CoreVideo/CoreVideo.h"
|
||||
#include <CoreVideo/CoreVideo.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GstCoreVideoTextureCache
|
||||
typedef struct _GstVideoTextureCache
|
||||
{
|
||||
GstGLContext *ctx;
|
||||
#if !HAVE_IOS
|
||||
|
@ -41,14 +41,14 @@ typedef struct _GstCoreVideoTextureCache
|
|||
GstCaps *in_caps;
|
||||
GstCaps *out_caps;
|
||||
GstGLColorConvert *convert;
|
||||
} GstCoreVideoTextureCache;
|
||||
} GstVideoTextureCache;
|
||||
|
||||
GstCoreVideoTextureCache *gst_core_video_texture_cache_new (GstGLContext * ctx);
|
||||
void gst_core_video_texture_cache_free (GstCoreVideoTextureCache * cache);
|
||||
void gst_core_video_texture_cache_set_format (GstCoreVideoTextureCache * cache,
|
||||
GstVideoTextureCache *gst_video_texture_cache_new (GstGLContext * ctx);
|
||||
void gst_video_texture_cache_free (GstVideoTextureCache * cache);
|
||||
void gst_video_texture_cache_set_format (GstVideoTextureCache * cache,
|
||||
GstVideoFormat in_format, GstCaps * out_caps);
|
||||
gboolean gst_core_video_texture_cache_upload (GstVideoGLTextureUploadMeta * meta, guint texture_id[4]);
|
||||
GstBuffer * gst_core_video_texture_cache_get_gl_buffer (GstCoreVideoTextureCache * cache,
|
||||
gboolean gst_video_texture_cache_upload (GstVideoGLTextureUploadMeta * meta, guint texture_id[4]);
|
||||
GstBuffer * gst_video_texture_cache_get_gl_buffer (GstVideoTextureCache * cache,
|
||||
GstBuffer * cv_buffer);
|
||||
|
||||
G_END_DECLS
|
|
@ -25,24 +25,24 @@
|
|||
#import <AppKit/AppKit.h>
|
||||
#include <gst/gl/cocoa/gstglcontext_cocoa.h>
|
||||
#endif
|
||||
#include "corevideotexturecache.h"
|
||||
#include "videotexturecache.h"
|
||||
#include "coremediabuffer.h"
|
||||
#include "corevideobuffer.h"
|
||||
#include "vtutil.h"
|
||||
|
||||
typedef struct _ContextThreadData
|
||||
{
|
||||
GstCoreVideoTextureCache *cache;
|
||||
GstVideoTextureCache *cache;
|
||||
GstBuffer *input_buffer;
|
||||
GstBuffer *output_buffer;
|
||||
} ContextThreadData;
|
||||
|
||||
GstCoreVideoTextureCache *
|
||||
gst_core_video_texture_cache_new (GstGLContext * ctx)
|
||||
GstVideoTextureCache *
|
||||
gst_video_texture_cache_new (GstGLContext * ctx)
|
||||
{
|
||||
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);
|
||||
gst_video_info_init (&cache->input_info);
|
||||
cache->convert = gst_gl_color_convert_new (cache->ctx);
|
||||
|
@ -69,7 +69,7 @@ gst_core_video_texture_cache_new (GstGLContext * ctx)
|
|||
}
|
||||
|
||||
void
|
||||
gst_core_video_texture_cache_free (GstCoreVideoTextureCache * cache)
|
||||
gst_video_texture_cache_free (GstVideoTextureCache * cache)
|
||||
{
|
||||
g_return_if_fail (cache != NULL);
|
||||
|
||||
|
@ -88,7 +88,7 @@ gst_core_video_texture_cache_free (GstCoreVideoTextureCache * cache)
|
|||
}
|
||||
|
||||
void
|
||||
gst_core_video_texture_cache_set_format (GstCoreVideoTextureCache * cache,
|
||||
gst_video_texture_cache_set_format (GstVideoTextureCache * cache,
|
||||
GstVideoFormat in_format, GstCaps * out_caps)
|
||||
{
|
||||
GstCaps *in_caps;
|
||||
|
@ -133,7 +133,7 @@ cv_pixel_buffer_from_gst_buffer (GstBuffer * buffer)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gl_mem_from_buffer (GstCoreVideoTextureCache * cache,
|
||||
gl_mem_from_buffer (GstVideoTextureCache * cache,
|
||||
GstBuffer * buffer, GstMemory **mem1, GstMemory **mem2)
|
||||
{
|
||||
gboolean ret = TRUE;
|
||||
|
@ -255,7 +255,7 @@ static void
|
|||
_do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
|
||||
{
|
||||
GstMemory *mem1 = NULL, *mem2 = NULL;
|
||||
GstCoreVideoTextureCache *cache = data->cache;
|
||||
GstVideoTextureCache *cache = data->cache;
|
||||
GstBuffer *buffer = data->input_buffer;
|
||||
|
||||
if (!gl_mem_from_buffer (cache, buffer, &mem1, &mem2)) {
|
||||
|
@ -273,7 +273,7 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
|
|||
}
|
||||
|
||||
GstBuffer *
|
||||
gst_core_video_texture_cache_get_gl_buffer (GstCoreVideoTextureCache * cache,
|
||||
gst_video_texture_cache_get_gl_buffer (GstVideoTextureCache * cache,
|
||||
GstBuffer * cv_buffer)
|
||||
{
|
||||
ContextThreadData data = {cache, cv_buffer, NULL};
|
|
@ -200,7 +200,7 @@ gst_vtdec_stop (GstVideoDecoder * decoder)
|
|||
gst_vtdec_invalidate_session (vtdec);
|
||||
|
||||
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;
|
||||
|
||||
GST_DEBUG_OBJECT (vtdec, "stop");
|
||||
|
@ -244,8 +244,8 @@ setup_texture_cache (GstVtdec * vtdec, GstGLContext * context)
|
|||
#else
|
||||
internal_format = GST_VIDEO_FORMAT_UYVY;
|
||||
#endif
|
||||
vtdec->texture_cache = gst_core_video_texture_cache_new (context);
|
||||
gst_core_video_texture_cache_set_format (vtdec->texture_cache,
|
||||
vtdec->texture_cache = gst_video_texture_cache_new (context);
|
||||
gst_video_texture_cache_set_format (vtdec->texture_cache,
|
||||
internal_format, output_state->caps);
|
||||
gst_video_codec_state_unref (output_state);
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ gst_vtdec_negotiate (GstVideoDecoder * decoder)
|
|||
ret = gst_vtdec_create_session (vtdec, format);
|
||||
if (ret) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -823,7 +823,7 @@ gst_vtdec_push_frames_if_needed (GstVtdec * vtdec, gboolean drain,
|
|||
frame = (GstVideoCodecFrame *) g_async_queue_try_pop (vtdec->reorder_queue);
|
||||
if (frame && frame->output_buffer && vtdec->texture_cache != NULL) {
|
||||
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);
|
||||
if (!frame->output_buffer)
|
||||
GST_ERROR_OBJECT (vtdec, "couldn't get textures from buffer");
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <gst/video/gstvideodecoder.h>
|
||||
#include <CoreMedia/CoreMedia.h>
|
||||
#include <VideoToolbox/VideoToolbox.h>
|
||||
#include "corevideotexturecache.h"
|
||||
#include "videotexturecache.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -47,7 +47,7 @@ struct _GstVtdec
|
|||
VTDecompressionSessionRef session;
|
||||
GAsyncQueue *reorder_queue;
|
||||
gint reorder_queue_length;
|
||||
GstCoreVideoTextureCache *texture_cache;
|
||||
GstVideoTextureCache *texture_cache;
|
||||
|
||||
gboolean require_hardware;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue