}
/* our fundamental types that are certainly not fixed */
if (type == GST_TYPE_INT_RANGE || type == GST_TYPE_DOUBLE_RANGE ||
+ type == GST_TYPE_INT64_RANGE ||
type == GST_TYPE_LIST || type == GST_TYPE_FRACTION_RANGE) {
return FALSE;
}
GValue val = { 0, };
g_return_if_fail (GST_VALUE_HOLDS_LIST (value));
+ g_return_if_fail (G_IS_VALUE (append_value));
gst_value_init_and_copy (&val, append_value);
g_array_append_vals ((GArray *) value->data[0].v_pointer, &val, 1);
GValue val = { 0, };
g_return_if_fail (GST_VALUE_HOLDS_LIST (value));
+ g_return_if_fail (G_IS_VALUE (prepend_value));
gst_value_init_and_copy (&val, prepend_value);
g_array_prepend_vals ((GArray *) value->data[0].v_pointer, &val, 1);
/**
* gst_value_list_concat:
- * @dest: an uninitialized #GValue to take the result
+ * @dest: (out caller-allocates): an uninitialized #GValue to take the result
* @value1: a #GValue
* @value2: a #GValue
*
}
/**
+ * gst_value_list_merge:
+ * @dest: (out caller-allocates): an uninitialized #GValue to take the result
+ * @value1: a #GValue
+ * @value2: a #GValue
+ *
+ * Merges copies of @value1 and @value2. Values that are not
+ * of type #GST_TYPE_LIST are treated as if they were lists of length 1.
+ *
+ * The result will be put into @dest and will either be a list that will not
+ * contain any duplicates, or a non-list type (if @value1 and @value2
+ * were equal).
+ *
+ * Since: 0.10.32
+ */
+void
+gst_value_list_merge (GValue * dest, const GValue * value1,
+ const GValue * value2)
+{
+ guint i, j, k, value1_length, value2_length, skipped;
+ const GValue *src;
+ gboolean skip;
+ GArray *array;
+
+ g_return_if_fail (dest != NULL);
+ g_return_if_fail (G_VALUE_TYPE (dest) == 0);
+ g_return_if_fail (G_IS_VALUE (value1));
+ g_return_if_fail (G_IS_VALUE (value2));
+
+ value1_length =
+ (GST_VALUE_HOLDS_LIST (value1) ? VALUE_LIST_SIZE (value1) : 1);
+ value2_length =
+ (GST_VALUE_HOLDS_LIST (value2) ? VALUE_LIST_SIZE (value2) : 1);
+ g_value_init (dest, GST_TYPE_LIST);
+ array = (GArray *) dest->data[0].v_pointer;
+ g_array_set_size (array, value1_length + value2_length);
+
+ if (GST_VALUE_HOLDS_LIST (value1)) {
+ for (i = 0; i < value1_length; i++) {
+ gst_value_init_and_copy (&g_array_index (array, GValue, i),
+ VALUE_LIST_GET_VALUE (value1, i));
+ }
+ } else {
+ gst_value_init_and_copy (&g_array_index (array, GValue, 0), value1);
+ }
+
+ j = value1_length;
+ skipped = 0;
+ if (GST_VALUE_HOLDS_LIST (value2)) {
+ for (i = 0; i < value2_length; i++) {
+ skip = FALSE;
+ src = VALUE_LIST_GET_VALUE (value2, i);
+ for (k = 0; k < value1_length; k++) {
+ if (gst_value_compare (&g_array_index (array, GValue, k),
+ src) == GST_VALUE_EQUAL) {
+ skip = TRUE;
+ skipped++;
+ break;
+ }
+ }
+ if (!skip) {
+ gst_value_init_and_copy (&g_array_index (array, GValue, j), src);
+ j++;
+ }
+ }
+ } else {
+ skip = FALSE;
+ for (k = 0; k < value1_length; k++) {
+ if (gst_value_compare (&g_array_index (array, GValue, k),
+ value2) == GST_VALUE_EQUAL) {
+ skip = TRUE;
+ skipped++;
+ break;
+ }
+ }
+ if (!skip) {
+ gst_value_init_and_copy (&g_array_index (array, GValue, j), value2);
+ }
+ }
+ if (skipped) {
+ guint new_size = value1_length + (value2_length - skipped);
+
+ if (new_size > 1) {
+ /* shrink list */
+ g_array_set_size (array, new_size);
+ } else {
+ GValue single_dest;
+
+ /* size is 1, take single value in list and make it new dest */
+ single_dest = g_array_index (array, GValue, 0);
+
+ /* clean up old value allocations: must set array size to 0, because
+ * allocated values are not inited meaning g_value_unset() will not
+ * work on them */
+ g_array_set_size (array, 0);
+ g_value_unset (dest);
+
+ /* the single value is our new result */
+ *dest = single_dest;
+ }
+ }
+}
+
+/**
* gst_value_list_get_size:
* @value: a #GValue of type #GST_TYPE_LIST
*
* Gets the value that is a member of the list contained in @value and
* has the index @index.
*
- * Returns: the value at the given index
+ * Returns: (transfer none): the value at the given index
*/
const GValue *
gst_value_list_get_value (const GValue * value, guint index)
GValue val = { 0, };
g_return_if_fail (GST_VALUE_HOLDS_ARRAY (value));
+ g_return_if_fail (G_IS_VALUE (append_value));
gst_value_init_and_copy (&val, append_value);
g_array_append_vals ((GArray *) value->data[0].v_pointer, &val, 1);
GValue val = { 0, };
g_return_if_fail (GST_VALUE_HOLDS_ARRAY (value));
+ g_return_if_fail (G_IS_VALUE (prepend_value));
gst_value_init_and_copy (&val, prepend_value);
g_array_prepend_vals ((GArray *) value->data[0].v_pointer, &val, 1);
* Gets the value that is a member of the array contained in @value and
* has the index @index.
*
- * Returns: the value at the given index
+ * Returns: (transfer none): the value at the given index
*/
const GValue *
gst_value_array_get_value (const GValue * value, guint index)
}
/* Do an unordered compare of the contents of a list */
-static int
+static gint
gst_value_compare_list (const GValue * value1, const GValue * value2)
{
guint i, j;
}
/* Perform an ordered comparison of the contents of an array */
-static int
+static gint
gst_value_compare_array (const GValue * value1, const GValue * value2)
{
guint i;
GValue * dest_value)
{
guint32 fourcc = src_value->data[0].v_int;
+ gchar fourcc_char[4];
+
+ fourcc_char[0] = (fourcc >> 0) & 0xff;
+ fourcc_char[1] = (fourcc >> 8) & 0xff;
+ fourcc_char[2] = (fourcc >> 16) & 0xff;
+ fourcc_char[3] = (fourcc >> 24) & 0xff;
- if (g_ascii_isprint ((fourcc >> 0) & 0xff) &&
- g_ascii_isprint ((fourcc >> 8) & 0xff) &&
- g_ascii_isprint ((fourcc >> 16) & 0xff) &&
- g_ascii_isprint ((fourcc >> 24) & 0xff)) {
+ if ((g_ascii_isalnum (fourcc_char[0]) || fourcc_char[0] == ' ') &&
+ (g_ascii_isalnum (fourcc_char[1]) || fourcc_char[1] == ' ') &&
+ (g_ascii_isalnum (fourcc_char[2]) || fourcc_char[2] == ' ') &&
+ (g_ascii_isalnum (fourcc_char[3]) || fourcc_char[3] == ' ')) {
dest_value->data[0].v_pointer =
g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
} else {
gst_value_serialize_fourcc (const GValue * value)
{
guint32 fourcc = value->data[0].v_int;
+ gchar fourcc_char[4];
- if (g_ascii_isalnum ((fourcc >> 0) & 0xff) &&
- g_ascii_isalnum ((fourcc >> 8) & 0xff) &&
- g_ascii_isalnum ((fourcc >> 16) & 0xff) &&
- g_ascii_isalnum ((fourcc >> 24) & 0xff)) {
+ fourcc_char[0] = (fourcc >> 0) & 0xff;
+ fourcc_char[1] = (fourcc >> 8) & 0xff;
+ fourcc_char[2] = (fourcc >> 16) & 0xff;
+ fourcc_char[3] = (fourcc >> 24) & 0xff;
+
+ if ((g_ascii_isalnum (fourcc_char[0]) || fourcc_char[0] == ' ') &&
+ (g_ascii_isalnum (fourcc_char[1]) || fourcc_char[1] == ' ') &&
+ (g_ascii_isalnum (fourcc_char[2]) || fourcc_char[2] == ' ') &&
+ (g_ascii_isalnum (fourcc_char[3]) || fourcc_char[3] == ' ')) {
return g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
} else {
return g_strdup_printf ("0x%08x", fourcc);
}
static gboolean
-gst_value_deserialize_fourcc (GValue * dest, const char *s)
+gst_value_deserialize_fourcc (GValue * dest, const gchar * s)
{
gboolean ret = FALSE;
guint32 fourcc = 0;
- char *end;
+ gchar *end;
+ gint l = strlen (s);
- if (strlen (s) == 4) {
+ if (l == 4) {
fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
ret = TRUE;
+ } else if (l == 3) {
+ fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], ' ');
+ ret = TRUE;
+ } else if (l == 2) {
+ fourcc = GST_MAKE_FOURCC (s[0], s[1], ' ', ' ');
+ ret = TRUE;
+ } else if (l == 1) {
+ fourcc = GST_MAKE_FOURCC (s[0], ' ', ' ', ' ');
+ ret = TRUE;
} else if (g_ascii_isdigit (*s)) {
fourcc = strtoul (s, &end, 0);
if (*end == 0) {
gst_value_collect_int_range (GValue * value, guint n_collect_values,
GTypeCValue * collect_values, guint collect_flags)
{
+ if (n_collect_values != 2)
+ return g_strdup_printf ("not enough value locations for `%s' passed",
+ G_VALUE_TYPE_NAME (value));
+ if (collect_values[0].v_int >= collect_values[1].v_int)
+ return g_strdup_printf ("range start is not smaller than end for `%s'",
+ G_VALUE_TYPE_NAME (value));
+
value->data[0].v_int = collect_values[0].v_int;
value->data[1].v_int = collect_values[1].v_int;
return FALSE;
}
+/***************
+ * int64 range *
+ ***************/
+
+static void
+gst_value_init_int64_range (GValue * value)
+{
+ value->data[0].v_int64 = 0;
+ value->data[1].v_int64 = 0;
+}
+
+static void
+gst_value_copy_int64_range (const GValue * src_value, GValue * dest_value)
+{
+ dest_value->data[0].v_int64 = src_value->data[0].v_int64;
+ dest_value->data[1].v_int64 = src_value->data[1].v_int64;
+}
+
+static gchar *
+gst_value_collect_int64_range (GValue * value, guint n_collect_values,
+ GTypeCValue * collect_values, guint collect_flags)
+{
+ if (n_collect_values != 2)
+ return g_strdup_printf ("not enough value locations for `%s' passed",
+ G_VALUE_TYPE_NAME (value));
+ if (collect_values[0].v_int64 >= collect_values[1].v_int64)
+ return g_strdup_printf ("range start is not smaller than end for `%s'",
+ G_VALUE_TYPE_NAME (value));
+
+ value->data[0].v_int64 = collect_values[0].v_int64;
+ value->data[1].v_int64 = collect_values[1].v_int64;
+
+ return NULL;
+}
+
+static gchar *
+gst_value_lcopy_int64_range (const GValue * value, guint n_collect_values,
+ GTypeCValue * collect_values, guint collect_flags)
+{
+ guint64 *int_range_start = collect_values[0].v_pointer;
+ guint64 *int_range_end = collect_values[1].v_pointer;
+
+ if (!int_range_start)
+ return g_strdup_printf ("start value location for `%s' passed as NULL",
+ G_VALUE_TYPE_NAME (value));
+ if (!int_range_end)
+ return g_strdup_printf ("end value location for `%s' passed as NULL",
+ G_VALUE_TYPE_NAME (value));
+
+ *int_range_start = value->data[0].v_int64;
+ *int_range_end = value->data[1].v_int64;
+
+ return NULL;
+}
+
+/**
+ * gst_value_set_int64_range:
+ * @value: a GValue initialized to GST_TYPE_INT64_RANGE
+ * @start: the start of the range
+ * @end: the end of the range
+ *
+ * Sets @value to the range specified by @start and @end.
+ *
+ * Since: 0.10.31
+ */
+void
+gst_value_set_int64_range (GValue * value, gint64 start, gint64 end)
+{
+ g_return_if_fail (GST_VALUE_HOLDS_INT64_RANGE (value));
+ g_return_if_fail (start < end);
+
+ value->data[0].v_int64 = start;
+ value->data[1].v_int64 = end;
+}
+
+/**
+ * gst_value_get_int64_range_min:
+ * @value: a GValue initialized to GST_TYPE_INT64_RANGE
+ *
+ * Gets the minimum of the range specified by @value.
+ *
+ * Returns: the minimum of the range
+ *
+ * Since: 0.10.31
+ */
+gint64
+gst_value_get_int64_range_min (const GValue * value)
+{
+ g_return_val_if_fail (GST_VALUE_HOLDS_INT64_RANGE (value), 0);
+
+ return value->data[0].v_int64;
+}
+
+/**
+ * gst_value_get_int64_range_max:
+ * @value: a GValue initialized to GST_TYPE_INT64_RANGE
+ *
+ * Gets the maximum of the range specified by @value.
+ *
+ * Returns: the maxumum of the range
+ *
+ * Since: 0.10.31
+ */
+gint64
+gst_value_get_int64_range_max (const GValue * value)
+{
+ g_return_val_if_fail (GST_VALUE_HOLDS_INT64_RANGE (value), 0);
+
+ return value->data[1].v_int64;
+}
+
+static void
+gst_value_transform_int64_range_string (const GValue * src_value,
+ GValue * dest_value)
+{
+ dest_value->data[0].v_pointer =
+ g_strdup_printf ("(gint64)[%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT "]",
+ src_value->data[0].v_int64, src_value->data[1].v_int64);
+}
+
+static gint
+gst_value_compare_int64_range (const GValue * value1, const GValue * value2)
+{
+ if (value2->data[0].v_int64 == value1->data[0].v_int64 &&
+ value2->data[1].v_int64 == value1->data[1].v_int64)
+ return GST_VALUE_EQUAL;
+ return GST_VALUE_UNORDERED;
+}
+
+static gchar *
+gst_value_serialize_int64_range (const GValue * value)
+{
+ return g_strdup_printf ("[ %" G_GINT64_FORMAT ", %" G_GINT64_FORMAT " ]",
+ value->data[0].v_int64, value->data[1].v_int64);
+}
+
+static gboolean
+gst_value_deserialize_int64_range (GValue * dest, const gchar * s)
+{
+ g_warning ("unimplemented");
+ return FALSE;
+}
+
/****************
* double range *
****************/
gst_value_collect_double_range (GValue * value, guint n_collect_values,
GTypeCValue * collect_values, guint collect_flags)
{
+ if (n_collect_values != 2)
+ return g_strdup_printf ("not enough value locations for `%s' passed",
+ G_VALUE_TYPE_NAME (value));
+ if (collect_values[0].v_double >= collect_values[1].v_double)
+ return g_strdup_printf ("range start is not smaller than end for `%s'",
+ G_VALUE_TYPE_NAME (value));
+
value->data[0].v_double = collect_values[0].v_double;
value->data[1].v_double = collect_values[1].v_double;
gst_value_set_double_range (GValue * value, gdouble start, gdouble end)
{
g_return_if_fail (GST_VALUE_HOLDS_DOUBLE_RANGE (value));
+ g_return_if_fail (start < end);
value->data[0].v_double = start;
value->data[1].v_double = end;
gst_value_transform_double_range_string (const GValue * src_value,
GValue * dest_value)
{
- char s1[G_ASCII_DTOSTR_BUF_SIZE], s2[G_ASCII_DTOSTR_BUF_SIZE];
+ gchar s1[G_ASCII_DTOSTR_BUF_SIZE], s2[G_ASCII_DTOSTR_BUF_SIZE];
dest_value->data[0].v_pointer = g_strdup_printf ("[%s,%s]",
g_ascii_dtostr (s1, G_ASCII_DTOSTR_BUF_SIZE,
static gchar *
gst_value_serialize_double_range (const GValue * value)
{
- char d1[G_ASCII_DTOSTR_BUF_SIZE];
- char d2[G_ASCII_DTOSTR_BUF_SIZE];
+ gchar d1[G_ASCII_DTOSTR_BUF_SIZE];
+ gchar d2[G_ASCII_DTOSTR_BUF_SIZE];
g_ascii_dtostr (d1, G_ASCII_DTOSTR_BUF_SIZE, value->data[0].v_double);
g_ascii_dtostr (d2, G_ASCII_DTOSTR_BUF_SIZE, value->data[1].v_double);
if (n_collect_values != 4)
return g_strdup_printf ("not enough value locations for `%s' passed",
G_VALUE_TYPE_NAME (value));
+ if (collect_values[1].v_int == 0)
+ return g_strdup_printf ("passed '0' as first denominator for `%s'",
+ G_VALUE_TYPE_NAME (value));
+ if (collect_values[3].v_int == 0)
+ return g_strdup_printf ("passed '0' as second denominator for `%s'",
+ G_VALUE_TYPE_NAME (value));
+ if (gst_util_fraction_compare (collect_values[0].v_int,
+ collect_values[1].v_int, collect_values[2].v_int,
+ collect_values[3].v_int) >= 0)
+ return g_strdup_printf ("range start is not smaller than end for `%s'",
+ G_VALUE_TYPE_NAME (value));
+
if (vals == NULL) {
gst_value_init_fraction_range (value);
vals = value->data[0].v_pointer;
gst_value_lcopy_fraction_range (const GValue * value, guint n_collect_values,
GTypeCValue * collect_values, guint collect_flags)
{
- int i;
- int *dest_values[4];
+ gint i;
+ gint *dest_values[4];
GValue *vals = (GValue *) value->data[0].v_pointer;
if (G_UNLIKELY (n_collect_values != 4))
GValue *vals;
g_return_if_fail (GST_VALUE_HOLDS_FRACTION_RANGE (value));
+ g_return_if_fail (GST_VALUE_HOLDS_FRACTION (start));
+ g_return_if_fail (GST_VALUE_HOLDS_FRACTION (end));
+ g_return_if_fail (gst_util_fraction_compare (start->data[0].v_int,
+ start->data[1].v_int, end->data[0].v_int, end->data[1].v_int) < 0);
vals = (GValue *) value->data[0].v_pointer;
if (vals == NULL) {
GValue start = { 0 };
GValue end = { 0 };
+ g_return_if_fail (value != NULL);
+ g_return_if_fail (denominator_start != 0);
+ g_return_if_fail (denominator_end != 0);
+ g_return_if_fail (gst_util_fraction_compare (numerator_start,
+ denominator_start, numerator_end, denominator_end) < 0);
+
g_value_init (&start, GST_TYPE_FRACTION);
g_value_init (&end, GST_TYPE_FRACTION);
{
GValue *vals;
- g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION_RANGE (value), FALSE);
+ g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION_RANGE (value), NULL);
vals = (GValue *) value->data[0].v_pointer;
if (vals != NULL) {
{
GValue *vals;
- g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION_RANGE (value), FALSE);
+ g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION_RANGE (value), NULL);
vals = (GValue *) value->data[0].v_pointer;
if (vals != NULL) {
return NULL;
}
-static char *
+static gchar *
gst_value_serialize_fraction_range (const GValue * value)
{
GValue *vals = (GValue *) value->data[0].v_pointer;
/**
* gst_value_set_caps:
* @value: a GValue initialized to GST_TYPE_CAPS
- * @caps: the caps to set the value to
+ * @caps: (transfer none): the caps to set the value to
*
- * Sets the contents of @value to @caps. The actual
- * #GstCaps structure is copied before it is used.
+ * Sets the contents of @value to @caps. A reference to the
+ * provided @caps will be taken by the @value.
*/
void
gst_value_set_caps (GValue * value, const GstCaps * caps)
{
+ g_return_if_fail (G_IS_VALUE (value));
g_return_if_fail (G_VALUE_TYPE (value) == GST_TYPE_CAPS);
+ g_return_if_fail (caps == NULL || GST_IS_CAPS (caps));
g_value_set_boxed (value, caps);
}
* gst_value_get_caps:
* @value: a GValue initialized to GST_TYPE_CAPS
*
- * Gets the contents of @value.
+ * Gets the contents of @value. The reference count of the returned
+ * #GstCaps will not be modified, therefore the caller must take one
+ * before getting rid of the @value.
*
- * Returns: the contents of @value
+ * Returns: (transfer none): the contents of @value
*/
const GstCaps *
gst_value_get_caps (const GValue * value)
{
+ g_return_val_if_fail (G_IS_VALUE (value), NULL);
g_return_val_if_fail (G_VALUE_TYPE (value) == GST_TYPE_CAPS, NULL);
return (GstCaps *) g_value_get_boxed (value);
}
-static char *
+static gchar *
gst_value_serialize_caps (const GValue * value)
{
GstCaps *caps = g_value_get_boxed (value);
void
gst_value_set_structure (GValue * value, const GstStructure * structure)
{
+ g_return_if_fail (G_IS_VALUE (value));
g_return_if_fail (G_VALUE_TYPE (value) == GST_TYPE_STRUCTURE);
+ g_return_if_fail (structure == NULL || GST_IS_STRUCTURE (structure));
g_value_set_boxed (value, structure);
}
*
* Gets the contents of @value.
*
- * Returns: the contents of @value
+ * Returns: (transfer none): the contents of @value
*
* Since: 0.10.15
*/
const GstStructure *
gst_value_get_structure (const GValue * value)
{
+ g_return_val_if_fail (G_IS_VALUE (value), NULL);
g_return_val_if_fail (G_VALUE_TYPE (value) == GST_TYPE_STRUCTURE, NULL);
return (GstStructure *) g_value_get_boxed (value);
}
-static char *
+static gchar *
gst_value_serialize_structure (const GValue * value)
{
GstStructure *structure = g_value_get_boxed (value);
* GstBuffer *
*************/
-static int
+static gint
gst_value_compare_buffer (const GValue * value1, const GValue * value2)
{
GstBuffer *buf1 = GST_BUFFER (gst_value_get_mini_object (value1));
return GST_VALUE_UNORDERED;
}
-static char *
+static gchar *
gst_value_serialize_buffer (const GValue * value)
{
guint8 *data;
- int i;
- int size;
- char *string;
+ gint i;
+ gint size;
+ gchar *string;
GstBuffer *buffer;
buffer = gst_value_get_buffer (value);
gst_value_deserialize_buffer (GValue * dest, const gchar * s)
{
GstBuffer *buffer;
- int len;
- char ts[3];
+ gint len;
+ gchar ts[3];
guint8 *data;
- int i;
+ gint i;
len = strlen (s);
if (len & 1)
* boolean *
***********/
-static int
+static gint
gst_value_compare_boolean (const GValue * value1, const GValue * value2)
{
if ((value1->data[0].v_int != 0) == (value2->data[0].v_int != 0))
return GST_VALUE_UNORDERED;
}
-static char *
+static gchar *
gst_value_serialize_boolean (const GValue * value)
{
if (value->data[0].v_int) {
return GST_VALUE_EQUAL; \
} \
\
-static char * \
+static gchar * \
gst_value_serialize_ ## _type (const GValue * value) \
{ \
GValue val = { 0, }; \
gint64 min, gint64 max, gint size)
{
gboolean ret = FALSE;
- char *end;
+ gchar *end;
gint64 mask = -1;
errno = 0;
gst_value_deserialize_ ## _type (GValue * dest, const gchar *s) \
{ \
gint64 x; \
- char *end; \
+ gchar *end; \
gboolean ret = FALSE; \
\
errno = 0; \
CREATE_USERIALIZATION (uint64, UINT64);
CREATE_USERIALIZATION (ulong, ULONG);
+/* FIXME 0.11: remove this again, plugins shouldn't have uchar properties */
+#ifndef G_MAXUCHAR
+#define G_MAXUCHAR 255
+#endif
+CREATE_USERIALIZATION (uchar, UCHAR);
+
/**********
* double *
**********/
-static int
+static gint
gst_value_compare_double (const GValue * value1, const GValue * value2)
{
if (value1->data[0].v_double > value2->data[0].v_double)
return GST_VALUE_UNORDERED;
}
-static char *
+static gchar *
gst_value_serialize_double (const GValue * value)
{
- char d[G_ASCII_DTOSTR_BUF_SIZE];
+ gchar d[G_ASCII_DTOSTR_BUF_SIZE];
g_ascii_dtostr (d, G_ASCII_DTOSTR_BUF_SIZE, value->data[0].v_double);
return g_strdup (d);
static gboolean
gst_value_deserialize_double (GValue * dest, const gchar * s)
{
- double x;
+ gdouble x;
gboolean ret = FALSE;
- char *end;
+ gchar *end;
x = g_ascii_strtod (s, &end);
if (*end == 0) {
static gboolean
gst_value_deserialize_float (GValue * dest, const gchar * s)
{
- double x;
+ gdouble x;
gboolean ret = FALSE;
- char *end;
+ gchar *end;
x = g_ascii_strtod (s, &end);
if (*end == 0) {
if (value1->data[0].v_pointer != value2->data[0].v_pointer)
return GST_VALUE_UNORDERED;
} else {
- int x = strcmp (value1->data[0].v_pointer, value2->data[0].v_pointer);
+ gint x = strcmp (value1->data[0].v_pointer, value2->data[0].v_pointer);
if (x < 0)
return GST_VALUE_LESS_THAN;
return GST_VALUE_EQUAL;
}
-static int
+static gint
gst_string_measure_wrapping (const gchar * s)
{
- int len;
+ gint len;
gboolean wrap = FALSE;
if (G_UNLIKELY (s == NULL))
}
static gchar *
-gst_string_wrap_inner (const gchar * s, int len)
+gst_string_wrap_inner (const gchar * s, gint len)
{
gchar *d, *e;
static gchar *
gst_string_wrap (const gchar * s)
{
- int len = gst_string_measure_wrapping (s);
+ gint len = gst_string_measure_wrapping (s);
if (G_LIKELY (len < 0))
return g_strdup (s);
gst_string_take_and_wrap (gchar * s)
{
gchar *out;
- int len = gst_string_measure_wrapping (s);
+ gint len = gst_string_measure_wrapping (s);
if (G_LIKELY (len < 0))
return s;
read += 3;
} else {
- /* if we run into a \0 here, we definately won't get a quote later */
+ /* if we run into a \0 here, we definitely won't get a quote later */
if (*read == 0)
goto beach;
if (G_UNLIKELY (en == NULL && G_VALUE_TYPE (value) == GST_TYPE_FORMAT)) {
const GstFormatDefinition *format_def;
- format_def = gst_format_get_details (g_value_get_enum (value));
+ format_def = gst_format_get_details ((GstFormat) g_value_get_enum (value));
g_return_val_if_fail (format_def != NULL, NULL);
return g_strdup (format_def->description);
}
}
static gboolean
+gst_value_intersect_int64_int64_range (GValue * dest, const GValue * src1,
+ const GValue * src2)
+{
+ if (src2->data[0].v_int64 <= src1->data[0].v_int64 &&
+ src2->data[1].v_int64 >= src1->data[0].v_int64) {
+ gst_value_init_and_copy (dest, src1);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+gst_value_intersect_int64_range_int64_range (GValue * dest, const GValue * src1,
+ const GValue * src2)
+{
+ gint64 min;
+ gint64 max;
+
+ min = MAX (src1->data[0].v_int64, src2->data[0].v_int64);
+ max = MIN (src1->data[1].v_int64, src2->data[1].v_int64);
+
+ if (min < max) {
+ g_value_init (dest, GST_TYPE_INT64_RANGE);
+ gst_value_set_int64_range (dest, min, max);
+ return TRUE;
+ }
+ if (min == max) {
+ g_value_init (dest, G_TYPE_INT64);
+ g_value_set_int64 (dest, min);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
gst_value_intersect_double_double_range (GValue * dest, const GValue * src1,
const GValue * src2)
{
gst_value_intersect_fraction_fraction_range (GValue * dest, const GValue * src1,
const GValue * src2)
{
- int res1, res2;
+ gint res1, res2;
GValue *vals;
GstValueCompareFunc compare;
{
GValue *min;
GValue *max;
- int res;
+ gint res;
GValue *vals1, *vals2;
GstValueCompareFunc compare;
gst_value_subtract_int_int_range (GValue * dest, const GValue * minuend,
const GValue * subtrahend)
{
- int min = gst_value_get_int_range_min (subtrahend);
- int max = gst_value_get_int_range_max (subtrahend);
- int val = g_value_get_int (minuend);
+ gint min = gst_value_get_int_range_min (subtrahend);
+ gint max = gst_value_get_int_range_max (subtrahend);
+ gint val = g_value_get_int (minuend);
/* subtracting a range from an int only works if the int is not in the
* range */
}
static gboolean
+gst_value_subtract_int64_int64_range (GValue * dest, const GValue * minuend,
+ const GValue * subtrahend)
+{
+ gint64 min = gst_value_get_int64_range_min (subtrahend);
+ gint64 max = gst_value_get_int64_range_max (subtrahend);
+ gint64 val = g_value_get_int64 (minuend);
+
+ /* subtracting a range from an int64 only works if the int64 is not in the
+ * range */
+ if (val < min || val > max) {
+ /* and the result is the int64 */
+ gst_value_init_and_copy (dest, minuend);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/* creates a new int64 range based on input values.
+ */
+static gboolean
+gst_value_create_new_int64_range (GValue * dest, gint64 min1, gint64 max1,
+ gint64 min2, gint64 max2)
+{
+ GValue v1 = { 0, };
+ GValue v2 = { 0, };
+ GValue *pv1, *pv2; /* yeah, hungarian! */
+
+ if (min1 <= max1 && min2 <= max2) {
+ pv1 = &v1;
+ pv2 = &v2;
+ } else if (min1 <= max1) {
+ pv1 = dest;
+ pv2 = NULL;
+ } else if (min2 <= max2) {
+ pv1 = NULL;
+ pv2 = dest;
+ } else {
+ return FALSE;
+ }
+
+ if (min1 < max1) {
+ g_value_init (pv1, GST_TYPE_INT64_RANGE);
+ gst_value_set_int64_range (pv1, min1, max1);
+ } else if (min1 == max1) {
+ g_value_init (pv1, G_TYPE_INT64);
+ g_value_set_int64 (pv1, min1);
+ }
+ if (min2 < max2) {
+ g_value_init (pv2, GST_TYPE_INT64_RANGE);
+ gst_value_set_int64_range (pv2, min2, max2);
+ } else if (min2 == max2) {
+ g_value_init (pv2, G_TYPE_INT64);
+ g_value_set_int64 (pv2, min2);
+ }
+
+ if (min1 <= max1 && min2 <= max2) {
+ gst_value_list_concat (dest, pv1, pv2);
+ g_value_unset (pv1);
+ g_value_unset (pv2);
+ }
+ return TRUE;
+}
+
+static gboolean
+gst_value_subtract_int64_range_int64 (GValue * dest, const GValue * minuend,
+ const GValue * subtrahend)
+{
+ gint64 min = gst_value_get_int64_range_min (minuend);
+ gint64 max = gst_value_get_int64_range_max (minuend);
+ gint64 val = g_value_get_int64 (subtrahend);
+
+ g_return_val_if_fail (min < max, FALSE);
+
+ /* value is outside of the range, return range unchanged */
+ if (val < min || val > max) {
+ gst_value_init_and_copy (dest, minuend);
+ return TRUE;
+ } else {
+ /* max must be MAXINT64 too as val <= max */
+ if (val == G_MAXINT64) {
+ max--;
+ val--;
+ }
+ /* min must be MININT64 too as val >= max */
+ if (val == G_MININT64) {
+ min++;
+ val++;
+ }
+ gst_value_create_new_int64_range (dest, min, val - 1, val + 1, max);
+ }
+ return TRUE;
+}
+
+static gboolean
+gst_value_subtract_int64_range_int64_range (GValue * dest,
+ const GValue * minuend, const GValue * subtrahend)
+{
+ gint64 min1 = gst_value_get_int64_range_min (minuend);
+ gint64 max1 = gst_value_get_int64_range_max (minuend);
+ gint64 min2 = gst_value_get_int64_range_min (subtrahend);
+ gint64 max2 = gst_value_get_int64_range_max (subtrahend);
+
+ if (max2 == G_MAXINT64 && min2 == G_MININT64) {
+ return FALSE;
+ } else if (max2 == G_MAXINT64) {
+ return gst_value_create_new_int64_range (dest, min1, MIN (min2 - 1, max1),
+ 1, 0);
+ } else if (min2 == G_MININT64) {
+ return gst_value_create_new_int64_range (dest, MAX (max2 + 1, min1), max1,
+ 1, 0);
+ } else {
+ return gst_value_create_new_int64_range (dest, min1, MIN (min2 - 1, max1),
+ MAX (max2 + 1, min1), max1);
+ }
+}
+
+static gboolean
gst_value_subtract_double_double_range (GValue * dest, const GValue * minuend,
const GValue * subtrahend)
{
const GValue *max2 = gst_value_get_fraction_range_max (minuend);
const GValue *max1 = gst_value_get_fraction_range_min (subtrahend);
const GValue *min2 = gst_value_get_fraction_range_max (subtrahend);
- int cmp1, cmp2;
+ gint cmp1, cmp2;
GValue v1 = { 0, };
GValue v2 = { 0, };
GValue *pv1, *pv2; /* yeah, hungarian! */
gboolean
gst_value_can_compare (const GValue * value1, const GValue * value2)
{
+ g_return_val_if_fail (G_IS_VALUE (value1), FALSE);
+ g_return_val_if_fail (G_IS_VALUE (value2), FALSE);
+
if (G_VALUE_TYPE (value1) != G_VALUE_TYPE (value2))
return FALSE;
gst_value_compare (const GValue * value1, const GValue * value2)
{
GstValueCompareFunc compare;
+ GType ltype;
+
+ g_return_val_if_fail (G_IS_VALUE (value1), GST_VALUE_LESS_THAN);
+ g_return_val_if_fail (G_IS_VALUE (value2), GST_VALUE_GREATER_THAN);
+
+ /* Special case: lists and scalar values
+ * "{ 1 }" and "1" are equal */
+ ltype = gst_value_list_get_type ();
+ if (G_VALUE_HOLDS (value1, ltype) && !G_VALUE_HOLDS (value2, ltype)
+ && gst_value_list_get_size (value1) == 1) {
+ const GValue *elt;
+
+ elt = gst_value_list_get_value (value1, 0);
+ return gst_value_compare (elt, value2);
+ } else if (G_VALUE_HOLDS (value2, ltype) && !G_VALUE_HOLDS (value1, ltype)
+ && gst_value_list_get_size (value2) == 1) {
+ const GValue *elt;
+
+ elt = gst_value_list_get_value (value2, 0);
+ return gst_value_compare (elt, value1);
+ }
if (G_VALUE_TYPE (value1) != G_VALUE_TYPE (value2))
return GST_VALUE_UNORDERED;
GstValueUnionInfo *union_info;
guint i, len;
+ g_return_val_if_fail (G_IS_VALUE (value1), FALSE);
+ g_return_val_if_fail (G_IS_VALUE (value2), FALSE);
+
len = gst_value_union_funcs->len;
for (i = 0; i < len; i++) {
/**
* gst_value_union:
- * @dest: the destination value
+ * @dest: (out caller-allocates): the destination value
* @value1: a value to union
* @value2: another value to union
*
GstValueUnionInfo *union_info;
guint i, len;
+ g_return_val_if_fail (dest != NULL, FALSE);
+ g_return_val_if_fail (G_IS_VALUE (value1), FALSE);
+ g_return_val_if_fail (G_IS_VALUE (value2), FALSE);
+
len = gst_value_union_funcs->len;
for (i = 0; i < len; i++) {
* gst_value_register_union_func:
* @type1: a type to union
* @type2: another type to union
- * @func: a function that implments creating a union between the two types
+ * @func: a function that implements creating a union between the two types
*
* Registers a union function that can create a union between #GValue items
* of the type @type1 and @type2.
guint i, len;
GType ltype, type1, type2;
+ g_return_val_if_fail (G_IS_VALUE (value1), FALSE);
+ g_return_val_if_fail (G_IS_VALUE (value2), FALSE);
+
ltype = gst_value_list_get_type ();
/* special cases */
/**
* gst_value_intersect:
- * @dest: a uninitialized #GValue that will hold the calculated
+ * @dest: (out caller-allocates): a uninitialized #GValue that will hold the calculated
* intersection value
* @value1: a value to intersect
* @value2: another value to intersect
guint i, len;
GType ltype, type1, type2;
+ g_return_val_if_fail (dest != NULL, FALSE);
+ g_return_val_if_fail (G_IS_VALUE (value1), FALSE);
+ g_return_val_if_fail (G_IS_VALUE (value2), FALSE);
+
ltype = gst_value_list_get_type ();
/* special cases first */
/**
* gst_value_subtract:
- * @dest: the destination value for the result if the subtraction is not empty
+ * @dest: (out caller-allocates): the destination value for the result if the
+ * subtraction is not empty
* @minuend: the value to subtract from
* @subtrahend: the value to subtract
*
guint i, len;
GType ltype, mtype, stype;
+ g_return_val_if_fail (dest != NULL, FALSE);
+ g_return_val_if_fail (G_IS_VALUE (minuend), FALSE);
+ g_return_val_if_fail (G_IS_VALUE (subtrahend), FALSE);
+
ltype = gst_value_list_get_type ();
/* special cases first */
guint i, len;
GType ltype, mtype, stype;
+ g_return_val_if_fail (G_IS_VALUE (minuend), FALSE);
+ g_return_val_if_fail (G_IS_VALUE (subtrahend), FALSE);
+
ltype = gst_value_list_get_type ();
/* special cases */
{
GstValueTable *found;
+ g_return_if_fail (table != NULL);
+
g_array_append_val (gst_value_table, *table);
found = gst_value_hash_lookup_type (table->type);
/**
* gst_value_init_and_copy:
- * @dest: the target value
+ * @dest: (out caller-allocates): the target value
* @src: the source value
*
* Initialises the target value to be of the same type as source and then copies
void
gst_value_init_and_copy (GValue * dest, const GValue * src)
{
+ g_return_if_fail (G_IS_VALUE (src));
+ g_return_if_fail (dest != NULL);
+
g_value_init (dest, G_VALUE_TYPE (src));
g_value_copy (src, dest);
}
* tries to transform the given @value into a string representation that allows
* getting back this string later on using gst_value_deserialize().
*
- * Returns: the serialization for @value or NULL if none exists
+ * Free-function: g_free
+ *
+ * Returns: (transfer full): the serialization for @value or NULL if none exists
*/
gchar *
gst_value_serialize (const GValue * value)
guint i, len;
GValue s_val = { 0 };
GstValueTable *table, *best;
- char *s;
+ gchar *s;
GType type;
g_return_val_if_fail (G_IS_VALUE (value), NULL);
/**
* gst_value_deserialize:
- * @dest: #GValue to fill with contents of deserialization
+ * @dest: (out caller-allocates): #GValue to fill with contents of
+ * deserialization
* @src: string to deserialize
*
* Tries to deserialize a string into the type specified by the given GValue.
gboolean
gst_value_is_fixed (const GValue * value)
{
- GType type = G_VALUE_TYPE (value);
+ GType type;
+
+ g_return_val_if_fail (G_IS_VALUE (value), FALSE);
+
+ type = G_VALUE_TYPE (value);
/* the most common types are just basic plain glib types */
if (type <= G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_GLIB_LAST)) {
gst_value_collect_fraction (GValue * value, guint n_collect_values,
GTypeCValue * collect_values, guint collect_flags)
{
+ if (n_collect_values != 2)
+ return g_strdup_printf ("not enough value locations for `%s' passed",
+ G_VALUE_TYPE_NAME (value));
+ if (collect_values[1].v_int == 0)
+ return g_strdup_printf ("passed '0' as denominator for `%s'",
+ G_VALUE_TYPE_NAME (value));
+ if (collect_values[0].v_int < -G_MAXINT)
+ return
+ g_strdup_printf
+ ("passed value smaller than -G_MAXINT as numerator for `%s'",
+ G_VALUE_TYPE_NAME (value));
+ if (collect_values[1].v_int < -G_MAXINT)
+ return
+ g_strdup_printf
+ ("passed value smaller than -G_MAXINT as denominator for `%s'",
+ G_VALUE_TYPE_NAME (value));
+
gst_value_set_fraction (value,
collect_values[0].v_int, collect_values[1].v_int);
gint n1, n2, d1, d2;
gint res_n, res_d;
+ g_return_val_if_fail (product != NULL, FALSE);
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (factor1), FALSE);
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (factor2), FALSE);
gint n1, n2, d1, d2;
gint res_n, res_d;
+ g_return_val_if_fail (dest != NULL, FALSE);
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (minuend), FALSE);
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (subtrahend), FALSE);
gst_value_deserialize_fraction (GValue * dest, const gchar * s)
{
gint num, den;
- int num_chars;
+ gint num_chars;
if (G_UNLIKELY (s == NULL))
return FALSE;
if (sscanf (s, "%d/%d%n", &num, &den, &num_chars) >= 2) {
if (s[num_chars] != 0)
return FALSE;
+ if (den == 0)
+ return FALSE;
+
gst_value_set_fraction (dest, num, den);
return TRUE;
} else if (g_ascii_strcasecmp (s, "1/max") == 0) {
{
gint n1, n2;
gint d1, d2;
-
- gint64 new_num_1;
- gint64 new_num_2;
+ gint ret;
n1 = value1->data[0].v_int;
n2 = value2->data[0].v_int;
if (n1 == n2 && d1 == d2)
return GST_VALUE_EQUAL;
- /* extend to 64 bits */
- new_num_1 = ((gint64) n1) * d2;
- new_num_2 = ((gint64) n2) * d1;
- if (new_num_1 < new_num_2)
+ if (d1 == 0 && d2 == 0)
+ return GST_VALUE_UNORDERED;
+ else if (d1 == 0)
+ return GST_VALUE_GREATER_THAN;
+ else if (d2 == 0)
+ return GST_VALUE_LESS_THAN;
+
+ ret = gst_util_fraction_compare (n1, d1, n2, d2);
+ if (ret == -1)
return GST_VALUE_LESS_THAN;
- if (new_num_1 > new_num_2)
+ else if (ret == 1)
return GST_VALUE_GREATER_THAN;
- /* new_num_1 == new_num_2 implies that both denominators must have
- * been 0, beause otherwise simplification would have caught the
- * equivalence */
- return GST_VALUE_UNORDERED;
+ /* Equality can't happen here because we check for that
+ * first already */
+ g_return_val_if_reached (GST_VALUE_UNORDERED);
}
/*********
* @value: a GValue initialized to GST_TYPE_DATE
* @date: the date to set the value to
*
- * Sets the contents of @value to coorespond to @date. The actual
+ * Sets the contents of @value to correspond to @date. The actual
* #GDate structure is copied before it is used.
*/
void
*
* Gets the contents of @value.
*
- * Returns: the contents of @value
+ * Returns: (transfer none): the contents of @value
*/
const GDate *
gst_value_get_date (const GValue * value)
}
static gboolean
-gst_value_deserialize_date (GValue * dest, const char *s)
+gst_value_deserialize_date (GValue * dest, const gchar * s)
{
guint year, month, day;
return TRUE;
}
+/*************
+ * GstDateTime *
+ *************/
+
+static gint
+gst_value_compare_date_time (const GValue * value1, const GValue * value2)
+{
+ const GstDateTime *date1 = (const GstDateTime *) g_value_get_boxed (value1);
+ const GstDateTime *date2 = (const GstDateTime *) g_value_get_boxed (value2);
+ gint ret;
+
+ if (date1 == date2)
+ return GST_VALUE_EQUAL;
+
+ if ((date1 == NULL) && (date2 != NULL)) {
+ return GST_VALUE_LESS_THAN;
+ }
+ if ((date2 == NULL) && (date1 != NULL)) {
+ return GST_VALUE_LESS_THAN;
+ }
+
+ ret = priv_gst_date_time_compare (date1, date2);
+
+ if (ret == 0)
+ return GST_VALUE_EQUAL;
+ else if (ret < 0)
+ return GST_VALUE_LESS_THAN;
+ else
+ return GST_VALUE_GREATER_THAN;
+}
+
+static gchar *
+gst_value_serialize_date_time (const GValue * val)
+{
+ GstDateTime *date = (GstDateTime *) g_value_get_boxed (val);
+ gfloat offset;
+ gint tzhour, tzminute;
+
+ if (date == NULL)
+ return g_strdup ("null");
+
+ offset = gst_date_time_get_time_zone_offset (date);
+
+ tzhour = (gint) ABS (offset);
+ tzminute = (gint) ((ABS (offset) - tzhour) * 60);
+
+ return g_strdup_printf ("\"%04d-%02d-%02dT%02d:%02d:%02d.%06d"
+ "%c%02d%02d\"", gst_date_time_get_year (date),
+ gst_date_time_get_month (date), gst_date_time_get_day (date),
+ gst_date_time_get_hour (date), gst_date_time_get_minute (date),
+ gst_date_time_get_second (date), gst_date_time_get_microsecond (date),
+ offset >= 0 ? '+' : '-', tzhour, tzminute);
+}
+
+static gboolean
+gst_value_deserialize_date_time (GValue * dest, const gchar * s)
+{
+ gint year, month, day, hour, minute, second, usecond;
+ gchar signal;
+ gint offset = 0;
+ gfloat tzoffset = 0;
+ gint ret;
+
+ if (!s || strcmp (s, "null") == 0) {
+ return FALSE;
+ }
+
+ ret = sscanf (s, "%04d-%02d-%02dT%02d:%02d:%02d.%06d%c%04d",
+ &year, &month, &day, &hour, &minute, &second, &usecond, &signal, &offset);
+ if (ret >= 9) {
+ tzoffset = (offset / 100) + ((offset % 100) / 60.0);
+ if (signal == '-')
+ tzoffset = -tzoffset;
+ } else
+ return FALSE;
+
+ g_value_take_boxed (dest, gst_date_time_new (tzoffset, year, month, day, hour,
+ minute, second + (usecond / 1000000.0)));
+ return TRUE;
+}
+
static void
gst_value_transform_date_string (const GValue * src_value, GValue * dest_value)
{
#define FUNC_VALUE_GET_TYPE(type, name) \
GType gst_ ## type ## _get_type (void) \
{ \
- static GType gst_ ## type ## _type = 0; \
+ static volatile GType gst_ ## type ## _type = 0; \
\
- if (G_UNLIKELY (gst_ ## type ## _type == 0)) { \
+ if (g_once_init_enter (&gst_ ## type ## _type)) { \
+ GType _type; \
_info.value_table = & _gst_ ## type ## _value_table; \
- gst_ ## type ## _type = g_type_register_fundamental ( \
+ _type = g_type_register_fundamental ( \
g_type_fundamental_next (), \
name, &_info, &_finfo, 0); \
+ g_once_init_leave(&gst_ ## type ## _type, _type); \
} \
\
return gst_ ## type ## _type; \
NULL,
gst_value_copy_fourcc,
NULL,
- "i",
+ (char *) "i",
gst_value_collect_fourcc,
- "p",
+ (char *) "p",
gst_value_lcopy_fourcc
};
NULL,
gst_value_copy_int_range,
NULL,
- "ii",
+ (char *) "ii",
gst_value_collect_int_range,
- "pp",
+ (char *) "pp",
gst_value_lcopy_int_range
};
FUNC_VALUE_GET_TYPE (int_range, "GstIntRange");
+static const GTypeValueTable _gst_int64_range_value_table = {
+ gst_value_init_int64_range,
+ NULL,
+ gst_value_copy_int64_range,
+ NULL,
+ (char *) "qq",
+ gst_value_collect_int64_range,
+ (char *) "pp",
+ gst_value_lcopy_int64_range
+};
+
+FUNC_VALUE_GET_TYPE (int64_range, "GstInt64Range");
+
static const GTypeValueTable _gst_double_range_value_table = {
gst_value_init_double_range,
NULL,
gst_value_copy_double_range,
NULL,
- "dd",
+ (char *) "dd",
gst_value_collect_double_range,
- "pp",
+ (char *) "pp",
gst_value_lcopy_double_range
};
gst_value_free_fraction_range,
gst_value_copy_fraction_range,
NULL,
- "iiii",
+ (char *) "iiii",
gst_value_collect_fraction_range,
- "pppp",
+ (char *) "pppp",
gst_value_lcopy_fraction_range
};
gst_value_free_list_or_array,
gst_value_copy_list_or_array,
gst_value_list_or_array_peek_pointer,
- "p",
+ (char *) "p",
gst_value_collect_list_or_array,
- "p",
+ (char *) "p",
gst_value_lcopy_list_or_array
};
gst_value_free_list_or_array,
gst_value_copy_list_or_array,
gst_value_list_or_array_peek_pointer,
- "p",
+ (char *) "p",
gst_value_collect_list_or_array,
- "p",
+ (char *) "p",
gst_value_lcopy_list_or_array
};
NULL,
gst_value_copy_fraction,
NULL,
- "ii",
+ (char *) "ii",
gst_value_collect_fraction,
- "pp",
+ (char *) "pp",
gst_value_lcopy_fraction
};
return gst_date_type;
}
+GType
+gst_date_time_get_type (void)
+{
+ static GType gst_date_time_type = 0;
+
+ if (G_UNLIKELY (gst_date_time_type == 0)) {
+ gst_date_time_type = g_boxed_type_register_static ("GstDateTime",
+ (GBoxedCopyFunc) gst_date_time_ref,
+ (GBoxedFreeFunc) gst_date_time_unref);
+ }
+
+ return gst_date_time_type;
+}
+
+
void
_gst_value_initialize (void)
{
{
static GstValueTable gst_value = {
0,
+ gst_value_compare_int64_range,
+ gst_value_serialize_int64_range,
+ gst_value_deserialize_int64_range,
+ };
+
+ gst_value.type = gst_int64_range_get_type ();
+ gst_value_register (&gst_value);
+ }
+
+ {
+ static GstValueTable gst_value = {
+ 0,
gst_value_compare_double_range,
gst_value_serialize_double_range,
gst_value_deserialize_double_range,
gst_value.type = gst_date_get_type ();
gst_value_register (&gst_value);
}
+ {
+ static GstValueTable gst_value = {
+ 0,
+ gst_value_compare_date_time,
+ gst_value_serialize_date_time,
+ gst_value_deserialize_date_time,
+ };
+
+ gst_value.type = gst_date_time_get_type ();
+ gst_value_register (&gst_value);
+ }
REGISTER_SERIALIZATION (G_TYPE_DOUBLE, double);
REGISTER_SERIALIZATION (G_TYPE_FLOAT, float);
REGISTER_SERIALIZATION (G_TYPE_UINT64, uint64);
REGISTER_SERIALIZATION (G_TYPE_ULONG, ulong);
+ REGISTER_SERIALIZATION (G_TYPE_UCHAR, uchar);
+
g_value_register_transform_func (GST_TYPE_FOURCC, G_TYPE_STRING,
gst_value_transform_fourcc_string);
g_value_register_transform_func (GST_TYPE_INT_RANGE, G_TYPE_STRING,
gst_value_transform_int_range_string);
+ g_value_register_transform_func (GST_TYPE_INT64_RANGE, G_TYPE_STRING,
+ gst_value_transform_int64_range_string);
g_value_register_transform_func (GST_TYPE_DOUBLE_RANGE, G_TYPE_STRING,
gst_value_transform_double_range_string);
g_value_register_transform_func (GST_TYPE_FRACTION_RANGE, G_TYPE_STRING,
gst_value_intersect_int_int_range);
gst_value_register_intersect_func (GST_TYPE_INT_RANGE, GST_TYPE_INT_RANGE,
gst_value_intersect_int_range_int_range);
+ gst_value_register_intersect_func (G_TYPE_INT64, GST_TYPE_INT64_RANGE,
+ gst_value_intersect_int64_int64_range);
+ gst_value_register_intersect_func (GST_TYPE_INT64_RANGE, GST_TYPE_INT64_RANGE,
+ gst_value_intersect_int64_range_int64_range);
gst_value_register_intersect_func (G_TYPE_DOUBLE, GST_TYPE_DOUBLE_RANGE,
gst_value_intersect_double_double_range);
gst_value_register_intersect_func (GST_TYPE_DOUBLE_RANGE,
gst_value_subtract_int_range_int);
gst_value_register_subtract_func (GST_TYPE_INT_RANGE, GST_TYPE_INT_RANGE,
gst_value_subtract_int_range_int_range);
+ gst_value_register_subtract_func (G_TYPE_INT64, GST_TYPE_INT64_RANGE,
+ gst_value_subtract_int64_int64_range);
+ gst_value_register_subtract_func (GST_TYPE_INT64_RANGE, G_TYPE_INT64,
+ gst_value_subtract_int64_range_int64);
+ gst_value_register_subtract_func (GST_TYPE_INT64_RANGE, GST_TYPE_INT64_RANGE,
+ gst_value_subtract_int64_range_int64_range);
gst_value_register_subtract_func (G_TYPE_DOUBLE, GST_TYPE_DOUBLE_RANGE,
gst_value_subtract_double_double_range);
gst_value_register_subtract_func (GST_TYPE_DOUBLE_RANGE, G_TYPE_DOUBLE,