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>
* 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 (sinkcaps != NULL, NULL);
GST_INFO ("attempting to autoplug via shortest path from %s to %s",
gst_caps_to_string(srccaps), gst_caps_to_string(sinkcaps));
GST_INFO ("attempting to autoplug via shortest path from %"
GST_PTR_FORMAT " to %" GST_PTR_FORMAT, srccaps, sinkcaps);
/* wrap all factories as GstAutoplugNode
* initialize the cost */

View file

@ -446,11 +446,8 @@ static void
spider_find_suggest (gpointer data, guint probability, const GstCaps *caps)
{
SpiderTypeFind *find = (SpiderTypeFind *) data;
G_GNUC_UNUSED gchar *caps_str;
caps_str = gst_caps_to_string (caps);
GST_INFO ("suggest %u, %s", probability, caps_str);
g_free (caps_str);
GST_INFO ("suggest %u, %" GST_PTR_FORMAT, probability, caps);
if (probability > find->best_probability) {
gst_caps_replace (&find->caps, gst_caps_copy (caps));
find->best_probability = probability;
@ -525,11 +522,7 @@ plug:
g_critical("could not set caps on spideridentity src pad\n");
}
}
{
gchar *str = gst_caps_to_string (find.caps);
GST_LOG_OBJECT (ident, "spider starting caps: %s", str);
g_free (str);
}
GST_LOG_OBJECT (ident, "spider starting caps: %" GST_PTR_FORMAT, find.caps);
if (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
gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
{
gchar *caps_str;
g_assert (typefind->caps == NULL);
g_assert (caps != NULL);
caps_str = gst_caps_to_string (caps);
GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
g_free (caps_str);
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));
}
@ -441,13 +437,10 @@ find_peek (gpointer data, gint64 offset, guint size)
static void
find_suggest (gpointer data, guint probability, const GstCaps *caps)
{
gchar *str;
TypeFindEntry *entry = (TypeFindEntry *) data;
str = gst_caps_to_string (caps);
GST_LOG_OBJECT (entry->self, "'%s' called suggest (%u, %s)",
GST_PLUGIN_FEATURE_NAME (entry->factory), probability, str);
g_free (str);
GST_LOG_OBJECT (entry->self, "'%s' called suggest (%u, %" GST_PTR_FORMAT ")",
GST_PLUGIN_FEATURE_NAME (entry->factory), probability, caps);
if (((gint) probability) > entry->probability) {
entry->probability = probability;
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;
GstPadLink *link;
gchar *str;
/* generic checks */
g_return_val_if_fail (GST_IS_PAD (srcpad), 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 %s",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad), str);
g_free (str);
GST_CAT_INFO (GST_CAT_PADS, "trying to relink %s:%s and %s:%s with filtercaps %" GST_PTR_FORMAT,
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad), filtercaps);
/* now we need to deal with the real/ghost stuff */
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);
GST_CAT_DEBUG (GST_CAT_PADS, "setting explicit caps to %s",
gst_caps_to_string (caps));
GST_CAT_DEBUG (GST_CAT_PADS, "setting explicit caps to %" GST_PTR_FORMAT,
caps);
if (caps == 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 (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 (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 (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);
PUT_ESCAPED ("caps", s);
g_free (s);
return TRUE;
}

View file

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