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
This commit is contained in:
Thomas Vander Stichele 2005-09-23 17:46:06 +00:00
parent 705936d1bf
commit 3694e3b45c
4 changed files with 48 additions and 1 deletions

View file

@ -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> 2005-09-23 Tim-Philipp Müller <tim at centricular dot net>
* check/gst/gstbin.c: (test_children_state_change_order_flagged_sink), * check/gst/gstbin.c: (test_children_state_change_order_flagged_sink),

View file

@ -359,6 +359,7 @@ gst_clock_id_unschedule
gst_clock_id_compare_func gst_clock_id_compare_func
gst_clock_id_ref gst_clock_id_ref
gst_clock_id_unref gst_clock_id_unref
GST_TYPE_CLOCK_TIME
<SUBSECTION Standard> <SUBSECTION Standard>
GstClockClass GstClockClass
@ -1628,6 +1629,7 @@ gst_structure_get_fourcc
gst_structure_get_double gst_structure_get_double
gst_structure_get_string gst_structure_get_string
gst_structure_get_date gst_structure_get_date
gst_structure_get_clock_time
gst_structure_map_in_place gst_structure_map_in_place
gst_structure_nth_field_name gst_structure_nth_field_name
gst_structure_set_parent_refcount gst_structure_set_parent_refcount

View file

@ -958,7 +958,7 @@ gst_structure_get_fourcc (const GstStructure * structure,
* @fieldname: the name of a field * @fieldname: the name of a field
* @value: a pointer to a #GDate to set * @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 * given field. Caller is responsible for making sure the field exists
* and has the correct type. * and has the correct type.
* *
@ -986,6 +986,40 @@ gst_structure_get_date (const GstStructure * structure, const gchar * fieldname,
return TRUE; return TRUE;
} }
/**
* 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: * gst_structure_get_double:
* @structure: a #GstStructure * @structure: a #GstStructure

View file

@ -22,6 +22,7 @@
#include <gst/gstconfig.h> #include <gst/gstconfig.h>
#include <glib-object.h> #include <glib-object.h>
#include <gst/gstclock.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -133,6 +134,9 @@ gboolean gst_structure_get_double (const GstStructure
gboolean gst_structure_get_date (const GstStructure *structure, gboolean gst_structure_get_date (const GstStructure *structure,
const gchar *fieldname, const gchar *fieldname,
GDate **value); 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, G_CONST_RETURN gchar * gst_structure_get_string (const GstStructure *structure,
const gchar *fieldname); const gchar *fieldname);