gst_structure_get_boolean
gst_structure_get_int
gst_structure_get_uint
+gst_structure_get_int64
+gst_structure_get_uint64
gst_structure_get_double
gst_structure_get_string
gst_structure_get_date
}
/**
+ * gst_structure_get_int64:
+ * @structure: a #GstStructure
+ * @fieldname: the name of a field
+ * @value: (out): a pointer to an int64 to set
+ *
+ * Sets the int64 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 an int64, this function
+ * returns %FALSE.
+ *
+ * Since: 1.4
+ */
+gboolean
+gst_structure_get_int64 (const GstStructure * structure,
+ const gchar * fieldname, gint64 * 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_INT64 (&field->value))
+ return FALSE;
+
+ *value = gst_g_value_get_int64_unchecked (&field->value);
+
+ return TRUE;
+}
+
+/**
+ * gst_structure_get_uint64:
+ * @structure: a #GstStructure
+ * @fieldname: the name of a field
+ * @value: (out): a pointer to a uint64 to set
+ *
+ * Sets the uint64 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 uint64, this function
+ * returns %FALSE.
+ *
+ * Since: 1.4
+ */
+gboolean
+gst_structure_get_uint64 (const GstStructure * structure,
+ const gchar * fieldname, guint64 * 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 = gst_g_value_get_uint64_unchecked (&field->value);
+
+ return TRUE;
+}
+
+/**
* gst_structure_get_date:
* @structure: a #GstStructure
* @fieldname: the name of a field
const gchar * fieldname,
guint * value);
+gboolean gst_structure_get_int64 (const GstStructure * structure,
+ const gchar * fieldname,
+ gint64 * value);
+
+gboolean gst_structure_get_uint64 (const GstStructure * structure,
+ const gchar * fieldname,
+ guint64 * value);
+
gboolean gst_structure_get_double (const GstStructure * structure,
const gchar * fieldname,
gdouble * value);
gboolean bool;
gint num, den;
GstClockTime clocktime;
+ guint64 uint64;
s = gst_structure_new ("name",
"key", G_TYPE_STRING, "value",
"bool", G_TYPE_BOOLEAN, TRUE,
"fraction", GST_TYPE_FRACTION, 1, 5,
- "clocktime", GST_TYPE_CLOCK_TIME, GST_CLOCK_TIME_NONE, NULL);
+ "clocktime", GST_TYPE_CLOCK_TIME, GST_CLOCK_TIME_NONE,
+ "uint64", G_TYPE_UINT64, (guint64) 1234, NULL);
fail_unless (gst_structure_get_field_type (s, "unknown") == G_TYPE_INVALID);
/* test setting a different name */
gst_structure_set_name (s, "newname");
fail_unless (strcmp (gst_structure_get_string (s, "key"), "value") == 0);
fail_unless (gst_structure_has_field (s, "key"));
- fail_unless_equals_int (gst_structure_n_fields (s), 4);
+ fail_unless_equals_int (gst_structure_n_fields (s), 5);
/* test removing a field */
gst_structure_remove_field (s, "key");
fail_if (gst_structure_get_string (s, "key"));
fail_if (gst_structure_has_field (s, "key"));
- fail_unless_equals_int (gst_structure_n_fields (s), 3);
+ fail_unless_equals_int (gst_structure_n_fields (s), 4);
fail_unless (gst_structure_get_boolean (s, "bool", &bool));
fail_unless (bool);
fail_unless (gst_structure_get_clock_time (s, "clocktime", &clocktime));
fail_unless_equals_uint64 (clocktime, GST_CLOCK_TIME_NONE);
+ fail_unless (gst_structure_get_uint64 (s, "uint64", &uint64));
+ fail_unless_equals_uint64 (uint64, 1234);
+
gst_structure_free (s);
domain = g_quark_from_static_string ("test");
gst_structure_get_field_type
gst_structure_get_fraction
gst_structure_get_int
+ gst_structure_get_int64
gst_structure_get_name
gst_structure_get_name_id
gst_structure_get_string
gst_structure_get_type
gst_structure_get_uint
+ gst_structure_get_uint64
gst_structure_get_valist
gst_structure_get_value
gst_structure_has_field