add a method to get a GstClockTime out of a structure
authorThomas Vander Stichele <thomas@apestaart.org>
Fri, 23 Sep 2005 17:46:06 +0000 (17:46 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Fri, 23 Sep 2005 17:46:06 +0000 (17:46 +0000)
Original commit message from CVS:

* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_get_clock_time):
* gst/gststructure.h:
add a method to get a GstClockTime out of a structure

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

index 06834da..d7e8e87 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-09-23  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * docs/gst/gstreamer-sections.txt:
+       * gst/gststructure.c: (gst_structure_get_clock_time):
+       * gst/gststructure.h:
+         add a method to get a GstClockTime out of a structure
+
 2005-09-23  Tim-Philipp Müller  <tim at centricular dot net>
 
        * check/gst/gstbin.c: (test_children_state_change_order_flagged_sink),
index e7bafa6..4dd6a2e 100644 (file)
@@ -359,6 +359,7 @@ gst_clock_id_unschedule
 gst_clock_id_compare_func
 gst_clock_id_ref
 gst_clock_id_unref
+GST_TYPE_CLOCK_TIME
 
 <SUBSECTION Standard>
 GstClockClass
@@ -1628,6 +1629,7 @@ gst_structure_get_fourcc
 gst_structure_get_double
 gst_structure_get_string
 gst_structure_get_date
+gst_structure_get_clock_time
 gst_structure_map_in_place
 gst_structure_nth_field_name
 gst_structure_set_parent_refcount
index 5d6e34c..809dd09 100644 (file)
@@ -958,7 +958,7 @@ gst_structure_get_fourcc (const GstStructure * structure,
  * @fieldname: the name of a field
  * @value: a pointer to a #GDate to set
  *
- * Sets the date pointed to by @date_out corresponding to the date of the
+ * Sets the date pointed to by @value corresponding to the date of the
  * given field.  Caller is responsible for making sure the field exists
  * and has the correct type.
  *
@@ -987,6 +987,40 @@ gst_structure_get_date (const GstStructure * structure, const gchar * fieldname,
 }
 
 /**
+ * gst_structure_get_clock_time:
+ * @structure: a #GstStructure
+ * @fieldname: the name of a field
+ * @value: a pointer to a #GstClockTime to set
+ *
+ * Sets the clock time pointed to by @value corresponding to the clock time
+ * 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
+ */
+gboolean
+gst_structure_get_clock_time (const GstStructure * structure,
+    const gchar * fieldname, GstClockTime * 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_UINT64 (&field->value))
+    return FALSE;
+
+  *value = g_value_get_uint64 (&field->value);
+
+  return TRUE;
+}
+
+/**
  * gst_structure_get_double:
  * @structure: a #GstStructure
  * @fieldname: the name of a field
index 7695a77..7659db8 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <gst/gstconfig.h>
 #include <glib-object.h>
+#include <gst/gstclock.h>
 
 G_BEGIN_DECLS
 
@@ -133,6 +134,9 @@ gboolean                gst_structure_get_double           (const GstStructure
 gboolean                gst_structure_get_date             (const GstStructure      *structure,
                                                            const gchar             *fieldname,
                                                             GDate                  **value);
+gboolean                gst_structure_get_clock_time       (const GstStructure      *structure,
+                                                           const gchar             *fieldname,
+                                                           GstClockTime            *value);
 G_CONST_RETURN gchar *  gst_structure_get_string           (const GstStructure      *structure,
                                                            const gchar             *fieldname);