patch over logic errors in osxvideosrc
apple's compiler carps, with reason, about some constructs in osxvideosrc.c fix them. also it seems that for some reason this required a gst-indent run. whee
This commit is contained in:
parent
1bd852073d
commit
f01ac09dfb
@ -166,33 +166,36 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
||||||
"format = (fourcc) UYVY, "
|
"format = (fourcc) UYVY, "
|
||||||
"width = (int) [ 1, MAX ], "
|
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ], "
|
||||||
"height = (int) [ 1, MAX ], "
|
|
||||||
//"framerate = (fraction) 0/1")
|
//"framerate = (fraction) 0/1")
|
||||||
"framerate = (fraction) 30/1")
|
"framerate = (fraction) 30/1")
|
||||||
);
|
);
|
||||||
|
|
||||||
static void gst_osx_video_src_init_interfaces (GType type);
|
static void
|
||||||
static void gst_osx_video_src_type_add_device_property_probe_interface (GType type);
|
gst_osx_video_src_init_interfaces (GType type);
|
||||||
|
static void
|
||||||
|
gst_osx_video_src_type_add_device_property_probe_interface (GType type);
|
||||||
|
|
||||||
GST_BOILERPLATE_FULL (GstOSXVideoSrc, gst_osx_video_src, GstPushSrc,
|
GST_BOILERPLATE_FULL (GstOSXVideoSrc, gst_osx_video_src, GstPushSrc,
|
||||||
GST_TYPE_PUSH_SRC, gst_osx_video_src_init_interfaces);
|
GST_TYPE_PUSH_SRC, gst_osx_video_src_init_interfaces);
|
||||||
|
|
||||||
static void gst_osx_video_src_dispose (GObject * object);
|
static void gst_osx_video_src_dispose (GObject * object);
|
||||||
static void gst_osx_video_src_finalize (GstOSXVideoSrc * osx_video_src);
|
static void gst_osx_video_src_finalize (GstOSXVideoSrc * osx_video_src);
|
||||||
static void gst_osx_video_src_set_property (GObject * object, guint prop_id,
|
static void gst_osx_video_src_set_property (GObject * object,
|
||||||
const GValue * value, GParamSpec * pspec);
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_osx_video_src_get_property (GObject * object, guint prop_id,
|
static void gst_osx_video_src_get_property (GObject * object,
|
||||||
GValue * value, GParamSpec * pspec);
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
||||||
|
|
||||||
static GstStateChangeReturn gst_osx_video_src_change_state (
|
static GstStateChangeReturn gst_osx_video_src_change_state (GstElement *
|
||||||
GstElement * element, GstStateChange transition);
|
element, GstStateChange transition);
|
||||||
|
|
||||||
static GstCaps *gst_osx_video_src_get_caps (GstBaseSrc * src);
|
static GstCaps *gst_osx_video_src_get_caps (GstBaseSrc * src);
|
||||||
static gboolean gst_osx_video_src_set_caps (GstBaseSrc * src, GstCaps * caps);
|
static gboolean gst_osx_video_src_set_caps (GstBaseSrc * src,
|
||||||
|
GstCaps * caps);
|
||||||
static gboolean gst_osx_video_src_start (GstBaseSrc * src);
|
static gboolean gst_osx_video_src_start (GstBaseSrc * src);
|
||||||
static gboolean gst_osx_video_src_stop (GstBaseSrc * src);
|
static gboolean gst_osx_video_src_stop (GstBaseSrc * src);
|
||||||
static gboolean gst_osx_video_src_query (GstBaseSrc * bsrc, GstQuery * query);
|
static gboolean gst_osx_video_src_query (GstBaseSrc * bsrc,
|
||||||
|
GstQuery * query);
|
||||||
static GstFlowReturn gst_osx_video_src_create (GstPushSrc * src,
|
static GstFlowReturn gst_osx_video_src_create (GstPushSrc * src,
|
||||||
GstBuffer ** buf);
|
GstBuffer ** buf);
|
||||||
static void gst_osx_video_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
|
static void gst_osx_video_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
|
||||||
@ -200,8 +203,7 @@ static void gst_osx_video_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
|
|||||||
static gboolean prepare_capture (GstOSXVideoSrc * self);
|
static gboolean prepare_capture (GstOSXVideoSrc * self);
|
||||||
|
|
||||||
/* \ = \\, : = \c */
|
/* \ = \\, : = \c */
|
||||||
static GString *
|
static GString *escape_string (const GString * in)
|
||||||
escape_string (const GString * in)
|
|
||||||
{
|
{
|
||||||
GString *out;
|
GString *out;
|
||||||
int n;
|
int n;
|
||||||
@ -238,12 +240,10 @@ unescape_string (const GString * in)
|
|||||||
else {
|
else {
|
||||||
/* unknown code, we will eat the escape sequence */
|
/* unknown code, we will eat the escape sequence */
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* string ends with backslash, we will eat it */
|
/* string ends with backslash, we will eat it */
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
g_string_append_c (out, in->str[n]);
|
g_string_append_c (out, in->str[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,8 +265,7 @@ create_device_id (const gchar * sgname, int inputIndex)
|
|||||||
if (inputIndex >= 0) {
|
if (inputIndex >= 0) {
|
||||||
out = g_string_new ("");
|
out = g_string_new ("");
|
||||||
g_string_printf (out, "%s:%d", nameenc->str, inputIndex);
|
g_string_printf (out, "%s:%d", nameenc->str, inputIndex);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* unspecified index */
|
/* unspecified index */
|
||||||
out = g_string_new (nameenc->str);
|
out = g_string_new (nameenc->str);
|
||||||
}
|
}
|
||||||
@ -283,7 +282,7 @@ parse_device_id (const gchar * id, gchar ** sgname, int * inputIndex)
|
|||||||
int numparts;
|
int numparts;
|
||||||
GString *p1;
|
GString *p1;
|
||||||
GString *out1;
|
GString *out1;
|
||||||
int out2;
|
int out2 = 0;
|
||||||
|
|
||||||
parts = g_strsplit (id, ":", -1);
|
parts = g_strsplit (id, ":", -1);
|
||||||
numparts = 0;
|
numparts = 0;
|
||||||
@ -317,7 +316,8 @@ parse_device_id (const gchar * id, gchar ** sgname, int * inputIndex)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
gchar *id;
|
gchar *id;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
} video_device;
|
} video_device;
|
||||||
@ -358,7 +358,7 @@ video_device_free_func (gpointer data, gpointer user_data)
|
|||||||
static GList *
|
static GList *
|
||||||
device_list (GstOSXVideoSrc * src)
|
device_list (GstOSXVideoSrc * src)
|
||||||
{
|
{
|
||||||
SeqGrabComponent component;
|
SeqGrabComponent component = NULL;
|
||||||
SGChannel channel;
|
SGChannel channel;
|
||||||
SGDeviceList deviceList;
|
SGDeviceList deviceList;
|
||||||
SGDeviceName *deviceEntry;
|
SGDeviceName *deviceEntry;
|
||||||
@ -378,13 +378,13 @@ device_list (GstOSXVideoSrc * src)
|
|||||||
/* if we already have a video channel allocated, use that */
|
/* if we already have a video channel allocated, use that */
|
||||||
GST_DEBUG_OBJECT (src, "reusing existing channel for device_list");
|
GST_DEBUG_OBJECT (src, "reusing existing channel for device_list");
|
||||||
channel = src->video_chan;
|
channel = src->video_chan;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* otherwise, allocate a temporary one */
|
/* otherwise, allocate a temporary one */
|
||||||
component = OpenDefaultComponent (SeqGrabComponentType, 0);
|
component = OpenDefaultComponent (SeqGrabComponentType, 0);
|
||||||
if (!component) {
|
if (!component) {
|
||||||
err = paramErr;
|
err = paramErr;
|
||||||
GST_ERROR_OBJECT (src, "OpenDefaultComponent failed. paramErr=%d", (int) err);
|
GST_ERROR_OBJECT (src, "OpenDefaultComponent failed. paramErr=%d",
|
||||||
|
(int) err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,7 +407,8 @@ device_list (GstOSXVideoSrc * src)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = SGGetChannelDeviceList (channel, sgDeviceListIncludeInputs, &deviceList);
|
err =
|
||||||
|
SGGetChannelDeviceList (channel, sgDeviceListIncludeInputs, &deviceList);
|
||||||
if (err != noErr) {
|
if (err != noErr) {
|
||||||
GST_ERROR_OBJECT (src, "SGGetChannelDeviceList returned %d", (int) err);
|
GST_ERROR_OBJECT (src, "SGGetChannelDeviceList returned %d", (int) err);
|
||||||
goto end;
|
goto end;
|
||||||
@ -440,7 +441,8 @@ device_list (GstOSXVideoSrc * src)
|
|||||||
list = g_list_append (list, dev);
|
list = g_list_append (list, dev);
|
||||||
|
|
||||||
/* if this is the default device, note it */
|
/* if this is the default device, note it */
|
||||||
if (n == (*deviceList)->selectedIndex && i == (*inputList)->selectedIndex) {
|
if (n == (*deviceList)->selectedIndex
|
||||||
|
&& i == (*inputList)->selectedIndex) {
|
||||||
default_dev = dev;
|
default_dev = dev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,8 +450,7 @@ device_list (GstOSXVideoSrc * src)
|
|||||||
/* error */
|
/* error */
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* ### can a device have no defined inputs? */
|
/* ### can a device have no defined inputs? */
|
||||||
dev = video_device_alloc ();
|
dev = video_device_alloc ();
|
||||||
dev->id = create_device_id (sgname, -1);
|
dev->id = create_device_id (sgname, -1);
|
||||||
@ -475,7 +476,7 @@ device_list (GstOSXVideoSrc * src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (!src->video_chan) {
|
if (!src->video_chan && component) {
|
||||||
err = CloseComponent (component);
|
err = CloseComponent (component);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
GST_WARNING_OBJECT (src, "CloseComponent returned %d", (int) err);
|
GST_WARNING_OBJECT (src, "CloseComponent returned %d", (int) err);
|
||||||
@ -602,7 +603,8 @@ device_select (GstOSXVideoSrc * src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_osx_video_src_iface_supported (GstImplementsInterface * iface, GType iface_type)
|
gst_osx_video_src_iface_supported (GstImplementsInterface * iface,
|
||||||
|
GType iface_type)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -697,8 +699,7 @@ gst_osx_video_src_class_init (GstOSXVideoSrcClass * klass)
|
|||||||
err = EnterMovies ();
|
err = EnterMovies ();
|
||||||
if (err == noErr) {
|
if (err == noErr) {
|
||||||
klass->movies_enabled = TRUE;
|
klass->movies_enabled = TRUE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
klass->movies_enabled = FALSE;
|
klass->movies_enabled = FALSE;
|
||||||
GST_ERROR ("EnterMovies returned %d", err);
|
GST_ERROR ("EnterMovies returned %d", err);
|
||||||
}
|
}
|
||||||
@ -842,7 +843,8 @@ gst_osx_video_src_set_caps (GstBaseSrc * src, GstCaps * caps)
|
|||||||
|
|
||||||
gst_structure_get_int (structure, "width", &width);
|
gst_structure_get_int (structure, "width", &width);
|
||||||
gst_structure_get_int (structure, "height", &height);
|
gst_structure_get_int (structure, "height", &height);
|
||||||
gst_structure_get_fraction (structure, "framerate", &framerate_num, &framerate_denom);
|
gst_structure_get_fraction (structure, "framerate", &framerate_num,
|
||||||
|
&framerate_denom);
|
||||||
fps = (float) framerate_num / framerate_denom;
|
fps = (float) framerate_num / framerate_denom;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (src, "changing caps to %dx%d@%f", width, height, fps);
|
GST_DEBUG_OBJECT (src, "changing caps to %dx%d@%f", width, height, fps);
|
||||||
@ -872,7 +874,6 @@ gst_osx_video_src_set_caps (GstBaseSrc * src, GstCaps * caps)
|
|||||||
GST_ERROR_OBJECT (self, "SGSetChannelBounds returned %d", (int) err);
|
GST_ERROR_OBJECT (self, "SGSetChannelBounds returned %d", (int) err);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ###: if we ever support choosing framerates, do something with this
|
// ###: if we ever support choosing framerates, do something with this
|
||||||
/*err = SGSetFrameRate (self->video_chan, FloatToFixed(fps));
|
/*err = SGSetFrameRate (self->video_chan, FloatToFixed(fps));
|
||||||
if (err != noErr) {
|
if (err != noErr) {
|
||||||
@ -931,7 +932,8 @@ gst_osx_video_src_start (GstBaseSrc * src)
|
|||||||
self->seq_grab = OpenDefaultComponent (SeqGrabComponentType, 0);
|
self->seq_grab = OpenDefaultComponent (SeqGrabComponentType, 0);
|
||||||
if (self->seq_grab == NULL) {
|
if (self->seq_grab == NULL) {
|
||||||
err = paramErr;
|
err = paramErr;
|
||||||
GST_ERROR_OBJECT (self, "OpenDefaultComponent failed. paramErr=%d", (int) err);
|
GST_ERROR_OBJECT (self, "OpenDefaultComponent failed. paramErr=%d",
|
||||||
|
(int) err);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1044,8 +1046,7 @@ gst_osx_video_src_query (GstBaseSrc * bsrc, GstQuery * query)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
gst_osx_video_src_change_state (GstElement * element,
|
gst_osx_video_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
GstStateChange transition)
|
|
||||||
{
|
{
|
||||||
GstStateChangeReturn result;
|
GstStateChangeReturn result;
|
||||||
GstOSXVideoSrc *self;
|
GstOSXVideoSrc *self;
|
||||||
@ -1086,7 +1087,8 @@ gst_osx_video_src_change_state (GstElement * element,
|
|||||||
SGStop (self->seq_grab);
|
SGStop (self->seq_grab);
|
||||||
SGRelease (self->seq_grab);
|
SGRelease (self->seq_grab);
|
||||||
DisposeHandle ((Handle) imageDesc);
|
DisposeHandle ((Handle) imageDesc);
|
||||||
GST_ERROR_OBJECT (self, "SGGetChannelSampleDescription returned %d", (int) err);
|
GST_ERROR_OBJECT (self, "SGGetChannelSampleDescription returned %d",
|
||||||
|
(int) err);
|
||||||
return GST_STATE_CHANGE_FAILURE;
|
return GST_STATE_CHANGE_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1103,7 +1105,8 @@ gst_osx_video_src_change_state (GstElement * element,
|
|||||||
SGStop (self->seq_grab);
|
SGStop (self->seq_grab);
|
||||||
SGRelease (self->seq_grab);
|
SGRelease (self->seq_grab);
|
||||||
DisposeHandle ((Handle) imageDesc);
|
DisposeHandle ((Handle) imageDesc);
|
||||||
GST_ERROR_OBJECT (self, "DecompressSequenceBegin returned %d", (int) err);
|
GST_ERROR_OBJECT (self, "DecompressSequenceBegin returned %d",
|
||||||
|
(int) err);
|
||||||
return GST_STATE_CHANGE_FAILURE;
|
return GST_STATE_CHANGE_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1114,8 +1117,7 @@ gst_osx_video_src_change_state (GstElement * element,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = GST_ELEMENT_CLASS (parent_class)->change_state (element,
|
result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||||
transition);
|
|
||||||
if (result == GST_STATE_CHANGE_FAILURE)
|
if (result == GST_STATE_CHANGE_FAILURE)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
@ -1270,8 +1272,7 @@ prepare_capture (GstOSXVideoSrc * self)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = SGSetDataProc (self->seq_grab, NewSGDataUPP (data_proc),
|
err = SGSetDataProc (self->seq_grab, NewSGDataUPP (data_proc), (long) self);
|
||||||
(long) self);
|
|
||||||
if (err != noErr) {
|
if (err != noErr) {
|
||||||
GST_ERROR_OBJECT (self, "SGSetDataProc returned %d", (int) err);
|
GST_ERROR_OBJECT (self, "SGSetDataProc returned %d", (int) err);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1372,7 +1373,8 @@ probe_get_values (GstPropertyProbe * probe, guint prop_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_osx_video_src_property_probe_interface_init (GstPropertyProbeInterface * iface)
|
gst_osx_video_src_property_probe_interface_init (GstPropertyProbeInterface *
|
||||||
|
iface)
|
||||||
{
|
{
|
||||||
iface->get_properties = probe_get_properties;
|
iface->get_properties = probe_get_properties;
|
||||||
iface->probe_property = probe_probe_property;
|
iface->probe_property = probe_probe_property;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user