mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
applemedia: remove the unneeded buffer factory
This commit is contained in:
parent
97bb1edf6c
commit
9b168e6b4d
5 changed files with 4 additions and 136 deletions
|
@ -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 \
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue