+2004-02-03 Benjamin Otte <in7y118@public.uni-hamburg.de>
+
+ * gst/gststructure.c: (gst_structure_from_string):
+ fix huge memleak
+ * gst/elements/gsttypefind.c: (gst_type_find_element_have_type),
+ (new_entry), (gst_type_find_element_chain):
+ * gst/gstelement.c: (gst_element_base_class_init),
+ (gst_element_class_set_details):
+ * gst/gstpad.c: (gst_pad_can_link_filtered):
+ fix smaller memleaks
+ * gst/gstpad.c: (gst_real_pad_dispose):
+ check that explicit caps are gone
+ * gst/gststructure.c: (gst_structure_free):
+ actually free the structure
+ * gst/gstelement.c: (gst_element_clear_pad_caps):
+ unset explicit caps
+
2004-02-03 Thomas Vander Stichele <thomas at apestaart dot org>
* tools/Makefile.am:
-Subproject commit 0f9fe900b0757fd2450454a1af24146b47aaaac2
+Subproject commit 28760b093e73a78cdd0c1fba76baa5d87dc2c0f2
GST_INFO_OBJECT (typefind, "found caps %" GST_PTR_FORMAT, caps);
typefind->caps = gst_caps_copy (caps);
- gst_pad_set_explicit_caps (typefind->src, gst_caps_copy(caps));
+ gst_pad_set_explicit_caps (typefind->src, caps);
}
static void
gst_type_find_element_base_init (gpointer g_class)
GList * buffers;
GstTypeFindElement * self;
} TypeFindEntry;
+
+static inline TypeFindEntry *
+new_entry (void)
+{
+ return g_new0 (TypeFindEntry, 1);
+}
static void
free_entry_buffers (TypeFindEntry *entry)
{
all_factories = g_list_sort (all_factories, compare_type_find_factory);
walk = all_factories;
while (all_factories) {
- entry = g_new0 (TypeFindEntry, 1);
+ entry = new_entry ();
entry->factory = GST_TYPE_FIND_FACTORY (all_factories->data);
entry->self = typefind;
GstCaps *found_caps = entry->caps;
guint probability = entry->probability;
- found_caps = gst_caps_copy (found_caps);
GST_INFO_OBJECT (typefind, "'%s' returned %u/%u probability, using it NOW",
GST_PLUGIN_FEATURE_NAME (entry->factory), probability, typefind->max_probability);
while (walk) {
typefind->possibilities = NULL;
g_list_free (typefind->possibilities);
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0, probability, found_caps);
- gst_caps_free (found_caps);
+ free_entry (entry);
} else {
typefind->possibilities = g_list_prepend (typefind->possibilities, entry);
}
};
extern void __gst_element_details_clear (GstElementDetails *dp);
-extern void __gst_element_details_set (GstElementDetails *dest,
+extern void __gst_element_details_copy (GstElementDetails *dest,
const GstElementDetails *src);
static void gst_element_class_init (GstElementClass *klass);
gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_element_real_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_element_real_get_property);
+ memset (&element_class->details, 0, sizeof (GstElementDetails));
element_class->padtemplates = NULL;
}
g_return_if_fail (GST_IS_ELEMENT_CLASS (klass));
g_return_if_fail (GST_IS_ELEMENT_DETAILS (details));
- __gst_element_details_set (&klass->details, details);
+ __gst_element_details_copy (&klass->details, details);
}
/**
GstPad *pad = GST_PAD (pads->data);
gst_pad_unnegotiate (pad);
+ gst_caps_replace (&GST_RPAD_EXPLICIT_CAPS (pad), NULL);
pads = g_list_next (pads);
}
if (filtercaps) link->filtercaps = gst_caps_copy (filtercaps);
gst_pad_link_intersect (link);
- if (gst_caps_is_empty (link->caps))
+ if (gst_caps_is_empty (link->caps)) {
+ gst_pad_link_free (link);
return FALSE;
+ }
+ gst_pad_link_free (link);
return TRUE;
}
gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (pad)), pad);
}
+ if (GST_RPAD_EXPLICIT_CAPS (pad)) {
+ GST_ERROR_OBJECT (pad, "still explicit caps %"GST_PTR_FORMAT" set", GST_RPAD_EXPLICIT_CAPS (pad));
+ g_warning ("pad %p has still explicit caps set", pad);
+ gst_caps_replace (&GST_RPAD_EXPLICIT_CAPS (pad), NULL);
+ }
G_OBJECT_CLASS (real_pad_parent_class)->dispose (object);
}
GstStructureField *field;
int i;
- return;
-
g_return_if_fail(structure != NULL);
for(i=0;i<structure->fields->len;i++){
char *w;
char *r;
char save;
- GstStructure *structure;
+ GstStructure *structure = NULL;
GstStructureField field = { 0 };
- gboolean res;
g_return_val_if_fail(string != NULL, NULL);
r = copy;
name = r;
- res = _gst_structure_parse_string (r, &w, &r);
- if (!res) return NULL;
+ if (!_gst_structure_parse_string (r, &w, &r))
+ goto error;
while (g_ascii_isspace(*r)) r++;
- if(*r != 0 && *r != ';' && *r != ',') return NULL;
+ if(*r != 0 && *r != ';' && *r != ',') goto error;
save = *w;
*w = 0;
*w = save;
while (*r && (*r != ';')){
- if(*r != ',') {
- return NULL;
- }
+ if(*r != ',')
+ goto error;
r++;
while (*r && g_ascii_isspace(*r)) r++;
memset(&field,0,sizeof(field));
- res = _gst_structure_parse_field (r, &r, &field);
- if (!res) {
- gst_structure_free (structure);
- return NULL;
- }
+ if (!_gst_structure_parse_field (r, &r, &field))
+ goto error;
gst_structure_set_field(structure, &field);
while (*r && g_ascii_isspace(*r)) r++;
}
if (end) *end = (char *)string + (r - copy);
+
+ g_free (copy);
return structure;
+
+error:
+ if (structure)
+ gst_structure_free (structure);
+ g_free (copy);
+ return NULL;
}
static void
GST_INFO_OBJECT (typefind, "found caps %" GST_PTR_FORMAT, caps);
typefind->caps = gst_caps_copy (caps);
- gst_pad_set_explicit_caps (typefind->src, gst_caps_copy(caps));
+ gst_pad_set_explicit_caps (typefind->src, caps);
}
static void
gst_type_find_element_base_init (gpointer g_class)
GList * buffers;
GstTypeFindElement * self;
} TypeFindEntry;
+
+static inline TypeFindEntry *
+new_entry (void)
+{
+ return g_new0 (TypeFindEntry, 1);
+}
static void
free_entry_buffers (TypeFindEntry *entry)
{
all_factories = g_list_sort (all_factories, compare_type_find_factory);
walk = all_factories;
while (all_factories) {
- entry = g_new0 (TypeFindEntry, 1);
+ entry = new_entry ();
entry->factory = GST_TYPE_FIND_FACTORY (all_factories->data);
entry->self = typefind;
GstCaps *found_caps = entry->caps;
guint probability = entry->probability;
- found_caps = gst_caps_copy (found_caps);
GST_INFO_OBJECT (typefind, "'%s' returned %u/%u probability, using it NOW",
GST_PLUGIN_FEATURE_NAME (entry->factory), probability, typefind->max_probability);
while (walk) {
typefind->possibilities = NULL;
g_list_free (typefind->possibilities);
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0, probability, found_caps);
- gst_caps_free (found_caps);
+ free_entry (entry);
} else {
typefind->possibilities = g_list_prepend (typefind->possibilities, entry);
}