API: Add GST_IS_PARAM_SPEC_MINI_OBJECT, GST_PARAM_SPEC_MINI_OBJECT
authorSebastian Dröge <slomo@circular-chaos.org>
Sat, 22 Mar 2008 14:51:17 +0000 (14:51 +0000)
committerSebastian Dröge <slomo@circular-chaos.org>
Sat, 22 Mar 2008 14:51:17 +0000 (14:51 +0000)
Original commit message from CVS:
* gst/gstminiobject.c: (gst_value_dup_mini_object),
(gst_param_spec_mini_object):
* gst/gstminiobject.h:
* win32/common/libgstreamer.def:
* docs/gst/gstreamer-sections.txt:
API: Add GST_IS_PARAM_SPEC_MINI_OBJECT, GST_PARAM_SPEC_MINI_OBJECT
GST_TYPE_PARAM_MINI_OBJECT and gst_value_dup_mini_object. Also move
GstParamSpecMiniObject into a public header for this.
This make GstMiniObject a bit more consistent with GObject and makes
it possible to extend the param specs.
gst_value_dup_mini_object is mainly useful for set_property methods.
Fixes bug #523798.
* tools/gst-inspect.c: (print_element_properties_info):
Print something useful for GstMiniObject properties and not just
"unknown type".

ChangeLog
docs/gst/gstreamer-sections.txt
gst/gstminiobject.c
gst/gstminiobject.h
tools/gst-inspect.c
win32/common/libgstreamer.def

index 4483a16..e566d01 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2008-03-22  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst/gstminiobject.c: (gst_value_dup_mini_object),
+       (gst_param_spec_mini_object):
+       * gst/gstminiobject.h:
+       * win32/common/libgstreamer.def:
+       * docs/gst/gstreamer-sections.txt:
+       API: Add GST_IS_PARAM_SPEC_MINI_OBJECT, GST_PARAM_SPEC_MINI_OBJECT
+       GST_TYPE_PARAM_MINI_OBJECT and gst_value_dup_mini_object. Also move
+       GstParamSpecMiniObject into a public header for this.
+
+       This make GstMiniObject a bit more consistent with GObject and makes
+       it possible to extend the param specs.
+
+       gst_value_dup_mini_object is mainly useful for set_property methods.
+
+       Fixes bug #523798.
+
+       * tools/gst-inspect.c: (print_element_properties_info):
+       Print something useful for GstMiniObject properties and not just
+       "unknown type".
+
 2008-03-21  Sebastian Dröge  <slomo@circular-chaos.org>
 
        * docs/gst/gstreamer-sections.txt:
index 7807ef4..fe6f0d5 100644 (file)
@@ -1099,10 +1099,16 @@ gst_mini_object_ref
 gst_mini_object_unref
 gst_mini_object_replace
 
+GST_IS_PARAM_SPEC_MINI_OBJECT
+GST_PARAM_SPEC_MINI_OBJECT
+GST_TYPE_PARAM_MINI_OBJECT
+GstParamSpecMiniObject
 gst_param_spec_mini_object
+
 gst_value_set_mini_object
 gst_value_take_mini_object
 gst_value_get_mini_object
+gst_value_dup_mini_object
 
 <SUBSECTION Standard>
 GstMiniObjectClass
@@ -1117,6 +1123,7 @@ GST_MINI_OBJECT_CAST
 <SUBSECTION Private>
 gst_mini_object_get_type
 gst_mini_object_flags_get_type
+gst_param_spec_mini_object_get_type
 </SECTION>
 
 
index 9336ab1..c4d14f7 100644 (file)
@@ -521,18 +521,27 @@ gst_value_get_mini_object (const GValue * value)
   return value->data[0].v_pointer;
 }
 
-/* param spec */
+/**
+ * gst_value_dup_mini_object:
+ * @value:   a valid #GValue of %GST_TYPE_MINI_OBJECT derived type
+ *
+ * Get the contents of a %GST_TYPE_MINI_OBJECT derived #GValue,
+ * increasing its reference count.
+ *
+ * Returns: mini object contents of @value
+ *
+ * Since: 0.10.19
+ */
+GstMiniObject *
+gst_value_dup_mini_object (const GValue * value)
+{
+  g_return_val_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value), NULL);
 
-static GType gst_param_spec_mini_object_get_type (void);
+  return gst_mini_object_ref (value->data[0].v_pointer);
+}
 
