Re: gst-plugins-base: oggdemux: remove avoidable call to gst_object_set_name

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: gst-plugins-base: oggdemux: remove avoidable call to gst_object_set_name

Stefan Sauer
On 10/21/2011 10:25 PM, RenXX Stadler wrote:
Module: gst-plugins-base
Branch: master
Commit: 133a0b17715b2b7f106bed7ea0164451e9c33e94
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=133a0b17715b2b7f106bed7ea0164451e9c33e94

Author: René Stadler [hidden email]
Date:   Fri Oct 21 21:41:03 2011 +0200

oggdemux: remove avoidable call to gst_object_set_name

---

 ext/ogg/gstoggdemux.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c
index 3a880d4..f739df0 100644
--- a/ext/ogg/gstoggdemux.c
+++ b/ext/ogg/gstoggdemux.c
@@ -1692,7 +1692,9 @@ gst_ogg_chain_new_stream (GstOggChain * chain, guint32 serialno)
   GST_DEBUG_OBJECT (chain->ogg,
       "creating new stream %08x in chain %p", serialno, chain);
 
-  ret = g_object_new (GST_TYPE_OGG_PAD, NULL);
+  name = g_strdup_printf ("serial_%08x", serialno);
+  ret = g_object_new (GST_TYPE_OGG_PAD, "name", name, NULL);
+  g_free (name);
what about gchar name[sizeof("serial_")+8] while you are on it

Stefan

   /* we own this one */
   gst_object_ref (ret);
   gst_object_sink (ret);
@@ -1707,10 +1709,6 @@ gst_ogg_chain_new_stream (GstOggChain * chain, guint32 serialno)
   if (ogg_stream_init (&ret->map.stream, serialno) != 0)
     goto init_failed;
 
-  name = g_strdup_printf ("serial_%08x", serialno);
-  gst_object_set_name (GST_OBJECT (ret), name);
-  g_free (name);
-
   /* FIXME: either do something with it or remove it */
   list = gst_tag_list_new ();
   gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_SERIAL, serialno,

_______________________________________________ gstreamer-commits mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gst-plugins-base: oggdemux: remove avoidable call to gst_object_set_name

René Stadler
On Wed, Oct 26, 2011 at 11:28 AM, Stefan Sauer <[hidden email]> [...]
> -  ret = g_object_new (GST_TYPE_OGG_PAD, NULL);
> +  name = g_strdup_printf ("serial_%08x", serialno);
> +  ret = g_object_new (GST_TYPE_OGG_PAD, "name", name, NULL);
> +  g_free (name);
>
> what about gchar name[sizeof("serial_")+8] while you are on it

Yeah good point. I have seen these in multiple places, sometimes one
way and sometimes the other. I guess the g_snprintf method is
preferable everywhere.

--René
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel