/**
* SECTION:gstvalue
+ * @title: GstValue
* @short_description: GValue implementations specific
* to GStreamer
*
static void gst_value_register_subtract_func (GType minuend_type,
GType subtrahend_type, GstValueSubtractFunc func);
+static gboolean _priv_gst_value_parse_list (gchar * s, gchar ** after,
+ GValue * value, GType type);
+static gboolean _priv_gst_value_parse_array (gchar * s, gchar ** after,
+ GValue * value, GType type);
+
typedef struct _GstValueUnionInfo GstValueUnionInfo;
struct _GstValueUnionInfo
{
typedef struct _GstFlagSetClass GstFlagSetClass;
+typedef struct _GstValueAbbreviation GstValueAbbreviation;
+
+struct _GstValueAbbreviation
+{
+ const gchar *type_name;
+ GType type;
+};
+
#define FUNDAMENTAL_TYPE_ID_MAX \
(G_TYPE_FUNDAMENTAL_MAX >> G_TYPE_FUNDAMENTAL_SHIFT)
#define FUNDAMENTAL_TYPE_ID(type) \
/* two helper functions to serialize/stringify any type of list
* regular lists are done with { }, arrays with < >
*/
-static gchar *
-gst_value_serialize_any_list (const GValue * value, const gchar * begin,
- const gchar * end)
+gchar *
+_priv_gst_value_serialize_any_list (const GValue * value, const gchar * begin,
+ const gchar * end, gboolean print_type)
{
guint i;
GArray *array = value->data[0].v_pointer;
v = &g_array_index (array, GValue, i);
s_val = gst_value_serialize (v);
if (s_val != NULL) {
+ if (print_type) {
+ g_string_append_c (s, '(');
+ g_string_append (s, _priv_gst_value_gtype_to_abbr (G_VALUE_TYPE (v)));
+ g_string_append_c (s, ')');
+ }
g_string_append (s, s_val);
g_free (s_val);
if (i < alen - 1) {
GString *s;
GValue *v;
gchar *s_val;
- guint alen = array->n_values;
+ guint alen = 0;
+
+ if (array)
+ alen = array->n_values;
/* estimate minimum string length to minimise re-allocs in GString */
s = g_string_sized_new (2 + (6 * alen) + 2);
_gst_value_transform_g_value_array_string (src_value, dest_value, "< ", " >");
}
+static void
+gst_value_transform_g_value_array_any_list (const GValue * src_value,
+ GValue * dest_value)
+{
+ const GValueArray *varray;
+ GArray *array;
+ gint i;
+
+ /* GLib will unset the value, memset to 0 the data instead of doing a proper
+ * reset. That's why we need to allocate the array here */
+ gst_value_init_list_or_array (dest_value);
+
+ varray = g_value_get_boxed (src_value);
+ array = dest_value->data[0].v_pointer;
+
+ for (i = 0; i < varray->n_values; i++) {
+ GValue val = G_VALUE_INIT;
+ gst_value_init_and_copy (&val, &varray->values[i]);
+ g_array_append_vals (array, &val, 1);
+ }
+}
+
+static void
+gst_value_transform_any_list_g_value_array (const GValue * src_value,
+ GValue * dest_value)
+{
+ GValueArray *varray;
+ const GArray *array;
+ gint i;
+
+ array = src_value->data[0].v_pointer;
+ varray = g_value_array_new (array->len);
+
+ for (i = 0; i < array->len; i++)
+ g_value_array_append (varray, &g_array_index (array, GValue, i));
+
+ g_value_take_boxed (dest_value, varray);
+}
+
/* Do an unordered compare of the contents of a list */
static gint
gst_value_compare_value_list (const GValue * value1, const GValue * value2)
static gchar *
gst_value_serialize_value_list (const GValue * value)
{
- return gst_value_serialize_any_list (value, "{ ", " }");
+ return _priv_gst_value_serialize_any_list (value, "{ ", " }", TRUE);
}
static gboolean
gst_value_deserialize_value_list (GValue * dest, const gchar * s)
{
- g_warning ("gst_value_deserialize_list: unimplemented");
- return FALSE;
+ gchar *s2 = (gchar *) s;
+ return _priv_gst_value_parse_list (s2, &s2, dest, G_TYPE_INVALID);
}
static gchar *
gst_value_serialize_value_array (const GValue * value)
{
- return gst_value_serialize_any_list (value, "< ", " >");
+ return _priv_gst_value_serialize_any_list (value, "< ", " >", TRUE);
}
static gboolean
gst_value_deserialize_value_array (GValue * dest, const gchar * s)
{
- g_warning ("gst_value_deserialize_array: unimplemented");
- return FALSE;
+ gchar *s2 = (gchar *) s;
+ return _priv_gst_value_parse_array (s2, &s2, dest, G_TYPE_INVALID);
}
static gchar *
*
* Gets the minimum of the range specified by @value.
*
- * Returns: the minimum of the range
+ * Returns: (nullable): the minimum of the range
*/
const GValue *
gst_value_get_fraction_range_min (const GValue * value)
*
* Gets the maximum of the range specified by @value.
*
- * Returns: the maximum of the range
+ * Returns: (nullable): the maximum of the range
*/
const GValue *
gst_value_get_fraction_range_max (const GValue * value)
return FALSE;
}
+/********************************************
+ * Serialization/deserialization of GValues *
+ ********************************************/
+
+static GstValueAbbreviation *
+_priv_gst_value_get_abbrs (gint * n_abbrs)
+{
+ static GstValueAbbreviation *abbrs = NULL;
+ static volatile gsize num = 0;
+
+ if (g_once_init_enter (&num)) {
+ /* dynamically generate the array */
+ gsize _num;
+ GstValueAbbreviation dyn_abbrs[] = {
+ {"int", G_TYPE_INT}
+ ,
+ {"i", G_TYPE_INT}
+ ,
+ {"uint", G_TYPE_UINT}
+ ,
+ {"u", G_TYPE_UINT}
+ ,
+ {"float", G_TYPE_FLOAT}
+ ,
+ {"f", G_TYPE_FLOAT}
+ ,
+ {"double", G_TYPE_DOUBLE}
+ ,
+ {"d", G_TYPE_DOUBLE}
+ ,
+ {"buffer", GST_TYPE_BUFFER}
+ ,
+ {"fraction", GST_TYPE_FRACTION}
+ ,
+ {"boolean", G_TYPE_BOOLEAN}
+ ,
+ {"bool", G_TYPE_BOOLEAN}
+ ,
+ {"b", G_TYPE_BOOLEAN}
+ ,
+ {"string", G_TYPE_STRING}
+ ,
+ {"str", G_TYPE_STRING}
+ ,
+ {"s", G_TYPE_STRING}
+ ,
+ {"structure", GST_TYPE_STRUCTURE}
+ ,
+ {"date", G_TYPE_DATE}
+ ,
+ {"datetime", GST_TYPE_DATE_TIME}
+ ,
+ {"bitmask", GST_TYPE_BITMASK}
+ ,
+ {"flagset", GST_TYPE_FLAG_SET}
+ ,
+ {"sample", GST_TYPE_SAMPLE}
+ ,
+ {"taglist", GST_TYPE_TAG_LIST}
+ ,
+ {"type", G_TYPE_GTYPE}
+ ,
+ {"array", GST_TYPE_ARRAY}
+ ,
+ {"list", GST_TYPE_LIST}
+ };
+ _num = G_N_ELEMENTS (dyn_abbrs);
+ /* permanently allocate and copy the array now */
+ abbrs = g_new0 (GstValueAbbreviation, _num);
+ memcpy (abbrs, dyn_abbrs, sizeof (GstValueAbbreviation) * _num);
+ g_once_init_leave (&num, _num);
+ }
+ *n_abbrs = num;
+
+ return abbrs;
+}
+
+/* given a type_name that could be a type abbreviation or a registered GType,
+ * return a matching GType */
+static GType
+_priv_gst_value_gtype_from_abbr (const char *type_name)
+{
+ int i;
+ GstValueAbbreviation *abbrs;
+ gint n_abbrs;
+ GType ret;
+
+ g_return_val_if_fail (type_name != NULL, G_TYPE_INVALID);
+
+ abbrs = _priv_gst_value_get_abbrs (&n_abbrs);
+
+ for (i = 0; i < n_abbrs; i++) {
+ if (strcmp (type_name, abbrs[i].type_name) == 0) {
+ return abbrs[i].type;
+ }
+ }
+
+ /* this is the fallback */
+ ret = g_type_from_name (type_name);
+ /* If not found, try it as a dynamic type */
+ if (G_UNLIKELY (ret == 0))
+ ret = gst_dynamic_type_factory_load (type_name);
+ return ret;
+
+}
+
+const char *
+_priv_gst_value_gtype_to_abbr (GType type)
+{
+ int i;
+ GstValueAbbreviation *abbrs;
+ gint n_abbrs;
+
+ g_return_val_if_fail (type != G_TYPE_INVALID, NULL);
+
+ abbrs = _priv_gst_value_get_abbrs (&n_abbrs);
+
+ for (i = 0; i < n_abbrs; i++) {
+ if (type == abbrs[i].type) {
+ return abbrs[i].type_name;
+ }
+ }
+
+ return g_type_name (type);
+}
+
+/*
+ * _priv_gst_value_parse_string:
+ * @s: string to parse
+ * @end: out-pointer to char behind end of string
+ * @next: out-pointer to start of unread data
+ * @unescape: @TRUE if the substring is escaped.
+ *
+ * Find the end of a sub-string. If end == next, the string will not be
+ * null-terminated. In all other cases it will be.
+ *
+ * Note: This function modifies the string in @s (if unescape == @TRUE).
+ *
+ * Returns: @TRUE if a sub-string was found and @FALSE if the string is not
+ * terminated.
+ */
+gboolean
+_priv_gst_value_parse_string (gchar * s, gchar ** end, gchar ** next,
+ gboolean unescape)
+{
+ gchar *w;
+
+ if (*s == 0)
+ return FALSE;
+
+ if (*s != '"') {
+ int ret = _priv_gst_value_parse_simple_string (s, end);
+ *next = *end;
+
+ return ret;
+ }
+
+ /* Find the closing quotes */
+ if (unescape) {
+ w = s;
+ s++;
+ while (*s != '"') {
+ if (G_UNLIKELY (*s == 0))
+ return FALSE;
+ if (G_UNLIKELY (*s == '\\')) {
+ s++;
+ if (G_UNLIKELY (*s == 0))
+ return FALSE;
+ }
+ *w = *s;
+ w++;
+ s++;
+ }
+ s++;
+ } else {
+ s++;
+ while (*s != '"') {
+ if (G_UNLIKELY (*s == 0))
+ return FALSE;
+ if (G_UNLIKELY (*s == '\\')) {
+ s++;
+ if (G_UNLIKELY (*s == 0))
+ return FALSE;
+ }
+ s++;
+ }
+ s++;
+ w = s;
+ }
+
+ *end = w;
+ *next = s;
+
+ return TRUE;
+}
+
+static gboolean
+_priv_gst_value_parse_range (gchar * s, gchar ** after, GValue * value,
+ GType type)
+{
+ GValue value1 = { 0 };
+ GValue value2 = { 0 };
+ GValue value3 = { 0 };
+ GType range_type;
+ gboolean ret, have_step = FALSE;
+
+ if (*s != '[')
+ return FALSE;
+ s++;
+
+ ret = _priv_gst_value_parse_value (s, &s, &value1, type);
+ if (!ret)
+ return FALSE;
+
+ while (g_ascii_isspace (*s))
+ s++;
+
+ if (*s != ',')
+ return FALSE;
+ s++;
+
+ while (g_ascii_isspace (*s))
+ s++;
+
+ ret = _priv_gst_value_parse_value (s, &s, &value2, type);
+ if (!ret)
+ return FALSE;
+
+ while (g_ascii_isspace (*s))
+ s++;
+
+ /* optional step for int and int64 */
+ if (G_VALUE_TYPE (&value1) == G_TYPE_INT
+ || G_VALUE_TYPE (&value1) == G_TYPE_INT64) {
+ if (*s == ',') {
+ s++;
+
+ while (g_ascii_isspace (*s))
+ s++;
+
+ ret = _priv_gst_value_parse_value (s, &s, &value3, type);
+ if (!ret)
+ return FALSE;
+
+ while (g_ascii_isspace (*s))
+ s++;
+
+ have_step = TRUE;
+ }
+ }
+
+ if (*s != ']')
+ return FALSE;
+ s++;
+
+ if (G_VALUE_TYPE (&value1) != G_VALUE_TYPE (&value2))
+ return FALSE;
+ if (have_step && G_VALUE_TYPE (&value1) != G_VALUE_TYPE (&value3))
+ return FALSE;
+
+ if (G_VALUE_TYPE (&value1) == G_TYPE_DOUBLE) {
+ range_type = GST_TYPE_DOUBLE_RANGE;
+ g_value_init (value, range_type);
+ gst_value_set_double_range (value,
+ gst_g_value_get_double_unchecked (&value1),
+ gst_g_value_get_double_unchecked (&value2));
+ } else if (G_VALUE_TYPE (&value1) == G_TYPE_INT) {
+ range_type = GST_TYPE_INT_RANGE;
+ g_value_init (value, range_type);
+ if (have_step)
+ gst_value_set_int_range_step (value,
+ gst_g_value_get_int_unchecked (&value1),
+ gst_g_value_get_int_unchecked (&value2),
+ gst_g_value_get_int_unchecked (&value3));
+ else
+ gst_value_set_int_range (value, gst_g_value_get_int_unchecked (&value1),
+ gst_g_value_get_int_unchecked (&value2));
+ } else if (G_VALUE_TYPE (&value1) == G_TYPE_INT64) {
+ range_type = GST_TYPE_INT64_RANGE;
+ g_value_init (value, range_type);
+ if (have_step)
+ gst_value_set_int64_range_step (value,
+ gst_g_value_get_int64_unchecked (&value1),
+ gst_g_value_get_int64_unchecked (&value2),
+ gst_g_value_get_int64_unchecked (&value3));
+ else
+ gst_value_set_int64_range (value,
+ gst_g_value_get_int64_unchecked (&value1),
+ gst_g_value_get_int64_unchecked (&value2));
+ } else if (G_VALUE_TYPE (&value1) == GST_TYPE_FRACTION) {
+ range_type = GST_TYPE_FRACTION_RANGE;
+ g_value_init (value, range_type);
+ gst_value_set_fraction_range (value, &value1, &value2);
+ } else {
+ return FALSE;
+ }
+
+ *after = s;
+ return TRUE;
+}
+
+static gboolean
+_priv_gst_value_parse_any_list (gchar * s, gchar ** after, GValue * value,
+ GType type, char begin, char end)
+{
+ GValue list_value = { 0 };
+ gboolean ret;
+ GArray *array;
+
+ array = g_value_peek_pointer (value);
+
+ if (*s != begin)
+ return FALSE;
+ s++;
+
+ while (g_ascii_isspace (*s))
+ s++;
+ if (*s == end) {
+ s++;
+ *after = s;
+ return TRUE;
+ }
+
+ ret = _priv_gst_value_parse_value (s, &s, &list_value, type);
+ if (!ret)
+ return FALSE;
+
+ g_array_append_val (array, list_value);
+
+ while (g_ascii_isspace (*s))
+ s++;
+
+ while (*s != end) {
+ if (*s != ',')
+ return FALSE;
+ s++;
+
+ while (g_ascii_isspace (*s))
+ s++;
+
+ memset (&list_value, 0, sizeof (list_value));
+ ret = _priv_gst_value_parse_value (s, &s, &list_value, type);
+ if (!ret)
+ return FALSE;
+
+ g_array_append_val (array, list_value);
+ while (g_ascii_isspace (*s))
+ s++;
+ }
+
+ s++;
+
+ *after = s;
+ return TRUE;
+}
+
+static gboolean
+_priv_gst_value_parse_list (gchar * s, gchar ** after, GValue * value,
+ GType type)
+{
+ return _priv_gst_value_parse_any_list (s, after, value, type, '{', '}');
+}
+
+static gboolean
+_priv_gst_value_parse_array (gchar * s, gchar ** after, GValue * value,
+ GType type)
+{
+ return _priv_gst_value_parse_any_list (s, after, value, type, '<', '>');
+}
+
+gboolean
+_priv_gst_value_parse_simple_string (gchar * str, gchar ** end)
+{
+ char *s = str;
+
+ while (G_LIKELY (GST_ASCII_IS_STRING (*s))) {
+ s++;
+ }
+
+ *end = s;
+
+ return (s != str);
+}
+
+gboolean
+_priv_gst_value_parse_value (gchar * str,
+ gchar ** after, GValue * value, GType default_type)
+{
+ gchar *type_name;
+ gchar *type_end;
+ gchar *value_s;
+ gchar *value_end;
+ gchar *s;
+ gchar c;
+ int ret = 0;
+ GType type = default_type;
+
+ s = str;
+ while (g_ascii_isspace (*s))
+ s++;
+
+ /* check if there's a (type_name) 'cast' */
+ type_name = NULL;
+ if (*s == '(') {
+ s++;
+ while (g_ascii_isspace (*s))
+ s++;
+ type_name = s;
+ if (G_UNLIKELY (!_priv_gst_value_parse_simple_string (s, &type_end)))
+ return FALSE;
+ s = type_end;
+ while (g_ascii_isspace (*s))
+ s++;
+ if (G_UNLIKELY (*s != ')'))
+ return FALSE;
+ s++;
+ while (g_ascii_isspace (*s))
+ s++;
+
+ c = *type_end;
+ *type_end = 0;
+ type = _priv_gst_value_gtype_from_abbr (type_name);
+ GST_DEBUG ("trying type name '%s'", type_name);
+ *type_end = c;
+
+ if (G_UNLIKELY (type == G_TYPE_INVALID)) {
+ GST_WARNING ("invalid type");
+ return FALSE;
+ }
+ }
+
+ while (g_ascii_isspace (*s))
+ s++;
+ if (*s == '[') {
+ ret = _priv_gst_value_parse_range (s, &s, value, type);
+ } else if (*s == '{') {
+ g_value_init (value, GST_TYPE_LIST);
+ ret = _priv_gst_value_parse_list (s, &s, value, type);
+ } else if (*s == '<') {
+ g_value_init (value, GST_TYPE_ARRAY);
+ ret = _priv_gst_value_parse_array (s, &s, value, type);
+ } else {
+ value_s = s;
+
+ if (G_UNLIKELY (type == G_TYPE_INVALID)) {
+ GType try_types[] =
+ { G_TYPE_INT, G_TYPE_DOUBLE, GST_TYPE_FRACTION, GST_TYPE_FLAG_SET,
+ G_TYPE_BOOLEAN, G_TYPE_STRING
+ };
+ int i;
+
+ if (G_UNLIKELY (!_priv_gst_value_parse_string (s, &value_end, &s, TRUE)))
+ return FALSE;
+ /* Set NULL terminator for deserialization */
+ c = *value_end;
+ *value_end = '\0';
+
+ for (i = 0; i < G_N_ELEMENTS (try_types); i++) {
+ g_value_init (value, try_types[i]);
+ ret = gst_value_deserialize (value, value_s);
+ if (ret)
+ break;
+ g_value_unset (value);
+ }
+ } else {
+ g_value_init (value, type);
+
+ if (G_UNLIKELY (!_priv_gst_value_parse_string (s, &value_end, &s,
+ (type != G_TYPE_STRING))))
+ return FALSE;
+ /* Set NULL terminator for deserialization */
+ c = *value_end;
+ *value_end = '\0';
+
+ ret = gst_value_deserialize (value, value_s);
+ if (G_UNLIKELY (!ret))
+ g_value_unset (value);
+ }
+ *value_end = c;
+ }
+
+ *after = s;
+
+ return ret;
+}
+
/**************
* GstSegment *
**************/
GstStructure *structure1 = GST_STRUCTURE (g_value_get_boxed (value1));
GstStructure *structure2 = GST_STRUCTURE (g_value_get_boxed (value2));
+ if (structure1 == structure2)
+ return GST_VALUE_EQUAL;
+
+ if (!structure1 || !structure2)
+ return GST_VALUE_UNORDERED;
+
if (gst_structure_is_equal (structure1, structure2))
return GST_VALUE_EQUAL;
/* check if it extends the range */
if (v == (INT_RANGE_MIN (src2) - 1) * INT_RANGE_STEP (src2)) {
if (dest) {
- guint64 new_min =
- (guint) ((INT_RANGE_MIN (src2) - 1) * INT_RANGE_STEP (src2));
- guint64 new_max = (guint) (INT_RANGE_MAX (src2) * INT_RANGE_STEP (src2));
+ guint64 new_min = INT_RANGE_MIN (src2) - 1;
+ guint64 new_max = INT_RANGE_MAX (src2);
gst_value_init_and_copy (dest, src2);
dest->data[0].v_uint64 = (new_min << 32) | (new_max);
}
if (v == (INT_RANGE_MAX (src2) + 1) * INT_RANGE_STEP (src2)) {
if (dest) {
- guint64 new_min = (guint) (INT_RANGE_MIN (src2) * INT_RANGE_STEP (src2));
- guint64 new_max =
- (guint) ((INT_RANGE_MAX (src2) + 1) * INT_RANGE_STEP (src2));
+ guint64 new_min = INT_RANGE_MIN (src2);
+ guint64 new_max = INT_RANGE_MAX (src2) + 1;
gst_value_init_and_copy (dest, src2);
dest->data[0].v_uint64 = (new_min << 32) | (new_max);
return FALSE;
g_value_unset (val);
- gst_value_init_and_copy (val, &res_value);
+ gst_value_move (val, &res_value);
return TRUE;
}
}
/* "Pure" variant of gst_value_compare which is guaranteed to
- * not have list arguments and therefore does basic comparisions
+ * not have list arguments and therefore does basic comparisons
*/
static inline gint
_gst_value_compare_nolist (const GValue * value1, const GValue * value2)
}
static gboolean
+is_valid_flags_string (const gchar * s)
+{
+ /* We're looking to match +this/that+other-thing/not-this-thing type strings */
+ return g_regex_match_simple ("^([\\+\\/][\\w\\d-]+)+$", s, G_REGEX_CASELESS,
+ 0);
+}
+
+static gboolean
gst_value_deserialize_flagset (GValue * dest, const gchar * s)
{
gboolean res = FALSE;
if (G_UNLIKELY ((mask == 0 && errno == EINVAL) || cur == next))
goto try_as_flags_string;
- /* Next char should be NULL terminator, or a ':' */
- if (G_UNLIKELY (next[0] != 0 && next[0] != ':'))
- goto try_as_flags_string;
+ /* Next char should be NULL terminator, or a ':'. If ':', we need the flag string after */
+ if (G_UNLIKELY (next[0] == 0)) {
+ res = TRUE;
+ goto done;
+ }
+
+ if (next[0] != ':')
+ return FALSE;
+
+ s = next + 1;
+
+ if (g_str_equal (g_type_name (G_VALUE_TYPE (dest)), "GstFlagSet")) {
+ /* If we're parsing a generic flag set, that can mean we're guessing
+ * at the type in deserialising a GstStructure so at least check that
+ * we have a valid-looking string, so we don't cause deserialisation of
+ * other types of strings like 00:01:00:00 - https://bugzilla.gnome.org/show_bug.cgi?id=779755 */
+ if (is_valid_flags_string (s)) {
+ res = TRUE;
+ goto done;
+ }
+ return FALSE;
+ }
+ /* Otherwise, we already got a hex string for a valid non-generic flagset type */
res = TRUE;
+ goto done;
try_as_flags_string:
- if (!res) {
+ {
const gchar *set_class = g_type_name (G_VALUE_TYPE (dest));
GFlagsClass *flags_klass = NULL;
const gchar *end;
- if (g_str_equal (set_class, "GstFlagSet"))
- goto done; /* There's no hope to parse a generic flag set */
+ if (g_str_equal (set_class, "GstFlagSet")) {
+ /* There's no hope to parse the fields of generic flag set if we didn't already
+ * catch a hex-string above */
+ return FALSE;
+ }
/* Flags class is the FlagSet class with 'Set' removed from the end */
end = g_strrstr (set_class, "Set");
}
}
+done:
if (res)
gst_value_set_flagset (dest, flags, mask);
-done:
return res;
}
/* These initial sizes are used for the tables
* below, and save a couple of reallocs at startup */
-static const gint GST_VALUE_TABLE_DEFAULT_SIZE = 35;
-static const gint GST_VALUE_UNION_TABLE_DEFAULT_SIZE = 4;
-static const gint GST_VALUE_INTERSECT_TABLE_DEFAULT_SIZE = 11;
-static const gint GST_VALUE_SUBTRACT_TABLE_DEFAULT_SIZE = 12;
+static const gint GST_VALUE_TABLE_DEFAULT_SIZE = 40;
+static const gint GST_VALUE_UNION_TABLE_DEFAULT_SIZE = 8;
+static const gint GST_VALUE_INTERSECT_TABLE_DEFAULT_SIZE = 16;
+static const gint GST_VALUE_SUBTRACT_TABLE_DEFAULT_SIZE = 16;
void
_priv_gst_value_initialize (void)
gst_value_transform_fraction_range_string);
g_value_register_transform_func (GST_TYPE_LIST, G_TYPE_STRING,
gst_value_transform_list_string);
+ g_value_register_transform_func (GST_TYPE_LIST, G_TYPE_VALUE_ARRAY,
+ gst_value_transform_any_list_g_value_array);
g_value_register_transform_func (GST_TYPE_ARRAY, G_TYPE_STRING,
gst_value_transform_array_string);
+ g_value_register_transform_func (GST_TYPE_ARRAY, G_TYPE_VALUE_ARRAY,
+ gst_value_transform_any_list_g_value_array);
g_value_register_transform_func (G_TYPE_VALUE_ARRAY, G_TYPE_STRING,
gst_value_transform_g_value_array_string);
+ g_value_register_transform_func (G_TYPE_VALUE_ARRAY, GST_TYPE_ARRAY,
+ gst_value_transform_g_value_array_any_list);
+ g_value_register_transform_func (G_TYPE_VALUE_ARRAY, GST_TYPE_LIST,
+ gst_value_transform_g_value_array_any_list);
g_value_register_transform_func (GST_TYPE_FRACTION, G_TYPE_STRING,
gst_value_transform_fraction_string);
g_value_register_transform_func (G_TYPE_STRING, GST_TYPE_FRACTION,
#if GST_VERSION_NANO == 1
/* If building from git master, check starting array sizes matched actual size
* so we can keep the defines in sync and save a few reallocs on startup */
- if (gst_value_table->len != GST_VALUE_TABLE_DEFAULT_SIZE) {
+ if (gst_value_table->len > GST_VALUE_TABLE_DEFAULT_SIZE) {
GST_ERROR ("Wrong initial gst_value_table size. "
"Please set GST_VALUE_TABLE_DEFAULT_SIZE to %u in gstvalue.c",
gst_value_table->len);
}
- if (gst_value_union_funcs->len != GST_VALUE_UNION_TABLE_DEFAULT_SIZE) {
+ if (gst_value_union_funcs->len > GST_VALUE_UNION_TABLE_DEFAULT_SIZE) {
GST_ERROR ("Wrong initial gst_value_union_funcs table size. "
"Please set GST_VALUE_UNION_TABLE_DEFAULT_SIZE to %u in gstvalue.c",
gst_value_union_funcs->len);
}
- if (gst_value_intersect_funcs->len != GST_VALUE_INTERSECT_TABLE_DEFAULT_SIZE) {
+ if (gst_value_intersect_funcs->len > GST_VALUE_INTERSECT_TABLE_DEFAULT_SIZE) {
GST_ERROR ("Wrong initial gst_value_intersect_funcs table size. "
"Please set GST_VALUE_INTERSECT_TABLE_DEFAULT_SIZE to %u in gstvalue.c",
gst_value_intersect_funcs->len);
}
- if (gst_value_subtract_funcs->len != GST_VALUE_SUBTRACT_TABLE_DEFAULT_SIZE) {
+ if (gst_value_subtract_funcs->len > GST_VALUE_SUBTRACT_TABLE_DEFAULT_SIZE) {
GST_ERROR ("Wrong initial gst_value_subtract_funcs table size. "
"Please set GST_VALUE_SUBTRACT_TABLE_DEFAULT_SIZE to %u in gstvalue.c",
gst_value_subtract_funcs->len);