Make GstCaps parameter const. Copy caps parameter. Use _POINTER to marshal caps instead of _BOXED. Don't double-fre...

Original commit message from CVS:
Make GstCaps parameter const.  Copy caps parameter. Use _POINTER to
marshal caps instead of _BOXED.  Don't double-free caps.Use
GST_PAD_LINK_SUCCESSFUL.
This commit is contained in:
Colin Walters 2003-12-24 07:42:43 +00:00
parent a7ef9c4a68
commit 5d39cbbd4e
10 changed files with 36 additions and 24 deletions

View file

@ -1,3 +1,10 @@
2003-12-24 Colin Walters <walters@verbum.org>
* gst/elements/gsttypefindelement.c:
gst/elements/gsttypefindelement.h: Make GstCaps parameter const.
Copy caps parameter. Use _POINTER to marshal caps instead of _BOXED.
Don't double-free caps.
2003-12-23 David Schleef <ds@schleef.org>
* gst/gstelement.c, gst/gstpad.c, gst/parse/grammar.y,

View file

@ -141,7 +141,7 @@ gst_type_find_element_get_type (void)
return typefind_type;
}
static void
gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, GstCaps *caps)
gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
{
gchar *caps_str;
@ -151,7 +151,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
caps_str = gst_caps_to_string (caps);
GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
g_free (caps_str);
gst_caps_replace (&typefind->caps, caps);
typefind->caps = gst_caps_copy (caps);
if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
}
@ -195,8 +195,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type",
G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
gst_marshal_VOID__UINT_BOXED, G_TYPE_NONE, 2,
G_TYPE_UINT, gst_caps_get_type());
gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
G_TYPE_UINT, G_TYPE_POINTER);
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
}
@ -669,7 +669,8 @@ gst_type_find_element_change_state (GstElement *element)
break;
case GST_STATE_PAUSED_TO_READY:
stop_typefinding (typefind);
gst_caps_replace (&typefind->caps, NULL);
if (typefind->caps)
gst_caps_free (typefind->caps);
break;
default:
break;

View file

@ -66,7 +66,7 @@ struct _GstTypeFindElementClass {
/* signals */
void (*have_type) (GstTypeFindElement *element,
guint probability,
GstCaps * caps);
const GstCaps * caps);
};
GType gst_type_find_element_get_type (void);

View file

@ -141,7 +141,7 @@ gst_type_find_element_get_type (void)
return typefind_type;
}
static void
gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, GstCaps *caps)
gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
{
gchar *caps_str;
@ -151,7 +151,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
caps_str = gst_caps_to_string (caps);
GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
g_free (caps_str);
gst_caps_replace (&typefind->caps, caps);
typefind->caps = gst_caps_copy (caps);
if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
}
@ -195,8 +195,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type",
G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
gst_marshal_VOID__UINT_BOXED, G_TYPE_NONE, 2,
G_TYPE_UINT, gst_caps_get_type());
gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
G_TYPE_UINT, G_TYPE_POINTER);
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
}
@ -669,7 +669,8 @@ gst_type_find_element_change_state (GstElement *element)
break;
case GST_STATE_PAUSED_TO_READY:
stop_typefinding (typefind);
gst_caps_replace (&typefind->caps, NULL);
if (typefind->caps)
gst_caps_free (typefind->caps);
break;
default:
break;

View file

@ -66,7 +66,7 @@ struct _GstTypeFindElementClass {
/* signals */
void (*have_type) (GstTypeFindElement *element,
guint probability,
GstCaps * caps);
const GstCaps * caps);
};
GType gst_type_find_element_get_type (void);

View file

@ -11,5 +11,6 @@ VOID:OBJECT,STRING
VOID:INT,INT
VOID:INT64
VOID:UINT,BOXED
VOID:UINT,POINTER
BOOLEAN:VOID
BOOLEAN:POINTER

View file

@ -141,7 +141,7 @@ gst_type_find_element_get_type (void)
return typefind_type;
}
static void
gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, GstCaps *caps)
gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
{
gchar *caps_str;
@ -151,7 +151,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
caps_str = gst_caps_to_string (caps);
GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
g_free (caps_str);
gst_caps_replace (&typefind->caps, caps);
typefind->caps = gst_caps_copy (caps);
if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
}
@ -195,8 +195,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type",
G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
gst_marshal_VOID__UINT_BOXED, G_TYPE_NONE, 2,
G_TYPE_UINT, gst_caps_get_type());
gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
G_TYPE_UINT, G_TYPE_POINTER);
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
}
@ -669,7 +669,8 @@ gst_type_find_element_change_state (GstElement *element)
break;
case GST_STATE_PAUSED_TO_READY:
stop_typefinding (typefind);
gst_caps_replace (&typefind->caps, NULL);
if (typefind->caps)
gst_caps_free (typefind->caps);
break;
default:
break;

View file

@ -66,7 +66,7 @@ struct _GstTypeFindElementClass {
/* signals */
void (*have_type) (GstTypeFindElement *element,
guint probability,
GstCaps * caps);
const GstCaps * caps);
};
GType gst_type_find_element_get_type (void);

View file

@ -141,7 +141,7 @@ gst_type_find_element_get_type (void)
return typefind_type;
}
static void
gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, GstCaps *caps)
gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
{
gchar *caps_str;
@ -151,7 +151,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
caps_str = gst_caps_to_string (caps);
GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
g_free (caps_str);
gst_caps_replace (&typefind->caps, caps);
typefind->caps = gst_caps_copy (caps);
if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
}
@ -195,8 +195,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type",
G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
gst_marshal_VOID__UINT_BOXED, G_TYPE_NONE, 2,
G_TYPE_UINT, gst_caps_get_type());
gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
G_TYPE_UINT, G_TYPE_POINTER);
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
}
@ -669,7 +669,8 @@ gst_type_find_element_change_state (GstElement *element)
break;
case GST_STATE_PAUSED_TO_READY:
stop_typefinding (typefind);
gst_caps_replace (&typefind->caps, NULL);
if (typefind->caps)
gst_caps_free (typefind->caps);
break;
default:
break;

View file

@ -66,7 +66,7 @@ struct _GstTypeFindElementClass {
/* signals */
void (*have_type) (GstTypeFindElement *element,
guint probability,
GstCaps * caps);
const GstCaps * caps);
};
GType gst_type_find_element_get_type (void);