From: Thomas Vander Stichele Date: Fri, 23 Sep 2005 17:46:06 +0000 (+0000) Subject: add a method to get a GstClockTime out of a structure X-Git-Tag: RELEASE-0_9_3~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3694e3b45cb713a2a223ae262c40446a357d2c74;p=platform%2Fupstream%2Fgstreamer.git add a method to get a GstClockTime out of a structure 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 --- diff --git a/ChangeLog b/ChangeLog index 06834da..d7e8e87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-09-23 Thomas Vander Stichele + + * 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 * check/gst/gstbin.c: (test_children_state_change_order_flagged_sink), diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index e7bafa6..4dd6a2e 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -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 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 diff --git a/gst/gststructure.c b/gst/gststructure.c index 5d6e34c..809dd09 100644 --- a/gst/gststructure.c +++ b/gst/gststructure.c @@ -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 diff --git a/gst/gststructure.h b/gst/gststructure.h index 7695a77..7659db8 100644 --- a/gst/gststructure.h +++ b/gst/gststructure.h @@ -22,6 +22,7 @@ #include #include +#include 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);