docs/random/ds/element-checklist: Notes about gst_caps_to_string()

Original commit message from CVS:
* docs/random/ds/element-checklist: Notes about gst_caps_to_string()
* gst/registries/gstxmlregistry.c: (gst_xml_registry_save_caps):
Fix memory leakage of gst_caps_to_string().
Use GST_PTR_FORMAT instead of gst_caps_to_string():
* gst/autoplug/gstsearchfuncs.c: (gst_autoplug_sp):
* gst/autoplug/gstspideridentity.c: (spider_find_suggest),
(gst_spider_identity_sink_loop_type_finding):
* gst/elements/gsttypefind.c: (gst_type_find_element_have_type),
(find_suggest):
* gst/gstpad.c: (gst_pad_try_relink_filtered),
(gst_pad_set_explicit_caps):
* gst/parse/grammar.y:
This commit is contained in:
David Schleef 2004-01-29 01:44:08 +00:00
parent 6a096813d4
commit a842daf05e
9 changed files with 41 additions and 40 deletions

View file

@ -1,3 +1,19 @@
2004-01-28 David Schleef <ds@schleef.org>
* docs/random/ds/element-checklist: Notes about gst_caps_to_string()
* gst/registries/gstxmlregistry.c: (gst_xml_registry_save_caps):
Fix memory leakage of gst_caps_to_string().
Use GST_PTR_FORMAT instead of gst_caps_to_string():
* gst/autoplug/gstsearchfuncs.c: (gst_autoplug_sp):
* gst/autoplug/gstspideridentity.c: (spider_find_suggest),
(gst_spider_identity_sink_loop_type_finding):
* gst/elements/gsttypefind.c: (gst_type_find_element_have_type),
(find_suggest):
* gst/gstpad.c: (gst_pad_try_relink_filtered),
(gst_pad_set_explicit_caps):
* gst/parse/grammar.y:
2004-01-28 David Schleef <ds@schleef.org> 2004-01-28 David Schleef <ds@schleef.org>
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and * configure.ac: Add detection for HAVE_PRINTF_EXTENSION and

View file

@ -25,3 +25,11 @@ config.h.
other ideas:
- plugins should avoid using gst_caps_to_string() in debug statement.
They should use %"GST_PTR_FORMAT" instead. Check all usage for leaks.

View file