-#define GST_TYPE_PARAM_SPEC_MINI_OBJECT (gst_param_spec_mini_object_get_type())
-#define GST_PARAM_SPEC_MINI_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_PARAM_SPEC_MINI_OBJECT, GstParamSpecMiniObject))
 
-typedef struct _GstParamSpecMiniObject GstParamSpecMiniObject;
-struct _GstParamSpecMiniObject
-{
-  GParamSpec parent_instance;
-};
+/* param spec */
 
 static void
 param_mini_object_init (GParamSpec * pspec)
@@ -576,7 +585,7 @@ param_mini_object_values_cmp (GParamSpec * pspec,
   return p1 < p2 ? -1 : p1 > p2;
 }
 
-static GType
+GType
 gst_param_spec_mini_object_get_type (void)
 {
   static GType type;
@@ -619,7 +628,7 @@ gst_param_spec_mini_object (const char *name, const char *nick,
 
   g_return_val_if_fail (g_type_is_a (object_type, GST_TYPE_MINI_OBJECT), NULL);
 
-  ospec = g_param_spec_internal (GST_TYPE_PARAM_SPEC_MINI_OBJECT,
+  ospec = g_param_spec_internal (GST_TYPE_PARAM_MINI_OBJECT,
       name, nick, blurb, flags);
   G_PARAM_SPEC (ospec)->value_type = object_type;
 
index b56cb50..ad032b3 100644 (file)
@@ -172,14 +172,41 @@ void              gst_mini_object_unref           (GstMiniObject *mini_object);
 void           gst_mini_object_replace         (GstMiniObject **olddata, GstMiniObject *newdata);
 
 /* GParamSpec */
+
+#define        GST_TYPE_PARAM_MINI_OBJECT              (gst_param_spec_mini_object_get_type())
+#define GST_IS_PARAM_SPEC_MINI_OBJECT(pspec)    (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), \
+                                                 GST_TYPE_PARAM_MINI_OBJECT))
+#define GST_PARAM_SPEC_MINI_OBJECT(pspec)       (G_TYPE_CHECK_INSTANCE_CAST ((pspec), \
+                                                 GST_TYPE_PARAM_MINI_OBJECT, \
+                                                GstParamSpecMiniObject))
+
+typedef struct _GstParamSpecMiniObject GstParamSpecMiniObject;
+
+/**
+ * GstParamSpecMiniObject:
+ * @parent_instance: private %GParamSpec portion
+ * 
+ * A %GParamSpec derived structure that contains the meta data
+ * for %GstMiniObject properties.
+ */
+struct _GstParamSpecMiniObject
+{
+  GParamSpec parent_instance;
+};
+
+
+GType gst_param_spec_mini_object_get_type (void);
+
 GParamSpec*    gst_param_spec_mini_object      (const char *name, const char *nick,
                                                 const char *blurb, GType object_type, 
                                                 GParamFlags flags);
 
 /* GValue stuff */
+
 void           gst_value_set_mini_object       (GValue *value, GstMiniObject *mini_object);
 void           gst_value_take_mini_object      (GValue *value, GstMiniObject *mini_object);
 GstMiniObject*         gst_value_get_mini_object       (const GValue *value);
+GstMiniObject*  gst_value_dup_mini_object       (const GValue *value);
 
 
 G_END_DECLS
index ec42c64..a5db596 100644 (file)
@@ -559,6 +559,9 @@ print_element_properties_info (GstElement * element)
                 gst_value_get_fraction_numerator (&value),
                 gst_value_get_fraction_denominator (&value));
 
+        } else if (GST_IS_PARAM_SPEC_MINI_OBJECT (param)) {
+          n_print ("%-23.23s MiniObject of type \"%s\"", "",
+              g_type_name (param->value_type));
         } else {
           n_print ("%-23.23s Unknown type %ld \"%s\"", "", param->value_type,
               g_type_name (param->value_type));
index 4ab27fc..6cc3dc5 100644 (file)
@@ -600,6 +600,7 @@ EXPORTS
        gst_param_spec_fraction
        gst_param_spec_fraction_get_type
        gst_param_spec_mini_object
+       gst_param_spec_mini_object_get_type
        gst_parse_bin_from_description
        gst_parse_error_get_type
        gst_parse_error_quark
@@ -926,6 +927,7 @@ EXPORTS
        gst_value_can_union
        gst_value_compare
        gst_value_deserialize
+       gst_value_dup_mini_object
        gst_value_fraction_multiply
        gst_value_fraction_subtract
        gst_value_get_caps