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
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
+
+
+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.
+
+
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 */
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;
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);
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));
}
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));
{
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);
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");
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,
{
char *s = gst_caps_to_string (caps);
PUT_ESCAPED ("caps", s);
+ g_free (s);
return TRUE;
}
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));
}
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));