]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
Add function to get uint from a structure.
authorWim Taymans <wim.taymans@gmail.com>
Sun, 12 Aug 2007 16:40:59 +0000 (16:40 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Sun, 12 Aug 2007 16:40:59 +0000 (16:40 +0000)
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_get_uint):
* gst/gststructure.h:
Add function to get uint from a structure.
API: gst_structure_get_uint()

ChangeLog
docs/gst/gstreamer-sections.txt
gst/gststructure.c
gst/gststructure.h

index b2ae06ce3d7818fa73023ff4c3bb13956ff677b6..725dca13e08b1a7b2119a6dc0878620006ade275 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-12  Wim Taymans  <wim.taymans@gmail.com>
+
+       * docs/gst/gstreamer-sections.txt:
+       * gst/gststructure.c: (gst_structure_get_uint):
+       * gst/gststructure.h:
+       Add function to get uint from a structure.
+       API: gst_structure_get_uint()
+
 2007-08-12  Wim Taymans  <wim.taymans@gmail.com>
 
        * gst/gstcaps.c: (gst_caps_set_simple_valist),
index 16722afa93ada51d63aa9bd102fe778b3aa3e2cc..a0e9b3c9bc3a3870e61d0e5ac64ae0d49f80087e 100644 (file)
@@ -1768,6 +1768,7 @@ gst_structure_has_field
 gst_structure_has_field_typed
 gst_structure_get_boolean
 gst_structure_get_int
+gst_structure_get_uint
 gst_structure_get_fourcc
 gst_structure_get_double
 gst_structure_get_string
index 1ccb857dd89f3a4b93be5eb6da12e244d8e1daf4..d837cb38a5413b3072570d3b79e3a54a88d4b996 100644 (file)
@@ -1042,6 +1042,42 @@ gst_structure_get_int (const GstStructure * structure,
   return TRUE;
 }
 
+/**
+ * gst_structure_get_uint:
+ * @structure: a #GstStructure
+ * @fieldname: the name of a field
+ * @value: a pointer to a uint to set
+ *
+ * Sets the uint pointed to by @value corresponding to the value of the
+ * given field.  Caller is responsible for making sure the field exists
+ * and has the correct type.
+ *
+ * Returns: %TRUE if the value could be set correctly. If there was no field
+ * with @fieldname or the existing field did not contain a uint, this function
+ * returns %FALSE.
+ */
+gboolean
+gst_structure_get_uint (const GstStructure * structure,
+    const gchar * fieldname, guint * value)
+{
+  GstStructureField *field;
+
+  g_return_val_if_fail (structure != NULL, FALSE);
+  g_return_val_if_fail (fieldname != NULL, FALSE);
+  g_return_val_if_fail (value != NULL, FALSE);
+
+  field = gst_structure_get_field (structure, fieldname);
+
+  if (field == NULL)
+    return FALSE;
+  if (!G_VALUE_HOLDS_UINT (&field->value))
+    return FALSE;
+
+  *value = g_value_get_uint (&field->value);
+
+  return TRUE;
+}
+
 /**
  * gst_structure_get_fourcc:
  * @structure: a #GstStructure
index 8bdfc847f86bdcf58aeca0dce6f42a38e8300895..0fc50315a7660203447538c70995f67fb0f0a5f8 100644 (file)
@@ -167,6 +167,9 @@ gboolean                gst_structure_get_boolean          (const GstStructure
 gboolean                gst_structure_get_int              (const GstStructure      *structure,
                                                            const gchar             *fieldname,
                                                            gint                    *value);
+gboolean                gst_structure_get_uint             (const GstStructure      *structure,
+                                                           const gchar             *fieldname,
+                                                           guint                   *value);
 gboolean                gst_structure_get_fourcc           (const GstStructure      *structure,
                                                            const gchar             *fieldname,
                                                            guint32                 *value);