@ -336,8 +336,8 @@ gst_autoplug_sp (const GstCaps *srccaps, const GstCaps *sinkcaps, GList *factori
g_return_val_if_fail (srccaps != NULL, NULL); g_return_val_if_fail (srccaps != NULL, NULL);
g_return_val_if_fail (sinkcaps != NULL, NULL); g_return_val_if_fail (sinkcaps != NULL, NULL);
GST_INFO ("attempting to autoplug via shortest path from %s to %s", GST_INFO ("attempting to autoplug via shortest path from %"
gst_caps_to_string(srccaps), gst_caps_to_string(sinkcaps)); GST_PTR_FORMAT " to %" GST_PTR_FORMAT, srccaps, sinkcaps);
/* wrap all factories as GstAutoplugNode /* wrap all factories as GstAutoplugNode
* initialize the cost */ * initialize the cost */

View file

@ -446,11 +446,8 @@ static void
spider_find_suggest (gpointer data, guint probability, const GstCaps *caps) spider_find_suggest (gpointer data, guint probability, const GstCaps *caps)
{ {
SpiderTypeFind *find = (SpiderTypeFind *) data; SpiderTypeFind *find = (SpiderTypeFind *) data;
G_GNUC_UNUSED gchar *caps_str;
caps_str = gst_caps_to_string (caps); GST_INFO ("suggest %u, %" GST_PTR_FORMAT, probability, caps);
GST_INFO ("suggest %u, %s", probability, caps_str);
g_free (caps_str);
if (probability > find->best_probability) { if (probability > find->best_probability) {
gst_caps_replace (&find->caps, gst_caps_copy (caps)); gst_caps_replace (&find->caps, gst_caps_copy (caps));
find->best_probability = probability; find->best_probability = probability;
@ -525,11 +522,7 @@ plug:
g_critical("could not set caps on spideridentity src pad\n"); g_critical("could not set caps on spideridentity src pad\n");
} }
} }
{ GST_LOG_OBJECT (ident, "spider starting caps: %" GST_PTR_FORMAT, find.caps);
gchar *str = gst_caps_to_string (find.caps);
GST_LOG_OBJECT (ident, "spider starting caps: %s", str);
g_free (str);
}
if (type_list) if (type_list)
g_list_free (type_list); g_list_free (type_list);

View file

@ -119,14 +119,10 @@ static guint gst_type_find_element_signals[LAST_SIGNAL] = { 0 };
static void static void
gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps) gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
{ {
gchar *caps_str;
g_assert (typefind->caps == NULL); g_assert (typefind->caps == NULL);
g_assert (caps != NULL); g_assert (caps != NULL);
caps_str = gst_caps_to_string (caps); GST_INFO_OBJECT (typefind, "found caps %" GST_PTR_FORMAT, caps);
GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
g_free (caps_str);
typefind->caps = gst_caps_copy (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, gst_caps_copy(caps));
} }
@ -441,13 +437,10 @@ find_peek (gpointer data, gint64 offset, guint size)
static void static void
find_suggest (gpointer data, guint probability, const GstCaps *caps) find_suggest (gpointer data, guint probability, const GstCaps *caps)
{ {
gchar *str;
TypeFindEntry *entry = (TypeFindEntry *) data; TypeFindEntry *entry = (TypeFindEntry *) data;
str = gst_caps_to_string (caps); GST_LOG_OBJECT (entry->self, "'%s' called suggest (%u, %" GST_PTR_FORMAT ")",
GST_LOG_OBJECT (entry->self, "'%s' called suggest (%u, %s)", GST_PLUGIN_FEATURE_NAME (entry->factory), probability, caps);
GST_PLUGIN_FEATURE_NAME (entry->factory), probability, str);
g_free (str);
if (((gint) probability) > entry->probability) { if (((gint) probability) > entry->probability) {
entry->probability = probability; entry->probability = probability;
gst_caps_replace (&entry->caps, gst_caps_copy (caps)); gst_caps_replace (&entry->caps, gst_caps_copy (caps));

View file

@ -2010,16 +2010,13 @@ gst_pad_try_relink_filtered (GstPad *srcpad, GstPad *sinkpad,
{ {
GstRealPad *realsrc, *realsink; GstRealPad *realsrc, *realsink;
GstPadLink *link; GstPadLink *link;
gchar *str;
/* generic checks */ /* generic checks */
g_return_val_if_fail (GST_IS_PAD (srcpad), FALSE); g_return_val_if_fail (GST_IS_PAD (srcpad), FALSE);
g_return_val_if_fail (GST_IS_PAD (sinkpad), FALSE); g_return_val_if_fail (GST_IS_PAD (sinkpad), FALSE);
str = filtercaps ? gst_caps_to_string (filtercaps) : g_strdup (""); GST_CAT_INFO (GST_CAT_PADS, "trying to relink %s:%s and %s:%s with filtercaps %" GST_PTR_FORMAT,
GST_CAT_INFO (GST_CAT_PADS, "trying to relink %s:%s and %s:%s with filtercaps %s", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad), filtercaps);
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad), str);
g_free (str);
/* now we need to deal with the real/ghost stuff */ /* now we need to deal with the real/ghost stuff */
realsrc = GST_PAD_REALIZE (srcpad); realsrc = GST_PAD_REALIZE (srcpad);
@ -2239,8 +2236,8 @@ gst_pad_set_explicit_caps (GstPad *pad, const GstCaps *caps)
g_return_val_if_fail (GST_IS_PAD (pad), FALSE); g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
GST_CAT_DEBUG (GST_CAT_PADS, "setting explicit caps to %s", GST_CAT_DEBUG (GST_CAT_PADS, "setting explicit caps to %" GST_PTR_FORMAT,
gst_caps_to_string (caps)); caps);
if (caps == NULL) { if (caps == NULL) {
GST_CAT_DEBUG (GST_CAT_PADS, "caps is NULL"); GST_CAT_DEBUG (GST_CAT_PADS, "caps is NULL");

View file

@ -458,10 +458,10 @@ gst_parse_perform_link (link_t *link, graph_t *graph)
g_assert (GST_IS_ELEMENT (src)); g_assert (GST_IS_ELEMENT (src));
g_assert (GST_IS_ELEMENT (sink)); g_assert (GST_IS_ELEMENT (sink));
GST_CAT_INFO (GST_CAT_PIPELINE, "linking %s(%s):%u to %s(%s):%u with caps \"%s\"", GST_CAT_INFO (GST_CAT_PIPELINE, "linking %s(%s):%u to %s(%s):%u with caps \"%" GST_PTR_FORMAT "\"",
GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "---", g_slist_length (srcs), GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "---", g_slist_length (srcs),
GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "---", g_slist_length (sinks), GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "---", g_slist_length (sinks),
link->caps ? gst_caps_to_string (link->caps) : "-"); link->caps);
if (!srcs || !sinks) { if (!srcs || !sinks) {
if (gst_element_link_pads_filtered (src, srcs ? (const gchar *) srcs->data : NULL, if (gst_element_link_pads_filtered (src, srcs ? (const gchar *) srcs->data : NULL,

View file

@ -1103,6 +1103,7 @@ gst_xml_registry_save_caps (GstXMLRegistry *xmlregistry, const GstCaps *caps)
{ {
char *s = gst_caps_to_string (caps); char *s = gst_caps_to_string (caps);
PUT_ESCAPED ("caps", s); PUT_ESCAPED ("caps", s);
g_free (s);
return TRUE; return TRUE;
} }

View file

@ -119,14 +119,10 @@ static guint gst_type_find_element_signals[LAST_SIGNAL] = { 0 };
static void static void
gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps) gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
{ {
gchar *caps_str;
g_assert (typefind->caps == NULL); g_assert (typefind->caps == NULL);
g_assert (caps != NULL); g_assert (caps != NULL);
caps_str = gst_caps_to_string (caps); GST_INFO_OBJECT (typefind, "found caps %" GST_PTR_FORMAT, caps);
GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
g_free (caps_str);
typefind->caps = gst_caps_copy (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, gst_caps_copy(caps));
} }
@ -441,13 +437,10 @@ find_peek (gpointer data, gint64 offset, guint size)
static void static void
find_suggest (gpointer data, guint probability, const GstCaps *caps) find_suggest (gpointer data, guint probability, const GstCaps *caps)
{ {
gchar *str;
TypeFindEntry *entry = (TypeFindEntry *) data; TypeFindEntry *entry = (TypeFindEntry *) data;
str = gst_caps_to_string (caps); GST_LOG_OBJECT (entry->self, "'%s' called suggest (%u, %" GST_PTR_FORMAT ")",
GST_LOG_OBJECT (entry->self, "'%s' called suggest (%u, %s)", GST_PLUGIN_FEATURE_NAME (entry->factory), probability, caps);
GST_PLUGIN_FEATURE_NAME (entry->factory), probability, str);
g_free (str);
if (((gint) probability) > entry->probability) { if (((gint) probability) > entry->probability) {
entry->probability = probability; entry->probability = probability;
gst_caps_replace (&entry->caps, gst_caps_copy (caps)); gst_caps_replace (&entry->caps, gst_caps_copy (caps));