mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 05:16:13 +00:00
applemedia: rename iphonecamerasrc to celvideosrc
This is in order to improve consistency with the other three sources.
This commit is contained in:
parent
8b22f855ec
commit
44df8abea8
4 changed files with 115 additions and 119 deletions
|
@ -46,7 +46,7 @@ noinst_HEADERS = \
|
||||||
miovideosrc.h \
|
miovideosrc.h \
|
||||||
miovideodevice.h \
|
miovideodevice.h \
|
||||||
avfvideosrc.h \
|
avfvideosrc.h \
|
||||||
iphonecamerasrc.h \
|
celvideosrc.h \
|
||||||
vth264decbin.h \
|
vth264decbin.h \
|
||||||
vth264encbin.h \
|
vth264encbin.h \
|
||||||
vtenc.h \
|
vtenc.h \
|
||||||
|
@ -69,7 +69,7 @@ if HAVE_IOS
|
||||||
|
|
||||||
libgstapplemedia_la_SOURCES += \
|
libgstapplemedia_la_SOURCES += \
|
||||||
avfvideosrc.m \
|
avfvideosrc.m \
|
||||||
iphonecamerasrc.c \
|
celvideosrc.c \
|
||||||
mtapi.c \
|
mtapi.c \
|
||||||
celapi.c
|
celapi.c
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "iphonecamerasrc.h"
|
#include "celvideosrc.h"
|
||||||
|
|
||||||
#include "coremediabuffer.h"
|
#include "coremediabuffer.h"
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@
|
||||||
g_cond_wait (instance->cond, GST_OBJECT_GET_LOCK (instance))
|
g_cond_wait (instance->cond, GST_OBJECT_GET_LOCK (instance))
|
||||||
#define BUFQUEUE_NOTIFY(instance) g_cond_signal (instance->cond)
|
#define BUFQUEUE_NOTIFY(instance) g_cond_signal (instance->cond)
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_iphone_camera_src_debug);
|
GST_DEBUG_CATEGORY (gst_cel_video_src_debug);
|
||||||
#define GST_CAT_DEFAULT gst_iphone_camera_src_debug
|
#define GST_CAT_DEFAULT gst_cel_video_src_debug
|
||||||
|
|
||||||
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
|
@ -57,33 +57,32 @@ typedef struct
|
||||||
gint height;
|
gint height;
|
||||||
gint fps_n;
|
gint fps_n;
|
||||||
gint fps_d;
|
gint fps_d;
|
||||||
} GstIPhoneCameraFormat;
|
} GstCelVideoFormat;
|
||||||
|
|
||||||
static gboolean gst_iphone_camera_src_open_device (GstIPhoneCameraSrc * self);
|
static gboolean gst_cel_video_src_open_device (GstCelVideoSrc * self);
|
||||||
static void gst_iphone_camera_src_close_device (GstIPhoneCameraSrc * self);
|
static void gst_cel_video_src_close_device (GstCelVideoSrc * self);
|
||||||
static void gst_iphone_camera_src_ensure_device_caps_and_formats
|
static void gst_cel_video_src_ensure_device_caps_and_formats
|
||||||
(GstIPhoneCameraSrc * self);
|
(GstCelVideoSrc * self);
|
||||||
static void gst_iphone_camera_src_release_device_caps_and_formats
|
static void gst_cel_video_src_release_device_caps_and_formats
|
||||||
(GstIPhoneCameraSrc * self);
|
(GstCelVideoSrc * self);
|
||||||
static gboolean gst_iphone_camera_src_select_format (GstIPhoneCameraSrc * self,
|
static gboolean gst_cel_video_src_select_format (GstCelVideoSrc * self,
|
||||||
GstIPhoneCameraFormat * format);
|
GstCelVideoFormat * format);
|
||||||
|
|
||||||
static gboolean gst_iphone_camera_src_parse_imager_format
|
static gboolean gst_cel_video_src_parse_imager_format
|
||||||
(GstIPhoneCameraSrc * self, guint index, CFDictionaryRef imager_format,
|
(GstCelVideoSrc * self, guint index, CFDictionaryRef imager_format,
|
||||||
GstIPhoneCameraFormat * format);
|
GstCelVideoFormat * format);
|
||||||
static OSStatus gst_iphone_camera_src_set_device_property_i32
|
static OSStatus gst_cel_video_src_set_device_property_i32
|
||||||
(GstIPhoneCameraSrc * self, CFStringRef name, SInt32 value);
|
(GstCelVideoSrc * self, CFStringRef name, SInt32 value);
|
||||||
static OSStatus gst_iphone_camera_src_set_device_property_cstr
|
static OSStatus gst_cel_video_src_set_device_property_cstr
|
||||||
(GstIPhoneCameraSrc * self, const gchar * name, const gchar * value);
|
(GstCelVideoSrc * self, const gchar * name, const gchar * value);
|
||||||
|
|
||||||
static GstPushSrcClass *parent_class;
|
static GstPushSrcClass *parent_class;
|
||||||
|
|
||||||
GST_BOILERPLATE (GstIPhoneCameraSrc, gst_iphone_camera_src, GstPushSrc,
|
GST_BOILERPLATE (GstCelVideoSrc, gst_cel_video_src, GstPushSrc,
|
||||||
GST_TYPE_PUSH_SRC);
|
GST_TYPE_PUSH_SRC);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_iphone_camera_src_init (GstIPhoneCameraSrc * self,
|
gst_cel_video_src_init (GstCelVideoSrc * self, GstCelVideoSrcClass * gclass)
|
||||||
GstIPhoneCameraSrcClass * gclass)
|
|
||||||
{
|
{
|
||||||
GstBaseSrc *base_src = GST_BASE_SRC_CAST (self);
|
GstBaseSrc *base_src = GST_BASE_SRC_CAST (self);
|
||||||
|
|
||||||
|
@ -94,15 +93,15 @@ gst_iphone_camera_src_init (GstIPhoneCameraSrc * self,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_iphone_camera_src_dispose (GObject * object)
|
gst_cel_video_src_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_iphone_camera_src_finalize (GObject * object)
|
gst_cel_video_src_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
GstIPhoneCameraSrc *self = GST_IPHONE_CAMERA_SRC_CAST (object);
|
GstCelVideoSrc *self = GST_CEL_VIDEO_SRC_CAST (object);
|
||||||
|
|
||||||
g_cond_free (self->cond);
|
g_cond_free (self->cond);
|
||||||
|
|
||||||
|
@ -110,10 +109,10 @@ gst_iphone_camera_src_finalize (GObject * object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_iphone_camera_src_get_property (GObject * object, guint prop_id,
|
gst_cel_video_src_get_property (GObject * object, guint prop_id,
|
||||||
GValue * value, GParamSpec * pspec)
|
GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstIPhoneCameraSrc *self = GST_IPHONE_CAMERA_SRC_CAST (object);
|
GstCelVideoSrc *self = GST_CEL_VIDEO_SRC_CAST (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_DO_STATS:
|
case PROP_DO_STATS:
|
||||||
|
@ -126,10 +125,10 @@ gst_iphone_camera_src_get_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_iphone_camera_src_set_property (GObject * object, guint prop_id,
|
gst_cel_video_src_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstIPhoneCameraSrc *self = GST_IPHONE_CAMERA_SRC_CAST (object);
|
GstCelVideoSrc *self = GST_CEL_VIDEO_SRC_CAST (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_DO_STATS:
|
case PROP_DO_STATS:
|
||||||
|
@ -142,15 +141,14 @@ gst_iphone_camera_src_set_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
gst_iphone_camera_src_change_state (GstElement * element,
|
gst_cel_video_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
GstStateChange transition)
|
|
||||||
{
|
{
|
||||||
GstIPhoneCameraSrc *self = GST_IPHONE_CAMERA_SRC_CAST (element);
|
GstCelVideoSrc *self = GST_CEL_VIDEO_SRC_CAST (element);
|
||||||
GstStateChangeReturn ret;
|
GstStateChangeReturn ret;
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
if (!gst_iphone_camera_src_open_device (self))
|
if (!gst_cel_video_src_open_device (self))
|
||||||
goto open_failed;
|
goto open_failed;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -161,7 +159,7 @@ gst_iphone_camera_src_change_state (GstElement * element,
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
gst_iphone_camera_src_close_device (self);
|
gst_cel_video_src_close_device (self);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -177,13 +175,13 @@ open_failed:
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
gst_iphone_camera_src_get_caps (GstBaseSrc * basesrc)
|
gst_cel_video_src_get_caps (GstBaseSrc * basesrc)
|
||||||
{
|
{
|
||||||
GstIPhoneCameraSrc *self = GST_IPHONE_CAMERA_SRC_CAST (basesrc);
|
GstCelVideoSrc *self = GST_CEL_VIDEO_SRC_CAST (basesrc);
|
||||||
GstCaps *result;
|
GstCaps *result;
|
||||||
|
|
||||||
if (self->device != NULL) {
|
if (self->device != NULL) {
|
||||||
gst_iphone_camera_src_ensure_device_caps_and_formats (self);
|
gst_cel_video_src_ensure_device_caps_and_formats (self);
|
||||||
|
|
||||||
result = gst_caps_ref (self->device_caps);
|
result = gst_caps_ref (self->device_caps);
|
||||||
} else {
|
} else {
|
||||||
|
@ -202,13 +200,13 @@ gst_iphone_camera_src_get_caps (GstBaseSrc * basesrc)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_iphone_camera_src_set_caps (GstBaseSrc * basesrc, GstCaps * caps)
|
gst_cel_video_src_set_caps (GstBaseSrc * basesrc, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstIPhoneCameraSrc *self = GST_IPHONE_CAMERA_SRC_CAST (basesrc);
|
GstCelVideoSrc *self = GST_CEL_VIDEO_SRC_CAST (basesrc);
|
||||||
GstVideoFormat video_format;
|
GstVideoFormat video_format;
|
||||||
gint width, height, fps_n, fps_d;
|
gint width, height, fps_n, fps_d;
|
||||||
guint i;
|
guint i;
|
||||||
GstIPhoneCameraFormat *selected_format;
|
GstCelVideoFormat *selected_format;
|
||||||
|
|
||||||
if (self->device == NULL)
|
if (self->device == NULL)
|
||||||
goto no_device;
|
goto no_device;
|
||||||
|
@ -218,14 +216,14 @@ gst_iphone_camera_src_set_caps (GstBaseSrc * basesrc, GstCaps * caps)
|
||||||
if (!gst_video_parse_caps_framerate (caps, &fps_n, &fps_d))
|
if (!gst_video_parse_caps_framerate (caps, &fps_n, &fps_d))
|
||||||
goto invalid_format;
|
goto invalid_format;
|
||||||
|
|
||||||
gst_iphone_camera_src_ensure_device_caps_and_formats (self);
|
gst_cel_video_src_ensure_device_caps_and_formats (self);
|
||||||
|
|
||||||
selected_format = NULL;
|
selected_format = NULL;
|
||||||
|
|
||||||
for (i = 0; i != self->device_formats->len; i++) {
|
for (i = 0; i != self->device_formats->len; i++) {
|
||||||
GstIPhoneCameraFormat *format;
|
GstCelVideoFormat *format;
|
||||||
|
|
||||||
format = &g_array_index (self->device_formats, GstIPhoneCameraFormat, i);
|
format = &g_array_index (self->device_formats, GstCelVideoFormat, i);
|
||||||
if (format->video_format == video_format &&
|
if (format->video_format == video_format &&
|
||||||
format->width == width && format->height == height &&
|
format->width == width && format->height == height &&
|
||||||
format->fps_n == fps_n && format->fps_d == fps_d) {
|
format->fps_n == fps_n && format->fps_d == fps_d) {
|
||||||
|
@ -239,10 +237,10 @@ gst_iphone_camera_src_set_caps (GstBaseSrc * basesrc, GstCaps * caps)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "selecting format %u", selected_format->index);
|
GST_DEBUG_OBJECT (self, "selecting format %u", selected_format->index);
|
||||||
|
|
||||||
if (!gst_iphone_camera_src_select_format (self, selected_format))
|
if (!gst_cel_video_src_select_format (self, selected_format))
|
||||||
goto select_failed;
|
goto select_failed;
|
||||||
|
|
||||||
gst_iphone_camera_src_release_device_caps_and_formats (self);
|
gst_cel_video_src_release_device_caps_and_formats (self);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -266,9 +264,9 @@ select_failed:
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_iphone_camera_src_start (GstBaseSrc * basesrc)
|
gst_cel_video_src_start (GstBaseSrc * basesrc)
|
||||||
{
|
{
|
||||||
GstIPhoneCameraSrc *self = GST_IPHONE_CAMERA_SRC_CAST (basesrc);
|
GstCelVideoSrc *self = GST_CEL_VIDEO_SRC_CAST (basesrc);
|
||||||
|
|
||||||
self->running = TRUE;
|
self->running = TRUE;
|
||||||
self->offset = 0;
|
self->offset = 0;
|
||||||
|
@ -277,15 +275,15 @@ gst_iphone_camera_src_start (GstBaseSrc * basesrc)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_iphone_camera_src_stop (GstBaseSrc * basesrc)
|
gst_cel_video_src_stop (GstBaseSrc * basesrc)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_iphone_camera_src_query (GstBaseSrc * basesrc, GstQuery * query)
|
gst_cel_video_src_query (GstBaseSrc * basesrc, GstQuery * query)
|
||||||
{
|
{
|
||||||
GstIPhoneCameraSrc *self = GST_IPHONE_CAMERA_SRC_CAST (basesrc);
|
GstCelVideoSrc *self = GST_CEL_VIDEO_SRC_CAST (basesrc);
|
||||||
gboolean result = FALSE;
|
gboolean result = FALSE;
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
|
@ -315,9 +313,9 @@ beach:
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_iphone_camera_src_unlock (GstBaseSrc * basesrc)
|
gst_cel_video_src_unlock (GstBaseSrc * basesrc)
|
||||||
{
|
{
|
||||||
GstIPhoneCameraSrc *self = GST_IPHONE_CAMERA_SRC_CAST (basesrc);
|
GstCelVideoSrc *self = GST_CEL_VIDEO_SRC_CAST (basesrc);
|
||||||
|
|
||||||
BUFQUEUE_LOCK (self);
|
BUFQUEUE_LOCK (self);
|
||||||
self->running = FALSE;
|
self->running = FALSE;
|
||||||
|
@ -327,16 +325,16 @@ gst_iphone_camera_src_unlock (GstBaseSrc * basesrc)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_iphone_camera_src_unlock_stop (GstBaseSrc * basesrc)
|
gst_cel_video_src_unlock_stop (GstBaseSrc * basesrc)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Boolean
|
static Boolean
|
||||||
gst_iphone_camera_src_validate (CMBufferQueueRef queue, CMSampleBufferRef buf,
|
gst_cel_video_src_validate (CMBufferQueueRef queue, CMSampleBufferRef buf,
|
||||||
void *refCon)
|
void *refCon)
|
||||||
{
|
{
|
||||||
GstIPhoneCameraSrc *self = GST_IPHONE_CAMERA_SRC_CAST (refCon);
|
GstCelVideoSrc *self = GST_CEL_VIDEO_SRC_CAST (refCon);
|
||||||
|
|
||||||
BUFQUEUE_LOCK (self);
|
BUFQUEUE_LOCK (self);
|
||||||
self->has_pending = TRUE;
|
self->has_pending = TRUE;
|
||||||
|
@ -347,9 +345,9 @@ gst_iphone_camera_src_validate (CMBufferQueueRef queue, CMSampleBufferRef buf,
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_iphone_camera_src_create (GstPushSrc * pushsrc, GstBuffer ** buf)
|
gst_cel_video_src_create (GstPushSrc * pushsrc, GstBuffer ** buf)
|
||||||
{
|
{
|
||||||
GstIPhoneCameraSrc *self = GST_IPHONE_CAMERA_SRC_CAST (pushsrc);
|
GstCelVideoSrc *self = GST_CEL_VIDEO_SRC_CAST (pushsrc);
|
||||||
GstCMApi *cm = self->ctx->cm;
|
GstCMApi *cm = self->ctx->cm;
|
||||||
CMSampleBufferRef sbuf = NULL;
|
CMSampleBufferRef sbuf = NULL;
|
||||||
GstClock *clock;
|
GstClock *clock;
|
||||||
|
@ -407,7 +405,7 @@ shutting_down:
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_iphone_camera_src_open_device (GstIPhoneCameraSrc * self)
|
gst_cel_video_src_open_device (GstCelVideoSrc * self)
|
||||||
{
|
{
|
||||||
GstCoreMediaCtx *ctx = NULL;
|
GstCoreMediaCtx *ctx = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
@ -455,7 +453,7 @@ gst_iphone_camera_src_open_device (GstIPhoneCameraSrc * self)
|
||||||
self->has_pending = FALSE;
|
self->has_pending = FALSE;
|
||||||
|
|
||||||
cm->CMBufferQueueSetValidationCallback (queue,
|
cm->CMBufferQueueSetValidationCallback (queue,
|
||||||
gst_iphone_camera_src_validate, self);
|
gst_cel_video_src_validate, self);
|
||||||
|
|
||||||
self->ctx = ctx;
|
self->ctx = ctx;
|
||||||
|
|
||||||
|
@ -507,9 +505,9 @@ any_error:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_iphone_camera_src_close_device (GstIPhoneCameraSrc * self)
|
gst_cel_video_src_close_device (GstCelVideoSrc * self)
|
||||||
{
|
{
|
||||||
gst_iphone_camera_src_release_device_caps_and_formats (self);
|
gst_cel_video_src_release_device_caps_and_formats (self);
|
||||||
|
|
||||||
self->stream_iface->Stop (self->stream);
|
self->stream_iface->Stop (self->stream);
|
||||||
self->stream_iface = NULL;
|
self->stream_iface = NULL;
|
||||||
|
@ -531,7 +529,7 @@ gst_iphone_camera_src_close_device (GstIPhoneCameraSrc * self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_iphone_camera_src_ensure_device_caps_and_formats (GstIPhoneCameraSrc * self)
|
gst_cel_video_src_ensure_device_caps_and_formats (GstCelVideoSrc * self)
|
||||||
{
|
{
|
||||||
OSStatus status;
|
OSStatus status;
|
||||||
CFArrayRef iformats = NULL;
|
CFArrayRef iformats = NULL;
|
||||||
|
@ -541,8 +539,7 @@ gst_iphone_camera_src_ensure_device_caps_and_formats (GstIPhoneCameraSrc * self)
|
||||||
goto already_probed;
|
goto already_probed;
|
||||||
|
|
||||||
self->device_caps = gst_caps_new_empty ();
|
self->device_caps = gst_caps_new_empty ();
|
||||||
self->device_formats =
|
self->device_formats = g_array_new (FALSE, FALSE, sizeof (GstCelVideoFormat));
|
||||||
g_array_new (FALSE, FALSE, sizeof (GstIPhoneCameraFormat));
|
|
||||||
|
|
||||||
status = self->device_iface_base->CopyProperty (self->device,
|
status = self->device_iface_base->CopyProperty (self->device,
|
||||||
*(self->ctx->mt->kFigCaptureDeviceProperty_ImagerSupportedFormatsArray),
|
*(self->ctx->mt->kFigCaptureDeviceProperty_ImagerSupportedFormatsArray),
|
||||||
|
@ -555,11 +552,11 @@ gst_iphone_camera_src_ensure_device_caps_and_formats (GstIPhoneCameraSrc * self)
|
||||||
|
|
||||||
for (i = 0; i != format_count; i++) {
|
for (i = 0; i != format_count; i++) {
|
||||||
CFDictionaryRef iformat;
|
CFDictionaryRef iformat;
|
||||||
GstIPhoneCameraFormat format;
|
GstCelVideoFormat format;
|
||||||
|
|
||||||
iformat = CFArrayGetValueAtIndex (iformats, i);
|
iformat = CFArrayGetValueAtIndex (iformats, i);
|
||||||
|
|
||||||
if (gst_iphone_camera_src_parse_imager_format (self, i, iformat, &format)) {
|
if (gst_cel_video_src_parse_imager_format (self, i, iformat, &format)) {
|
||||||
gst_caps_append_structure (self->device_caps,
|
gst_caps_append_structure (self->device_caps,
|
||||||
gst_structure_new ("video/x-raw-yuv",
|
gst_structure_new ("video/x-raw-yuv",
|
||||||
"format", GST_TYPE_FOURCC, format.fourcc,
|
"format", GST_TYPE_FOURCC, format.fourcc,
|
||||||
|
@ -581,8 +578,7 @@ beach:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_iphone_camera_src_release_device_caps_and_formats (GstIPhoneCameraSrc *
|
gst_cel_video_src_release_device_caps_and_formats (GstCelVideoSrc * self)
|
||||||
self)
|
|
||||||
{
|
{
|
||||||
if (self->device_caps != NULL) {
|
if (self->device_caps != NULL) {
|
||||||
gst_caps_unref (self->device_caps);
|
gst_caps_unref (self->device_caps);
|
||||||
|
@ -596,32 +592,32 @@ gst_iphone_camera_src_release_device_caps_and_formats (GstIPhoneCameraSrc *
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_iphone_camera_src_select_format (GstIPhoneCameraSrc * self,
|
gst_cel_video_src_select_format (GstCelVideoSrc * self,
|
||||||
GstIPhoneCameraFormat * format)
|
GstCelVideoFormat * format)
|
||||||
{
|
{
|
||||||
gboolean result = FALSE;
|
gboolean result = FALSE;
|
||||||
GstMTApi *mt = self->ctx->mt;
|
GstMTApi *mt = self->ctx->mt;
|
||||||
OSStatus status;
|
OSStatus status;
|
||||||
SInt32 framerate;
|
SInt32 framerate;
|
||||||
|
|
||||||
status = gst_iphone_camera_src_set_device_property_i32 (self,
|
status = gst_cel_video_src_set_device_property_i32 (self,
|
||||||
*(mt->kFigCaptureDeviceProperty_ImagerFormatDescription), format->index);
|
*(mt->kFigCaptureDeviceProperty_ImagerFormatDescription), format->index);
|
||||||
if (status != noErr)
|
if (status != noErr)
|
||||||
goto beach;
|
goto beach;
|
||||||
|
|
||||||
framerate = format->fps_n / format->fps_d;
|
framerate = format->fps_n / format->fps_d;
|
||||||
|
|
||||||
status = gst_iphone_camera_src_set_device_property_i32 (self,
|
status = gst_cel_video_src_set_device_property_i32 (self,
|
||||||
*(mt->kFigCaptureDeviceProperty_ImagerFrameRate), framerate);
|
*(mt->kFigCaptureDeviceProperty_ImagerFrameRate), framerate);
|
||||||
if (status != noErr)
|
if (status != noErr)
|
||||||
goto beach;
|
goto beach;
|
||||||
|
|
||||||
status = gst_iphone_camera_src_set_device_property_i32 (self,
|
status = gst_cel_video_src_set_device_property_i32 (self,
|
||||||
*(mt->kFigCaptureDeviceProperty_ImagerMinimumFrameRate), framerate);
|
*(mt->kFigCaptureDeviceProperty_ImagerMinimumFrameRate), framerate);
|
||||||
if (status != noErr)
|
if (status != noErr)
|
||||||
goto beach;
|
goto beach;
|
||||||
|
|
||||||
status = gst_iphone_camera_src_set_device_property_cstr (self,
|
status = gst_cel_video_src_set_device_property_cstr (self,
|
||||||
"ColorRange", "ColorRangeSDVideo");
|
"ColorRange", "ColorRangeSDVideo");
|
||||||
if (status != noErr)
|
if (status != noErr)
|
||||||
goto beach;
|
goto beach;
|
||||||
|
@ -643,8 +639,8 @@ beach:
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_iphone_camera_src_parse_imager_format (GstIPhoneCameraSrc * self,
|
gst_cel_video_src_parse_imager_format (GstCelVideoSrc * self,
|
||||||
guint index, CFDictionaryRef imager_format, GstIPhoneCameraFormat * format)
|
guint index, CFDictionaryRef imager_format, GstCelVideoFormat * format)
|
||||||
{
|
{
|
||||||
GstCMApi *cm = self->ctx->cm;
|
GstCMApi *cm = self->ctx->cm;
|
||||||
GstMTApi *mt = self->ctx->mt;
|
GstMTApi *mt = self->ctx->mt;
|
||||||
|
@ -691,7 +687,7 @@ unsupported_format:
|
||||||
}
|
}
|
||||||
|
|
||||||
static OSStatus
|
static OSStatus
|
||||||
gst_iphone_camera_src_set_device_property_i32 (GstIPhoneCameraSrc * self,
|
gst_cel_video_src_set_device_property_i32 (GstCelVideoSrc * self,
|
||||||
CFStringRef name, SInt32 value)
|
CFStringRef name, SInt32 value)
|
||||||
{
|
{
|
||||||
OSStatus status;
|
OSStatus status;
|
||||||
|
@ -705,7 +701,7 @@ gst_iphone_camera_src_set_device_property_i32 (GstIPhoneCameraSrc * self,
|
||||||
}
|
}
|
||||||
|
|
||||||
static OSStatus
|
static OSStatus
|
||||||
gst_iphone_camera_src_set_device_property_cstr (GstIPhoneCameraSrc * self,
|
gst_cel_video_src_set_device_property_cstr (GstCelVideoSrc * self,
|
||||||
const gchar * name, const gchar * value)
|
const gchar * name, const gchar * value)
|
||||||
{
|
{
|
||||||
OSStatus status;
|
OSStatus status;
|
||||||
|
@ -724,7 +720,7 @@ gst_iphone_camera_src_set_device_property_cstr (GstIPhoneCameraSrc * self,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_iphone_camera_src_base_init (gpointer gclass)
|
gst_cel_video_src_base_init (gpointer gclass)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
|
||||||
|
|
||||||
|
@ -739,35 +735,35 @@ gst_iphone_camera_src_base_init (gpointer gclass)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_iphone_camera_src_class_init (GstIPhoneCameraSrcClass * klass)
|
gst_cel_video_src_class_init (GstCelVideoSrcClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
||||||
GstBaseSrcClass *gstbasesrc_class = GST_BASE_SRC_CLASS (klass);
|
GstBaseSrcClass *gstbasesrc_class = GST_BASE_SRC_CLASS (klass);
|
||||||
GstPushSrcClass *gstpushsrc_class = GST_PUSH_SRC_CLASS (klass);
|
GstPushSrcClass *gstpushsrc_class = GST_PUSH_SRC_CLASS (klass);
|
||||||
|
|
||||||
gobject_class->dispose = gst_iphone_camera_src_dispose;
|
gobject_class->dispose = gst_cel_video_src_dispose;
|
||||||
gobject_class->finalize = gst_iphone_camera_src_finalize;
|
gobject_class->finalize = gst_cel_video_src_finalize;
|
||||||
gobject_class->get_property = gst_iphone_camera_src_get_property;
|
gobject_class->get_property = gst_cel_video_src_get_property;
|
||||||
gobject_class->set_property = gst_iphone_camera_src_set_property;
|
gobject_class->set_property = gst_cel_video_src_set_property;
|
||||||
|
|
||||||
gstelement_class->change_state = gst_iphone_camera_src_change_state;
|
gstelement_class->change_state = gst_cel_video_src_change_state;
|
||||||
|
|
||||||
gstbasesrc_class->get_caps = gst_iphone_camera_src_get_caps;
|
gstbasesrc_class->get_caps = gst_cel_video_src_get_caps;
|
||||||
gstbasesrc_class->set_caps = gst_iphone_camera_src_set_caps;
|
gstbasesrc_class->set_caps = gst_cel_video_src_set_caps;
|
||||||
gstbasesrc_class->start = gst_iphone_camera_src_start;
|
gstbasesrc_class->start = gst_cel_video_src_start;
|
||||||
gstbasesrc_class->stop = gst_iphone_camera_src_stop;
|
gstbasesrc_class->stop = gst_cel_video_src_stop;
|
||||||
gstbasesrc_class->query = gst_iphone_camera_src_query;
|
gstbasesrc_class->query = gst_cel_video_src_query;
|
||||||
gstbasesrc_class->unlock = gst_iphone_camera_src_unlock;
|
gstbasesrc_class->unlock = gst_cel_video_src_unlock;
|
||||||
gstbasesrc_class->unlock_stop = gst_iphone_camera_src_unlock_stop;
|
gstbasesrc_class->unlock_stop = gst_cel_video_src_unlock_stop;
|
||||||
|
|
||||||
gstpushsrc_class->create = gst_iphone_camera_src_create;
|
gstpushsrc_class->create = gst_cel_video_src_create;
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_DO_STATS,
|
g_object_class_install_property (gobject_class, PROP_DO_STATS,
|
||||||
g_param_spec_boolean ("do-stats", "Enable statistics",
|
g_param_spec_boolean ("do-stats", "Enable statistics",
|
||||||
"Enable logging of statistics", DEFAULT_DO_STATS,
|
"Enable logging of statistics", DEFAULT_DO_STATS,
|
||||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_iphone_camera_src_debug, "iphonecamerasrc",
|
GST_DEBUG_CATEGORY_INIT (gst_cel_video_src_debug, "celvideosrc",
|
||||||
0, "iPhone video source");
|
0, "iPhone video source");
|
||||||
}
|
}
|
|
@ -17,8 +17,8 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GST_IPHONE_CAMERA_SRC_H__
|
#ifndef __GST_CEL_VIDEO_SRC_H__
|
||||||
#define __GST_IPHONE_CAMERA_SRC_H__
|
#define __GST_CEL_VIDEO_SRC_H__
|
||||||
|
|
||||||
#include <gst/base/gstpushsrc.h>
|
#include <gst/base/gstpushsrc.h>
|
||||||
|
|
||||||
|
@ -26,23 +26,23 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GST_TYPE_IPHONE_CAMERA_SRC \
|
#define GST_TYPE_CEL_VIDEO_SRC \
|
||||||
(gst_iphone_camera_src_get_type ())
|
(gst_cel_video_src_get_type ())
|
||||||
#define GST_IPHONE_CAMERA_SRC(obj) \
|
#define GST_CEL_VIDEO_SRC(obj) \
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_IPHONE_CAMERA_SRC, GstIPhoneCameraSrc))
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CEL_VIDEO_SRC, GstCelVideoSrc))
|
||||||
#define GST_IPHONE_CAMERA_SRC_CAST(obj) \
|
#define GST_CEL_VIDEO_SRC_CAST(obj) \
|
||||||
((GstIPhoneCameraSrc *) (obj))
|
((GstCelVideoSrc *) (obj))
|
||||||
#define GST_IPHONE_CAMERA_SRC_CLASS(klass) \
|
#define GST_CEL_VIDEO_SRC_CLASS(klass) \
|
||||||
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_IPHONE_CAMERA_SRC, GstIPhoneCameraSrcClass))
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CEL_VIDEO_SRC, GstCelVideoSrcClass))
|
||||||
#define GST_IS_IPHONE_CAMERA_SRC(obj) \
|
#define GST_IS_CEL_VIDEO_SRC(obj) \
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_IPHONE_CAMERA_SRC))
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CEL_VIDEO_SRC))
|
||||||
#define GST_IS_IPHONE_CAMERA_SRC_CLASS(klass) \
|
#define GST_IS_CEL_VIDEO_SRC_CLASS(klass) \
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_IPHONE_CAMERA_SRC))
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CEL_VIDEO_SRC))
|
||||||
|
|
||||||
typedef struct _GstIPhoneCameraSrc GstIPhoneCameraSrc;
|
typedef struct _GstCelVideoSrc GstCelVideoSrc;
|
||||||
typedef struct _GstIPhoneCameraSrcClass GstIPhoneCameraSrcClass;
|
typedef struct _GstCelVideoSrcClass GstCelVideoSrcClass;
|
||||||
|
|
||||||
struct _GstIPhoneCameraSrc
|
struct _GstCelVideoSrc
|
||||||
{
|
{
|
||||||
GstPushSrc push_src;
|
GstPushSrc push_src;
|
||||||
|
|
||||||
|
@ -67,13 +67,13 @@ struct _GstIPhoneCameraSrc
|
||||||
volatile gboolean has_pending;
|
volatile gboolean has_pending;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstIPhoneCameraSrcClass
|
struct _GstCelVideoSrcClass
|
||||||
{
|
{
|
||||||
GstPushSrcClass parent_class;
|
GstPushSrcClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_iphone_camera_src_get_type (void);
|
GType gst_cel_video_src_get_type (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_IPHONE_CAMERA_SRC_H__ */
|
#endif /* __GST_CEL_VIDEO_SRC_H__ */
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#ifdef HAVE_IOS
|
#ifdef HAVE_IOS
|
||||||
#include "avfvideosrc.h"
|
#include "avfvideosrc.h"
|
||||||
#include "iphonecamerasrc.h"
|
#include "celvideosrc.h"
|
||||||
#else
|
#else
|
||||||
#include "qtkitvideosrc.h"
|
#include "qtkitvideosrc.h"
|
||||||
#include "miovideosrc.h"
|
#include "miovideosrc.h"
|
||||||
|
@ -53,8 +53,8 @@ plugin_init (GstPlugin * plugin)
|
||||||
#ifdef HAVE_IOS
|
#ifdef HAVE_IOS
|
||||||
res = gst_element_register (plugin, "avfvideosrc", GST_RANK_NONE,
|
res = gst_element_register (plugin, "avfvideosrc", GST_RANK_NONE,
|
||||||
GST_TYPE_AVF_VIDEO_SRC);
|
GST_TYPE_AVF_VIDEO_SRC);
|
||||||
res &= gst_element_register (plugin, "iphonecamerasrc", GST_RANK_NONE,
|
res &= gst_element_register (plugin, "celvideosrc", GST_RANK_NONE,
|
||||||
GST_TYPE_IPHONE_CAMERA_SRC);
|
GST_TYPE_CEL_VIDEO_SRC);
|
||||||
#else
|
#else
|
||||||
enable_mt_mode ();
|
enable_mt_mode ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue