summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2013-04-24 22:22:28 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2013-05-20 13:31:02 +0200
commit9b168e6b4d0a1a4dfe8bbcd98bd1c4b6e456be0b (patch)
tree9618f6adba531d2119bfa79c0dae35ec8dece4a0
parent97bb1edf6c8c13dbede03be13b25ba1d5a6a4d6f (diff)
downloadgstreamer-plugins-bad-9b168e6b4d0a1a4dfe8bbcd98bd1c4b6e456be0b.tar.gz
applemedia: remove the unneeded buffer factory
-rw-r--r--sys/applemedia/Makefile.am2
-rw-r--r--sys/applemedia/avfvideosrc.m23
-rw-r--r--sys/applemedia/bufferfactory.h34
-rw-r--r--sys/applemedia/bufferfactory.m61
-rw-r--r--sys/applemedia/qtkitvideosrc.m20
5 files changed, 4 insertions, 136 deletions
diff --git a/sys/applemedia/Makefile.am b/sys/applemedia/Makefile.am
index 95401c2a6..e043fd7e0 100644
--- a/sys/applemedia/Makefile.am
+++ b/sys/applemedia/Makefile.am
@@ -3,7 +3,6 @@ plugin_LTLIBRARIES = libgstapplemedia.la
libgstapplemedia_la_SOURCES = \
plugin.m \
vtutil.c \
- bufferfactory.m \
corevideobuffer.c \
coremediabuffer.c \
coremediactx.c \
@@ -47,7 +46,6 @@ noinst_HEADERS = \
vtenc.h \
vtdec.h \
vtutil.h \
- bufferfactory.h \
corevideobuffer.h \
coremediabuffer.h \
coremediactx.h \
diff --git a/sys/applemedia/avfvideosrc.m b/sys/applemedia/avfvideosrc.m
index 3c570b1a6..d2db4a883 100644
--- a/sys/applemedia/avfvideosrc.m
+++ b/sys/applemedia/avfvideosrc.m
@@ -19,10 +19,9 @@
#include "avfvideosrc.h"
-#import "bufferfactory.h"
-
#import <AVFoundation/AVFoundation.h>
#include <gst/video/video.h>
+#include "coremediabuffer.h"
#define DEFAULT_DEVICE_INDEX -1
#define DEFAULT_DO_STATS FALSE
@@ -82,7 +81,6 @@ static GstPushSrcClass * parent_class;
gint deviceIndex;
BOOL doStats;
- GstAMBufferFactory *bufferFactory;
AVCaptureSession *session;
AVCaptureDeviceInput *input;
AVCaptureVideoDataOutput *output;
@@ -176,15 +174,6 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
- (BOOL)openDevice
{
BOOL success = NO, *successPtr = &success;
- GError *error;
-
- bufferFactory = [[GstAMBufferFactory alloc] initWithError:&error];
- if (bufferFactory == nil) {
- GST_ELEMENT_ERROR (element, RESOURCE, FAILED, ("API error"),
- ("%s", error->message));
- g_clear_error (&error);
- return NO;
- }
dispatch_async (mainQueue, ^{
NSString *mediaType = AVMediaTypeVideo;
@@ -239,11 +228,6 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
});
[self waitForMainQueueToDrain];
- if (!success) {
- [bufferFactory release];
- bufferFactory = nil;
- }
-
return success;
}
@@ -268,9 +252,6 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
device = nil;
});
[self waitForMainQueueToDrain];
-
- [bufferFactory release];
- bufferFactory = nil;
}
#define GST_AVF_CAPS_NEW(format, w, h) \
@@ -513,7 +494,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
[bufQueueLock unlockWithCondition:
([bufQueue count] == 0) ? NO_BUFFERS : HAS_BUFFER_OR_STOP_REQUEST];
- *buf = [bufferFactory createGstBufferForSampleBuffer:sbuf];
+ *buf = gst_core_media_buffer_new (sbuf);
CFRelease (sbuf);
[self timestampBuffer:*buf];
diff --git a/sys/applemedia/bufferfactory.h b/sys/applemedia/bufferfactory.h
deleted file mode 100644
index 132b953ef..000000000
--- a/sys/applemedia/bufferfactory.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2010 Ole André Vadla Ravnås <oleavr@soundrop.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.
- */
-
-#import <Foundation/Foundation.h>
-
-#include <gst/gst.h>
-
-@interface GstAMBufferFactory : NSObject {
- gpointer coreMediaCtx;
-}
-
-- (id)initWithError:(GError **)error;
-- (void)finalize;
-
-- (GstBuffer *)createGstBufferForCoreVideoBuffer:(CFTypeRef)cvbuf;
-- (GstBuffer *)createGstBufferForSampleBuffer:(CFTypeRef)sbuf;
-
-@end
diff --git a/sys/applemedia/bufferfactory.m b/sys/applemedia/bufferfactory.m
deleted file mode 100644
index 7b2e845cc..000000000
--- a/sys/applemedia/bufferfactory.m
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2010 Ole André Vadla Ravnås <oleavr@soundrop.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.
- */
-
-#import "bufferfactory.h"
-
-#include "coremediabuffer.h"
-#include "corevideobuffer.h"
-
-@implementation GstAMBufferFactory
-
-- (id)initWithError:(GError **)error
-{
- GstCoreMediaCtx *ctx;
-
- ctx =
- gst_core_media_ctx_new (GST_API_CORE_VIDEO | GST_API_CORE_MEDIA, error);
- if (ctx == NULL)
- return nil;
-
- if ((self = [super init]))
- coreMediaCtx = ctx;
- else
- g_object_unref (ctx);
-
- return self;
-}
-
-- (void)finalize
-{
- g_object_unref (coreMediaCtx);
-
- [super finalize];
-}
-
-- (GstBuffer *)createGstBufferForCoreVideoBuffer:(CFTypeRef)cvbuf
-{
- return gst_core_video_buffer_new (coreMediaCtx, (CVBufferRef) cvbuf, NULL);
-}
-
-- (GstBuffer *)createGstBufferForSampleBuffer:(CFTypeRef)sbuf
-{
- return gst_core_media_buffer_new (coreMediaCtx, sbuf);
-}
-
-@end
diff --git a/sys/applemedia/qtkitvideosrc.m b/sys/applemedia/qtkitvideosrc.m
index 32e18b8a4..e6b427f87 100644
--- a/sys/applemedia/qtkitvideosrc.m
+++ b/sys/applemedia/qtkitvideosrc.m
@@ -19,7 +19,7 @@
#include "qtkitvideosrc.h"
-#import "bufferfactory.h"
+#import "corevideobuffer.h"
#import <QTKit/QTKit.h>
@@ -90,7 +90,6 @@ G_DEFINE_TYPE (GstQTKitVideoSrc, gst_qtkit_video_src, GST_TYPE_PUSH_SRC);
int deviceIndex;
- GstAMBufferFactory *bufferFactory;
QTCaptureSession *session;
QTCaptureDeviceInput *input;
QTCaptureDecompressedVideoOutput *output;
@@ -159,18 +158,9 @@ G_DEFINE_TYPE (GstQTKitVideoSrc, gst_qtkit_video_src, GST_TYPE_PUSH_SRC);
- (BOOL)openDevice
{
- GError *gerror;
NSString *mediaType = QTMediaTypeVideo;
NSError *error = nil;
- bufferFactory = [[GstAMBufferFactory alloc] initWithError:&gerror];
- if (bufferFactory == nil) {
- GST_ELEMENT_ERROR (element, RESOURCE, FAILED, ("API error"),
- ("%s", gerror->message));
- g_clear_error (&gerror);
- goto openFailed;
- }
-
if (deviceIndex == -1) {
device = [QTCaptureDevice defaultInputDeviceWithMediaType:mediaType];
if (device == nil) {
@@ -206,9 +196,6 @@ openFailed:
[device release];
device = nil;
- [bufferFactory release];
- bufferFactory = nil;
-
return NO;
}
}
@@ -228,9 +215,6 @@ openFailed:
[device release];
device = nil;
-
- [bufferFactory release];
- bufferFactory = nil;
}
- (BOOL)setCaps:(GstCaps *)caps
@@ -450,7 +434,7 @@ openFailed:
[queueLock unlockWithCondition:
([queue count] == 0) ? NO_FRAMES : HAS_FRAME_OR_STOP_REQUEST];
- *buf = [bufferFactory createGstBufferForCoreVideoBuffer:frame];
+ *buf = gst_core_video_buffer_new ((CVBufferRef)frame, NULL);
CVBufferRelease (frame);
[self timestampBuffer:*buf];