mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-15 13:53:19 +00:00
value: Always add the type name to elements when serializing arrays/lists
But only when serializing outside of GstStructures, because in case of GstStructure the type is already preprended to the array/list and the GstStructure API makes sure that they have the same "generic" type so deserialization works properly. This keeps serialization of GstStructures the same as before, and the GstCaps unit tests already test for that. However when serializing standalone arrays/lists get the types added now.
This commit is contained in:
parent
33118f6118
commit
a3cfcbfede
3 changed files with 17 additions and 5 deletions
|
@ -157,7 +157,7 @@ G_GNUC_INTERNAL const char * _priv_gst_value_gtype_to_abbr (GType type);
|
|||
G_GNUC_INTERNAL gboolean _priv_gst_value_parse_string (gchar * s, gchar ** end, gchar ** next, gboolean unescape);
|
||||
G_GNUC_INTERNAL gboolean _priv_gst_value_parse_simple_string (gchar * str, gchar ** end);
|
||||
G_GNUC_INTERNAL gboolean _priv_gst_value_parse_value (gchar * str, gchar ** after, GValue * value, GType default_type);
|
||||
G_GNUC_INTERNAL gchar * _priv_gst_value_serialize_any_list (const GValue * value, const gchar * begin, const gchar * end);
|
||||
G_GNUC_INTERNAL gchar * _priv_gst_value_serialize_any_list (const GValue * value, const gchar * begin, const gchar * end, gboolean print_type);
|
||||
|
||||
/* Used in GstBin for manual state handling */
|
||||
G_GNUC_INTERNAL void _priv_gst_element_state_changed (GstElement *element,
|
||||
|
|
|
@ -1799,7 +1799,14 @@ priv_gst_structure_append_to_gstring (const GstStructure * structure,
|
|||
|
||||
field = GST_STRUCTURE_FIELD (structure, i);
|
||||
|
||||
if (G_VALUE_TYPE (&field->value) == GST_TYPE_ARRAY) {
|
||||
t = _priv_gst_value_serialize_any_list (&field->value, "< ", " >", FALSE);
|
||||
} else if (G_VALUE_TYPE (&field->value) == GST_TYPE_LIST) {
|
||||
t = _priv_gst_value_serialize_any_list (&field->value, "{ ", " }", FALSE);
|
||||
} else {
|
||||
t = gst_value_serialize (&field->value);
|
||||
}
|
||||
|
||||
type = gst_structure_value_get_generic_type (&field->value);
|
||||
|
||||
g_string_append_len (s, ", ", 2);
|
||||
|
|
|
@ -198,7 +198,7 @@ gst_value_hash_add_type (GType type, const GstValueTable * table)
|
|||
*/
|
||||
gchar *
|
||||
_priv_gst_value_serialize_any_list (const GValue * value, const gchar * begin,
|
||||
const gchar * end)
|
||||
const gchar * end, gboolean print_type)
|
||||
{
|
||||
guint i;
|
||||
GArray *array = value->data[0].v_pointer;
|
||||
|
@ -214,6 +214,11 @@ _priv_gst_value_serialize_any_list (const GValue * value, const gchar * begin,
|
|||
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) {
|
||||
|
@ -1036,7 +1041,7 @@ gst_value_compare_g_value_array (const GValue * value1, const GValue * value2)
|
|||
static gchar *
|
||||
gst_value_serialize_value_list (const GValue * value)
|
||||
{
|
||||
return _priv_gst_value_serialize_any_list (value, "{ ", " }");
|
||||
return _priv_gst_value_serialize_any_list (value, "{ ", " }", TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1049,7 +1054,7 @@ gst_value_deserialize_value_list (GValue * dest, const gchar * s)
|
|||
static gchar *
|
||||
gst_value_serialize_value_array (const GValue * value)
|
||||
{
|
||||
return _priv_gst_value_serialize_any_list (value, "< ", " >");
|
||||
return _priv_gst_value_serialize_any_list (value, "{ ", " }", TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue