gst/gstvalue.c: Implement GstObject -> string transform so we print object names when serializing GValues containing ...

Original commit message from CVS:
* gst/gstvalue.c: (gst_value_transform_object_string),
(_gst_value_initialize):
Implement GstObject -> string transform so we print object names
when serializing GValues containing GstObjects.
diff --git a/ChangeLog b/ChangeLog
index 1b2ce4b..fc9753e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2007-02-28  Wim Taymans  <wim@fluendo.com>
 
+	* gst/gstvalue.c: (gst_value_transform_object_string),
+	(_gst_value_initialize):
+	Implement GstObject -> string transform so we print object names
+	when serializing GValues containing GstObjects.
+
+2007-02-28  Wim Taymans  <wim@fluendo.com>
+
 	* docs/gst/gstreamer-sections.txt:
 	Add new stuff to docs.
 
diff --git a/gst/gstvalue.c b/gst/gstvalue.c
index e47364c..9d64ed2 100644
--- a/gst/gstvalue.c
+++ b/gst/gstvalue.c
@@ -3834,6 +3834,19 @@
   gst_value_deserialize_date (dest_value, src_value->data[0].v_pointer);
 }
 
+static void
+gst_value_transform_object_string (const GValue * src_value,
+    GValue * dest_value)
+{
+  GstObject *obj;
+  gchar *str;
+
+  obj = g_value_get_object (src_value);
+  str = obj ? GST_OBJECT_NAME (obj) : "NULL";
+
+  dest_value->data[0].v_pointer = g_strdup (str);
+}
+
 static GTypeInfo _info = {
   0,
   NULL,
@@ -4158,6 +4171,8 @@
       gst_value_transform_date_string);
   g_value_register_transform_func (G_TYPE_STRING, GST_TYPE_DATE,
       gst_value_transform_string_date);
+  g_value_register_transform_func (GST_TYPE_OBJECT, G_TYPE_STRING,
+      gst_value_transform_object_string);
 
   gst_value_register_intersect_func (G_TYPE_INT, GST_TYPE_INT_RANGE,
       gst_value_intersect_int_int_range);