common: Stop using GQuark-based GstStructure field name API

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432>
This commit is contained in:
Sebastian Dröge 2024-08-29 20:09:52 +03:00
parent 2df9c4739e
commit 6233eb0ff3
68 changed files with 1072 additions and 1119 deletions

View file

@ -148,9 +148,10 @@ typedef struct
} StructureValues; } StructureValues;
static gboolean static gboolean
structure_set_fields (GQuark field_id, GValue * value, StructureValues * data) structure_set_fields (const GstIdStr * fieldname, GValue * value,
StructureValues * data)
{ {
const gchar *field = g_quark_to_string (field_id); const gchar *field = gst_id_str_as_str (fieldname);
if (data->ignored_fields if (data->ignored_fields
&& g_strv_contains ((const gchar **) data->ignored_fields, field)) && g_strv_contains ((const gchar **) data->ignored_fields, field))
@ -176,8 +177,8 @@ validate_flow_structure_cleanup (const GstStructure * structure,
.ignored_fields = ignored_fields, .ignored_fields = ignored_fields,
}; };
gst_structure_foreach (structure, gst_structure_foreach_id_str (structure,
(GstStructureForeachFunc) structure_set_fields, &d); (GstStructureForeachIdStrFunc) structure_set_fields, &d);
d.fields = g_list_sort (d.fields, (GCompareFunc) g_ascii_strcasecmp); d.fields = g_list_sort (d.fields, (GCompareFunc) g_ascii_strcasecmp);
nstructure = gst_structure_new_empty (gst_structure_get_name (structure)); nstructure = gst_structure_new_empty (gst_structure_get_name (structure));
for (GList * tmp = d.fields; tmp; tmp = tmp->next) { for (GList * tmp = d.fields; tmp; tmp = tmp->next) {

View file

@ -301,12 +301,12 @@ _incompatible_fields_info_set_found (StructureIncompatibleFieldsInfo * info)
} }
static gboolean static gboolean
_find_structure_incompatible_fields (GQuark field_id, const GValue * value, _find_structure_incompatible_fields (const GstIdStr * fieldname,
StructureIncompatibleFieldsInfo * info) const GValue * value, StructureIncompatibleFieldsInfo * info)
{ {
gchar *value_str, *filter_str; gchar *value_str, *filter_str;
const GValue *filter_value = gst_structure_id_get_value (info->filter, const GValue *filter_value = gst_structure_id_str_get_value (info->filter,
field_id); fieldname);
if (!filter_value) if (!filter_value)
return TRUE; return TRUE;
@ -319,7 +319,7 @@ _find_structure_incompatible_fields (GQuark field_id, const GValue * value,
g_string_append_printf (info->str, g_string_append_printf (info->str,
"\n -> Field '%s' downstream value from structure %d '(%s)%s' can't intersect with" "\n -> Field '%s' downstream value from structure %d '(%s)%s' can't intersect with"
" filter value from structure number %d '(%s)%s' because of their types.", " filter value from structure number %d '(%s)%s' because of their types.",
g_quark_to_string (field_id), info->caps_struct_num, gst_id_str_as_str (fieldname), info->caps_struct_num,
G_VALUE_TYPE_NAME (value), value_str, info->filter_caps_struct_num, G_VALUE_TYPE_NAME (value), value_str, info->filter_caps_struct_num,
G_VALUE_TYPE_NAME (filter_value), filter_str); G_VALUE_TYPE_NAME (filter_value), filter_str);
@ -337,7 +337,7 @@ _find_structure_incompatible_fields (GQuark field_id, const GValue * value,
g_string_append_printf (info->str, g_string_append_printf (info->str,
"\n -> Field '%s' downstream value from structure %d '(%s)%s' can't intersect with" "\n -> Field '%s' downstream value from structure %d '(%s)%s' can't intersect with"
" filter value from structure number %d '(%s)%s'", " filter value from structure number %d '(%s)%s'",
g_quark_to_string (field_id), info->caps_struct_num, gst_id_str_as_str (fieldname), info->caps_struct_num,
G_VALUE_TYPE_NAME (value), value_str, info->filter_caps_struct_num, G_VALUE_TYPE_NAME (value), value_str, info->filter_caps_struct_num,
G_VALUE_TYPE_NAME (filter_value), filter_str); G_VALUE_TYPE_NAME (filter_value), filter_str);
@ -411,8 +411,9 @@ _append_query_caps_failure_details (GstValidatePadMonitor * monitor,
continue; continue;
} }
gst_structure_foreach (possible_struct, gst_structure_foreach_id_str (possible_struct,
(GstStructureForeachFunc) _find_structure_incompatible_fields, &info); (GstStructureForeachIdStrFunc) _find_structure_incompatible_fields,
&info);
if (info.found) if (info.found)
found = TRUE; found = TRUE;
@ -481,8 +482,9 @@ _append_accept_caps_failure_details (GstValidatePadMonitor * monitor,
continue; continue;
} }
gst_structure_foreach (refused_struct, gst_structure_foreach_id_str (refused_struct,
(GstStructureForeachFunc) _find_structure_incompatible_fields, &info); (GstStructureForeachIdStrFunc) _find_structure_incompatible_fields,
&info);
} }
} }

View file

@ -962,10 +962,11 @@ typedef struct
} PrintActionFieldData; } PrintActionFieldData;
static gboolean static gboolean
_append_value (GQuark field_id, const GValue * value, PrintActionFieldData * d) _append_value (const GstIdStr * field, const GValue * value,
PrintActionFieldData * d)
{ {
gchar *val_str = NULL; gchar *val_str = NULL;
const gchar *fieldname = g_quark_to_string (field_id); const gchar *fieldname = gst_id_str_as_str (field);
if (g_str_has_prefix (fieldname, "__") && g_str_has_suffix (fieldname, "__")) if (g_str_has_prefix (fieldname, "__") && g_str_has_suffix (fieldname, "__"))
return TRUE; return TRUE;
@ -1021,8 +1022,8 @@ gst_validate_print_action (GstValidateAction * action, const gchar * message)
GST_VALIDATE_ACTION_N_REPEATS (action)); GST_VALIDATE_ACTION_N_REPEATS (action));
g_string_append (string, " ( "); g_string_append (string, " ( ");
gst_structure_foreach (action->structure, gst_structure_foreach_id_str (action->structure,
(GstStructureForeachFunc) _append_value, &d); (GstStructureForeachIdStrFunc) _append_value, &d);
if (d.printed) if (d.printed)
g_string_append_printf (string, "\n%*c)\n", indent, ' '); g_string_append_printf (string, "\n%*c)\n", indent, ' ');
else else

View file

@ -1265,9 +1265,10 @@ _pause_action_restore_playing (GstValidateScenario * scenario)
} }
static gboolean static gboolean
_set_const_func (GQuark field_id, const GValue * value, GstStructure * consts) _set_const_func (const GstIdStr * fieldname, const GValue * value,
GstStructure * consts)
{ {
gst_structure_id_set_value (consts, field_id, value); gst_structure_id_str_set_value (consts, fieldname, value);
return TRUE; return TRUE;
} }
@ -1276,14 +1277,14 @@ static GstValidateExecuteActionReturn
_execute_define_vars (GstValidateScenario * scenario, _execute_define_vars (GstValidateScenario * scenario,
GstValidateAction * action) GstValidateAction * action)
{ {
gst_structure_foreach (action->structure, gst_structure_foreach_id_str (action->structure,
(GstStructureForeachFunc) _set_const_func, scenario->priv->vars); (GstStructureForeachIdStrFunc) _set_const_func, scenario->priv->vars);
return GST_VALIDATE_EXECUTE_ACTION_OK; return GST_VALIDATE_EXECUTE_ACTION_OK;
} }
static GstValidateExecuteActionReturn static GstValidateExecuteActionReturn
_set_timed_value (GQuark field_id, const GValue * gvalue, _set_timed_value (const GstIdStr * fieldname, const GValue * gvalue,
GstStructure * structure) GstStructure * structure)
{ {
GstValidateExecuteActionReturn res = GST_VALIDATE_EXECUTE_ACTION_OK; GstValidateExecuteActionReturn res = GST_VALIDATE_EXECUTE_ACTION_OK;
@ -1295,7 +1296,7 @@ _set_timed_value (GQuark field_id, const GValue * gvalue,
GstValidateAction *action; GstValidateAction *action;
GstObject *obj = NULL; GstObject *obj = NULL;
GParamSpec *paramspec = NULL; GParamSpec *paramspec = NULL;
const gchar *field = g_quark_to_string (field_id); const gchar *field = gst_id_str_as_str (fieldname);
const gchar *unused_fields[] = const gchar *unused_fields[] =
{ "binding-type", "source-type", "interpolation-mode", { "binding-type", "source-type", "interpolation-mode",
"timestamp", "__scenario__", "__action__", "__res__", "repeat", "timestamp", "__scenario__", "__action__", "__res__", "repeat",
@ -1408,8 +1409,8 @@ _set_timed_value_property (GstValidateScenario * scenario,
gst_structure_set (action->structure, "__action__", G_TYPE_POINTER, gst_structure_set (action->structure, "__action__", G_TYPE_POINTER,
action, "__scenario__", G_TYPE_POINTER, scenario, NULL); action, "__scenario__", G_TYPE_POINTER, scenario, NULL);
gst_structure_foreach (action->structure, gst_structure_foreach_id_str (action->structure,
(GstStructureForeachFunc) _set_timed_value, action->structure); (GstStructureForeachIdStrFunc) _set_timed_value, action->structure);
gst_structure_get_int (action->structure, "__res__", &res); gst_structure_get_int (action->structure, "__res__", &res);
gst_structure_remove_fields (action->structure, "__action__", "__scenario__", gst_structure_remove_fields (action->structure, "__action__", "__scenario__",
"__res__", NULL); "__res__", NULL);
@ -1455,7 +1456,7 @@ _check_property (GstValidateScenario * scenario, GstValidateAction * action,
} }
static GstValidateExecuteActionReturn static GstValidateExecuteActionReturn
_set_or_check_properties (GQuark field_id, const GValue * value, _set_or_check_properties (const GstIdStr * fieldname, const GValue * value,
GstStructure * structure) GstStructure * structure)
{ {
GstValidateExecuteActionReturn res = GST_VALIDATE_EXECUTE_ACTION_OK; GstValidateExecuteActionReturn res = GST_VALIDATE_EXECUTE_ACTION_OK;
@ -1465,7 +1466,7 @@ _set_or_check_properties (GQuark field_id, const GValue * value,
GParamSpec *paramspec = NULL; GParamSpec *paramspec = NULL;
gboolean no_value_check = FALSE; gboolean no_value_check = FALSE;
GstValidateObjectSetPropertyFlags flags = 0; GstValidateObjectSetPropertyFlags flags = 0;
const gchar *field = g_quark_to_string (field_id); const gchar *field = gst_id_str_as_str (fieldname);
const gchar *unused_fields[] = { "__scenario__", "__action__", "__res__", const gchar *unused_fields[] = { "__scenario__", "__action__", "__res__",
"playback-time", "repeat", "no-value-check", NULL "playback-time", "repeat", "no-value-check", NULL
}; };
@ -1513,8 +1514,9 @@ _execute_set_or_check_properties (GstValidateScenario * scenario,
gst_structure_set (action->structure, "__action__", G_TYPE_POINTER, gst_structure_set (action->structure, "__action__", G_TYPE_POINTER,
action, "__scenario__", G_TYPE_POINTER, scenario, NULL); action, "__scenario__", G_TYPE_POINTER, scenario, NULL);
gst_structure_foreach (action->structure, gst_structure_foreach_id_str (action->structure,
(GstStructureForeachFunc) _set_or_check_properties, action->structure); (GstStructureForeachIdStrFunc) _set_or_check_properties,
action->structure);
gst_structure_get_int (action->structure, "__res__", &res); gst_structure_get_int (action->structure, "__res__", &res);
gst_structure_remove_fields (action->structure, "__action__", "__scenario__", gst_structure_remove_fields (action->structure, "__action__", "__scenario__",
"__res__", NULL); "__res__", NULL);
@ -2663,10 +2665,10 @@ gst_validate_parse_next_action_playback_time (GstValidateScenario * self)
} }
static gboolean static gboolean
_foreach_find_iterator (GQuark field_id, GValue * value, _foreach_find_iterator (const GstIdStr * fieldname, GValue * value,
GstValidateAction * action) GstValidateAction * action)
{ {
const gchar *field = g_quark_to_string (field_id); const gchar *field = gst_id_str_as_str (fieldname);
if (!g_strcmp0 (field, "actions")) if (!g_strcmp0 (field, "actions"))
return TRUE; return TRUE;
@ -3720,10 +3722,10 @@ done:
} }
static gboolean static gboolean
set_env_var (GQuark field_id, GValue * value, set_env_var (const GstIdStr * fieldname, GValue * value,
GSubprocessLauncher * subproc_launcher) GSubprocessLauncher * subproc_launcher)
{ {
g_subprocess_launcher_setenv (subproc_launcher, g_quark_to_string (field_id), g_subprocess_launcher_setenv (subproc_launcher, gst_id_str_as_str (fieldname),
g_value_get_string (value), TRUE); g_value_get_string (value), TRUE);
return TRUE; return TRUE;
@ -3754,8 +3756,8 @@ _run_command (GstValidateScenario * scenario, GstValidateAction * action)
"The `env` parameter should be a GstStructure, got %s", "The `env` parameter should be a GstStructure, got %s",
G_VALUE_TYPE_NAME (env)); G_VALUE_TYPE_NAME (env));
if (env) { if (env) {
gst_structure_foreach (gst_value_get_structure (env), gst_structure_foreach_id_str (gst_value_get_structure (env),
(GstStructureForeachFunc) set_env_var, subproc_launcher); (GstStructureForeachIdStrFunc) set_env_var, subproc_launcher);
} }
REPORT_UNLESS ( REPORT_UNLESS (
@ -4720,8 +4722,8 @@ gst_validate_foreach_prepare (GstValidateAction * action)
g_free (GST_VALIDATE_ACTION_RANGE_NAME (action)); g_free (GST_VALIDATE_ACTION_RANGE_NAME (action));
GST_VALIDATE_ACTION_RANGE_NAME (action) = NULL; GST_VALIDATE_ACTION_RANGE_NAME (action) = NULL;
gst_structure_foreach (action->structure, gst_structure_foreach_id_str (action->structure,
(GstStructureForeachFunc) _foreach_find_iterator, action); (GstStructureForeachIdStrFunc) _foreach_find_iterator, action);
/* Allow using the repeat field here too */ /* Allow using the repeat field here too */
if (!GST_VALIDATE_ACTION_RANGE_NAME (action) if (!GST_VALIDATE_ACTION_RANGE_NAME (action)
@ -4792,10 +4794,10 @@ gst_validate_foreach_prepare (GstValidateAction * action)
} }
static gboolean static gboolean
_check_structure_has_expected_value (GQuark field_id, const GValue * value, _check_structure_has_expected_value (const GstIdStr * fieldname,
GstStructure * message_struct) const GValue * value, GstStructure * message_struct)
{ {
const GValue *v = gst_structure_id_get_value (message_struct, field_id); const GValue *v = gst_structure_id_str_get_value (message_struct, fieldname);
if (!v) { if (!v) {
gst_structure_set (message_struct, "__validate_has_expected_values", gst_structure_set (message_struct, "__validate_has_expected_values",
@ -4855,8 +4857,8 @@ _check_waiting_for_message (GstValidateScenario * scenario,
gst_structure_set (message_struct, "__validate_has_expected_values", gst_structure_set (message_struct, "__validate_has_expected_values",
G_TYPE_BOOLEAN, FALSE, NULL); G_TYPE_BOOLEAN, FALSE, NULL);
gst_structure_foreach (expected_values, gst_structure_foreach_id_str (expected_values,
(GstStructureForeachFunc) _check_structure_has_expected_value, (GstStructureForeachIdStrFunc) _check_structure_has_expected_value,
message_struct); message_struct);
if (!gst_structure_get_boolean (message_struct, if (!gst_structure_get_boolean (message_struct,
@ -6078,13 +6080,14 @@ gst_validate_scenario_factory_create (GstValidateRunner *
} }
static gboolean static gboolean
_add_description (GQuark field_id, const GValue * value, KeyFileGroupName * kfg) _add_description (const GstIdStr * fieldname, const GValue * value,
KeyFileGroupName * kfg)
{ {
gchar *tmp = gst_value_serialize (value); gchar *tmp = gst_value_serialize (value);
gchar *tmpcompress = g_strcompress (tmp); gchar *tmpcompress = g_strcompress (tmp);
g_key_file_set_string (kfg->kf, kfg->group_name, g_key_file_set_string (kfg->kf, kfg->group_name,
g_quark_to_string (field_id), tmpcompress); gst_id_str_as_str (fieldname), tmpcompress);
g_free (tmpcompress); g_free (tmpcompress);
g_free (tmp); g_free (tmp);
@ -6154,8 +6157,8 @@ _parse_scenario (GFile * f, GKeyFile * kf)
gst_structure_remove_fields (meta, "__lineno__", "__filename__", gst_structure_remove_fields (meta, "__lineno__", "__filename__",
"__debug__", NULL); "__debug__", NULL);
gst_structure_foreach (meta, gst_structure_foreach_id_str (meta,
(GstStructureForeachFunc) _add_description, &kfg); (GstStructureForeachIdStrFunc) _add_description, &kfg);
gst_structure_free (meta); gst_structure_free (meta);
g_free (kfg.group_name); g_free (kfg.group_name);
} else { } else {

View file

@ -50,10 +50,6 @@
static GRegex *_variables_regex = NULL; static GRegex *_variables_regex = NULL;
static GstStructure *global_vars = NULL; static GstStructure *global_vars = NULL;
static GQuark debug_quark = 0;
static GQuark lineno_quark = 0;
static GQuark filename_quark = 0;
typedef struct typedef struct
{ {
const gchar *str; const gchar *str;
@ -563,17 +559,6 @@ skip_spaces (gchar * c)
return c; return c;
} }
static void
setup_quarks (void)
{
if (filename_quark)
return;
filename_quark = g_quark_from_static_string ("__filename__");
lineno_quark = g_quark_from_static_string ("__lineno__");
debug_quark = g_quark_from_static_string ("__debug__");
}
gboolean gboolean
gst_validate_has_colored_output (void) gst_validate_has_colored_output (void)
{ {
@ -809,11 +794,10 @@ _file_get_structures (GFile * file, gchar ** err,
} }
gst_structure_free (structure); gst_structure_free (structure);
} else { } else {
setup_quarks (); gst_structure_set_static_str (structure,
gst_structure_id_set (structure, "__lineno__", G_TYPE_INT, current_lineno,
lineno_quark, G_TYPE_INT, current_lineno, "__filename__", G_TYPE_STRING, filename,
filename_quark, G_TYPE_STRING, filename, "__debug__", G_TYPE_STRING, debug_line->str, NULL);
debug_quark, G_TYPE_STRING, debug_line->str, NULL);
structures = g_list_append (structures, structure); structures = g_list_append (structures, structure);
} }
} }
@ -1356,10 +1340,17 @@ done:
} }
static gboolean static gboolean
_structure_set_variables (GQuark field_id, GValue * value, ReplaceData * data) _structure_set_variables (const GstIdStr * fieldname, GValue * value,
ReplaceData * data)
{ {
if (field_id == filename_quark || field_id == debug_quark static const gchar *skip_fields[] = {
|| field_id == debug_quark) "__filename__",
"__lineno__",
"__debug__",
NULL,
};
if (fieldname && g_strv_contains (skip_fields, gst_id_str_as_str (fieldname)))
return TRUE; return TRUE;
if (GST_VALUE_HOLDS_LIST (value)) { if (GST_VALUE_HOLDS_LIST (value)) {
@ -1415,14 +1406,15 @@ gst_validate_structure_resolve_variables (gpointer source,
{ {
ReplaceData d = { source ? source : structure, local_variables, flags }; ReplaceData d = { source ? source : structure, local_variables, flags };
gst_structure_filter_and_map_in_place (structure, gst_structure_filter_and_map_in_place_id_str (structure,
(GstStructureFilterMapFunc) _structure_set_variables, &d); (GstStructureFilterMapIdStrFunc) _structure_set_variables, &d);
} }
static gboolean static gboolean
_set_vars_func (GQuark field_id, const GValue * value, GstStructure * vars) _set_vars_func (const GstIdStr * fieldname, const GValue * value,
GstStructure * vars)
{ {
gst_structure_id_set_value (vars, field_id, value); gst_structure_id_str_set_value (vars, fieldname, value);
return TRUE; return TRUE;
} }
@ -1462,8 +1454,8 @@ gst_validate_set_globals (GstStructure * structure)
if (!structure) if (!structure)
return; return;
gst_structure_foreach (structure, gst_structure_foreach_id_str (structure,
(GstStructureForeachFunc) _set_vars_func, global_vars); (GstStructureForeachIdStrFunc) _set_vars_func, global_vars);
} }
/** /**

View file

@ -138,9 +138,10 @@ gst_structure_validate_name (const gchar * name)
} }
static gboolean static gboolean
_set_vars_func (GQuark field_id, const GValue * value, GstStructure * vars) _set_vars_func (const GstIdStr * fieldname, const GValue * value,
GstStructure * vars)
{ {
gst_structure_id_set_value (vars, field_id, value); gst_structure_id_str_set_value (vars, fieldname, value);
return TRUE; return TRUE;
} }
@ -199,8 +200,8 @@ create_config (const gchar * config)
if (gst_structure_has_field (structure, "set-vars")) { if (gst_structure_has_field (structure, "set-vars")) {
gst_structure_remove_field (structure, "set-vars"); gst_structure_remove_field (structure, "set-vars");
gst_structure_foreach (structure, gst_structure_foreach_id_str (structure,
(GstStructureForeachFunc) _set_vars_func, local_vars); (GstStructureForeachIdStrFunc) _set_vars_func, local_vars);
gst_structure_free (structure); gst_structure_free (structure);
} else if (!loaded_globals } else if (!loaded_globals
&& gst_structure_has_name (structure, "set-globals")) { && gst_structure_has_name (structure, "set-globals")) {

View file

@ -722,10 +722,11 @@ _handle_event (GstValidateOverride * override,
} }
static gboolean static gboolean
_map_confg (GQuark field_id, GValue * value, GstStructure * structure) _map_confg (const GstIdStr * fieldname, GValue * value,
GstStructure * structure)
{ {
if (!gst_structure_id_has_field (structure, field_id)) if (!gst_structure_id_str_has_field (structure, fieldname))
gst_structure_id_set_value (structure, field_id, value); gst_structure_id_str_set_value (structure, fieldname, value);
return TRUE; return TRUE;
} }
@ -760,8 +761,8 @@ gst_validate_ssim_init (GstPlugin * plugin)
continue; continue;
if (config_structure) { if (config_structure) {
gst_structure_map_in_place (config_structure, gst_structure_map_in_place_id_str (config_structure,
(GstStructureMapFunc) _map_confg, tmp->data); (GstStructureMapIdStrFunc) _map_confg, tmp->data);
} }
if ((name || target_element_classification)) { if ((name || target_element_classification)) {
GstValidateOverride *override = GstValidateOverride *override =

View file

@ -546,7 +546,7 @@ _loading_done_cb (GESFormatter * self)
} }
static gboolean static gboolean
_set_child_property (GQuark field_id, const GValue * value, _set_child_property (const GstIdStr * fieldname, const GValue * value,
GESTimelineElement * tlelement) GESTimelineElement * tlelement)
{ {
GParamSpec *pspec; GParamSpec *pspec;
@ -554,11 +554,11 @@ _set_child_property (GQuark field_id, const GValue * value,
/* FIXME: error handling? */ /* FIXME: error handling? */
if (!ges_timeline_element_lookup_child (tlelement, if (!ges_timeline_element_lookup_child (tlelement,
g_quark_to_string (field_id), &object, &pspec)) { gst_id_str_as_str (fieldname), &object, &pspec)) {
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
gchar *tmp = gst_value_serialize (value); gchar *tmp = gst_value_serialize (value);
GST_ERROR_OBJECT (tlelement, "Could not set %s=%s", GST_ERROR_OBJECT (tlelement, "Could not set %s=%s",
g_quark_to_string (field_id), tmp); gst_id_str_as_str (fieldname), tmp);
g_free (tmp); g_free (tmp);
#endif #endif
return TRUE; return TRUE;
@ -571,9 +571,10 @@ _set_child_property (GQuark field_id, const GValue * value,
} }
gboolean gboolean
set_property_foreach (GQuark field_id, const GValue * value, GObject * object) set_property_foreach (const GstIdStr * fieldname, const GValue * value,
GObject * object)
{ {
g_object_set_property (object, g_quark_to_string (field_id), value); g_object_set_property (object, gst_id_str_as_str (fieldname), value);
return TRUE; return TRUE;
} }
@ -602,12 +603,12 @@ _add_object_to_layer (GESBaseXmlFormatterPrivate * priv, const gchar * id,
metadatas); metadatas);
if (properties) if (properties)
gst_structure_foreach (properties, gst_structure_foreach_id_str (properties,
(GstStructureForeachFunc) set_property_foreach, clip); (GstStructureForeachIdStrFunc) set_property_foreach, clip);
if (children_properties) if (children_properties)
gst_structure_foreach (children_properties, gst_structure_foreach_id_str (children_properties,
(GstStructureForeachFunc) _set_child_property, clip); (GstStructureForeachIdStrFunc) _set_child_property, clip);
g_hash_table_insert (priv->containers, g_strdup (id), gst_object_ref (clip)); g_hash_table_insert (priv->containers, g_strdup (id), gst_object_ref (clip));
return clip; return clip;
@ -635,8 +636,8 @@ _add_track_element (GESFormatter * self, GESClip * clip,
GES_TIMELINE_ELEMENT (trackelement))) GES_TIMELINE_ELEMENT (trackelement)))
GST_ERROR ("%" GES_FORMAT " could not add child %p while" GST_ERROR ("%" GES_FORMAT " could not add child %p while"
" reloading, this should never happen", GES_ARGS (clip), trackelement); " reloading, this should never happen", GES_ARGS (clip), trackelement);
gst_structure_foreach (children_properties, gst_structure_foreach_id_str (children_properties,
(GstStructureForeachFunc) _set_child_property, trackelement); (GstStructureForeachIdStrFunc) _set_child_property, trackelement);
if (properties) { if (properties) {
gboolean has_internal_source; gboolean has_internal_source;
@ -649,8 +650,8 @@ _add_track_element (GESFormatter * self, GESClip * clip,
&has_internal_source) && has_internal_source) &has_internal_source) && has_internal_source)
g_object_set (trackelement, "has-internal-source", has_internal_source, g_object_set (trackelement, "has-internal-source", has_internal_source,
NULL); NULL);
gst_structure_foreach (properties, gst_structure_foreach_id_str (properties,
(GstStructureForeachFunc) set_property_foreach, trackelement); (GstStructureForeachIdStrFunc) set_property_foreach, trackelement);
} }
} }
@ -686,8 +687,8 @@ new_asset_cb (GESAsset * source, GAsyncResult * res, PendingAsset * passet)
ges_meta_container_add_metas_from_string (GES_META_CONTAINER (source), ges_meta_container_add_metas_from_string (GES_META_CONTAINER (source),
passet->metadatas); passet->metadatas);
if (passet->properties) if (passet->properties)
gst_structure_foreach (passet->properties, gst_structure_foreach_id_str (passet->properties,
(GstStructureForeachFunc) set_property_foreach, source); (GstStructureForeachIdStrFunc) set_property_foreach, source);
possible_id = ges_project_try_updating_id (GES_FORMATTER (self)->project, possible_id = ges_project_try_updating_id (GES_FORMATTER (self)->project,
source, error); source, error);
@ -922,8 +923,8 @@ ges_base_xml_formatter_set_timeline_properties (GESBaseXmlFormatter * self,
&auto_transition)) &auto_transition))
gst_structure_remove_field (props, "auto-transition"); gst_structure_remove_field (props, "auto-transition");
gst_structure_foreach (props, gst_structure_foreach_id_str (props,
(GstStructureForeachFunc) set_property_foreach, timeline); (GstStructureForeachIdStrFunc) set_property_foreach, timeline);
gst_structure_free (props); gst_structure_free (props);
} }
} }
@ -977,8 +978,8 @@ ges_base_xml_formatter_add_layer (GESBaseXmlFormatter * self,
&auto_transition)) &auto_transition))
gst_structure_remove_field (properties, "auto-transition"); gst_structure_remove_field (properties, "auto-transition");
gst_structure_foreach (properties, gst_structure_foreach_id_str (properties,
(GstStructureForeachFunc) set_property_foreach, layer); (GstStructureForeachIdStrFunc) set_property_foreach, layer);
} }
if (metadatas) if (metadatas)
@ -1047,8 +1048,8 @@ ges_base_xml_formatter_add_track (GESBaseXmlFormatter * self,
} }
gst_structure_remove_fields (properties, "restriction-caps", "caps", gst_structure_remove_fields (properties, "restriction-caps", "caps",
"message-forward", NULL); "message-forward", NULL);
gst_structure_foreach (properties, gst_structure_foreach_id_str (properties,
(GstStructureForeachFunc) set_property_foreach, track); (GstStructureForeachIdStrFunc) set_property_foreach, track);
g_free (restriction); g_free (restriction);
} }
@ -1133,12 +1134,12 @@ ges_base_xml_formatter_add_source (GESBaseXmlFormatter * self,
} }
if (properties) if (properties)
gst_structure_foreach (properties, gst_structure_foreach_id_str (properties,
(GstStructureForeachFunc) set_property_foreach, element); (GstStructureForeachIdStrFunc) set_property_foreach, element);
if (children_properties) if (children_properties)
gst_structure_foreach (children_properties, gst_structure_foreach_id_str (children_properties,
(GstStructureForeachFunc) _set_child_property, element); (GstStructureForeachIdStrFunc) _set_child_property, element);
if (metadatas) if (metadatas)
ges_meta_container_add_metas_from_string (GES_META_CONTAINER ges_meta_container_add_metas_from_string (GES_META_CONTAINER

View file

@ -401,7 +401,7 @@ G_GNUC_INTERNAL void ges_base_xml_formatter_end_current_clip (GESBaseXmlFo
G_GNUC_INTERNAL void ges_xml_formatter_deinit (void); G_GNUC_INTERNAL void ges_xml_formatter_deinit (void);
G_GNUC_INTERNAL gboolean set_property_foreach (GQuark field_id, G_GNUC_INTERNAL gboolean set_property_foreach (const GstIdStr *fieldname,
const GValue * value, const GValue * value,
GObject * object); GObject * object);

View file

@ -152,19 +152,21 @@ typedef struct
} MetadataForeachData; } MetadataForeachData;
static gboolean static gboolean
structure_foreach_wrapper (GQuark field_id, const GValue * value, structure_foreach_wrapper (const GstIdStr * fieldname, const GValue * value,
gpointer user_data) gpointer user_data)
{ {
MetadataForeachData *data = (MetadataForeachData *) user_data; MetadataForeachData *data = (MetadataForeachData *) user_data;
data->func (data->container, g_quark_to_string (field_id), value, data->data); data->func (data->container, gst_id_str_as_str (fieldname), value,
data->data);
return TRUE; return TRUE;
} }
static gboolean static gboolean
_append_foreach (GQuark field_id, const GValue * value, GESMetaContainer * self) _append_foreach (const GstIdStr * fieldname, const GValue * value,
GESMetaContainer * self)
{ {
ges_meta_container_set_meta (self, g_quark_to_string (field_id), value); ges_meta_container_set_meta (self, gst_id_str_as_str (fieldname), value);
return TRUE; return TRUE;
} }
@ -195,8 +197,8 @@ ges_meta_container_foreach (GESMetaContainer * container,
foreach_data.container = container; foreach_data.container = container;
foreach_data.data = user_data; foreach_data.data = user_data;
gst_structure_foreach (structure, gst_structure_foreach_id_str (structure,
(GstStructureForeachFunc) structure_foreach_wrapper, &foreach_data); (GstStructureForeachIdStrFunc) structure_foreach_wrapper, &foreach_data);
} }
static gboolean static gboolean
@ -563,8 +565,8 @@ ges_meta_container_add_metas_from_string (GESMetaContainer * container,
return FALSE; return FALSE;
} }
gst_structure_foreach (n_structure, (GstStructureForeachFunc) _append_foreach, gst_structure_foreach_id_str (n_structure,
container); (GstStructureForeachIdStrFunc) _append_foreach, container);
gst_structure_free (n_structure); gst_structure_free (n_structure);
return TRUE; return TRUE;

View file

@ -156,18 +156,17 @@ enum_from_str (GType type, const gchar * str_enum, guint * enum_value)
} }
static gboolean static gboolean
_check_field (GQuark field_id, const GValue * value, FieldsError * fields_error) _check_field (const GstIdStr * fieldname, const GValue * value,
FieldsError * fields_error)
{ {
guint i; const gchar *field = gst_id_str_as_str (fieldname);
const gchar *field = g_quark_to_string (field_id);
for (i = 0; fields_error->fields[i]; i++) {
if (g_strcmp0 (fields_error->fields[i], field) == 0) {
if (g_strv_contains (fields_error->fields, gst_id_str_as_str (fieldname)))
return TRUE; return TRUE;
}
}
// The pointers to the field names are only valid for as long as the structure
// is, but they're only used in the direct caller while the structure lives
// longer.
fields_error->invalid_fields = fields_error->invalid_fields =
g_list_append (fields_error->invalid_fields, (gpointer) field); g_list_append (fields_error->invalid_fields, (gpointer) field);
@ -178,8 +177,8 @@ static gboolean
_check_fields (GstStructure * structure, FieldsError fields_error, _check_fields (GstStructure * structure, FieldsError fields_error,
GError ** error) GError ** error)
{ {
gst_structure_foreach (structure, gst_structure_foreach_id_str (structure,
(GstStructureForeachFunc) _check_field, &fields_error); (GstStructureForeachIdStrFunc) _check_field, &fields_error);
if (fields_error.invalid_fields) { if (fields_error.invalid_fields) {
GList *tmp; GList *tmp;
@ -199,6 +198,7 @@ _check_fields (GstStructure * structure, FieldsError fields_error,
g_list_free (fields_error.invalid_fields); g_list_free (fields_error.invalid_fields);
g_string_free (msg, TRUE); g_string_free (msg, TRUE);
g_list_free (fields_error.invalid_fields);
return FALSE; return FALSE;
} }
@ -351,24 +351,21 @@ value_to_double (const GValue * v)
} }
static gboolean static gboolean
un_set_keyframes_foreach (GQuark field_id, const GValue * value, un_set_keyframes_foreach (const GstIdStr * fieldname, const GValue * value,
SetKeyframesData * d) SetKeyframesData * d)
{ {
GError **error = &d->error; GError **error = &d->error;
gchar *tmp; gchar *tmp;
gint i;
const gchar *valid_fields[] = { const gchar *valid_fields[] = {
"element-name", "property-name", "value", "timestamp", "project-uri", "element-name", "property-name", "value", "timestamp", "project-uri",
"binding-type", "source-type", "interpolation-mode", "interpolation-mode", "binding-type", "source-type", "interpolation-mode", "interpolation-mode",
NULL NULL
}; };
const gchar *field = g_quark_to_string (field_id); const gchar *field = gst_id_str_as_str (fieldname);
gdouble ts; gdouble ts;
for (i = 0; valid_fields[i]; i++) { if (g_strv_contains (valid_fields, gst_id_str_as_str (fieldname)))
if (g_quark_from_string (valid_fields[i]) == field_id)
return TRUE; return TRUE;
}
errno = 0; errno = 0;
ts = g_strtod (field, &tmp); ts = g_strtod (field, &tmp);
@ -456,8 +453,8 @@ _ges_add_remove_keyframe_from_struct (GESTimeline * timeline,
SetKeyframesData d = { SetKeyframesData d = {
source, structure, NULL, property_name, TRUE, source, structure, NULL, property_name, TRUE,
}; };
gst_structure_foreach (structure, gst_structure_foreach_id_str (structure,
(GstStructureForeachFunc) un_set_keyframes_foreach, &d); (GstStructureForeachIdStrFunc) un_set_keyframes_foreach, &d);
if (!d.res) if (!d.res)
g_propagate_error (error, d.error); g_propagate_error (error, d.error);

View file

@ -305,9 +305,10 @@ track_resort_and_fill_gaps (GESTrack * track)
} }
static gboolean static gboolean
update_field (GQuark field_id, const GValue * value, GstStructure * original) update_field (const GstIdStr * fieldname, const GValue * value,
GstStructure * original)
{ {
gst_structure_id_set_value (original, field_id, value); gst_structure_id_str_set_value (original, fieldname, value);
return TRUE; return TRUE;
} }
@ -1094,8 +1095,8 @@ ges_track_update_restriction_caps (GESTrack * self, const GstCaps * caps)
if (gst_caps_get_size (new_restriction_caps) > i) { if (gst_caps_get_size (new_restriction_caps) > i) {
GstStructure *original = gst_caps_get_structure (new_restriction_caps, i); GstStructure *original = gst_caps_get_structure (new_restriction_caps, i);
gst_structure_foreach (new, (GstStructureForeachFunc) update_field, gst_structure_foreach_id_str (new,
original); (GstStructureForeachIdStrFunc) update_field, original);
} else } else
gst_caps_append_structure (new_restriction_caps, gst_caps_append_structure (new_restriction_caps,
gst_structure_copy (new)); gst_structure_copy (new));

View file

@ -534,11 +534,12 @@ typedef struct
} PropertyData; } PropertyData;
static gboolean static gboolean
check_property (GQuark field_id, GValue * expected_value, PropertyData * data) check_property (const GstIdStr * fieldname, GValue * expected_value,
PropertyData * data)
{ {
GValue cvalue = G_VALUE_INIT, *tvalue = NULL, comparable_value = G_VALUE_INIT, GValue cvalue = G_VALUE_INIT, *tvalue = NULL, comparable_value = G_VALUE_INIT,
*observed_value; *observed_value;
const gchar *property = g_quark_to_string (field_id); const gchar *property = gst_id_str_as_str (fieldname);
GstControlBinding *binding = NULL; GstControlBinding *binding = NULL;
if (!data->on_children) { if (!data->on_children) {
@ -665,9 +666,10 @@ compare:
} }
static gboolean static gboolean
set_property (GQuark field_id, const GValue * value, PropertyData * data) set_property (const GstIdStr * fieldname, const GValue * value,
PropertyData * data)
{ {
const gchar *property = g_quark_to_string (field_id); const gchar *property = gst_id_str_as_str (fieldname);
if (data->on_children) { if (data->on_children) {
if (!ges_timeline_element_set_child_property (data->element, property, if (!ges_timeline_element_set_child_property (data->element, property,
@ -729,9 +731,9 @@ GES_START_VALIDATE_ACTION (set_or_check_properties)
data.element = element; data.element = element;
gst_structure_remove_fields (structure, "element-name", "at-time", gst_structure_remove_fields (structure, "element-name", "at-time",
"project-uri", NULL); "project-uri", NULL);
gst_structure_foreach (structure, gst_structure_foreach_id_str (structure,
is_setting ? (GstStructureForeachFunc) set_property is_setting ? (GstStructureForeachIdStrFunc) set_property
: (GstStructureForeachFunc) check_property, &data); : (GstStructureForeachIdStrFunc) check_property, &data);
gst_object_unref (element); gst_object_unref (element);
local_done: local_done:

View file

@ -380,14 +380,15 @@ on_ice_gathering_state_notify (GstElement * webrtcbin, GParamSpec * pspec,
static gboolean webrtcbin_get_stats (GstElement * webrtcbin); static gboolean webrtcbin_get_stats (GstElement * webrtcbin);
static gboolean static gboolean
on_webrtcbin_stat (GQuark field_id, const GValue * value, gpointer unused) on_webrtcbin_stat (const GstIdStr * fieldname, const GValue * value,
gpointer unused)
{ {
if (GST_VALUE_HOLDS_STRUCTURE (value)) { if (GST_VALUE_HOLDS_STRUCTURE (value)) {
GST_DEBUG ("stat: \'%s\': %" GST_PTR_FORMAT, g_quark_to_string (field_id), GST_DEBUG ("stat: \'%s\': %" GST_PTR_FORMAT, gst_id_str_as_str (fieldname),
gst_value_get_structure (value)); gst_value_get_structure (value));
} else { } else {
GST_FIXME ("unknown field \'%s\' value type: \'%s\'", GST_FIXME ("unknown field \'%s\' value type: \'%s\'",
g_quark_to_string (field_id), g_type_name (G_VALUE_TYPE (value))); gst_id_str_as_str (fieldname), g_type_name (G_VALUE_TYPE (value)));
} }
return TRUE; return TRUE;
@ -401,7 +402,7 @@ on_webrtcbin_get_stats (GstPromise * promise, GstElement * webrtcbin)
g_return_if_fail (gst_promise_wait (promise) == GST_PROMISE_RESULT_REPLIED); g_return_if_fail (gst_promise_wait (promise) == GST_PROMISE_RESULT_REPLIED);
stats = gst_promise_get_reply (promise); stats = gst_promise_get_reply (promise);
gst_structure_foreach (stats, on_webrtcbin_stat, NULL); gst_structure_foreach_id_str (stats, on_webrtcbin_stat, NULL);
g_timeout_add (100, (GSourceFunc) webrtcbin_get_stats, webrtcbin); g_timeout_add (100, (GSourceFunc) webrtcbin_get_stats, webrtcbin);
} }

View file

@ -1056,12 +1056,13 @@ escape:
* understand. * understand.
*/ */
static gboolean static gboolean
_headers_to_curl_slist (GQuark field_id, const GValue * value, gpointer ptr) _headers_to_curl_slist (const GstIdStr * fieldname, const GValue * value,
gpointer ptr)
{ {
gchar *field; gchar *field;
struct curl_slist **p_slist = ptr; struct curl_slist **p_slist = ptr;
field = g_strdup_printf ("%s: %s", g_quark_to_string (field_id), field = g_strdup_printf ("%s: %s", gst_id_str_as_str (fieldname),
g_value_get_string (value)); g_value_get_string (value));
*p_slist = curl_slist_append (*p_slist, field); *p_slist = curl_slist_append (*p_slist, field);
@ -1124,7 +1125,7 @@ gst_curl_http_src_create_easy_handle (GstCurlHttpSrc * s)
/* curl_slist_append dynamically allocates memory, but I need to free it */ /* curl_slist_append dynamically allocates memory, but I need to free it */
if (s->request_headers != NULL) { if (s->request_headers != NULL) {
gst_structure_foreach (s->request_headers, _headers_to_curl_slist, gst_structure_foreach_id_str (s->request_headers, _headers_to_curl_slist,
&s->slist); &s->slist);
if (curl_easy_setopt (handle, CURLOPT_HTTPHEADER, s->slist) != CURLE_OK) { if (curl_easy_setopt (handle, CURLOPT_HTTPHEADER, s->slist) != CURLE_OK) {
GST_WARNING_OBJECT (s, "Failed to set HTTP headers!"); GST_WARNING_OBJECT (s, "Failed to set HTTP headers!");

View file

@ -3088,13 +3088,13 @@ done:
/* https://tools.ietf.org/html/rfc5576#section-4.2 */ /* https://tools.ietf.org/html/rfc5576#section-4.2 */
static gboolean static gboolean
_media_add_rtx_ssrc_group (GQuark field_id, const GValue * value, _media_add_rtx_ssrc_group (const GstIdStr * fieldname, const GValue * value,
GstSDPMedia * media) GstSDPMedia * media)
{ {
gchar *str; gchar *str;
str = str =
g_strdup_printf ("FID %s %u", g_quark_to_string (field_id), g_strdup_printf ("FID %s %u", gst_id_str_as_str (fieldname),
g_value_get_uint (value)); g_value_get_uint (value));
gst_sdp_media_add_attribute (media, "ssrc-group", str); gst_sdp_media_add_attribute (media, "ssrc-group", str);
@ -3111,7 +3111,8 @@ typedef struct
} RtxSsrcData; } RtxSsrcData;
static gboolean static gboolean
_media_add_rtx_ssrc (GQuark field_id, const GValue * value, RtxSsrcData * data) _media_add_rtx_ssrc (const GstIdStr * fieldname, const GValue * value,
RtxSsrcData * data)
{ {
gchar *str; gchar *str;
GstStructure *sdes; GstStructure *sdes;
@ -3164,8 +3165,8 @@ _media_add_ssrcs (GstSDPMedia * media, GstCaps * caps, GstWebRTCBin * webrtc,
cname = gst_structure_get_string (sdes, "cname"); cname = gst_structure_get_string (sdes, "cname");
if (trans->local_rtx_ssrc_map) if (trans->local_rtx_ssrc_map)
gst_structure_foreach (trans->local_rtx_ssrc_map, gst_structure_foreach_id_str (trans->local_rtx_ssrc_map,
(GstStructureForeachFunc) _media_add_rtx_ssrc_group, media); (GstStructureForeachIdStrFunc) _media_add_rtx_ssrc_group, media);
for (i = 0; i < gst_caps_get_size (caps); i++) { for (i = 0; i < gst_caps_get_size (caps); i++) {
const GstStructure *s = gst_caps_get_structure (caps, i); const GstStructure *s = gst_caps_get_structure (caps, i);
@ -3204,8 +3205,8 @@ _media_add_ssrcs (GstSDPMedia * media, GstCaps * caps, GstWebRTCBin * webrtc,
gst_structure_free (sdes); gst_structure_free (sdes);
if (trans->local_rtx_ssrc_map) if (trans->local_rtx_ssrc_map)
gst_structure_foreach (trans->local_rtx_ssrc_map, gst_structure_foreach_id_str (trans->local_rtx_ssrc_map,
(GstStructureForeachFunc) _media_add_rtx_ssrc, &data); (GstStructureForeachIdStrFunc) _media_add_rtx_ssrc, &data);
} }
static void static void
@ -3229,7 +3230,8 @@ _add_fingerprint_to_media (GstWebRTCDTLSTransport * transport,
} }
static gchar * static gchar *
_parse_extmap (GQuark field_id, const GValue * value, GError ** error) _parse_extmap (const GstIdStr * fieldname, const GValue * value,
GError ** error)
{ {
gchar *ret = NULL; gchar *ret = NULL;
@ -3271,7 +3273,7 @@ _parse_extmap (GQuark field_id, const GValue * value, GError ** error)
g_set_error (error, GST_WEBRTC_ERROR, g_set_error (error, GST_WEBRTC_ERROR,
GST_WEBRTC_ERROR_INTERNAL_FAILURE, GST_WEBRTC_ERROR_INTERNAL_FAILURE,
"Invalid value for %s: %s", g_quark_to_string (field_id), val_str); "Invalid value for %s: %s", gst_id_str_as_str (fieldname), val_str);
g_free (val_str); g_free (val_str);
} }
@ -3287,37 +3289,38 @@ typedef struct
} ExtmapData; } ExtmapData;
static gboolean static gboolean
_dedup_extmap_field (GQuark field_id, const GValue * value, ExtmapData * data) _dedup_extmap_field (const GstIdStr * fieldname, const GValue * value,
ExtmapData * data)
{ {
gboolean is_extmap = gboolean is_extmap =
g_str_has_prefix (g_quark_to_string (field_id), "extmap-"); g_str_has_prefix (gst_id_str_as_str (fieldname), "extmap-");
if (!data->ret) if (!data->ret)
goto done; goto done;
if (is_extmap) { if (is_extmap) {
gchar *new_value = _parse_extmap (field_id, value, data->error); gchar *new_value = _parse_extmap (fieldname, value, data->error);
if (!new_value) { if (!new_value) {
data->ret = FALSE; data->ret = FALSE;
goto done; goto done;
} }
if (gst_structure_id_has_field (data->extmap, field_id)) { if (gst_structure_id_str_has_field (data->extmap, fieldname)) {
gchar *old_value = gchar *old_value = _parse_extmap (fieldname,
_parse_extmap (field_id, gst_structure_id_get_value (data->extmap, gst_structure_id_str_get_value (data->extmap,
field_id), NULL); fieldname), NULL);
g_assert (old_value); g_assert (old_value);
if (g_strcmp0 (new_value, old_value)) { if (g_strcmp0 (new_value, old_value)) {
GST_ERROR GST_ERROR
("extmap contains different values for id %s (%s != %s)", ("extmap contains different values for id %s (%s != %s)",
g_quark_to_string (field_id), old_value, new_value); gst_id_str_as_str (fieldname), old_value, new_value);
g_set_error (data->error, GST_WEBRTC_ERROR, g_set_error (data->error, GST_WEBRTC_ERROR,
GST_WEBRTC_ERROR_INTERNAL_FAILURE, GST_WEBRTC_ERROR_INTERNAL_FAILURE,
"extmap contains different values for id %s (%s != %s)", "extmap contains different values for id %s (%s != %s)",
g_quark_to_string (field_id), old_value, new_value); gst_id_str_as_str (fieldname), old_value, new_value);
data->ret = FALSE; data->ret = FALSE;
} }
@ -3326,7 +3329,7 @@ _dedup_extmap_field (GQuark field_id, const GValue * value, ExtmapData * data)
} }
if (data->ret) { if (data->ret) {
gst_structure_id_set_value (data->extmap, field_id, value); gst_structure_id_str_set_value (data->extmap, fieldname, value);
} }
g_free (new_value); g_free (new_value);
@ -3348,8 +3351,8 @@ _gather_extmap (GstCaps * caps, GError ** error)
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
GstStructure *s = gst_caps_get_structure (caps, i); GstStructure *s = gst_caps_get_structure (caps, i);
gst_structure_filter_and_map_in_place (s, gst_structure_filter_and_map_in_place_id_str (s,
(GstStructureFilterMapFunc) _dedup_extmap_field, &edata); (GstStructureFilterMapIdStrFunc) _dedup_extmap_field, &edata);
if (!edata.ret) { if (!edata.ret) {
gst_clear_structure (&edata.extmap); gst_clear_structure (&edata.extmap);
@ -3367,11 +3370,11 @@ struct hdrext_id
}; };
static gboolean static gboolean
structure_value_get_rtphdrext_id (GQuark field_id, const GValue * value, structure_value_get_rtphdrext_id (const GstIdStr * fieldname,
gpointer user_data) const GValue * value, gpointer user_data)
{ {
struct hdrext_id *rtphdrext = user_data; struct hdrext_id *rtphdrext = user_data;
const char *field_name = g_quark_to_string (field_id); const char *field_name = gst_id_str_as_str (fieldname);
if (g_str_has_prefix (field_name, "extmap-")) { if (g_str_has_prefix (field_name, "extmap-")) {
const char *val = NULL; const char *val = NULL;
@ -3408,7 +3411,7 @@ caps_get_rtp_header_extension_id (const GstCaps * caps,
const GstStructure *s = gst_caps_get_structure (caps, i); const GstStructure *s = gst_caps_get_structure (caps, i);
struct hdrext_id data = { rtphdrext_uri, -1 }; struct hdrext_id data = { rtphdrext_uri, -1 };
gst_structure_foreach (s, structure_value_get_rtphdrext_id, &data); gst_structure_foreach_id_str (s, structure_value_get_rtphdrext_id, &data);
if (data.ext_id != -1) if (data.ext_id != -1)
return data.ext_id; return data.ext_id;
@ -3425,9 +3428,9 @@ caps_contain_rtp_header_extension (const GstCaps * caps,
} }
static gboolean static gboolean
_copy_field (GQuark field_id, const GValue * value, GstStructure * s) _copy_field (const GstIdStr * fieldname, const GValue * value, GstStructure * s)
{ {
gst_structure_id_set_value (s, field_id, value); gst_structure_id_str_set_value (s, fieldname, value);
return TRUE; return TRUE;
} }
@ -3595,7 +3598,8 @@ sdp_media_from_transceiver (GstWebRTCBin * webrtc, GstSDPMedia * media,
GstStructure *s = gst_structure_copy (gst_caps_get_structure (caps, i)); GstStructure *s = gst_structure_copy (gst_caps_get_structure (caps, i));
if (i == 0) { if (i == 0) {
gst_structure_foreach (extmap, (GstStructureForeachFunc) _copy_field, s); gst_structure_foreach_id_str (extmap,
(GstStructureForeachIdStrFunc) _copy_field, s);
} }
gst_caps_append_structure (format, s); gst_caps_append_structure (format, s);
@ -4992,11 +4996,12 @@ _build_fec_encoder (GstWebRTCBin * webrtc, WebRTCTransceiver * trans)
} }
static gboolean static gboolean
_merge_structure (GQuark field_id, const GValue * value, gpointer user_data) _merge_structure (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
GstStructure *s = user_data; GstStructure *s = user_data;
gst_structure_id_set_value (s, field_id, value); gst_structure_id_str_set_value (s, fieldname, value);
return TRUE; return TRUE;
} }
@ -5147,7 +5152,7 @@ _set_internal_rtpbin_element_props_from_stream (GstWebRTCBin * webrtc,
} }
if (trans->local_rtx_ssrc_map) { if (trans->local_rtx_ssrc_map) {
gst_structure_foreach (trans->local_rtx_ssrc_map, gst_structure_foreach_id_str (trans->local_rtx_ssrc_map,
_merge_structure, merged_local_rtx_ssrc_map); _merge_structure, merged_local_rtx_ssrc_map);
} }
} }
@ -5452,11 +5457,11 @@ _add_end_of_candidate_to_sdp (GstWebRTCBin * webrtc,
} }
static gboolean static gboolean
_filter_sdp_fields (GQuark field_id, const GValue * value, _filter_sdp_fields (const GstIdStr * fieldname, const GValue * value,
GstStructure * new_structure) GstStructure * new_structure)
{ {
if (!g_str_has_prefix (g_quark_to_string (field_id), "a-")) { if (!g_str_has_prefix (gst_id_str_as_str (fieldname), "a-")) {
gst_structure_id_set_value (new_structure, field_id, value); gst_structure_id_str_set_value (new_structure, fieldname, value);
} }
return TRUE; return TRUE;
} }
@ -5621,8 +5626,8 @@ _update_transport_ptmap_from_media (GstWebRTCBin * webrtc,
GstStructure *filtered = GstStructure *filtered =
gst_structure_new_empty (gst_structure_get_name (s)); gst_structure_new_empty (gst_structure_get_name (s));
gst_structure_foreach (s, gst_structure_foreach_id_str (s,
(GstStructureForeachFunc) _filter_sdp_fields, filtered); (GstStructureForeachIdStrFunc) _filter_sdp_fields, filtered);
gst_caps_append_structure (item.caps, filtered); gst_caps_append_structure (item.caps, filtered);
} }

View file

@ -85,28 +85,6 @@ gst_player_error_quark (void)
return g_quark_from_static_string ("gst-player-error-quark"); return g_quark_from_static_string ("gst-player-error-quark");
} }
static GQuark QUARK_CONFIG;
/* Keep ConfigQuarkId and _config_quark_strings ordered and synced */
typedef enum
{
CONFIG_QUARK_USER_AGENT = 0,
CONFIG_QUARK_POSITION_INTERVAL_UPDATE,
CONFIG_QUARK_ACCURATE_SEEK,
CONFIG_QUARK_MAX
} ConfigQuarkId;
static const gchar *_config_quark_strings[] = {
"user-agent",
"position-interval-update",
"accurate-seek",
};
static GQuark _config_quark_table[CONFIG_QUARK_MAX];
#define CONFIG_QUARK(q) _config_quark_table[CONFIG_QUARK_##q]
enum enum
{ {
PROP_0, PROP_0,
@ -185,23 +163,6 @@ gst_player_init (GstPlayer * self)
self->play = gst_play_new (NULL); self->play = gst_play_new (NULL);
} }
static void
config_quark_initialize (void)
{
gint i;
QUARK_CONFIG = g_quark_from_static_string ("player-config");
if (G_N_ELEMENTS (_config_quark_strings) != CONFIG_QUARK_MAX)
g_warning ("the quark table is not consistent! %d != %d",
(int) G_N_ELEMENTS (_config_quark_strings), CONFIG_QUARK_MAX);
for (i = 0; i < CONFIG_QUARK_MAX; i++) {
_config_quark_table[i] =
g_quark_from_static_string (_config_quark_strings[i]);
}
}
static void static void
gst_player_class_init (GstPlayerClass * klass) gst_player_class_init (GstPlayerClass * klass)
{ {
@ -371,8 +332,6 @@ gst_player_class_init (GstPlayerClass * klass)
g_signal_new ("seek-done", G_TYPE_FROM_CLASS (klass), g_signal_new ("seek-done", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL, G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL,
NULL, NULL, G_TYPE_NONE, 1, GST_TYPE_CLOCK_TIME); NULL, NULL, G_TYPE_NONE, 1, GST_TYPE_CLOCK_TIME);
config_quark_initialize ();
} }
static void static void
@ -1632,8 +1591,8 @@ gst_player_config_set_user_agent (GstStructure * config, const gchar * agent)
g_return_if_fail (config != NULL); g_return_if_fail (config != NULL);
g_return_if_fail (agent != NULL); g_return_if_fail (agent != NULL);
gst_structure_id_set (config, gst_structure_set_static_str (config,
CONFIG_QUARK (USER_AGENT), G_TYPE_STRING, agent, NULL); "user-agent", G_TYPE_STRING, agent, NULL);
} }
/** /**
@ -1654,8 +1613,7 @@ gst_player_config_get_user_agent (const GstStructure * config)
g_return_val_if_fail (config != NULL, NULL); g_return_val_if_fail (config != NULL, NULL);
gst_structure_id_get (config, gst_structure_get (config, "user-agent", G_TYPE_STRING, &agent, NULL);
CONFIG_QUARK (USER_AGENT), G_TYPE_STRING, &agent, NULL);
return agent; return agent;
} }
@ -1677,8 +1635,8 @@ gst_player_config_set_position_update_interval (GstStructure * config,
g_return_if_fail (config != NULL); g_return_if_fail (config != NULL);
g_return_if_fail (interval <= 10000); g_return_if_fail (interval <= 10000);
gst_structure_id_set (config, gst_structure_set_static_str (config,
CONFIG_QUARK (POSITION_INTERVAL_UPDATE), G_TYPE_UINT, interval, NULL); "position-interval-update", G_TYPE_UINT, interval, NULL);
} }
/** /**
@ -1696,8 +1654,8 @@ gst_player_config_get_position_update_interval (const GstStructure * config)
g_return_val_if_fail (config != NULL, DEFAULT_POSITION_UPDATE_INTERVAL_MS); g_return_val_if_fail (config != NULL, DEFAULT_POSITION_UPDATE_INTERVAL_MS);
gst_structure_id_get (config, gst_structure_get (config,
CONFIG_QUARK (POSITION_INTERVAL_UPDATE), G_TYPE_UINT, &interval, NULL); "position-interval-update", G_TYPE_UINT, &interval, NULL);
return interval; return interval;
} }
@ -1724,8 +1682,8 @@ gst_player_config_set_seek_accurate (GstStructure * config, gboolean accurate)
{ {
g_return_if_fail (config != NULL); g_return_if_fail (config != NULL);
gst_structure_id_set (config, gst_structure_set_static_str (config,
CONFIG_QUARK (ACCURATE_SEEK), G_TYPE_BOOLEAN, accurate, NULL); "accurate-seek", G_TYPE_BOOLEAN, accurate, NULL);
} }
/** /**
@ -1743,8 +1701,7 @@ gst_player_config_get_seek_accurate (const GstStructure * config)
g_return_val_if_fail (config != NULL, FALSE); g_return_val_if_fail (config != NULL, FALSE);
gst_structure_id_get (config, gst_structure_get (config, "accurate-seek", G_TYPE_BOOLEAN, &accurate, NULL);
CONFIG_QUARK (ACCURATE_SEEK), G_TYPE_BOOLEAN, &accurate, NULL);
return accurate; return accurate;
} }

View file

@ -235,20 +235,20 @@ gst_test_src_bin_chain (GstPad * pad, GstObject * object, GstBuffer * buffer)
} }
static gboolean static gboolean
gst_test_src_bin_set_element_property (GQuark property_id, const GValue * value, gst_test_src_bin_set_element_property (const GstIdStr * property,
GObject * element) const GValue * value, GObject * element)
{ {
if (property_id == g_quark_from_static_string ("__streamobj__")) if (gst_id_str_is_equal_to_str (property, "__streamobj__"))
return TRUE; return TRUE;
if (property_id == g_quark_from_static_string ("caps")) if (gst_id_str_is_equal_to_str (property, "caps"))
return TRUE; return TRUE;
if (G_VALUE_HOLDS_STRING (value)) if (G_VALUE_HOLDS_STRING (value))
gst_util_set_object_arg (element, g_quark_to_string (property_id), gst_util_set_object_arg (element, gst_id_str_as_str (property),
g_value_get_string (value)); g_value_get_string (value));
else else
g_object_set_property (element, g_quark_to_string (property_id), value); g_object_set_property (element, gst_id_str_as_str (property), value);
return TRUE; return TRUE;
} }
@ -352,8 +352,9 @@ gst_test_src_bin_setup_src (GstTestSrcBin * self, const gchar * srcfactory,
(*n_stream == 0) ? GST_STREAM_FLAG_SELECT : GST_STREAM_FLAG_UNSELECT); (*n_stream == 0) ? GST_STREAM_FLAG_SELECT : GST_STREAM_FLAG_UNSELECT);
stream_start = gst_event_new_stream_start (gst_stream_get_stream_id (stream)); stream_start = gst_event_new_stream_start (gst_stream_get_stream_id (stream));
gst_structure_foreach (props, gst_structure_foreach_id_str (props,
(GstStructureForeachFunc) gst_test_src_bin_set_element_property, src); (GstStructureForeachIdStrFunc) gst_test_src_bin_set_element_property,
src);
gst_event_set_stream (stream_start, stream); gst_event_set_stream (stream_start, stream);
gst_event_set_group_id (stream_start, self->group_id); gst_event_set_group_id (stream_start, self->group_id);

View file

@ -1680,11 +1680,11 @@ gst_ipc_pipeline_comm_cancel (GstIpcPipelineComm * comm, gboolean cleanup)
} }
static gboolean static gboolean
set_field (GQuark field_id, const GValue * value, gpointer user_data) set_field (const GstIdStr * fieldname, const GValue * value, gpointer user_data)
{ {
GstStructure *structure = user_data; GstStructure *structure = user_data;
gst_structure_id_set_value (structure, field_id, value); gst_structure_id_str_set_value (structure, fieldname, value);
return TRUE; return TRUE;
} }
@ -1711,7 +1711,7 @@ gst_ipc_pipeline_comm_reply_request (GstIpcPipelineComm * comm, guint32 id,
will expect the object to be the same */ will expect the object to be the same */
GstStructure *structure = gst_query_writable_structure (req->query); GstStructure *structure = gst_query_writable_structure (req->query);
gst_structure_remove_all_fields (structure); gst_structure_remove_all_fields (structure);
gst_structure_foreach (gst_query_get_structure (query), set_field, gst_structure_foreach_id_str (gst_query_get_structure (query), set_field,
structure); structure);
} else { } else {
GST_WARNING_OBJECT (comm->element, GST_WARNING_OBJECT (comm->element,

View file

@ -931,14 +931,15 @@ typedef struct
} SetPropsIter; } SetPropsIter;
static gboolean static gboolean
set_obj_prop (GQuark field_id, const GValue * value, gpointer user_data) set_obj_prop (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
SetPropsIter *iter = user_data; SetPropsIter *iter = user_data;
GstKMSSink *self = iter->self; GstKMSSink *self = iter->self;
const gchar *name; const gchar *name;
guint64 v; guint64 v;
name = g_quark_to_string (field_id); name = gst_id_str_as_str (fieldname);
if (G_VALUE_HOLDS (value, G_TYPE_INT)) if (G_VALUE_HOLDS (value, G_TYPE_INT))
v = g_value_get_int (value); v = g_value_get_int (value);
@ -976,7 +977,7 @@ gst_kms_sink_update_properties (SetPropsIter * iter, GstStructure * props)
iter->properties = drmModeObjectGetProperties (self->fd, iter->obj_id, iter->properties = drmModeObjectGetProperties (self->fd, iter->obj_id,
iter->obj_type); iter->obj_type);
gst_structure_foreach (props, set_obj_prop, iter); gst_structure_foreach_id_str (props, set_obj_prop, iter);
drmModeFreeObjectProperties (iter->properties); drmModeFreeObjectProperties (iter->properties);
} }

View file

@ -2207,11 +2207,12 @@ error:
} }
static gboolean static gboolean
copy_config (GQuark field_id, const GValue * value, gpointer user_data) copy_config (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
GstCudaConverter *self = (GstCudaConverter *) user_data; GstCudaConverter *self = (GstCudaConverter *) user_data;
gst_structure_id_set_value (self->priv->config, field_id, value); gst_structure_id_str_set_value (self->priv->config, fieldname, value);
return TRUE; return TRUE;
} }
@ -2219,7 +2220,7 @@ copy_config (GQuark field_id, const GValue * value, gpointer user_data)
static void static void
gst_cuda_converter_set_config (GstCudaConverter * self, GstStructure * config) gst_cuda_converter_set_config (GstCudaConverter * self, GstStructure * config)
{ {
gst_structure_foreach (config, copy_config, self); gst_structure_foreach_id_str (config, copy_config, self);
gst_structure_free (config); gst_structure_free (config);
} }

View file

@ -1790,13 +1790,13 @@ struct stats_check_state
}; };
static gboolean static gboolean
validate_stats_foreach (GQuark field_id, const GValue * value, validate_stats_foreach (const GstIdStr * fieldname, const GValue * value,
gpointer user_data) gpointer user_data)
{ {
struct stats_check_state *state = (struct stats_check_state *) (user_data); struct stats_check_state *state = (struct stats_check_state *) (user_data);
const GstStructure *stats = state->stats; const GstStructure *stats = state->stats;
const gchar *field = g_quark_to_string (field_id); const gchar *field = gst_id_str_as_str (fieldname);
GstWebRTCStatsType type; GstWebRTCStatsType type;
fail_unless (GST_VALUE_HOLDS_STRUCTURE (value)); fail_unless (GST_VALUE_HOLDS_STRUCTURE (value));
@ -1843,8 +1843,8 @@ validate_stats_foreach (GQuark field_id, const GValue * value,
static void static void
validate_stats (struct stats_check_state *state) validate_stats (struct stats_check_state *state)
{ {
gst_structure_foreach (state->stats, gst_structure_foreach_id_str (state->stats,
(GstStructureForeachFunc) validate_stats_foreach, (gpointer) state); (GstStructureForeachIdStrFunc) validate_stats_foreach, (gpointer) state);
} }
static void static void

View file

@ -51,11 +51,12 @@ g_value_to_string (const GValue * val)
} }
static gboolean static gboolean
insert_field (GQuark field_id, const GValue * val, gpointer user_data) insert_field (const GstIdStr * fieldname, const GValue * val,
gpointer user_data)
{ {
GtkTreeIter *parent_iter = user_data; GtkTreeIter *parent_iter = user_data;
GtkTreeIter iter; GtkTreeIter iter;
const gchar *f = g_quark_to_string (field_id); const gchar *f = gst_id_str_as_str (fieldname);
gtk_tree_store_append (treestore, &iter, parent_iter); gtk_tree_store_append (treestore, &iter, parent_iter);
@ -77,7 +78,7 @@ insert_field (GQuark field_id, const GValue * val, gpointer user_data)
gtk_tree_store_set (treestore, &child_iter, 0, gtk_tree_store_set (treestore, &child_iter, 0,
gst_structure_get_name (s), -1); gst_structure_get_name (s), -1);
gst_structure_foreach (s, insert_field, &child_iter); gst_structure_foreach_id_str (s, insert_field, &child_iter);
} else { } else {
gchar *v = g_value_to_string (ve); gchar *v = g_value_to_string (ve);
@ -94,7 +95,7 @@ insert_field (GQuark field_id, const GValue * val, gpointer user_data)
g_free (entry); g_free (entry);
gst_structure_foreach (s, insert_field, &iter); gst_structure_foreach_id_str (s, insert_field, &iter);
} else { } else {
gchar *v = g_value_to_string (val); gchar *v = g_value_to_string (val);
gchar *entry = g_strdup_printf ("%s: %s", f, v); gchar *entry = g_strdup_printf ("%s: %s", f, v);
@ -115,7 +116,7 @@ insert_structure (const GstStructure * s, GtkTreeIter * iter)
gtk_tree_store_set (treestore, iter, 0, name, -1); gtk_tree_store_set (treestore, iter, 0, name, -1);
gst_structure_foreach (s, insert_field, iter); gst_structure_foreach_id_str (s, insert_field, iter);
} }
static gboolean static gboolean

View file

@ -352,10 +352,11 @@ gst_gl_filtershader_filter_texture (GstGLFilter * filter, GstGLMemory * in_tex,
} }
static gboolean static gboolean
_set_uniform (GQuark field_id, const GValue * value, gpointer user_data) _set_uniform (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
GstGLShader *shader = user_data; GstGLShader *shader = user_data;
const gchar *field_name = g_quark_to_string (field_id); const gchar *field_name = gst_id_str_as_str (fieldname);
if (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT)) { if (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT)) {
gst_gl_shader_set_uniform_1i (shader, field_name, g_value_get_int (value)); gst_gl_shader_set_uniform_1i (shader, field_name, g_value_get_int (value));
@ -404,8 +405,8 @@ _update_uniforms (GstGLFilterShader * filtershader)
if (filtershader->new_uniforms && filtershader->uniforms) { if (filtershader->new_uniforms && filtershader->uniforms) {
gst_gl_shader_use (filtershader->shader); gst_gl_shader_use (filtershader->shader);
gst_structure_foreach (filtershader->uniforms, gst_structure_foreach_id_str (filtershader->uniforms,
(GstStructureForeachFunc) _set_uniform, filtershader->shader); (GstStructureForeachIdStrFunc) _set_uniform, filtershader->shader);
filtershader->new_uniforms = FALSE; filtershader->new_uniforms = FALSE;
} }
} }

View file

@ -311,11 +311,12 @@ get_opt_value (GstAudioConverter * convert, const gchar * opt)
GST_AUDIO_CONVERTER_OPT_MIX_MATRIX) GST_AUDIO_CONVERTER_OPT_MIX_MATRIX)
static gboolean static gboolean
copy_config (GQuark field_id, const GValue * value, gpointer user_data) copy_config (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
GstAudioConverter *convert = user_data; GstAudioConverter *convert = user_data;
gst_structure_id_set_value (convert->config, field_id, value); gst_structure_id_str_set_value (convert->config, fieldname, value);
return TRUE; return TRUE;
} }
@ -366,7 +367,7 @@ gst_audio_converter_update_config (GstAudioConverter * convert,
gst_audio_resampler_update (convert->resampler, in_rate, out_rate, config); gst_audio_resampler_update (convert->resampler, in_rate, out_rate, config);
if (config) { if (config) {
gst_structure_foreach (config, copy_config, convert); gst_structure_foreach_id_str (config, copy_config, convert);
gst_structure_free (config); gst_structure_free (config);
} }

View file

@ -60,14 +60,6 @@ GST_DEBUG_CATEGORY_STATIC (discoverer_debug);
#define GST_CAT_DEFAULT discoverer_debug #define GST_CAT_DEFAULT discoverer_debug
#define CACHE_DIRNAME "discoverer" #define CACHE_DIRNAME "discoverer"
static GQuark _CAPS_QUARK;
static GQuark _TAGS_QUARK;
static GQuark _ELEMENT_SRCPAD_QUARK;
static GQuark _TOC_QUARK;
static GQuark _STREAM_ID_QUARK;
static GQuark _TOPOLOGY_PAD_QUARK;
typedef struct typedef struct
{ {
GstDiscoverer *dc; GstDiscoverer *dc;
@ -150,13 +142,6 @@ static void
_do_init (void) _do_init (void)
{ {
GST_DEBUG_CATEGORY_INIT (discoverer_debug, "discoverer", 0, "Discoverer"); GST_DEBUG_CATEGORY_INIT (discoverer_debug, "discoverer", 0, "Discoverer");
_CAPS_QUARK = g_quark_from_static_string ("caps");
_ELEMENT_SRCPAD_QUARK = g_quark_from_static_string ("element-srcpad");
_TAGS_QUARK = g_quark_from_static_string ("tags");
_TOC_QUARK = g_quark_from_static_string ("toc");
_STREAM_ID_QUARK = g_quark_from_static_string ("stream-id");
_TOPOLOGY_PAD_QUARK = g_quark_from_static_string ("pad");
}; };
G_DEFINE_TYPE_EXTENDED (GstDiscoverer, gst_discoverer, G_TYPE_OBJECT, 0, G_DEFINE_TYPE_EXTENDED (GstDiscoverer, gst_discoverer, G_TYPE_OBJECT, 0,
@ -849,15 +834,16 @@ collect_stream_information (GstDiscoverer * dc, PrivateStream * ps, guint idx)
} }
if (caps) { if (caps) {
GST_DEBUG ("stream-%02d, got caps %" GST_PTR_FORMAT, idx, caps); GST_DEBUG ("stream-%02d, got caps %" GST_PTR_FORMAT, idx, caps);
gst_structure_id_set (st, _CAPS_QUARK, GST_TYPE_CAPS, caps, NULL); gst_structure_set_static_str (st, "caps", GST_TYPE_CAPS, caps, NULL);
gst_caps_unref (caps); gst_caps_unref (caps);
} }
if (ps->tags) if (ps->tags)
gst_structure_id_set (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, ps->tags, NULL); gst_structure_set_static_str (st, "tags", GST_TYPE_TAG_LIST, ps->tags,
NULL);
if (ps->toc) if (ps->toc)
gst_structure_id_set (st, _TOC_QUARK, GST_TYPE_TOC, ps->toc, NULL); gst_structure_set_static_str (st, "toc", GST_TYPE_TOC, ps->toc, NULL);
if (ps->stream_id) if (ps->stream_id)
gst_structure_id_set (st, _STREAM_ID_QUARK, G_TYPE_STRING, ps->stream_id, gst_structure_set_static_str (st, "stream-id", G_TYPE_STRING, ps->stream_id,
NULL); NULL);
return st; return st;
@ -884,13 +870,12 @@ static void
collect_common_information (GstDiscovererStreamInfo * info, collect_common_information (GstDiscovererStreamInfo * info,
const GstStructure * st) const GstStructure * st)
{ {
if (gst_structure_id_has_field (st, _TOC_QUARK)) { if (gst_structure_has_field (st, "toc")) {
gst_structure_id_get (st, _TOC_QUARK, GST_TYPE_TOC, &info->toc, NULL); gst_structure_get (st, "toc", GST_TYPE_TOC, &info->toc, NULL);
} }
if (gst_structure_id_has_field (st, _STREAM_ID_QUARK)) { if (gst_structure_has_field (st, "stream-id")) {
gst_structure_id_get (st, _STREAM_ID_QUARK, G_TYPE_STRING, &info->stream_id, gst_structure_get (st, "stream-id", G_TYPE_STRING, &info->stream_id, NULL);
NULL);
} }
} }
@ -924,19 +909,18 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
gint tmp, tmp2; gint tmp, tmp2;
guint utmp; guint utmp;
if (!st || (!gst_structure_id_has_field (st, _CAPS_QUARK) if (!st || (!gst_structure_has_field (st, "caps")
&& !gst_structure_id_has_field (st, _ELEMENT_SRCPAD_QUARK))) { && !gst_structure_has_field (st, "element-srcpad"))) {
GST_WARNING ("Couldn't find caps !"); GST_WARNING ("Couldn't find caps !");
return make_info (parent, GST_TYPE_DISCOVERER_STREAM_INFO, NULL); return make_info (parent, GST_TYPE_DISCOVERER_STREAM_INFO, NULL);
} }
if (gst_structure_id_get (st, _ELEMENT_SRCPAD_QUARK, GST_TYPE_PAD, &srcpad, if (gst_structure_get (st, "element-srcpad", GST_TYPE_PAD, &srcpad, NULL)) {
NULL)) {
caps = gst_pad_get_current_caps (srcpad); caps = gst_pad_get_current_caps (srcpad);
gst_object_unref (srcpad); gst_object_unref (srcpad);
} }
if (!caps) { if (!caps) {
gst_structure_id_get (st, _CAPS_QUARK, GST_TYPE_CAPS, &caps, NULL); gst_structure_get (st, "caps", GST_TYPE_CAPS, &caps, NULL);
} }
if (!caps || gst_caps_is_empty (caps) || gst_caps_is_any (caps)) { if (!caps || gst_caps_is_empty (caps) || gst_caps_is_any (caps)) {
@ -983,8 +967,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
info->depth = GST_AUDIO_FORMAT_INFO_DEPTH (finfo); info->depth = GST_AUDIO_FORMAT_INFO_DEPTH (finfo);
} }
if (gst_structure_id_has_field (st, _TAGS_QUARK)) { if (gst_structure_has_field (st, "tags")) {
gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, NULL); gst_structure_get (st, "tags", GST_TYPE_TAG_LIST, &tags_st, NULL);
if (gst_tag_list_get_uint (tags_st, GST_TAG_BITRATE, &utmp) || if (gst_tag_list_get_uint (tags_st, GST_TAG_BITRATE, &utmp) ||
gst_tag_list_get_uint (tags_st, GST_TAG_NOMINAL_BITRATE, &utmp)) gst_tag_list_get_uint (tags_st, GST_TAG_NOMINAL_BITRATE, &utmp))
info->bitrate = utmp; info->bitrate = utmp;
@ -1057,8 +1041,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
else else
info->interlaced = TRUE; info->interlaced = TRUE;
if (gst_structure_id_has_field (st, _TAGS_QUARK)) { if (gst_structure_has_field (st, "tags")) {
gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, NULL); gst_structure_get (st, "tags", GST_TYPE_TAG_LIST, &tags_st, NULL);
if (gst_tag_list_get_uint (tags_st, GST_TAG_BITRATE, &utmp) || if (gst_tag_list_get_uint (tags_st, GST_TAG_BITRATE, &utmp) ||
gst_tag_list_get_uint (tags_st, GST_TAG_NOMINAL_BITRATE, &utmp)) gst_tag_list_get_uint (tags_st, GST_TAG_NOMINAL_BITRATE, &utmp))
info->bitrate = utmp; info->bitrate = utmp;
@ -1081,10 +1065,10 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
info = (GstDiscovererSubtitleInfo *) make_info (parent, info = (GstDiscovererSubtitleInfo *) make_info (parent,
GST_TYPE_DISCOVERER_SUBTITLE_INFO, caps); GST_TYPE_DISCOVERER_SUBTITLE_INFO, caps);
if (gst_structure_id_has_field (st, _TAGS_QUARK)) { if (gst_structure_has_field (st, "tags")) {
const gchar *language; const gchar *language;
gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, NULL); gst_structure_get (st, "tags", GST_TYPE_TAG_LIST, &tags_st, NULL);
language = gst_structure_get_string (caps_st, GST_TAG_LANGUAGE_CODE); language = gst_structure_get_string (caps_st, GST_TAG_LANGUAGE_CODE);
if (language) if (language)
@ -1113,8 +1097,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
info = make_info (parent, GST_TYPE_DISCOVERER_STREAM_INFO, caps); info = make_info (parent, GST_TYPE_DISCOVERER_STREAM_INFO, caps);
if (gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, if (gst_structure_get (st, "tags", GST_TYPE_TAG_LIST, &tags_st, NULL)) {
NULL)) {
gst_discoverer_merge_and_replace_tags (&info->tags, tags_st); gst_discoverer_merge_and_replace_tags (&info->tags, tags_st);
} }
@ -1140,13 +1123,12 @@ find_stream_for_node (GstDiscoverer * dc, const GstStructure * topology)
return NULL; return NULL;
} }
if (!gst_structure_id_has_field (topology, _TOPOLOGY_PAD_QUARK)) { if (!gst_structure_has_field (topology, "pad")) {
GST_DEBUG ("Could not find pad for node %" GST_PTR_FORMAT, topology); GST_DEBUG ("Could not find pad for node %" GST_PTR_FORMAT, topology);
return NULL; return NULL;
} }
gst_structure_id_get (topology, _TOPOLOGY_PAD_QUARK, gst_structure_get (topology, "pad", GST_TYPE_PAD, &pad, NULL);
GST_TYPE_PAD, &pad, NULL);
for (i = 0, tmp = dc->priv->streams; tmp; tmp = tmp->next, i++) { for (i = 0, tmp = dc->priv->streams; tmp; tmp = tmp->next, i++) {
ps = (PrivateStream *) tmp->data; ps = (PrivateStream *) tmp->data;
@ -1263,13 +1245,12 @@ parse_stream_topology (GstDiscoverer * dc, const GstStructure * topology,
if (!parent) if (!parent)
parent = res; parent = res;
if (gst_structure_id_get (st, _ELEMENT_SRCPAD_QUARK, GST_TYPE_PAD, if (gst_structure_get (st, "element-srcpad", GST_TYPE_PAD, &srcpad, NULL)) {
&srcpad, NULL)) {
caps = gst_pad_get_current_caps (srcpad); caps = gst_pad_get_current_caps (srcpad);
gst_object_unref (srcpad); gst_object_unref (srcpad);
} }
if (!caps) { if (!caps) {
gst_structure_id_get (st, _CAPS_QUARK, GST_TYPE_CAPS, &caps, NULL); gst_structure_get (st, "caps", GST_TYPE_CAPS, &caps, NULL);
} }
if (caps) { if (caps) {
@ -1308,13 +1289,13 @@ parse_stream_topology (GstDiscoverer * dc, const GstStructure * topology,
GstDiscovererContainerInfo *cont; GstDiscovererContainerInfo *cont;
GstPad *srcpad; GstPad *srcpad;
if (gst_structure_id_get (topology, _ELEMENT_SRCPAD_QUARK, GST_TYPE_PAD, if (gst_structure_get (topology, "element-srcpad", GST_TYPE_PAD,
&srcpad, NULL)) { &srcpad, NULL)) {
caps = gst_pad_get_current_caps (srcpad); caps = gst_pad_get_current_caps (srcpad);
gst_object_unref (srcpad); gst_object_unref (srcpad);
} }
if (!caps) { if (!caps) {
gst_structure_id_get (topology, _CAPS_QUARK, GST_TYPE_CAPS, &caps, NULL); gst_structure_get (topology, "caps", GST_TYPE_CAPS, &caps, NULL);
} }
if (!caps) if (!caps)

View file

@ -965,10 +965,11 @@ gst_rtp_base_payload_set_options (GstRTPBasePayload * payload,
} }
static gboolean static gboolean
copy_fixed (GQuark field_id, const GValue * value, GstStructure * dest) copy_fixed (const GstIdStr * fieldname, const GValue * value,
GstStructure * dest)
{ {
if (gst_value_is_fixed (value)) { if (gst_value_is_fixed (value)) {
gst_structure_id_set_value (dest, field_id, value); gst_structure_id_str_set_value (dest, fieldname, value);
} }
return TRUE; return TRUE;
} }
@ -989,9 +990,9 @@ update_max_ptime (GstRTPBasePayload * rtpbasepayload)
} }
static gboolean static gboolean
_set_caps (GQuark field_id, const GValue * value, GstCaps * caps) _set_caps (const GstIdStr * fieldname, const GValue * value, GstCaps * caps)
{ {
gst_caps_set_value (caps, g_quark_to_string (field_id), value); gst_caps_set_value (caps, gst_id_str_as_str (fieldname), value);
return TRUE; return TRUE;
} }
@ -1022,7 +1023,8 @@ gst_rtp_base_payload_set_outcaps_structure (GstRTPBasePayload * payload,
GST_DEBUG_OBJECT (payload, "defaults: %" GST_PTR_FORMAT, srccaps); GST_DEBUG_OBJECT (payload, "defaults: %" GST_PTR_FORMAT, srccaps);
if (s && gst_structure_n_fields (s) > 0) { if (s && gst_structure_n_fields (s) > 0) {
gst_structure_foreach (s, (GstStructureForeachFunc) _set_caps, srccaps); gst_structure_foreach_id_str (s, (GstStructureForeachIdStrFunc) _set_caps,
srccaps);
GST_DEBUG_OBJECT (payload, "custom added: %" GST_PTR_FORMAT, srccaps); GST_DEBUG_OBJECT (payload, "custom added: %" GST_PTR_FORMAT, srccaps);
} }
@ -1349,7 +1351,8 @@ gst_rtp_base_payload_negotiate (GstRTPBasePayload * payload)
srccaps = gst_caps_new_empty_simple (gst_structure_get_name (s)); srccaps = gst_caps_new_empty_simple (gst_structure_get_name (s));
d = gst_caps_get_structure (srccaps, 0); d = gst_caps_get_structure (srccaps, 0);
gst_structure_foreach (s, (GstStructureForeachFunc) copy_fixed, d); gst_structure_foreach_id_str (s, (GstStructureForeachIdStrFunc) copy_fixed,
d);
gst_caps_unref (temp); gst_caps_unref (temp);

View file

@ -2689,11 +2689,12 @@ gst_video_converter_free (GstVideoConverter * convert)
} }
static gboolean static gboolean
copy_config (GQuark field_id, const GValue * value, gpointer user_data) copy_config (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
GstVideoConverter *convert = user_data; GstVideoConverter *convert = user_data;
gst_structure_id_set_value (convert->config, field_id, value); gst_structure_id_str_set_value (convert->config, fieldname, value);
return TRUE; return TRUE;
} }
@ -2723,7 +2724,7 @@ gst_video_converter_set_config (GstVideoConverter * convert,
g_return_val_if_fail (convert != NULL, FALSE); g_return_val_if_fail (convert != NULL, FALSE);
g_return_val_if_fail (config != NULL, FALSE); g_return_val_if_fail (config != NULL, FALSE);
gst_structure_foreach (config, copy_config, convert); gst_structure_foreach_id_str (config, copy_config, convert);
gst_structure_free (config); gst_structure_free (config);
gst_video_converter_init_from_config (convert); gst_video_converter_init_from_config (convert);

View file

@ -883,10 +883,11 @@ beach:
} }
static gboolean static gboolean
_set_properties (GQuark property_id, const GValue * value, GObject * element) _set_properties (const GstIdStr * property, const GValue * value,
GObject * element)
{ {
GST_DEBUG_OBJECT (element, "Setting %s", g_quark_to_string (property_id)); GST_DEBUG_OBJECT (element, "Setting %s", gst_id_str_as_str (property));
g_object_set_property (element, g_quark_to_string (property_id), value); g_object_set_property (element, gst_id_str_as_str (property), value);
return TRUE; return TRUE;
} }
@ -905,8 +906,8 @@ set_element_properties_from_encoding_profile (GstEncodingProfile * profile,
return; return;
if (!gst_structure_has_name (properties, "element-properties-map")) { if (!gst_structure_has_name (properties, "element-properties-map")) {
gst_structure_foreach (properties, gst_structure_foreach_id_str (properties,
(GstStructureForeachFunc) _set_properties, element); (GstStructureForeachIdStrFunc) _set_properties, element);
goto done; goto done;
} }
@ -938,8 +939,8 @@ set_element_properties_from_encoding_profile (GstEncodingProfile * profile,
GST_DEBUG_OBJECT (GST_OBJECT_PARENT (element), GST_DEBUG_OBJECT (GST_OBJECT_PARENT (element),
"Setting %" GST_PTR_FORMAT " on %" GST_PTR_FORMAT, tmp_properties, "Setting %" GST_PTR_FORMAT " on %" GST_PTR_FORMAT, tmp_properties,
element); element);
gst_structure_foreach (tmp_properties, gst_structure_foreach_id_str (tmp_properties,
(GstStructureForeachFunc) _set_properties, element); (GstStructureForeachIdStrFunc) _set_properties, element);
goto done; goto done;
} }
@ -2029,10 +2030,12 @@ cleanup:
} }
static gboolean static gboolean
_gst_caps_match_foreach (GQuark field_id, const GValue * value, gpointer data) _gst_caps_match_foreach (const GstIdStr * fieldname, const GValue * value,
gpointer data)
{ {
GstStructure *structure = data; GstStructure *structure = data;
const GValue *other_value = gst_structure_id_get_value (structure, field_id); const GValue *other_value =
gst_structure_id_str_get_value (structure, fieldname);
if (G_UNLIKELY (other_value == NULL)) if (G_UNLIKELY (other_value == NULL))
return FALSE; return FALSE;
@ -2058,7 +2061,7 @@ _gst_caps_match (const GstCaps * caps_a, const GstCaps * caps_b)
for (j = 0; j < gst_caps_get_size (caps_b); j++) { for (j = 0; j < gst_caps_get_size (caps_b); j++) {
GstStructure *structure_b = gst_caps_get_structure (caps_b, j); GstStructure *structure_b = gst_caps_get_structure (caps_b, j);
res = gst_structure_foreach (structure_a, _gst_caps_match_foreach, res = gst_structure_foreach_id_str (structure_a, _gst_caps_match_foreach,
structure_b); structure_b);
if (res) if (res)
goto end; goto end;

View file

@ -402,7 +402,7 @@ static void update_text_offset (GstPlaySink * playsink);
static gboolean gst_play_sink_do_reconfigure (GstPlaySink * playsink); static gboolean gst_play_sink_do_reconfigure (GstPlaySink * playsink);
static GQuark _playsink_reset_segment_event_marker_id = 0; #define PLAYSINK_RESET_SEGMENT_EVENT_MARKER "gst-playsink-reset-segment-event-marker"
/* static guint gst_play_sink_signals[LAST_SIGNAL] = { 0 }; */ /* static guint gst_play_sink_signals[LAST_SIGNAL] = { 0 }; */
@ -671,9 +671,6 @@ gst_play_sink_class_init (GstPlaySinkClass * klass)
klass->reconfigure = GST_DEBUG_FUNCPTR (gst_play_sink_reconfigure); klass->reconfigure = GST_DEBUG_FUNCPTR (gst_play_sink_reconfigure);
klass->convert_sample = GST_DEBUG_FUNCPTR (gst_play_sink_convert_sample); klass->convert_sample = GST_DEBUG_FUNCPTR (gst_play_sink_convert_sample);
_playsink_reset_segment_event_marker_id =
g_quark_from_static_string ("gst-playsink-reset-segment-event-marker");
g_type_class_ref (GST_TYPE_STREAM_SYNCHRONIZER); g_type_class_ref (GST_TYPE_STREAM_SYNCHRONIZER);
g_type_class_ref (GST_TYPE_COLOR_BALANCE_CHANNEL); g_type_class_ref (GST_TYPE_COLOR_BALANCE_CHANNEL);
@ -2248,8 +2245,8 @@ gst_play_sink_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer,
if (segment_event) if (segment_event)
gst_event_set_seqnum (event, gst_event_get_seqnum (segment_event)); gst_event_set_seqnum (event, gst_event_get_seqnum (segment_event));
structure = gst_event_writable_structure (event); structure = gst_event_writable_structure (event);
gst_structure_id_set (structure, gst_structure_set_static_str (structure,
_playsink_reset_segment_event_marker_id, G_TYPE_BOOLEAN, TRUE, NULL); PLAYSINK_RESET_SEGMENT_EVENT_MARKER, G_TYPE_BOOLEAN, TRUE, NULL);
GST_DEBUG_OBJECT (pad, GST_DEBUG_OBJECT (pad,
"Pushing %s flush-start event with reset segment marker set: %" "Pushing %s flush-start event with reset segment marker set: %"
@ -2262,8 +2259,8 @@ gst_play_sink_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer,
if (segment_event) if (segment_event)
gst_event_set_seqnum (event, gst_event_get_seqnum (segment_event)); gst_event_set_seqnum (event, gst_event_get_seqnum (segment_event));
structure = gst_event_writable_structure (event); structure = gst_event_writable_structure (event);
gst_structure_id_set (structure, gst_structure_set_static_str (structure,
_playsink_reset_segment_event_marker_id, G_TYPE_BOOLEAN, TRUE, NULL); PLAYSINK_RESET_SEGMENT_EVENT_MARKER, G_TYPE_BOOLEAN, TRUE, NULL);
GST_DEBUG_OBJECT (pad, GST_DEBUG_OBJECT (pad,
"Pushing %s flush-stop event with reset segment marker set: %" "Pushing %s flush-stop event with reset segment marker set: %"
@ -2275,8 +2272,8 @@ gst_play_sink_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer,
if (segment_event) { if (segment_event) {
event = gst_event_copy (segment_event); event = gst_event_copy (segment_event);
structure = gst_event_writable_structure (event); structure = gst_event_writable_structure (event);
gst_structure_id_set (structure, gst_structure_set_static_str (structure,
_playsink_reset_segment_event_marker_id, G_TYPE_BOOLEAN, TRUE, NULL); PLAYSINK_RESET_SEGMENT_EVENT_MARKER, G_TYPE_BOOLEAN, TRUE, NULL);
GST_DEBUG_OBJECT (playsink, GST_DEBUG_OBJECT (playsink,
"Pushing segment event with reset " "Pushing segment event with reset "
@ -2424,8 +2421,8 @@ gst_play_sink_text_src_event (GstPad * pad, GstObject * parent,
structure = gst_event_get_structure (event); structure = gst_event_get_structure (event);
if (structure && if (structure &&
gst_structure_id_has_field (structure, gst_structure_has_field (structure,
_playsink_reset_segment_event_marker_id)) { PLAYSINK_RESET_SEGMENT_EVENT_MARKER)) {
/* the events marked with a reset segment marker /* the events marked with a reset segment marker
* are sent internally to reset the queue and * are sent internally to reset the queue and
* must be dropped here */ * must be dropped here */

View file

@ -88,12 +88,11 @@ enum
#define gst_subtitle_overlay_parent_class parent_class #define gst_subtitle_overlay_parent_class parent_class
G_DEFINE_TYPE (GstSubtitleOverlay, gst_subtitle_overlay, GST_TYPE_BIN); G_DEFINE_TYPE (GstSubtitleOverlay, gst_subtitle_overlay, GST_TYPE_BIN);
static GQuark _subtitle_overlay_event_marker_id = 0; #define SUBTITLE_OVERLAY_EVENT_MARKER "gst-subtitle-overlay-event-marker"
#define _do_init \ #define _do_init \
GST_DEBUG_CATEGORY_INIT (subtitle_overlay_debug, "subtitleoverlay", 0, "Subtitle Overlay"); \ GST_DEBUG_CATEGORY_INIT (subtitle_overlay_debug, "subtitleoverlay", 0, "Subtitle Overlay"); \
playback_element_init (plugin); \ playback_element_init (plugin);
_subtitle_overlay_event_marker_id = g_quark_from_static_string ("gst-subtitle-overlay-event-marker")
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (subtitleoverlay, "subtitleoverlay", GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (subtitleoverlay, "subtitleoverlay",
GST_RANK_NONE, GST_TYPE_SUBTITLE_OVERLAY, _do_init); GST_RANK_NONE, GST_TYPE_SUBTITLE_OVERLAY, _do_init);
@ -1710,7 +1709,7 @@ gst_subtitle_overlay_src_proxy_event (GstPad * proxypad, GstObject * parent,
goto out; goto out;
s = gst_event_get_structure (event); s = gst_event_get_structure (event);
if (s && gst_structure_id_has_field (s, _subtitle_overlay_event_marker_id)) { if (s && gst_structure_has_field (s, SUBTITLE_OVERLAY_EVENT_MARKER)) {
GST_DEBUG_OBJECT (ghostpad, GST_DEBUG_OBJECT (ghostpad,
"Dropping event with marker: %" GST_PTR_FORMAT, "Dropping event with marker: %" GST_PTR_FORMAT,
gst_event_get_structure (event)); gst_event_get_structure (event));
@ -2189,7 +2188,7 @@ gst_subtitle_overlay_subtitle_sink_event (GstPad * pad, GstObject * parent,
event = GST_EVENT_CAST (gst_event_make_writable (event)); event = GST_EVENT_CAST (gst_event_make_writable (event));
structure = gst_event_writable_structure (event); structure = gst_event_writable_structure (event);
gst_structure_id_set (structure, _subtitle_overlay_event_marker_id, gst_structure_set_static_str (structure, SUBTITLE_OVERLAY_EVENT_MARKER,
G_TYPE_BOOLEAN, TRUE, NULL); G_TYPE_BOOLEAN, TRUE, NULL);
break; break;
} }

View file

@ -24,14 +24,15 @@
*/ */
static gboolean static gboolean
remove_range_foreach (GQuark field_id, const GValue * value, GstStructure * st) remove_range_foreach (const GstIdStr * fieldname, const GValue * value,
GstStructure * st)
{ {
GType ftype = G_VALUE_TYPE (value); GType ftype = G_VALUE_TYPE (value);
/* const gchar *fname; */ /* const gchar *fname; */
if (ftype == GST_TYPE_INT_RANGE || ftype == GST_TYPE_DOUBLE_RANGE || if (ftype == GST_TYPE_INT_RANGE || ftype == GST_TYPE_DOUBLE_RANGE ||
ftype == GST_TYPE_FRACTION_RANGE) { ftype == GST_TYPE_FRACTION_RANGE) {
gst_structure_remove_field (st, g_quark_to_string (field_id)); gst_structure_remove_field (st, gst_id_str_as_str (fieldname));
return FALSE; return FALSE;
} }
@ -61,8 +62,8 @@ clear_caps (GstCaps * caps, GstCaps * rescaps)
st = gst_caps_get_structure (res, i - 1); st = gst_caps_get_structure (res, i - 1);
/* Remove range fields */ /* Remove range fields */
while (!gst_structure_foreach (st, while (!gst_structure_foreach_id_str (st,
(GstStructureForeachFunc) remove_range_foreach, st)); (GstStructureForeachIdStrFunc) remove_range_foreach, st));
} }
GST_DEBUG ("stripped %" GST_PTR_FORMAT, res); GST_DEBUG ("stripped %" GST_PTR_FORMAT, res);

View file

@ -140,7 +140,7 @@ get_launch_line (GstDevice * device)
static gboolean static gboolean
print_structure_field (GQuark field_id, const GValue * value, print_structure_field (const GstIdStr * fieldname, const GValue * value,
gpointer user_data) gpointer user_data)
{ {
gchar *val; gchar *val;
@ -155,10 +155,10 @@ print_structure_field (GQuark field_id, const GValue * value,
} }
if (val != NULL) if (val != NULL)
g_print ("\n\t\t%s = %s", g_quark_to_string (field_id), val); g_print ("\n\t\t%s = %s", gst_id_str_as_str (fieldname), val);
else else
g_print ("\n\t\t%s - could not serialise field of type %s", g_print ("\n\t\t%s - could not serialise field of type %s",
g_quark_to_string (field_id), G_VALUE_TYPE_NAME (value)); gst_id_str_as_str (fieldname), G_VALUE_TYPE_NAME (value));
g_free (val); g_free (val);
@ -166,11 +166,11 @@ print_structure_field (GQuark field_id, const GValue * value,
} }
static gboolean static gboolean
print_field (GQuark field, const GValue * value, gpointer unused) print_field (const GstIdStr * fieldname, const GValue * value, gpointer unused)
{ {
gchar *str = gst_value_serialize (value); gchar *str = gst_value_serialize (value);
g_print (", %s=%s", g_quark_to_string (field), str); g_print (", %s=%s", gst_id_str_as_str (fieldname), str);
g_free (str); g_free (str);
return TRUE; return TRUE;
} }
@ -208,12 +208,12 @@ print_device (GstDevice * device, gboolean modified)
g_print ("(%s)", features_string); g_print ("(%s)", features_string);
g_free (features_string); g_free (features_string);
} }
gst_structure_foreach (s, print_field, NULL); gst_structure_foreach_id_str (s, print_field, NULL);
g_print ("\n"); g_print ("\n");
} }
if (props) { if (props) {
g_print ("\tproperties:"); g_print ("\tproperties:");
gst_structure_foreach (props, print_structure_field, NULL); gst_structure_foreach_id_str (props, print_structure_field, NULL);
gst_structure_free (props); gst_structure_free (props);
g_print ("\n"); g_print ("\n");
} }

View file

@ -51,7 +51,7 @@ typedef struct
} PrivStruct; } PrivStruct;
static gboolean static gboolean
structure_remove_buffers_ip (GQuark field_id, GValue * value, structure_remove_buffers_ip (const GstIdStr * fieldname, GValue * value,
gpointer user_data) gpointer user_data)
{ {
if (G_VALUE_HOLDS (value, GST_TYPE_BUFFER)) if (G_VALUE_HOLDS (value, GST_TYPE_BUFFER))
@ -75,7 +75,7 @@ static gboolean
caps_remove_buffers_ip (GstCapsFeatures * features, GstStructure * structure, caps_remove_buffers_ip (GstCapsFeatures * features, GstStructure * structure,
gpointer user_data) gpointer user_data)
{ {
gst_structure_filter_and_map_in_place (structure, gst_structure_filter_and_map_in_place_id_str (structure,
structure_remove_buffers_ip, NULL); structure_remove_buffers_ip, NULL);
return TRUE; return TRUE;

View file

@ -1107,12 +1107,12 @@ struct http_headers_collector
}; };
static gboolean static gboolean
gst_adaptive_demux_handle_upstream_http_header (GQuark field_id, gst_adaptive_demux_handle_upstream_http_header (const GstIdStr * fieldname,
const GValue * value, gpointer userdata) const GValue * value, gpointer userdata)
{ {
struct http_headers_collector *hdr_data = userdata; struct http_headers_collector *hdr_data = userdata;
GstAdaptiveDemux *demux = hdr_data->demux; GstAdaptiveDemux *demux = hdr_data->demux;
const gchar *field_name = g_quark_to_string (field_id); const gchar *field_name = gst_id_str_as_str (fieldname);
if (G_UNLIKELY (value == NULL)) if (G_UNLIKELY (value == NULL))
return TRUE; /* This should not happen */ return TRUE; /* This should not happen */
@ -1137,7 +1137,7 @@ gst_adaptive_demux_handle_upstream_http_header (GQuark field_id,
cookies = (gchar **) g_malloc0 ((total_len + 1) * sizeof (gchar *)); cookies = (gchar **) g_malloc0 ((total_len + 1) * sizeof (gchar *));
for (i = 0; i < gst_value_array_get_size (value); i++) { for (i = 0; i < gst_value_array_get_size (value); i++) {
GST_INFO_OBJECT (demux, "%s : %s", g_quark_to_string (field_id), GST_INFO_OBJECT (demux, "%s : %s", gst_id_str_as_str (fieldname),
g_value_get_string (gst_value_array_get_value (value, i))); g_value_get_string (gst_value_array_get_value (value, i)));
cookies[i] = g_value_dup_string (gst_value_array_get_value (value, i)); cookies[i] = g_value_dup_string (gst_value_array_get_value (value, i));
} }
@ -1145,12 +1145,12 @@ gst_adaptive_demux_handle_upstream_http_header (GQuark field_id,
total_len = 1 + prev_len; total_len = 1 + prev_len;
cookies = (gchar **) g_malloc0 ((total_len + 1) * sizeof (gchar *)); cookies = (gchar **) g_malloc0 ((total_len + 1) * sizeof (gchar *));
GST_INFO_OBJECT (demux, "%s : %s", g_quark_to_string (field_id), GST_INFO_OBJECT (demux, "%s : %s", gst_id_str_as_str (fieldname),
g_value_get_string (value)); g_value_get_string (value));
cookies[0] = g_value_dup_string (value); cookies[0] = g_value_dup_string (value);
} else { } else {
GST_WARNING_OBJECT (demux, "%s field is not string or array", GST_WARNING_OBJECT (demux, "%s field is not string or array",
g_quark_to_string (field_id)); gst_id_str_as_str (fieldname));
} }
if (cookies) { if (cookies) {
@ -1260,7 +1260,7 @@ gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent,
gst_structure_get (structure, "request-headers", GST_TYPE_STRUCTURE, gst_structure_get (structure, "request-headers", GST_TYPE_STRUCTURE,
&req_headers, NULL); &req_headers, NULL);
if (req_headers) { if (req_headers) {
gst_structure_foreach (req_headers, gst_structure_foreach_id_str (req_headers,
gst_adaptive_demux_handle_upstream_http_header, &c); gst_adaptive_demux_handle_upstream_http_header, &c);
gst_structure_free (req_headers); gst_structure_free (req_headers);
} }
@ -1270,7 +1270,7 @@ gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent,
gst_structure_get (structure, "response-headers", GST_TYPE_STRUCTURE, gst_structure_get (structure, "response-headers", GST_TYPE_STRUCTURE,
&res_headers, NULL); &res_headers, NULL);
if (res_headers) { if (res_headers) {
gst_structure_foreach (res_headers, gst_structure_foreach_id_str (res_headers,
gst_adaptive_demux_handle_upstream_http_header, &c); gst_adaptive_demux_handle_upstream_http_header, &c);
gst_structure_free (res_headers); gst_structure_free (res_headers);
} }

View file

@ -3375,12 +3375,12 @@ hls_master_playlist_get_variant_for_bitrate (GstHLSMasterPlaylist *
} }
static gboolean static gboolean
remove_uncommon (GQuark field_id, GValue * value, GstStructure * st2) remove_uncommon (const GstIdStr * fieldname, GValue * value, GstStructure * st2)
{ {
const GValue *other; const GValue *other;
GValue dest = G_VALUE_INIT; GValue dest = G_VALUE_INIT;
other = gst_structure_id_get_value (st2, field_id); other = gst_structure_id_str_get_value (st2, fieldname);
if (other == NULL || (G_VALUE_TYPE (value) != G_VALUE_TYPE (other))) if (other == NULL || (G_VALUE_TYPE (value) != G_VALUE_TYPE (other)))
return FALSE; return FALSE;
@ -3414,8 +3414,8 @@ gst_caps_merge_common (GstCaps * caps1, GstCaps * caps2)
if (gst_structure_has_name (st2, name1)) { if (gst_structure_has_name (st2, name1)) {
if (merged == NULL) if (merged == NULL)
merged = gst_structure_copy (st1); merged = gst_structure_copy (st1);
gst_structure_filter_and_map_in_place (merged, gst_structure_filter_and_map_in_place_id_str (merged,
(GstStructureFilterMapFunc) remove_uncommon, st2); (GstStructureFilterMapIdStrFunc) remove_uncommon, st2);
} }
} }

View file

@ -346,10 +346,11 @@ gst_pulse_cvolume_from_linear (pa_cvolume * v, unsigned channels,
} }
static gboolean static gboolean
make_proplist_item (GQuark field_id, const GValue * value, gpointer user_data) make_proplist_item (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
pa_proplist *p = (pa_proplist *) user_data; pa_proplist *p = (pa_proplist *) user_data;
gchar *prop_id = (gchar *) g_quark_to_string (field_id); const gchar *prop_id = gst_id_str_as_str (fieldname);
/* http://0pointer.de/lennart/projects/pulseaudio/doxygen/proplist_8h.html */ /* http://0pointer.de/lennart/projects/pulseaudio/doxygen/proplist_8h.html */
@ -374,7 +375,7 @@ gst_pulse_make_proplist (const GstStructure * properties)
pa_proplist *proplist = pa_proplist_new (); pa_proplist *proplist = pa_proplist_new ();
/* iterate the structure and fill the proplist */ /* iterate the structure and fill the proplist */
gst_structure_foreach (properties, make_proplist_item, proplist); gst_structure_foreach_id_str (properties, make_proplist_item, proplist);
return proplist; return proplist;
} }

View file

@ -940,10 +940,11 @@ gst_soup_http_src_add_range_header (GstSoupHTTPSrc * src, guint64 offset,
} }
static gboolean static gboolean
_append_extra_header (GQuark field_id, const GValue * value, gpointer user_data) _append_extra_header (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (user_data); GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (user_data);
const gchar *field_name = g_quark_to_string (field_id); const gchar *field_name = gst_id_str_as_str (fieldname);
gchar *field_content = NULL; gchar *field_content = NULL;
SoupMessageHeaders *request_headers = SoupMessageHeaders *request_headers =
_soup_message_get_request_headers (src->msg); _soup_message_get_request_headers (src->msg);
@ -975,7 +976,7 @@ _append_extra_header (GQuark field_id, const GValue * value, gpointer user_data)
} }
static gboolean static gboolean
_append_extra_headers (GQuark field_id, const GValue * value, _append_extra_headers (const GstIdStr * fieldname, const GValue * value,
gpointer user_data) gpointer user_data)
{ {
if (G_VALUE_TYPE (value) == GST_TYPE_ARRAY) { if (G_VALUE_TYPE (value) == GST_TYPE_ARRAY) {
@ -985,7 +986,7 @@ _append_extra_headers (GQuark field_id, const GValue * value,
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
const GValue *v = gst_value_array_get_value (value, i); const GValue *v = gst_value_array_get_value (value, i);
if (!_append_extra_header (field_id, v, user_data)) if (!_append_extra_header (fieldname, v, user_data))
return FALSE; return FALSE;
} }
} else if (G_VALUE_TYPE (value) == GST_TYPE_LIST) { } else if (G_VALUE_TYPE (value) == GST_TYPE_LIST) {
@ -995,11 +996,11 @@ _append_extra_headers (GQuark field_id, const GValue * value,
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
const GValue *v = gst_value_list_get_value (value, i); const GValue *v = gst_value_list_get_value (value, i);
if (!_append_extra_header (field_id, v, user_data)) if (!_append_extra_header (fieldname, v, user_data))
return FALSE; return FALSE;
} }
} else { } else {
return _append_extra_header (field_id, value, user_data); return _append_extra_header (fieldname, value, user_data);
} }
return TRUE; return TRUE;
@ -1012,7 +1013,8 @@ gst_soup_http_src_add_extra_headers (GstSoupHTTPSrc * src)
if (!src->extra_headers) if (!src->extra_headers)
return TRUE; return TRUE;
return gst_structure_foreach (src->extra_headers, _append_extra_headers, src); return gst_structure_foreach_id_str (src->extra_headers,
_append_extra_headers, src);
} }
static gpointer static gpointer

View file

@ -249,7 +249,7 @@ gst_caps_setter_transform_ip (GstBaseTransform * btrans, GstBuffer * in)
} }
static gboolean static gboolean
gst_caps_is_fixed_foreach (GQuark field_id, const GValue * value, gst_caps_is_fixed_foreach (const GstIdStr * fieldname, const GValue * value,
gpointer unused) gpointer unused)
{ {
return gst_value_is_fixed (value); return gst_value_is_fixed (value);
@ -277,7 +277,7 @@ gst_caps_setter_set_property (GObject * object, guint prop_id,
GstStructure *s; GstStructure *s;
s = gst_caps_get_structure (new_caps, i); s = gst_caps_get_structure (new_caps, i);
if (!gst_structure_foreach (s, gst_caps_is_fixed_foreach, NULL)) { if (!gst_structure_foreach_id_str (s, gst_caps_is_fixed_foreach, NULL)) {
GST_ERROR_OBJECT (filter, "rejected unfixed caps: %" GST_PTR_FORMAT, GST_ERROR_OBJECT (filter, "rejected unfixed caps: %" GST_PTR_FORMAT,
new_caps); new_caps);
gst_caps_unref (new_caps); gst_caps_unref (new_caps);

View file

@ -5714,20 +5714,19 @@ gst_qt_mux_aggregate (GstAggregator * agg, gboolean timeout)
} }
static gboolean static gboolean
field_is_in (GQuark field_id, const gchar * fieldname, ...) field_is_in (const GstIdStr * fieldname, const gchar * name, ...)
{ {
va_list varargs; va_list varargs;
gchar *name = (gchar *) fieldname;
va_start (varargs, fieldname); va_start (varargs, name);
while (name) { while (name) {
if (field_id == g_quark_from_static_string (name)) { if (gst_id_str_is_equal_to_str (fieldname, name)) {
va_end (varargs); va_end (varargs);
return TRUE; return TRUE;
} }
name = va_arg (varargs, char *); name = va_arg (varargs, const char *);
} }
va_end (varargs); va_end (varargs);
@ -5735,15 +5734,16 @@ field_is_in (GQuark field_id, const gchar * fieldname, ...)
} }
static gboolean static gboolean
check_field (GQuark field_id, const GValue * value, gpointer user_data) check_field (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
GstStructure *structure = (GstStructure *) user_data; GstStructure *structure = (GstStructure *) user_data;
const GValue *other = gst_structure_id_get_value (structure, field_id); const GValue *other = gst_structure_id_str_get_value (structure, fieldname);
const gchar *name = gst_structure_get_name (structure); const gchar *name = gst_structure_get_name (structure);
if (g_str_has_prefix (name, "video/")) { if (g_str_has_prefix (name, "video/")) {
/* ignore framerate with video caps */ /* ignore framerate with video caps */
if (g_strcmp0 (g_quark_to_string (field_id), "framerate") == 0) if (gst_id_str_is_equal_to_str (fieldname, "framerate"))
return TRUE; return TRUE;
} }
@ -5753,7 +5753,7 @@ check_field (GQuark field_id, const GValue * value, gpointer user_data)
* will contain updated tier / level / profiles, which means we do * will contain updated tier / level / profiles, which means we do
* not need to fail renegotiation when those change. * not need to fail renegotiation when those change.
*/ */
if (field_is_in (field_id, if (field_is_in (fieldname,
"codec_data", "tier", "level", "profile", "codec_data", "tier", "level", "profile",
"chroma-site", "chroma-format", "bit-depth-luma", "colorimetry", "chroma-site", "chroma-format", "bit-depth-luma", "colorimetry",
/* TODO: this may require a separate track but gst, vlc, ffmpeg and /* TODO: this may require a separate track but gst, vlc, ffmpeg and
@ -5765,7 +5765,7 @@ check_field (GQuark field_id, const GValue * value, gpointer user_data)
} }
if (other == NULL) { if (other == NULL) {
if (field_is_in (field_id, "interlace-mode", NULL) && if (field_is_in (fieldname, "interlace-mode", NULL) &&
!g_strcmp0 (g_value_get_string (value), "progressive")) { !g_strcmp0 (g_value_get_string (value), "progressive")) {
return TRUE; return TRUE;
} }
@ -5785,7 +5785,7 @@ gst_qtmux_caps_is_subset_full (GstQTMux * qtmux, GstCaps * subset,
if (!gst_structure_has_name (sup_s, gst_structure_get_name (sub_s))) if (!gst_structure_has_name (sup_s, gst_structure_get_name (sub_s)))
return FALSE; return FALSE;
return gst_structure_foreach (sub_s, check_field, sup_s); return gst_structure_foreach_id_str (sub_s, check_field, sup_s);
} }
/* will unref @qtmux */ /* will unref @qtmux */

View file

@ -977,7 +977,8 @@ gst_matroska_mux_set_codec_id (GstMatroskaTrackContext * context,
} }
static gboolean static gboolean
check_field (GQuark field_id, const GValue * value, gpointer user_data) check_field (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
GstStructure *structure = (GstStructure *) user_data; GstStructure *structure = (GstStructure *) user_data;
const gchar *name = gst_structure_get_name (structure); const gchar *name = gst_structure_get_name (structure);
@ -994,48 +995,48 @@ check_field (GQuark field_id, const GValue * value, gpointer user_data)
* *
* We don't warn here as we already warned elsewhere. * We don't warn here as we already warned elsewhere.
*/ */
if (field_id == g_quark_from_static_string ("codec_data")) { if (gst_id_str_is_equal_to_str (fieldname, "codec_data")) {
return FALSE; return FALSE;
} else if (field_id == g_quark_from_static_string ("tier")) { } else if (gst_id_str_is_equal_to_str (fieldname, "tier")) {
return FALSE; return FALSE;
} else if (field_id == g_quark_from_static_string ("profile")) { } else if (gst_id_str_is_equal_to_str (fieldname, "profile")) {
return FALSE; return FALSE;
} else if (field_id == g_quark_from_static_string ("level")) { } else if (gst_id_str_is_equal_to_str (fieldname, "level")) {
return FALSE; return FALSE;
} else if (field_id == g_quark_from_static_string ("width")) { } else if (gst_id_str_is_equal_to_str (fieldname, "width")) {
return FALSE; return FALSE;
} else if (field_id == g_quark_from_static_string ("height")) { } else if (gst_id_str_is_equal_to_str (fieldname, "height")) {
return FALSE; return FALSE;
} }
} else if (gst_structure_has_name (structure, "video/x-vp8") } else if (gst_structure_has_name (structure, "video/x-vp8")
|| gst_structure_has_name (structure, "video/x-vp9")) { || gst_structure_has_name (structure, "video/x-vp9")) {
/* We do not use profile and streamheader for VPX so let it change /* We do not use profile and streamheader for VPX so let it change
* mid stream */ * mid stream */
if (field_id == g_quark_from_static_string ("streamheader")) if (gst_id_str_is_equal_to_str (fieldname, "streamheader"))
return FALSE; return FALSE;
else if (field_id == g_quark_from_static_string ("profile")) else if (gst_id_str_is_equal_to_str (fieldname, "profile"))
return FALSE; return FALSE;
else if (field_id == g_quark_from_static_string ("width")) else if (gst_id_str_is_equal_to_str (fieldname, "width"))
return FALSE; return FALSE;
else if (field_id == g_quark_from_static_string ("height")) else if (gst_id_str_is_equal_to_str (fieldname, "height"))
return FALSE; return FALSE;
} }
/* This fields aren't used and are not retained into the bitstream so we can /* This fields aren't used and are not retained into the bitstream so we can
* discard them. */ * discard them. */
if (g_str_has_prefix (gst_structure_get_name (structure), "video/")) { if (g_str_has_prefix (gst_structure_get_name (structure), "video/")) {
if (field_id == g_quark_from_static_string ("chroma-site")) if (gst_id_str_is_equal_to_str (fieldname, "chroma-site"))
return FALSE; return FALSE;
else if (field_id == g_quark_from_static_string ("chroma-format")) else if (gst_id_str_is_equal_to_str (fieldname, "chroma-format"))
return FALSE; return FALSE;
else if (field_id == g_quark_from_static_string ("bit-depth-luma")) else if (gst_id_str_is_equal_to_str (fieldname, "bit-depth-luma"))
return FALSE; return FALSE;
/* Remove pixel-aspect-ratio field if it contains 1/1 as that's considered /* Remove pixel-aspect-ratio field if it contains 1/1 as that's considered
* equivalent to not having the field but are not considered equivalent * equivalent to not having the field but are not considered equivalent
* by the generic caps functions * by the generic caps functions
*/ */
if (field_id == g_quark_from_static_string ("pixel-aspect-ratio")) { if (gst_id_str_is_equal_to_str (fieldname, "pixel-aspect-ratio")) {
gint par_n = gst_value_get_fraction_numerator (value); gint par_n = gst_value_get_fraction_numerator (value);
gint par_d = gst_value_get_fraction_denominator (value); gint par_d = gst_value_get_fraction_denominator (value);
@ -1047,14 +1048,14 @@ check_field (GQuark field_id, const GValue * value, gpointer user_data)
* equivalent with not having the fields but are not considered equivalent * equivalent with not having the fields but are not considered equivalent
* by the generic caps functions. * by the generic caps functions.
*/ */
if (field_id == g_quark_from_static_string ("multiview-mode")) { if (gst_id_str_is_equal_to_str (fieldname, "multiview-mode")) {
const gchar *s = g_value_get_string (value); const gchar *s = g_value_get_string (value);
if (g_strcmp0 (s, "mono") == 0) if (g_strcmp0 (s, "mono") == 0)
return FALSE; return FALSE;
} }
if (field_id == g_quark_from_static_string ("multiview-flags")) { if (gst_id_str_is_equal_to_str (fieldname, "multiview-flags")) {
guint multiview_flags = gst_value_get_flagset_flags (value); guint multiview_flags = gst_value_get_flagset_flags (value);
if (multiview_flags == 0) if (multiview_flags == 0)
@ -1078,10 +1079,10 @@ check_new_caps (GstMatroskaTrackVideoContext * videocontext, GstCaps * old_caps,
new_s = gst_caps_get_structure (new_caps, 0); new_s = gst_caps_get_structure (new_caps, 0);
old_s = gst_caps_get_structure (old_caps, 0); old_s = gst_caps_get_structure (old_caps, 0);
gst_structure_filter_and_map_in_place (new_s, gst_structure_filter_and_map_in_place_id_str (new_s,
(GstStructureFilterMapFunc) check_field, new_s); (GstStructureFilterMapIdStrFunc) check_field, new_s);
gst_structure_filter_and_map_in_place (old_s, gst_structure_filter_and_map_in_place_id_str (old_s,
(GstStructureFilterMapFunc) check_field, old_s); (GstStructureFilterMapIdStrFunc) check_field, old_s);
ret = gst_caps_is_subset (new_caps, old_caps); ret = gst_caps_is_subset (new_caps, old_caps);

View file

@ -2123,10 +2123,10 @@ block_context (MqStreamCtx * ctx, GstSplitMuxSink * splitmux)
} }
static gboolean static gboolean
_set_property_from_structure (GQuark field_id, const GValue * value, _set_property_from_structure (const GstIdStr * fieldname, const GValue * value,
gpointer user_data) gpointer user_data)
{ {
const gchar *property_name = g_quark_to_string (field_id); const gchar *property_name = gst_id_str_as_str (fieldname);
GObject *element = G_OBJECT (user_data); GObject *element = G_OBJECT (user_data);
g_object_set_property (element, property_name, value); g_object_set_property (element, property_name, value);
@ -2204,7 +2204,7 @@ start_next_fragment (GstSplitMuxSink * splitmux, MqStreamCtx * ctx)
gst_preset_load_preset (GST_PRESET (splitmux->sink), gst_preset_load_preset (GST_PRESET (splitmux->sink),
splitmux->sink_preset); splitmux->sink_preset);
if (splitmux->sink_properties) if (splitmux->sink_properties)
gst_structure_foreach (splitmux->sink_properties, gst_structure_foreach_id_str (splitmux->sink_properties,
_set_property_from_structure, splitmux->sink); _set_property_from_structure, splitmux->sink);
splitmux->active_sink = splitmux->sink; splitmux->active_sink = splitmux->sink;
g_signal_emit (splitmux, signals[SIGNAL_SINK_ADDED], 0, splitmux->sink); g_signal_emit (splitmux, signals[SIGNAL_SINK_ADDED], 0, splitmux->sink);
@ -2224,7 +2224,7 @@ start_next_fragment (GstSplitMuxSink * splitmux, MqStreamCtx * ctx)
gst_preset_load_preset (GST_PRESET (splitmux->muxer), gst_preset_load_preset (GST_PRESET (splitmux->muxer),
splitmux->muxer_preset); splitmux->muxer_preset);
if (splitmux->muxer_properties) if (splitmux->muxer_properties)
gst_structure_foreach (splitmux->muxer_properties, gst_structure_foreach_id_str (splitmux->muxer_properties,
_set_property_from_structure, splitmux->muxer); _set_property_from_structure, splitmux->muxer);
g_signal_emit (splitmux, signals[SIGNAL_MUXER_ADDED], 0, splitmux->muxer); g_signal_emit (splitmux, signals[SIGNAL_MUXER_ADDED], 0, splitmux->muxer);
g_free (newname); g_free (newname);
@ -3888,7 +3888,7 @@ create_muxer (GstSplitMuxSink * splitmux)
gst_preset_load_preset (GST_PRESET (splitmux->muxer), gst_preset_load_preset (GST_PRESET (splitmux->muxer),
splitmux->muxer_preset); splitmux->muxer_preset);
if (splitmux->muxer_properties) if (splitmux->muxer_properties)
gst_structure_foreach (splitmux->muxer_properties, gst_structure_foreach_id_str (splitmux->muxer_properties,
_set_property_from_structure, splitmux->muxer); _set_property_from_structure, splitmux->muxer);
} else { } else {
/* Ensure it's not in locked state (we might be reusing an old element) */ /* Ensure it's not in locked state (we might be reusing an old element) */
@ -3985,7 +3985,7 @@ create_sink (GstSplitMuxSink * splitmux)
gst_preset_load_preset (GST_PRESET (splitmux->sink), gst_preset_load_preset (GST_PRESET (splitmux->sink),
splitmux->sink_preset); splitmux->sink_preset);
if (splitmux->sink_properties) if (splitmux->sink_properties)
gst_structure_foreach (splitmux->sink_properties, gst_structure_foreach_id_str (splitmux->sink_properties,
_set_property_from_structure, splitmux->sink); _set_property_from_structure, splitmux->sink);
splitmux->active_sink = splitmux->sink; splitmux->active_sink = splitmux->sink;
} else { } else {

View file

@ -314,15 +314,14 @@ gst_rtp_pt_demux_finalize (GObject * object)
/* Removes "ssrc-*" attributes matching other SSRCs. */ /* Removes "ssrc-*" attributes matching other SSRCs. */
static gboolean static gboolean
_filter_ssrc (GQuark field_id, GValue * value, gpointer ssrc) _filter_ssrc (const GstIdStr * fieldname, GValue * value, gpointer ssrc)
{ {
const gchar *field_name = g_quark_to_string (field_id); if (!g_str_has_prefix (gst_id_str_as_str (fieldname), "ssrc-"))
if (!g_str_has_prefix (field_name, "ssrc-"))
return TRUE; return TRUE;
gchar *endptr; gchar *endptr;
guint32 field_ssrc = g_ascii_strtoll (field_name + 5, &endptr, 10); guint32 field_ssrc =
g_ascii_strtoll (gst_id_str_as_str (fieldname) + 5, &endptr, 10);
if (!endptr || *endptr != '-') if (!endptr || *endptr != '-')
return TRUE; return TRUE;
@ -376,7 +375,7 @@ gst_rtp_pt_demux_get_caps (GstRtpPtDemux * rtpdemux, guint pt)
caps = gst_caps_make_writable (caps); caps = gst_caps_make_writable (caps);
s = gst_caps_get_structure (caps, 0); s = gst_caps_get_structure (caps, 0);
gst_structure_filter_and_map_in_place (s, _filter_ssrc, &ssrc); gst_structure_filter_and_map_in_place_id_str (s, _filter_ssrc, &ssrc);
gst_caps_set_simple (caps, "payload", G_TYPE_INT, pt, NULL); gst_caps_set_simple (caps, "payload", G_TYPE_INT, pt, NULL);
if (have_ssrc) if (have_ssrc)

View file

@ -1002,14 +1002,14 @@ gst_rtp_rtx_receive_get_property (GObject * object,
} }
static gboolean static gboolean
structure_to_hash_table_inv (GQuark field_id, const GValue * value, structure_to_hash_table_inv (const GstIdStr * fieldname, const GValue * value,
gpointer hash) gpointer hash)
{ {
const gchar *field_str; const gchar *field_str;
guint field_uint; guint field_uint;
guint value_uint; guint value_uint;
field_str = g_quark_to_string (field_id); field_str = gst_id_str_as_str (fieldname);
field_uint = atoi (field_str); field_uint = atoi (field_str);
value_uint = g_value_get_uint (value); value_uint = g_value_get_uint (value);
g_hash_table_insert ((GHashTable *) hash, GUINT_TO_POINTER (value_uint), g_hash_table_insert ((GHashTable *) hash, GUINT_TO_POINTER (value_uint),
@ -1031,7 +1031,7 @@ gst_rtp_rtx_receive_set_property (GObject * object,
gst_structure_free (rtx->external_ssrc_map); gst_structure_free (rtx->external_ssrc_map);
rtx->external_ssrc_map = g_value_dup_boxed (value); rtx->external_ssrc_map = g_value_dup_boxed (value);
g_hash_table_remove_all (rtx->ssrc2_ssrc1_map); g_hash_table_remove_all (rtx->ssrc2_ssrc1_map);
gst_structure_foreach (rtx->external_ssrc_map, gst_structure_foreach_id_str (rtx->external_ssrc_map,
structure_to_hash_table_inv, rtx->ssrc2_ssrc1_map); structure_to_hash_table_inv, rtx->ssrc2_ssrc1_map);
GST_OBJECT_UNLOCK (rtx); GST_OBJECT_UNLOCK (rtx);
break; break;
@ -1041,7 +1041,7 @@ gst_rtp_rtx_receive_set_property (GObject * object,
gst_structure_free (rtx->rtx_pt_map_structure); gst_structure_free (rtx->rtx_pt_map_structure);
rtx->rtx_pt_map_structure = g_value_dup_boxed (value); rtx->rtx_pt_map_structure = g_value_dup_boxed (value);
g_hash_table_remove_all (rtx->rtx_pt_map); g_hash_table_remove_all (rtx->rtx_pt_map);
gst_structure_foreach (rtx->rtx_pt_map_structure, gst_structure_foreach_id_str (rtx->rtx_pt_map_structure,
structure_to_hash_table_inv, rtx->rtx_pt_map); structure_to_hash_table_inv, rtx->rtx_pt_map);
GST_OBJECT_UNLOCK (rtx); GST_OBJECT_UNLOCK (rtx);
break; break;

View file

@ -1199,13 +1199,14 @@ gst_rtp_rtx_send_get_property (GObject * object,
} }
static gboolean static gboolean
structure_to_hash_table (GQuark field_id, const GValue * value, gpointer hash) structure_to_hash_table (const GstIdStr * fieldname, const GValue * value,
gpointer hash)
{ {
const gchar *field_str; const gchar *field_str;
guint field_uint; guint field_uint;
guint value_uint; guint value_uint;
field_str = g_quark_to_string (field_id); field_str = gst_id_str_as_str (fieldname);
field_uint = atoi (field_str); field_uint = atoi (field_str);
value_uint = g_value_get_uint (value); value_uint = g_value_get_uint (value);
g_hash_table_insert ((GHashTable *) hash, GUINT_TO_POINTER (field_uint), g_hash_table_insert ((GHashTable *) hash, GUINT_TO_POINTER (field_uint),
@ -1234,8 +1235,8 @@ gst_rtp_rtx_send_set_property (GObject * object,
gst_structure_free (rtx->rtx_pt_map_structure); gst_structure_free (rtx->rtx_pt_map_structure);
rtx->rtx_pt_map_structure = g_value_dup_boxed (value); rtx->rtx_pt_map_structure = g_value_dup_boxed (value);
g_hash_table_remove_all (rtx->rtx_pt_map); g_hash_table_remove_all (rtx->rtx_pt_map);
gst_structure_foreach (rtx->rtx_pt_map_structure, structure_to_hash_table, gst_structure_foreach_id_str (rtx->rtx_pt_map_structure,
rtx->rtx_pt_map); structure_to_hash_table, rtx->rtx_pt_map);
GST_OBJECT_UNLOCK (rtx); GST_OBJECT_UNLOCK (rtx);
if (IS_RTX_ENABLED (rtx)) if (IS_RTX_ENABLED (rtx))
@ -1260,7 +1261,7 @@ gst_rtp_rtx_send_set_property (GObject * object,
gst_structure_free (rtx->clock_rate_map_structure); gst_structure_free (rtx->clock_rate_map_structure);
rtx->clock_rate_map_structure = g_value_dup_boxed (value); rtx->clock_rate_map_structure = g_value_dup_boxed (value);
g_hash_table_remove_all (rtx->clock_rate_map); g_hash_table_remove_all (rtx->clock_rate_map);
gst_structure_foreach (rtx->clock_rate_map_structure, gst_structure_foreach_id_str (rtx->clock_rate_map_structure,
structure_to_hash_table, rtx->clock_rate_map); structure_to_hash_table, rtx->clock_rate_map);
GST_OBJECT_UNLOCK (rtx); GST_OBJECT_UNLOCK (rtx);
break; break;

View file

@ -490,22 +490,20 @@ rtp_source_get_sdes_struct (RTPSource * src)
} }
static gboolean static gboolean
sdes_struct_compare_func (GQuark field_id, const GValue * value, sdes_struct_compare_func (const GstIdStr * fieldname, const GValue * value,
gpointer user_data) gpointer user_data)
{ {
GstStructure *old; GstStructure *old;
const gchar *field;
old = GST_STRUCTURE (user_data); old = GST_STRUCTURE (user_data);
field = g_quark_to_string (field_id);
if (!gst_structure_has_field (old, field)) if (!gst_structure_id_str_has_field (old, fieldname))
return FALSE; return FALSE;
g_assert (G_VALUE_HOLDS_STRING (value)); g_assert (G_VALUE_HOLDS_STRING (value));
return strcmp (g_value_get_string (value), gst_structure_get_string (old, return strcmp (g_value_get_string (value), gst_structure_get_string (old,
field)) == 0; gst_id_str_as_str (fieldname))) == 0;
} }
/** /**
@ -529,7 +527,8 @@ rtp_source_set_sdes_struct (RTPSource * src, GstStructure * sdes)
g_return_val_if_fail (strcmp (gst_structure_get_name (sdes), g_return_val_if_fail (strcmp (gst_structure_get_name (sdes),
"application/x-rtp-source-sdes") == 0, FALSE); "application/x-rtp-source-sdes") == 0, FALSE);
changed = !gst_structure_foreach (sdes, sdes_struct_compare_func, src->sdes); changed =
!gst_structure_foreach_id_str (sdes, sdes_struct_compare_func, src->sdes);
if (changed) { if (changed) {
gst_structure_free (src->sdes); gst_structure_free (src->sdes);

View file

@ -5420,9 +5420,10 @@ accept_certificate_cb (GTlsConnection * conn, GTlsCertificate * peer_cert,
} }
static gboolean static gboolean
_add_header_to_conn (GQuark field_id, const GValue * value, gpointer user_data) _add_header_to_conn (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
const gchar *key_str = g_quark_to_string (field_id); const gchar *key_str = gst_id_str_as_str (fieldname);
const gchar *value_str = g_value_get_string (value); const gchar *value_str = g_value_get_string (value);
GstRTSPConnection *conn = (GstRTSPConnection *) user_data; GstRTSPConnection *conn = (GstRTSPConnection *) user_data;
@ -5493,7 +5494,7 @@ gst_rtsp_conninfo_connect (GstRTSPSrc * src, GstRTSPConnInfo * info,
} }
if (src->prop_extra_http_request_headers != NULL) { if (src->prop_extra_http_request_headers != NULL) {
gst_structure_foreach (src->prop_extra_http_request_headers, gst_structure_foreach_id_str (src->prop_extra_http_request_headers,
_add_header_to_conn, info->connection); _add_header_to_conn, info->connection);
} }
} }

View file

@ -390,17 +390,18 @@ gst_v4l2src_get_property (GObject * object,
} }
static gboolean static gboolean
gst_vl42_src_fixate_fields (GQuark field_id, GValue * value, gpointer user_data) gst_vl42_src_fixate_fields (const GstIdStr * fieldname, GValue * value,
gpointer user_data)
{ {
GstStructure *s = user_data; GstStructure *s = user_data;
if (field_id == g_quark_from_string ("interlace-mode")) if (gst_id_str_is_equal_to_str (fieldname, "interlace-mode"))
return TRUE; return TRUE;
if (field_id == g_quark_from_string ("colorimetry")) if (gst_id_str_is_equal_to_str (fieldname, "colorimetry"))
return TRUE; return TRUE;
gst_structure_fixate_field (s, g_quark_to_string (field_id)); gst_structure_fixate_field (s, gst_id_str_as_str (fieldname));
return TRUE; return TRUE;
} }
@ -421,7 +422,7 @@ gst_v4l2_src_fixate_struct_with_preference (GstStructure * s,
/* Finally, fixate everything else except the interlace-mode and colorimetry /* Finally, fixate everything else except the interlace-mode and colorimetry
* which still need further negotiation as it wasn't probed */ * which still need further negotiation as it wasn't probed */
gst_structure_map_in_place (s, gst_vl42_src_fixate_fields, s); gst_structure_map_in_place_id_str (s, gst_vl42_src_fixate_fields, s);
} }
static void static void

View file

@ -1035,10 +1035,10 @@ ctrl_failed:
} }
static gboolean static gboolean
set_control (GQuark field_id, const GValue * value, gpointer user_data) set_control (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{ {
GstV4l2Object *v4l2object = user_data; GstV4l2Object *v4l2object = user_data;
GQuark normalised_field_id;
gpointer *d; gpointer *d;
/* 32 bytes is the maximum size for a control name according to v4l2 */ /* 32 bytes is the maximum size for a control name according to v4l2 */
@ -1048,22 +1048,21 @@ set_control (GQuark field_id, const GValue * value, gpointer user_data)
a subtly different way to v4l2-ctl. e.g. the kernel's "Focus (absolute)" a subtly different way to v4l2-ctl. e.g. the kernel's "Focus (absolute)"
would become "focus__absolute_" whereas now it becomes "focus_absolute". would become "focus__absolute_" whereas now it becomes "focus_absolute".
Please remove the following in GStreamer 1.5 for 1.6 */ Please remove the following in GStreamer 1.5 for 1.6 */
strncpy (name, g_quark_to_string (field_id), sizeof (name)); strncpy (name, gst_id_str_as_str (fieldname), sizeof (name));
name[31] = '\0'; name[31] = '\0';
gst_v4l2_normalise_control_name (name); gst_v4l2_normalise_control_name (name);
normalised_field_id = g_quark_from_string (name); if (!gst_id_str_is_equal_to_str (fieldname, name))
if (normalised_field_id != field_id)
g_warning ("In GStreamer 1.4 the way V4L2 control names were normalised " g_warning ("In GStreamer 1.4 the way V4L2 control names were normalised "
"changed. Instead of setting \"%s\" please use \"%s\". The former is " "changed. Instead of setting \"%s\" please use \"%s\". The former is "
"deprecated and will be removed in a future version of GStreamer", "deprecated and will be removed in a future version of GStreamer",
g_quark_to_string (field_id), name); gst_id_str_as_str (fieldname), name);
field_id = normalised_field_id;
d = g_datalist_id_get_data (&v4l2object->controls, field_id); d = g_datalist_id_get_data (&v4l2object->controls,
g_quark_from_string (gst_id_str_as_str (fieldname)));
if (!d) { if (!d) {
GST_WARNING_OBJECT (v4l2object, GST_WARNING_OBJECT (v4l2object,
"Control '%s' does not exist or has an unsupported type.", "Control '%s' does not exist or has an unsupported type.",
g_quark_to_string (field_id)); gst_id_str_as_str (fieldname));
return TRUE; return TRUE;
} }
if (G_VALUE_HOLDS (value, G_TYPE_INT)) { if (G_VALUE_HOLDS (value, G_TYPE_INT)) {
@ -1078,7 +1077,7 @@ set_control (GQuark field_id, const GValue * value, gpointer user_data)
} else { } else {
GST_WARNING_OBJECT (v4l2object, GST_WARNING_OBJECT (v4l2object,
"no compatible value expected for control '%s'.", "no compatible value expected for control '%s'.",
g_quark_to_string (field_id)); gst_id_str_as_str (fieldname));
return TRUE; return TRUE;
} }
return TRUE; return TRUE;
@ -1087,7 +1086,7 @@ set_control (GQuark field_id, const GValue * value, gpointer user_data)
gboolean gboolean
gst_v4l2_set_controls (GstV4l2Object * v4l2object, GstStructure * controls) gst_v4l2_set_controls (GstV4l2Object * v4l2object, GstStructure * controls)
{ {
return gst_structure_foreach (controls, set_control, v4l2object); return gst_structure_foreach_id_str (controls, set_control, v4l2object);
} }
gboolean gboolean

View file

@ -50,10 +50,10 @@ setup_backchannel_shoveler (GstElement * rtspsrc, GstCaps * caps)
} }
static gboolean static gboolean
remove_extra_fields (GQuark field_id, GValue * value G_GNUC_UNUSED, remove_extra_fields (const GstIdStr * fieldname, GValue * value G_GNUC_UNUSED,
gpointer user_data G_GNUC_UNUSED) gpointer user_data G_GNUC_UNUSED)
{ {
return !g_str_has_prefix (g_quark_to_string (field_id), "a-"); return !g_str_has_prefix (gst_id_str_as_str (fieldname), "a-");
} }
static gboolean static gboolean
@ -71,7 +71,7 @@ find_backchannel (GstElement * rtspsrc, guint idx, GstCaps * caps,
caps = gst_caps_new_empty (); caps = gst_caps_new_empty ();
s = gst_structure_copy (s); s = gst_structure_copy (s);
gst_structure_set_name (s, "application/x-rtp"); gst_structure_set_name (s, "application/x-rtp");
gst_structure_filter_and_map_in_place (s, remove_extra_fields, NULL); gst_structure_filter_and_map_in_place_id_str (s, remove_extra_fields, NULL);
gst_caps_append_structure (caps, s); gst_caps_append_structure (caps, s);
setup_backchannel_shoveler (rtspsrc, caps); setup_backchannel_shoveler (rtspsrc, caps);
} }

View file

@ -1255,32 +1255,6 @@ gst_vaapi_video_info_quark_get (void)
return g_quark; return g_quark;
} }
#define ALLOCATION_VINFO_QUARK allocation_vinfo_quark_get ()
static GQuark
allocation_vinfo_quark_get (void)
{
static gsize g_quark;
if (g_once_init_enter (&g_quark)) {
gsize quark = (gsize) g_quark_from_static_string ("allocation-vinfo");
g_once_init_leave (&g_quark, quark);
}
return g_quark;
}
#define SURFACE_ALLOC_FLAGS_QUARK surface_alloc_flags_quark_get ()
static GQuark
surface_alloc_flags_quark_get (void)
{
static gsize g_quark;
if (g_once_init_enter (&g_quark)) {
gsize quark = (gsize) g_quark_from_static_string ("surface-alloc-flags");
g_once_init_leave (&g_quark, quark);
}
return g_quark;
}
#define NEGOTIATED_VINFO_QUARK negotiated_vinfo_quark_get () #define NEGOTIATED_VINFO_QUARK negotiated_vinfo_quark_get ()
static GQuark static GQuark
negotiated_vinfo_quark_get (void) negotiated_vinfo_quark_get (void)
@ -1323,13 +1297,13 @@ gst_allocator_get_vaapi_video_info (GstAllocator * allocator,
return NULL; return NULL;
if (out_flags_ptr) { if (out_flags_ptr) {
value = gst_structure_id_get_value (structure, SURFACE_ALLOC_FLAGS_QUARK); value = gst_structure_get_value (structure, "surface-alloc-flags");
if (!value) if (!value)
return NULL; return NULL;
*out_flags_ptr = g_value_get_uint (value); *out_flags_ptr = g_value_get_uint (value);
} }
value = gst_structure_id_get_value (structure, ALLOCATION_VINFO_QUARK); value = gst_structure_get_value (structure, "allocation-vinfo");
if (!value) if (!value)
return NULL; return NULL;
return g_value_get_boxed (value); return g_value_get_boxed (value);

View file

@ -593,12 +593,12 @@ _add_properties (GString * json, GString * other_types,
} }
static gboolean static gboolean
print_field (GQuark field, const GValue * value, GString * jcaps) print_field (const GstIdStr * fieldname, const GValue * value, GString * jcaps)
{ {
gchar *tmp, *str = gst_value_serialize (value); gchar *tmp, *str = gst_value_serialize (value);
if (!g_strcmp0 (g_quark_to_string (field), "format") || if (!g_strcmp0 (gst_id_str_as_str (fieldname), "format") ||
!g_strcmp0 (g_quark_to_string (field), "rate")) { !g_strcmp0 (gst_id_str_as_str (fieldname), "rate")) {
if (!cleanup_caps_field) if (!cleanup_caps_field)
cleanup_caps_field = g_regex_new ("\\(string\\)|\\(rate\\)", 0, 0, NULL); cleanup_caps_field = g_regex_new ("\\(string\\)|\\(rate\\)", 0, 0, NULL);
@ -607,7 +607,8 @@ print_field (GQuark field, const GValue * value, GString * jcaps)
g_free (tmp); g_free (tmp);
} }
g_string_append_printf (jcaps, "%15s: %s\n", g_quark_to_string (field), str); g_string_append_printf (jcaps, "%15s: %s\n", gst_id_str_as_str (fieldname),
str);
g_free (str); g_free (str);
return TRUE; return TRUE;
} }
@ -645,8 +646,8 @@ _build_caps (const GstCaps * caps)
g_string_append_printf (jcaps, "%s:\n", g_string_append_printf (jcaps, "%s:\n",
gst_structure_get_name (structure)); gst_structure_get_name (structure));
} }
gst_structure_foreach (structure, (GstStructureForeachFunc) print_field, gst_structure_foreach_id_str (structure,
jcaps); (GstStructureForeachIdStrFunc) print_field, jcaps);
} }
res = json_strescape (jcaps->str); res = json_strescape (jcaps->str);

View file

@ -830,11 +830,11 @@ gst_buffer_pool_config_set_params (GstStructure * config, GstCaps * caps,
g_return_if_fail (max_buffers == 0 || min_buffers <= max_buffers); g_return_if_fail (max_buffers == 0 || min_buffers <= max_buffers);
g_return_if_fail (caps == NULL || gst_caps_is_fixed (caps)); g_return_if_fail (caps == NULL || gst_caps_is_fixed (caps));
gst_structure_id_set (config, gst_structure_set_static_str (config,
GST_QUARK (CAPS), GST_TYPE_CAPS, caps, "caps", GST_TYPE_CAPS, caps,
GST_QUARK (SIZE), G_TYPE_UINT, size, "size", G_TYPE_UINT, size,
GST_QUARK (MIN_BUFFERS), G_TYPE_UINT, min_buffers, "min-buffers", G_TYPE_UINT, min_buffers,
GST_QUARK (MAX_BUFFERS), G_TYPE_UINT, max_buffers, NULL); "max-buffers", G_TYPE_UINT, max_buffers, NULL);
} }
/** /**
@ -863,9 +863,9 @@ gst_buffer_pool_config_set_allocator (GstStructure * config,
g_return_if_fail (config != NULL); g_return_if_fail (config != NULL);
g_return_if_fail (allocator != NULL || params != NULL); g_return_if_fail (allocator != NULL || params != NULL);
gst_structure_id_set (config, gst_structure_set_static_str (config,
GST_QUARK (ALLOCATOR), GST_TYPE_ALLOCATOR, allocator, "allocator", GST_TYPE_ALLOCATOR, allocator,
GST_QUARK (PARAMS), GST_TYPE_ALLOCATION_PARAMS, params, NULL); "params", GST_TYPE_ALLOCATION_PARAMS, params, NULL);
} }
/** /**
@ -887,7 +887,7 @@ gst_buffer_pool_config_add_option (GstStructure * config, const gchar * option)
g_return_if_fail (config != NULL); g_return_if_fail (config != NULL);
value = gst_structure_id_get_value (config, GST_QUARK (OPTIONS)); value = gst_structure_get_value (config, "options");
if (value) { if (value) {
len = gst_value_array_get_size (value); len = gst_value_array_get_size (value);
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
@ -900,8 +900,8 @@ gst_buffer_pool_config_add_option (GstStructure * config, const gchar * option)
GValue new_array_val = { 0, }; GValue new_array_val = { 0, };
g_value_init (&new_array_val, GST_TYPE_ARRAY); g_value_init (&new_array_val, GST_TYPE_ARRAY);
gst_structure_id_take_value (config, GST_QUARK (OPTIONS), &new_array_val); gst_structure_take_value_static_str (config, "options", &new_array_val);
value = gst_structure_id_get_value (config, GST_QUARK (OPTIONS)); value = gst_structure_get_value (config, "options");
} }
g_value_init (&option_value, G_TYPE_STRING); g_value_init (&option_value, G_TYPE_STRING);
g_value_set_string (&option_value, option); g_value_set_string (&option_value, option);
@ -925,7 +925,7 @@ gst_buffer_pool_config_n_options (GstStructure * config)
g_return_val_if_fail (config != NULL, 0); g_return_val_if_fail (config != NULL, 0);
value = gst_structure_id_get_value (config, GST_QUARK (OPTIONS)); value = gst_structure_get_value (config, "options");
if (value) { if (value) {
size = gst_value_array_get_size (value); size = gst_value_array_get_size (value);
} }
@ -950,7 +950,7 @@ gst_buffer_pool_config_get_option (GstStructure * config, guint index)
g_return_val_if_fail (config != NULL, 0); g_return_val_if_fail (config != NULL, 0);
value = gst_structure_id_get_value (config, GST_QUARK (OPTIONS)); value = gst_structure_get_value (config, "options");
if (value) { if (value) {
const GValue *option_value; const GValue *option_value;
@ -978,7 +978,7 @@ gst_buffer_pool_config_has_option (GstStructure * config, const gchar * option)
g_return_val_if_fail (config != NULL, 0); g_return_val_if_fail (config != NULL, 0);
value = gst_structure_id_get_value (config, GST_QUARK (OPTIONS)); value = gst_structure_get_value (config, "options");
if (value) { if (value) {
len = gst_value_array_get_size (value); len = gst_value_array_get_size (value);
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
@ -1010,13 +1010,12 @@ gst_buffer_pool_config_get_params (GstStructure * config, GstCaps ** caps,
g_return_val_if_fail (config != NULL, FALSE); g_return_val_if_fail (config != NULL, FALSE);
if (caps) { if (caps) {
*caps = g_value_get_boxed (gst_structure_id_get_value (config, *caps = g_value_get_boxed (gst_structure_get_value (config, "caps"));
GST_QUARK (CAPS)));
} }
return gst_structure_id_get (config, return gst_structure_get (config,
GST_QUARK (SIZE), G_TYPE_UINT, size, "size", G_TYPE_UINT, size,
GST_QUARK (MIN_BUFFERS), G_TYPE_UINT, min_buffers, "min-buffers", G_TYPE_UINT, min_buffers,
GST_QUARK (MAX_BUFFERS), G_TYPE_UINT, max_buffers, NULL); "max-buffers", G_TYPE_UINT, max_buffers, NULL);
} }
/** /**
@ -1036,13 +1035,12 @@ gst_buffer_pool_config_get_allocator (GstStructure * config,
g_return_val_if_fail (config != NULL, FALSE); g_return_val_if_fail (config != NULL, FALSE);
if (allocator) if (allocator)
*allocator = g_value_get_object (gst_structure_id_get_value (config, *allocator = g_value_get_object (gst_structure_get_value (config,
GST_QUARK (ALLOCATOR))); "allocator"));
if (params) { if (params) {
GstAllocationParams *p; GstAllocationParams *p;
p = g_value_get_boxed (gst_structure_id_get_value (config, p = g_value_get_boxed (gst_structure_get_value (config, "params"));
GST_QUARK (PARAMS)));
if (p) { if (p) {
*params = *p; *params = *p;
} else { } else {

View file

@ -68,6 +68,7 @@
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS #define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
#include "gst_private.h" #include "gst_private.h"
#include "gstidstr-private.h"
#include <gst/gst.h> #include <gst/gst.h>
#include <gobject/gvaluecollector.h> #include <gobject/gvaluecollector.h>
@ -1217,7 +1218,7 @@ gst_caps_is_empty (const GstCaps * caps)
} }
static gboolean static gboolean
gst_caps_is_fixed_foreach (GQuark field_id, const GValue * value, gst_caps_is_fixed_foreach (const GstIdStr * field, const GValue * value,
gpointer unused) gpointer unused)
{ {
return gst_value_is_fixed (value); return gst_value_is_fixed (value);
@ -1254,7 +1255,7 @@ gst_caps_is_fixed (const GstCaps * caps)
structure = gst_caps_get_structure_unchecked (caps, 0); structure = gst_caps_get_structure_unchecked (caps, 0);
return gst_structure_foreach (structure, gst_caps_is_fixed_foreach, NULL); return gst_structure_foreach_id_str (structure, gst_caps_is_fixed_foreach, NULL);
} }
/** /**
@ -1810,7 +1811,7 @@ typedef struct
} SubtractionEntry; } SubtractionEntry;
static gboolean static gboolean
gst_caps_structure_subtract_field (GQuark field_id, const GValue * value, gst_caps_structure_subtract_field (const GstIdStr * field, const GValue * value,
gpointer user_data) gpointer user_data)
{ {
SubtractionEntry *e = user_data; SubtractionEntry *e = user_data;
@ -1818,7 +1819,7 @@ gst_caps_structure_subtract_field (GQuark field_id, const GValue * value,
const GValue *other; const GValue *other;
GstStructure *structure; GstStructure *structure;
other = gst_structure_id_get_value (e->subtract_from, field_id); other = gst_structure_id_str_get_value (e->subtract_from, field);
if (!other) { if (!other) {
return FALSE; return FALSE;
@ -1832,7 +1833,7 @@ gst_caps_structure_subtract_field (GQuark field_id, const GValue * value,
return FALSE; return FALSE;
} else { } else {
structure = gst_structure_copy (e->subtract_from); structure = gst_structure_copy (e->subtract_from);
gst_structure_id_take_value (structure, field_id, &subtraction); gst_structure_id_str_take_value (structure, field, &subtraction);
e->put_into = g_slist_prepend (e->put_into, structure); e->put_into = g_slist_prepend (e->put_into, structure);
return TRUE; return TRUE;
} }
@ -1847,7 +1848,7 @@ gst_caps_structure_subtract (GSList ** into, const GstStructure * minuend,
e.subtract_from = minuend; e.subtract_from = minuend;
e.put_into = NULL; e.put_into = NULL;
ret = gst_structure_foreach ((GstStructure *) subtrahend, ret = gst_structure_foreach_id_str ((GstStructure *) subtrahend,
gst_caps_structure_subtract_field, &e); gst_caps_structure_subtract_field, &e);
if (ret) { if (ret) {
@ -1972,7 +1973,7 @@ typedef struct _NormalizeForeach
} NormalizeForeach; } NormalizeForeach;
static gboolean static gboolean
gst_caps_normalize_foreach (GQuark field_id, const GValue * value, gpointer ptr) gst_caps_normalize_foreach (const GstIdStr * field, const GValue * value, gpointer ptr)
{ {
NormalizeForeach *nf = (NormalizeForeach *) ptr; NormalizeForeach *nf = (NormalizeForeach *) ptr;
GValue val = { 0 }; GValue val = { 0 };
@ -1985,13 +1986,13 @@ gst_caps_normalize_foreach (GQuark field_id, const GValue * value, gpointer ptr)
const GValue *v = gst_value_list_get_value (value, i); const GValue *v = gst_value_list_get_value (value, i);
GstStructure *structure = gst_structure_copy (nf->structure); GstStructure *structure = gst_structure_copy (nf->structure);
gst_structure_id_set_value (structure, field_id, v); gst_structure_id_str_set_value (structure, field, v);
gst_caps_append_structure_unchecked (nf->caps, structure, gst_caps_append_structure_unchecked (nf->caps, structure,
gst_caps_features_copy_conditional (nf->features)); gst_caps_features_copy_conditional (nf->features));
} }
gst_value_init_and_copy (&val, gst_value_list_get_value (value, 0)); gst_value_init_and_copy (&val, gst_value_list_get_value (value, 0));
gst_structure_id_take_value (nf->structure, field_id, &val); gst_structure_id_str_take_value (nf->structure, field, &val);
return FALSE; return FALSE;
} }
@ -2026,7 +2027,7 @@ gst_caps_normalize (GstCaps * caps)
for (i = 0; i < gst_caps_get_size (nf.caps); i++) { for (i = 0; i < gst_caps_get_size (nf.caps); i++) {
nf.structure = gst_caps_get_structure_unchecked (nf.caps, i); nf.structure = gst_caps_get_structure_unchecked (nf.caps, i);
nf.features = gst_caps_get_features_unchecked (nf.caps, i); nf.features = gst_caps_get_features_unchecked (nf.caps, i);
while (!gst_structure_foreach (nf.structure, while (!gst_structure_foreach_id_str (nf.structure,
gst_caps_normalize_foreach, &nf)); gst_caps_normalize_foreach, &nf));
} }
@ -2053,20 +2054,20 @@ gst_caps_compare_structures (gconstpointer one, gconstpointer two)
typedef struct typedef struct
{ {
GQuark name; GstIdStr name;
GValue value; GValue value;
GstStructure *compare; GstStructure *compare;
} UnionField; } UnionField;
static gboolean static gboolean
gst_caps_structure_figure_out_union (GQuark field_id, const GValue * value, gst_caps_structure_figure_out_union (const GstIdStr * field, const GValue * value,
gpointer user_data) gpointer user_data)
{ {
UnionField *u = user_data; UnionField *u = user_data;
const GValue *val = gst_structure_id_get_value (u->compare, field_id); const GValue *val = gst_structure_id_str_get_value (u->compare, field);
if (!val) { if (!val) {
if (u->name) if (G_VALUE_TYPE (&u->value) != G_TYPE_INVALID)
g_value_unset (&u->value); g_value_unset (&u->value);
return FALSE; return FALSE;
} }
@ -2074,12 +2075,12 @@ gst_caps_structure_figure_out_union (GQuark field_id, const GValue * value,
if (gst_value_compare (val, value) == GST_VALUE_EQUAL) if (gst_value_compare (val, value) == GST_VALUE_EQUAL)
return TRUE; return TRUE;
if (u->name) { if (G_VALUE_TYPE (&u->value) != G_TYPE_INVALID) {
g_value_unset (&u->value); g_value_unset (&u->value);
return FALSE; return FALSE;
} }
u->name = field_id; gst_id_str_copy_into (&u->name, field);
gst_value_union (&u->value, val, value); gst_value_union (&u->value, val, value);
return TRUE; return TRUE;
@ -2090,7 +2091,7 @@ gst_caps_structure_simplify (GstStructure ** result,
GstStructure * simplify, GstStructure * compare) GstStructure * simplify, GstStructure * compare)
{ {
GSList *list; GSList *list;
UnionField field = { 0, {0,}, NULL }; UnionField field = { GST_ID_STR_INIT, G_VALUE_INIT, NULL };
/* try to subtract to get a real subset */ /* try to subtract to get a real subset */
if (gst_caps_structure_subtract (&list, simplify, compare)) { if (gst_caps_structure_subtract (&list, simplify, compare)) {
@ -2110,7 +2111,7 @@ gst_caps_structure_simplify (GstStructure ** result,
/* try to union both structs */ /* try to union both structs */
field.compare = compare; field.compare = compare;
if (gst_structure_foreach (simplify, if (gst_structure_foreach_id_str (simplify,
gst_caps_structure_figure_out_union, &field)) { gst_caps_structure_figure_out_union, &field)) {
gboolean ret = FALSE; gboolean ret = FALSE;
@ -2118,7 +2119,7 @@ gst_caps_structure_simplify (GstStructure ** result,
* but at most one field: field.name */ * but at most one field: field.name */
if (G_IS_VALUE (&field.value)) { if (G_IS_VALUE (&field.value)) {
if (gst_structure_n_fields (simplify) == gst_structure_n_fields (compare)) { if (gst_structure_n_fields (simplify) == gst_structure_n_fields (compare)) {
gst_structure_id_take_value (compare, field.name, &field.value); gst_structure_id_str_take_value (compare, &field.name, &field.value);
*result = NULL; *result = NULL;
ret = TRUE; ret = TRUE;
} else { } else {

View file

@ -62,6 +62,7 @@
#include "gstpad.h" #include "gstpad.h"
#include "gstutils.h" #include "gstutils.h"
#include "gstvalue.h" #include "gstvalue.h"
#include "gstidstr-private.h"
/*** PIPELINE GRAPHS **********************************************************/ /*** PIPELINE GRAPHS **********************************************************/
@ -375,14 +376,14 @@ debug_dump_element_pad (GstPad * pad, GstElement * element,
} }
static gboolean static gboolean
string_append_field (GQuark field, const GValue * value, gpointer ptr) string_append_field (const GstIdStr * field, const GValue * value, gpointer ptr)
{ {
GString *str = (GString *) ptr; GString *str = (GString *) ptr;
gchar *value_str = gst_value_serialize (value); gchar *value_str = gst_value_serialize (value);
gchar *esc_value_str; gchar *esc_value_str;
if (value_str == NULL) { if (value_str == NULL) {
g_string_append_printf (str, " %18s: NULL\\l", g_quark_to_string (field)); g_string_append_printf (str, " %18s: NULL\\l", gst_id_str_as_str (field));
return TRUE; return TRUE;
} }
@ -413,7 +414,7 @@ string_append_field (GQuark field, const GValue * value, gpointer ptr)
} }
esc_value_str = g_strescape (value_str, NULL); esc_value_str = g_strescape (value_str, NULL);
g_string_append_printf (str, " %18s: %s\\l", g_quark_to_string (field), g_string_append_printf (str, " %18s: %s\\l", gst_id_str_as_str (field),
esc_value_str); esc_value_str);
g_free (value_str); g_free (value_str);
@ -457,7 +458,8 @@ debug_dump_describe_caps (GstCaps * caps, GstDebugGraphDetails details)
} }
g_string_append (str, "\\l"); g_string_append (str, "\\l");
gst_structure_foreach (structure, string_append_field, (gpointer) str); gst_structure_foreach_id_str (structure, string_append_field,
(gpointer) str);
} }
media = g_string_free (str, FALSE); media = g_string_free (str, FALSE);

View file

@ -279,11 +279,11 @@ gst_device_provider_class_set_metadata (GstDeviceProviderClass * klass,
g_return_if_fail (description != NULL && *description != '\0'); g_return_if_fail (description != NULL && *description != '\0');
g_return_if_fail (author != NULL && *author != '\0'); g_return_if_fail (author != NULL && *author != '\0');
gst_structure_id_set ((GstStructure *) klass->metadata, gst_structure_set_static_str ((GstStructure *) klass->metadata,
GST_QUARK (ELEMENT_METADATA_LONGNAME), G_TYPE_STRING, longname, GST_ELEMENT_METADATA_LONGNAME, G_TYPE_STRING, longname,
GST_QUARK (ELEMENT_METADATA_KLASS), G_TYPE_STRING, classification, GST_ELEMENT_METADATA_KLASS, G_TYPE_STRING, classification,
GST_QUARK (ELEMENT_METADATA_DESCRIPTION), G_TYPE_STRING, description, GST_ELEMENT_METADATA_DESCRIPTION, G_TYPE_STRING, description,
GST_QUARK (ELEMENT_METADATA_AUTHOR), G_TYPE_STRING, author, NULL); GST_ELEMENT_METADATA_AUTHOR, G_TYPE_STRING, author, NULL);
} }
/** /**
@ -327,17 +327,17 @@ gst_device_provider_class_set_static_metadata (GstDeviceProviderClass * klass,
g_value_init (&val, G_TYPE_STRING); g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, longname); g_value_set_static_string (&val, longname);
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_LONGNAME), &val); gst_structure_set_value_static_str (s, GST_ELEMENT_METADATA_LONGNAME, &val);
g_value_set_static_string (&val, classification); g_value_set_static_string (&val, classification);
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_KLASS), &val); gst_structure_set_value_static_str (s, GST_ELEMENT_METADATA_KLASS, &val);
g_value_set_static_string (&val, description); g_value_set_static_string (&val, description);
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_DESCRIPTION), gst_structure_set_value_static_str (s, GST_ELEMENT_METADATA_DESCRIPTION,
&val); &val);
g_value_set_static_string (&val, author); g_value_set_static_string (&val, author);
gst_structure_id_take_value (s, GST_QUARK (ELEMENT_METADATA_AUTHOR), &val); gst_structure_set_value_static_str (s, GST_ELEMENT_METADATA_AUTHOR, &val);
} }
/** /**

View file

@ -1659,11 +1659,11 @@ gst_element_class_set_metadata (GstElementClass * klass,
g_return_if_fail (description != NULL && *description != '\0'); g_return_if_fail (description != NULL && *description != '\0');
g_return_if_fail (author != NULL && *author != '\0'); g_return_if_fail (author != NULL && *author != '\0');
gst_structure_id_set ((GstStructure *) klass->metadata, gst_structure_set_static_str ((GstStructure *) klass->metadata,
GST_QUARK (ELEMENT_METADATA_LONGNAME), G_TYPE_STRING, longname, GST_ELEMENT_METADATA_LONGNAME, G_TYPE_STRING, longname,
GST_QUARK (ELEMENT_METADATA_KLASS), G_TYPE_STRING, classification, GST_ELEMENT_METADATA_KLASS, G_TYPE_STRING, classification,
GST_QUARK (ELEMENT_METADATA_DESCRIPTION), G_TYPE_STRING, description, GST_ELEMENT_METADATA_DESCRIPTION, G_TYPE_STRING, description,
GST_QUARK (ELEMENT_METADATA_AUTHOR), G_TYPE_STRING, author, NULL); GST_ELEMENT_METADATA_AUTHOR, G_TYPE_STRING, author, NULL);
} }
/** /**
@ -1704,17 +1704,17 @@ gst_element_class_set_static_metadata (GstElementClass * klass,
g_value_init (&val, G_TYPE_STRING); g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, longname); g_value_set_static_string (&val, longname);
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_LONGNAME), &val); gst_structure_set_value_static_str (s, GST_ELEMENT_METADATA_LONGNAME, &val);
g_value_set_static_string (&val, classification); g_value_set_static_string (&val, classification);
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_KLASS), &val); gst_structure_set_value_static_str (s, GST_ELEMENT_METADATA_KLASS, &val);
g_value_set_static_string (&val, description); g_value_set_static_string (&val, description);
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_DESCRIPTION), gst_structure_set_value_static_str (s, GST_ELEMENT_METADATA_DESCRIPTION,
&val); &val);
g_value_set_static_string (&val, author); g_value_set_static_string (&val, author);
gst_structure_id_take_value (s, GST_QUARK (ELEMENT_METADATA_AUTHOR), &val); gst_structure_take_value_static_str (s, GST_ELEMENT_METADATA_AUTHOR, &val);
} }
/** /**

View file

@ -79,7 +79,6 @@
#include "gstevent.h" #include "gstevent.h"
#include "gstenumtypes.h" #include "gstenumtypes.h"
#include "gstutils.h" #include "gstutils.h"
#include "gstquark.h"
#include "gstvalue.h" #include "gstvalue.h"
GType _gst_event_type = 0; GType _gst_event_type = 0;
@ -630,8 +629,7 @@ gst_event_parse_flush_stop (GstEvent * event, gboolean * reset_time)
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
if (G_LIKELY (reset_time)) if (G_LIKELY (reset_time))
*reset_time = *reset_time =
g_value_get_boolean (gst_structure_id_get_value (structure, g_value_get_boolean (gst_structure_get_value (structure, "reset-time"));
GST_QUARK (RESET_TIME)));
} }
/** /**
@ -675,7 +673,7 @@ gst_event_new_select_streams (GList * streams)
g_value_set_string (&strval, str); g_value_set_string (&strval, str);
gst_value_list_append_and_take_value (&val, &strval); gst_value_list_append_and_take_value (&val, &strval);
} }
gst_structure_id_take_value (struc, GST_QUARK (STREAMS), &val); gst_structure_take_value (struc, "streams", &val);
event = gst_event_new_custom (GST_EVENT_SELECT_STREAMS, struc); event = gst_event_new_custom (GST_EVENT_SELECT_STREAMS, struc);
return event; return event;
@ -701,8 +699,7 @@ gst_event_parse_select_streams (GstEvent * event, GList ** streams)
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
if (G_LIKELY (streams)) { if (G_LIKELY (streams)) {
const GValue *vlist = const GValue *vlist = gst_structure_get_value (structure, "streams");
gst_structure_id_get_value (structure, GST_QUARK (STREAMS));
guint i, sz = gst_value_list_get_size (vlist); guint i, sz = gst_value_list_get_size (vlist);
for (i = 0; i < sz; i++) { for (i = 0; i < sz; i++) {
const GValue *strv = gst_value_list_get_value (vlist, i); const GValue *strv = gst_value_list_get_value (vlist, i);
@ -761,8 +758,8 @@ gst_event_parse_stream_group_done (GstEvent * event, guint * group_id)
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_GROUP_DONE); g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_GROUP_DONE);
if (group_id) { if (group_id) {
gst_structure_id_get (GST_EVENT_STRUCTURE (event), gst_structure_get (GST_EVENT_STRUCTURE (event),
GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, NULL); "group-id", G_TYPE_UINT, group_id, NULL);
} }
} }
@ -844,9 +841,9 @@ gst_event_parse_gap (GstEvent * event, GstClockTime * timestamp,
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_GAP); g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_GAP);
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
gst_structure_id_get (structure, gst_structure_get (structure,
GST_QUARK (TIMESTAMP), GST_TYPE_CLOCK_TIME, timestamp, "timestamp", GST_TYPE_CLOCK_TIME, timestamp,
GST_QUARK (DURATION), GST_TYPE_CLOCK_TIME, duration, NULL); "duration", GST_TYPE_CLOCK_TIME, duration, NULL);
} }
/** /**
@ -866,8 +863,8 @@ gst_event_set_gap_flags (GstEvent * event, GstGapFlags flags)
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_GAP); g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_GAP);
g_return_if_fail (gst_event_is_writable (event)); g_return_if_fail (gst_event_is_writable (event));
gst_structure_id_set (GST_EVENT_STRUCTURE (event), gst_structure_set (GST_EVENT_STRUCTURE (event),
GST_QUARK (GAP_FLAGS), GST_TYPE_GAP_FLAGS, flags, NULL); "gap-flags", GST_TYPE_GAP_FLAGS, flags, NULL);
} }
/** /**
@ -890,8 +887,8 @@ gst_event_parse_gap_flags (GstEvent * event, GstGapFlags * flags)
if (flags) if (flags)
*flags = 0; *flags = 0;
gst_structure_id_get (GST_EVENT_STRUCTURE (event), gst_structure_get (GST_EVENT_STRUCTURE (event),
GST_QUARK (GAP_FLAGS), GST_TYPE_GAP_FLAGS, flags, NULL); "gap-flags", GST_TYPE_GAP_FLAGS, flags, NULL);
} }
/** /**
@ -939,9 +936,7 @@ gst_event_parse_caps (GstEvent * event, GstCaps ** caps)
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
if (G_LIKELY (caps)) if (G_LIKELY (caps))
*caps = *caps = g_value_get_boxed (gst_structure_get_value (structure, "caps"));
g_value_get_boxed (gst_structure_id_get_value (structure,
GST_QUARK (CAPS)));
} }
/** /**
@ -1021,8 +1016,8 @@ gst_event_parse_segment (GstEvent * event, const GstSegment ** segment)
if (segment) { if (segment) {
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
*segment = g_value_get_boxed (gst_structure_id_get_value (structure, *segment = g_value_get_boxed (gst_structure_get_value (structure,
GST_QUARK (SEGMENT))); "segment"));
} }
} }
@ -1076,7 +1071,7 @@ gst_event_new_tag (GstTagList * taglist)
(taglist)]); (taglist)]);
g_value_init (&val, GST_TYPE_TAG_LIST); g_value_init (&val, GST_TYPE_TAG_LIST);
g_value_take_boxed (&val, taglist); g_value_take_boxed (&val, taglist);
gst_structure_id_take_value (s, GST_QUARK (TAGLIST), &val); gst_structure_take_value (s, "taglist", &val);
return gst_event_new_custom (GST_EVENT_TAG, s); return gst_event_new_custom (GST_EVENT_TAG, s);
} }
@ -1098,8 +1093,7 @@ gst_event_parse_tag (GstEvent * event, GstTagList ** taglist)
g_return_if_fail (GST_IS_EVENT (event)); g_return_if_fail (GST_IS_EVENT (event));
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_TAG); g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_TAG);
val = gst_structure_id_get_value (GST_EVENT_STRUCTURE (event), val = gst_structure_get_value (GST_EVENT_STRUCTURE (event), "taglist");
GST_QUARK (TAGLIST));
if (taglist) if (taglist)
*taglist = (GstTagList *) g_value_get_boxed (val); *taglist = (GstTagList *) g_value_get_boxed (val);
@ -1163,20 +1157,15 @@ gst_event_parse_buffer_size (GstEvent * event, GstFormat * format,
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
if (format) if (format)
*format = (GstFormat) *format = (GstFormat)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "format"));
GST_QUARK (FORMAT)));
if (minsize) if (minsize)
*minsize = *minsize =
g_value_get_int64 (gst_structure_id_get_value (structure, g_value_get_int64 (gst_structure_get_value (structure, "minsize"));
GST_QUARK (MINSIZE)));
if (maxsize) if (maxsize)
*maxsize = *maxsize =
g_value_get_int64 (gst_structure_id_get_value (structure, g_value_get_int64 (gst_structure_get_value (structure, "maxsize"));
GST_QUARK (MAXSIZE)));
if (async) if (async)
*async = *async = g_value_get_boolean (gst_structure_get_value (structure, "async"));
g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (ASYNC)));
} }
/** /**
@ -1280,25 +1269,20 @@ gst_event_parse_qos (GstEvent * event, GstQOSType * type,
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
if (type) if (type)
*type = (GstQOSType) *type = (GstQOSType)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "type"));
GST_QUARK (TYPE)));
if (proportion) if (proportion)
*proportion = *proportion =
g_value_get_double (gst_structure_id_get_value (structure, g_value_get_double (gst_structure_get_value (structure, "proportion"));
GST_QUARK (PROPORTION)));
if (diff) if (diff)
*diff = *diff = g_value_get_int64 (gst_structure_get_value (structure, "diff"));
g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (DIFF)));
if (timestamp) { if (timestamp) {
gint64 offset = gst_event_get_running_time_offset (event); gint64 offset = gst_event_get_running_time_offset (event);
GstClockTimeDiff diff_ = GstClockTimeDiff diff_ =
g_value_get_int64 (gst_structure_id_get_value (structure, g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (DIFF))); "diff"));
*timestamp = *timestamp =
g_value_get_uint64 (gst_structure_id_get_value (structure, g_value_get_uint64 (gst_structure_get_value (structure, "timestamp"));
GST_QUARK (TIMESTAMP)));
/* Catch underflows */ /* Catch underflows */
if (*timestamp > -offset) if (*timestamp > -offset)
*timestamp += offset; *timestamp += offset;
@ -1436,33 +1420,23 @@ gst_event_parse_seek (GstEvent * event, gdouble * rate,
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
if (rate) if (rate)
*rate = *rate = g_value_get_double (gst_structure_get_value (structure, "rate"));
g_value_get_double (gst_structure_id_get_value (structure,
GST_QUARK (RATE)));
if (format) if (format)
*format = (GstFormat) *format = (GstFormat)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "format"));
GST_QUARK (FORMAT)));
if (flags) if (flags)
*flags = (GstSeekFlags) *flags = (GstSeekFlags)
g_value_get_flags (gst_structure_id_get_value (structure, g_value_get_flags (gst_structure_get_value (structure, "flags"));
GST_QUARK (FLAGS)));
if (start_type) if (start_type)
*start_type = (GstSeekType) *start_type = (GstSeekType)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "cur-type"));
GST_QUARK (CUR_TYPE)));
if (start) if (start)
*start = *start = g_value_get_int64 (gst_structure_get_value (structure, "cur"));
g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (CUR)));
if (stop_type) if (stop_type)
*stop_type = (GstSeekType) *stop_type = (GstSeekType)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "stop-type"));
GST_QUARK (STOP_TYPE)));
if (stop) if (stop)
*stop = *stop = g_value_get_int64 (gst_structure_get_value (structure, "stop"));
g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (STOP)));
} }
/** /**
@ -1482,8 +1456,8 @@ gst_event_set_seek_trickmode_interval (GstEvent * event, GstClockTime interval)
g_return_if_fail (gst_event_is_writable (event)); g_return_if_fail (gst_event_is_writable (event));
g_return_if_fail (GST_CLOCK_TIME_IS_VALID (interval)); g_return_if_fail (GST_CLOCK_TIME_IS_VALID (interval));
gst_structure_id_set (GST_EVENT_STRUCTURE (event), gst_structure_set_static_str (GST_EVENT_STRUCTURE (event),
GST_QUARK (TRICKMODE_INTERVAL), GST_TYPE_CLOCK_TIME, interval, NULL); "trickmode-interval", GST_TYPE_CLOCK_TIME, interval, NULL);
} }
/** /**
@ -1506,8 +1480,8 @@ gst_event_parse_seek_trickmode_interval (GstEvent * event,
if (interval) if (interval)
*interval = GST_CLOCK_TIME_NONE; *interval = GST_CLOCK_TIME_NONE;
gst_structure_id_get (GST_EVENT_STRUCTURE (event), gst_structure_get (GST_EVENT_STRUCTURE (event),
GST_QUARK (TRICKMODE_INTERVAL), GST_TYPE_CLOCK_TIME, interval, NULL); "trickmode-interval", GST_TYPE_CLOCK_TIME, interval, NULL);
} }
/** /**
@ -1574,8 +1548,8 @@ gst_event_parse_latency (GstEvent * event, GstClockTime * latency)
if (latency) if (latency)
*latency = *latency =
g_value_get_uint64 (gst_structure_id_get_value (GST_EVENT_STRUCTURE g_value_get_uint64 (gst_structure_get_value (GST_EVENT_STRUCTURE
(event), GST_QUARK (LATENCY))); (event), "latency"));
} }
/** /**
@ -1648,20 +1622,18 @@ gst_event_parse_step (GstEvent * event, GstFormat * format, guint64 * amount,
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
if (format) if (format)
*format = *format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, (GstFormat) g_value_get_enum (gst_structure_get_value (structure,
GST_QUARK (FORMAT))); "format"));
if (amount) if (amount)
*amount = g_value_get_uint64 (gst_structure_id_get_value (structure, *amount = g_value_get_uint64 (gst_structure_get_value (structure,
GST_QUARK (AMOUNT))); "amount"));
if (rate) if (rate)
*rate = g_value_get_double (gst_structure_id_get_value (structure, *rate = g_value_get_double (gst_structure_get_value (structure, "rate"));
GST_QUARK (RATE)));
if (flush) if (flush)
*flush = g_value_get_boolean (gst_structure_id_get_value (structure, *flush = g_value_get_boolean (gst_structure_get_value (structure, "flush"));
GST_QUARK (FLUSH)));
if (intermediate) if (intermediate)
*intermediate = g_value_get_boolean (gst_structure_id_get_value (structure, *intermediate = g_value_get_boolean (gst_structure_get_value (structure,
GST_QUARK (INTERMEDIATE))); "intermediate"));
} }
/** /**
@ -1736,8 +1708,8 @@ gst_event_parse_sink_message (GstEvent * event, GstMessage ** msg)
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
if (msg) if (msg)
*msg = *msg =
GST_MESSAGE (g_value_dup_boxed (gst_structure_id_get_value GST_MESSAGE (g_value_dup_boxed (gst_structure_get_value
(structure, GST_QUARK (MESSAGE)))); (structure, "message")));
} }
/** /**
@ -1802,7 +1774,7 @@ gst_event_parse_stream_start (GstEvent * event, const gchar ** stream_id)
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START); g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START);
structure = gst_event_get_structure (event); structure = gst_event_get_structure (event);
val = gst_structure_id_get_value (structure, GST_QUARK (STREAM_ID)); val = gst_structure_get_value (structure, "stream-id");
if (stream_id) if (stream_id)
*stream_id = g_value_get_string (val); *stream_id = g_value_get_string (val);
@ -1824,8 +1796,8 @@ gst_event_set_stream (GstEvent * event, GstStream * stream)
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START); g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START);
g_return_if_fail (gst_event_is_writable (event)); g_return_if_fail (gst_event_is_writable (event));
gst_structure_id_set (GST_EVENT_STRUCTURE (event), gst_structure_set (GST_EVENT_STRUCTURE (event),
GST_QUARK (STREAM), GST_TYPE_STREAM, stream, NULL); "stream", GST_TYPE_STREAM, stream, NULL);
} }
/** /**
@ -1845,8 +1817,8 @@ gst_event_parse_stream (GstEvent * event, GstStream ** stream)
if (stream) { if (stream) {
*stream = NULL; *stream = NULL;
gst_structure_id_get (GST_EVENT_STRUCTURE (event), gst_structure_get (GST_EVENT_STRUCTURE (event),
GST_QUARK (STREAM), GST_TYPE_STREAM, stream, NULL); "stream", GST_TYPE_STREAM, stream, NULL);
} }
} }
@ -1864,8 +1836,8 @@ gst_event_set_stream_flags (GstEvent * event, GstStreamFlags flags)
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START); g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START);
g_return_if_fail (gst_event_is_writable (event)); g_return_if_fail (gst_event_is_writable (event));
gst_structure_id_set (GST_EVENT_STRUCTURE (event), gst_structure_set (GST_EVENT_STRUCTURE (event),
GST_QUARK (FLAGS), GST_TYPE_STREAM_FLAGS, flags, NULL); "flags", GST_TYPE_STREAM_FLAGS, flags, NULL);
} }
/** /**
@ -1883,8 +1855,8 @@ gst_event_parse_stream_flags (GstEvent * event, GstStreamFlags * flags)
if (flags) { if (flags) {
*flags = 0; *flags = 0;
gst_structure_id_get (GST_EVENT_STRUCTURE (event), gst_structure_get (GST_EVENT_STRUCTURE (event),
GST_QUARK (FLAGS), GST_TYPE_STREAM_FLAGS, flags, NULL); "flags", GST_TYPE_STREAM_FLAGS, flags, NULL);
} }
} }
@ -1911,8 +1883,8 @@ gst_event_set_group_id (GstEvent * event, guint group_id)
g_return_if_fail (gst_event_is_writable (event)); g_return_if_fail (gst_event_is_writable (event));
g_return_if_fail (group_id != GST_GROUP_ID_INVALID); g_return_if_fail (group_id != GST_GROUP_ID_INVALID);
gst_structure_id_set (GST_EVENT_STRUCTURE (event), gst_structure_set (GST_EVENT_STRUCTURE (event),
GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, NULL); "group-id", G_TYPE_UINT, group_id, NULL);
} }
/** /**
@ -1934,8 +1906,8 @@ gst_event_parse_group_id (GstEvent * event, guint * group_id)
if (group_id) { if (group_id) {
*group_id = 0; *group_id = 0;
return gst_structure_id_get (GST_EVENT_STRUCTURE (event), return gst_structure_get (GST_EVENT_STRUCTURE (event),
GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, NULL); "group-id", G_TYPE_UINT, group_id, NULL);
} }
return TRUE; return TRUE;
@ -1993,8 +1965,8 @@ gst_event_parse_stream_collection (GstEvent * event,
structure = gst_event_get_structure (event); structure = gst_event_get_structure (event);
if (collection) { if (collection) {
gst_structure_id_get (structure, gst_structure_get (structure,
GST_QUARK (COLLECTION), GST_TYPE_STREAM_COLLECTION, collection, NULL); "collection", GST_TYPE_STREAM_COLLECTION, collection, NULL);
} }
} }
@ -2050,9 +2022,8 @@ gst_event_parse_toc (GstEvent * event, GstToc ** toc, gboolean * updated)
structure = gst_event_get_structure (event); structure = gst_event_get_structure (event);
gst_structure_id_get (structure, gst_structure_get (structure,
GST_QUARK (TOC), GST_TYPE_TOC, toc, "toc", GST_TYPE_TOC, toc, "updated", G_TYPE_BOOLEAN, updated, NULL);
GST_QUARK (UPDATED), G_TYPE_BOOLEAN, updated, NULL);
} }
/** /**
@ -2097,7 +2068,7 @@ gst_event_parse_toc_select (GstEvent * event, gchar ** uid)
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_TOC_SELECT); g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_TOC_SELECT);
structure = gst_event_get_structure (event); structure = gst_event_get_structure (event);
val = gst_structure_id_get_value (structure, GST_QUARK (UID)); val = gst_structure_get_value (structure, "uid");
if (uid != NULL) if (uid != NULL)
*uid = g_value_dup_string (val); *uid = g_value_dup_string (val);
@ -2264,11 +2235,11 @@ gst_event_parse_segment_done (GstEvent * event, GstFormat * format,
structure = gst_event_get_structure (event); structure = gst_event_get_structure (event);
val = gst_structure_id_get_value (structure, GST_QUARK (FORMAT)); val = gst_structure_get_value (structure, "format");
if (format != NULL) if (format != NULL)
*format = g_value_get_enum (val); *format = g_value_get_enum (val);
val = gst_structure_id_get_value (structure, GST_QUARK (POSITION)); val = gst_structure_get_value (structure, "position");
if (position != NULL) if (position != NULL)
*position = g_value_get_int64 (val); *position = g_value_get_int64 (val);
} }
@ -2335,9 +2306,8 @@ gst_event_parse_instant_rate_change (GstEvent * event,
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_INSTANT_RATE_CHANGE); g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_INSTANT_RATE_CHANGE);
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
gst_structure_id_get (structure, GST_QUARK (RATE), G_TYPE_DOUBLE, gst_structure_get (structure, "rate", G_TYPE_DOUBLE,
rate_multiplier, GST_QUARK (FLAGS), GST_TYPE_SEGMENT_FLAGS, new_flags, rate_multiplier, "flags", GST_TYPE_SEGMENT_FLAGS, new_flags, NULL);
NULL);
} }
/** /**
@ -2414,9 +2384,9 @@ gst_event_parse_instant_rate_sync_time (GstEvent * event,
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_INSTANT_RATE_SYNC_TIME); g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_INSTANT_RATE_SYNC_TIME);
structure = GST_EVENT_STRUCTURE (event); structure = GST_EVENT_STRUCTURE (event);
gst_structure_id_get (structure, GST_QUARK (RATE), G_TYPE_DOUBLE, gst_structure_get (structure, "rate", G_TYPE_DOUBLE,
rate_multiplier, GST_QUARK (RUNNING_TIME), GST_TYPE_CLOCK_TIME, rate_multiplier, "running-time", GST_TYPE_CLOCK_TIME,
running_time, GST_QUARK (UPSTREAM_RUNNING_TIME), GST_TYPE_CLOCK_TIME, running_time, "upstream-running-time", GST_TYPE_CLOCK_TIME,
upstream_running_time, NULL); upstream_running_time, NULL);
} }

View file

@ -46,13 +46,11 @@
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS #define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
#include "gst_private.h" #include "gst_private.h"
#include <string.h> /* memcpy */ #include <string.h> /* memcpy */
#include "gsterror.h"
#include "gstenumtypes.h" #include "gstenumtypes.h"
#include "gstinfo.h" #include "gstinfo.h"
#include "gstmessage.h" #include "gstmessage.h"
#include "gsttaglist.h" #include "gsttaglist.h"
#include "gstutils.h" #include "gstutils.h"
#include "gstquark.h"
#include "gstvalue.h" #include "gstvalue.h"
@ -116,8 +114,6 @@ static GstMessageQuarks message_quarks[] = {
{0, NULL, 0} {0, NULL, 0}
}; };
static GQuark details_quark = 0;
GType _gst_message_type = 0; GType _gst_message_type = 0;
GST_DEFINE_MINI_OBJECT_TYPE (GstMessage, gst_message); GST_DEFINE_MINI_OBJECT_TYPE (GstMessage, gst_message);
@ -132,7 +128,6 @@ _priv_gst_message_initialize (void)
message_quarks[i].quark = message_quarks[i].quark =
g_quark_from_static_string (message_quarks[i].name); g_quark_from_static_string (message_quarks[i].name);
} }
details_quark = g_quark_from_static_string ("details");
_gst_message_type = gst_message_get_type (); _gst_message_type = gst_message_get_type ();
} }
@ -419,8 +414,7 @@ message_set_details (GstMessage * message, GstStructure * details)
} }
g_value_init (&v, GST_TYPE_STRUCTURE); g_value_init (&v, GST_TYPE_STRUCTURE);
g_value_take_boxed (&v, details); g_value_take_boxed (&v, details);
gst_structure_id_take_value (GST_MESSAGE_STRUCTURE (message), details_quark, gst_structure_take_value (GST_MESSAGE_STRUCTURE (message), "details", &v);
&v);
} }
/** /**
@ -441,8 +435,7 @@ gst_message_set_details (GstMessage * message, GstStructure * details)
g_return_if_fail (details); g_return_if_fail (details);
if (GST_MESSAGE_STRUCTURE (message) if (GST_MESSAGE_STRUCTURE (message)
&& gst_structure_id_has_field (GST_MESSAGE_STRUCTURE (message), && gst_structure_has_field (GST_MESSAGE_STRUCTURE (message), "details")) {
details_quark)) {
gst_structure_free (details); gst_structure_free (details);
g_critical ("Message already has details"); g_critical ("Message already has details");
return; return;
@ -466,11 +459,9 @@ message_parse_details (GstMessage * message, GstStructure ** details,
return; return;
if (GST_MESSAGE_STRUCTURE (message) && if (GST_MESSAGE_STRUCTURE (message) &&
gst_structure_id_has_field (GST_MESSAGE_STRUCTURE (message), gst_structure_has_field (GST_MESSAGE_STRUCTURE (message), "details")) {
details_quark)) { const GValue *v = gst_structure_get_value (GST_MESSAGE_STRUCTURE (message),
const GValue *v = "details");
gst_structure_id_get_value (GST_MESSAGE_STRUCTURE (message),
details_quark);
if (v && G_VALUE_TYPE (v) == GST_TYPE_STRUCTURE) { if (v && G_VALUE_TYPE (v) == GST_TYPE_STRUCTURE) {
*details = g_value_get_boxed (v); *details = g_value_get_boxed (v);
} }
@ -856,7 +847,7 @@ gst_message_new_tag (GstObject * src, GstTagList * tag_list)
s = gst_structure_new_static_str_empty ("GstMessageTag"); s = gst_structure_new_static_str_empty ("GstMessageTag");
g_value_init (&val, GST_TYPE_TAG_LIST); g_value_init (&val, GST_TYPE_TAG_LIST);
g_value_take_boxed (&val, tag_list); g_value_take_boxed (&val, tag_list);
gst_structure_id_take_value (s, GST_QUARK (TAGLIST), &val); gst_structure_take_value (s, "taglist", &val);
message = gst_message_new_custom (GST_MESSAGE_TAG, src, s); message = gst_message_new_custom (GST_MESSAGE_TAG, src, s);
return message; return message;
} }
@ -1417,8 +1408,8 @@ gst_message_parse_tag (GstMessage * message, GstTagList ** tag_list)
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG);
g_return_if_fail (tag_list != NULL); g_return_if_fail (tag_list != NULL);
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (TAGLIST), GST_TYPE_TAG_LIST, tag_list, NULL); "taglist", GST_TYPE_TAG_LIST, tag_list, NULL);
} }
/** /**
@ -1439,8 +1430,8 @@ gst_message_parse_buffering (GstMessage * message, gint * percent)
if (percent) if (percent)
*percent = *percent =
g_value_get_int (gst_structure_id_get_value (GST_MESSAGE_STRUCTURE g_value_get_int (gst_structure_get_value (GST_MESSAGE_STRUCTURE
(message), GST_QUARK (BUFFER_PERCENT))); (message), "buffer-percent"));
} }
/** /**
@ -1460,11 +1451,11 @@ gst_message_set_buffering_stats (GstMessage * message, GstBufferingMode mode,
g_return_if_fail (GST_IS_MESSAGE (message)); g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING);
gst_structure_id_set (GST_MESSAGE_STRUCTURE (message), gst_structure_set (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode, "buffering-mode", GST_TYPE_BUFFERING_MODE, mode,
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in, "avg-in-rate", G_TYPE_INT, avg_in,
GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out, "avg-out-rate", G_TYPE_INT, avg_out,
GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL); "buffering-left", G_TYPE_INT64, buffering_left, NULL);
} }
/** /**
@ -1490,18 +1481,18 @@ gst_message_parse_buffering_stats (GstMessage * message,
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
if (mode) if (mode)
*mode = (GstBufferingMode) *mode = (GstBufferingMode)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure,
GST_QUARK (BUFFERING_MODE))); "buffering-mode"));
if (avg_in) if (avg_in)
*avg_in = g_value_get_int (gst_structure_id_get_value (structure, *avg_in = g_value_get_int (gst_structure_get_value (structure,
GST_QUARK (AVG_IN_RATE))); "avg-in-rate"));
if (avg_out) if (avg_out)
*avg_out = g_value_get_int (gst_structure_id_get_value (structure, *avg_out = g_value_get_int (gst_structure_get_value (structure,
GST_QUARK (AVG_OUT_RATE))); "avg-out-rate"));
if (buffering_left) if (buffering_left)
*buffering_left = *buffering_left =
g_value_get_int64 (gst_structure_id_get_value (structure, g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (BUFFERING_LEFT))); "buffering-left"));
} }
/** /**
@ -1546,16 +1537,13 @@ gst_message_parse_state_changed (GstMessage * message,
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
if (oldstate) if (oldstate)
*oldstate = (GstState) *oldstate = (GstState)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "old-state"));
GST_QUARK (OLD_STATE)));
if (newstate) if (newstate)
*newstate = (GstState) *newstate = (GstState)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "new-state"));
GST_QUARK (NEW_STATE)));
if (pending) if (pending)
*pending = (GstState) *pending = (GstState)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "pending-state"));
GST_QUARK (PENDING_STATE)));
} }
/** /**
@ -1581,14 +1569,12 @@ gst_message_parse_clock_provide (GstMessage * message, GstClock ** clock,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_PROVIDE); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_PROVIDE);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
clock_gvalue = gst_structure_id_get_value (structure, GST_QUARK (CLOCK)); clock_gvalue = gst_structure_get_value (structure, "clock");
g_return_if_fail (clock_gvalue != NULL); g_return_if_fail (clock_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK); g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
if (ready) if (ready)
*ready = *ready = g_value_get_boolean (gst_structure_get_value (structure, "ready"));
g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (READY)));
if (clock) if (clock)
*clock = (GstClock *) g_value_get_object (clock_gvalue); *clock = (GstClock *) g_value_get_object (clock_gvalue);
} }
@ -1613,7 +1599,7 @@ gst_message_parse_clock_lost (GstMessage * message, GstClock ** clock)
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_LOST); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_LOST);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
clock_gvalue = gst_structure_id_get_value (structure, GST_QUARK (CLOCK)); clock_gvalue = gst_structure_get_value (structure, "clock");
g_return_if_fail (clock_gvalue != NULL); g_return_if_fail (clock_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK); g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
@ -1642,7 +1628,7 @@ gst_message_parse_new_clock (GstMessage * message, GstClock ** clock)
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_NEW_CLOCK); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_NEW_CLOCK);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
clock_gvalue = gst_structure_id_get_value (structure, GST_QUARK (CLOCK)); clock_gvalue = gst_structure_get_value (structure, "clock");
g_return_if_fail (clock_gvalue != NULL); g_return_if_fail (clock_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK); g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
@ -1674,20 +1660,17 @@ gst_message_parse_structure_change (GstMessage * message,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STRUCTURE_CHANGE); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STRUCTURE_CHANGE);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
owner_gvalue = gst_structure_id_get_value (structure, GST_QUARK (OWNER)); owner_gvalue = gst_structure_get_value (structure, "owner");
g_return_if_fail (owner_gvalue != NULL); g_return_if_fail (owner_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (owner_gvalue) == GST_TYPE_ELEMENT); g_return_if_fail (G_VALUE_TYPE (owner_gvalue) == GST_TYPE_ELEMENT);
if (type) if (type)
*type = (GstStructureChangeType) *type = (GstStructureChangeType)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "type"));
GST_QUARK (TYPE)));
if (owner) if (owner)
*owner = (GstElement *) g_value_get_object (owner_gvalue); *owner = (GstElement *) g_value_get_object (owner_gvalue);
if (busy) if (busy)
*busy = *busy = g_value_get_boolean (gst_structure_get_value (structure, "busy"));
g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (BUSY)));
} }
/** /**
@ -1729,9 +1712,8 @@ gst_message_parse_error (GstMessage * message, GError ** gerror, gchar ** debug)
g_return_if_fail (GST_IS_MESSAGE (message)); g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR);
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (GERROR), G_TYPE_ERROR, gerror, "gerror", G_TYPE_ERROR, gerror, "debug", G_TYPE_STRING, debug, NULL);
GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
} }
/** /**
@ -1753,9 +1735,8 @@ gst_message_parse_warning (GstMessage * message, GError ** gerror,
g_return_if_fail (GST_IS_MESSAGE (message)); g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING);
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (GERROR), G_TYPE_ERROR, gerror, "gerror", G_TYPE_ERROR, gerror, "debug", G_TYPE_STRING, debug, NULL);
GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
} }
/** /**
@ -1776,9 +1757,8 @@ gst_message_parse_info (GstMessage * message, GError ** gerror, gchar ** debug)
g_return_if_fail (GST_IS_MESSAGE (message)); g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_INFO); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_INFO);
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (GERROR), G_TYPE_ERROR, gerror, "gerror", G_TYPE_ERROR, gerror, "debug", G_TYPE_STRING, debug, NULL);
GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
} }
/** /**
@ -1803,12 +1783,10 @@ gst_message_parse_segment_start (GstMessage * message, GstFormat * format,
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
if (format) if (format)
*format = (GstFormat) *format = (GstFormat)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "format"));
GST_QUARK (FORMAT)));
if (position) if (position)
*position = *position =
g_value_get_int64 (gst_structure_id_get_value (structure, g_value_get_int64 (gst_structure_get_value (structure, "position"));
GST_QUARK (POSITION)));
} }
/** /**
@ -1833,12 +1811,10 @@ gst_message_parse_segment_done (GstMessage * message, GstFormat * format,
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
if (format) if (format)
*format = (GstFormat) *format = (GstFormat)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "format"));
GST_QUARK (FORMAT)));
if (position) if (position)
*position = *position =
g_value_get_int64 (gst_structure_id_get_value (structure, g_value_get_int64 (gst_structure_get_value (structure, "position"));
GST_QUARK (POSITION)));
} }
/** /**
@ -1861,8 +1837,8 @@ gst_message_parse_async_done (GstMessage * message, GstClockTime * running_time)
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
if (running_time) if (running_time)
*running_time = *running_time =
g_value_get_uint64 (gst_structure_id_get_value (structure, g_value_get_uint64 (gst_structure_get_value (structure,
GST_QUARK (RUNNING_TIME))); "running-time"));
} }
/** /**
@ -1885,8 +1861,7 @@ gst_message_parse_request_state (GstMessage * message, GstState * state)
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
if (state) if (state)
*state = (GstState) *state = (GstState)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "new-state"));
GST_QUARK (NEW_STATE)));
} }
/** /**
@ -1940,13 +1915,12 @@ gst_message_parse_stream_status (GstMessage * message,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
owner_gvalue = gst_structure_id_get_value (structure, GST_QUARK (OWNER)); owner_gvalue = gst_structure_get_value (structure, "owner");
g_return_if_fail (owner_gvalue != NULL); g_return_if_fail (owner_gvalue != NULL);
if (type) if (type)
*type = (GstStreamStatusType) *type = (GstStreamStatusType)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure, "type"));
GST_QUARK (TYPE)));
if (owner) if (owner)
*owner = (GstElement *) g_value_get_object (owner_gvalue); *owner = (GstElement *) g_value_get_object (owner_gvalue);
} }
@ -1969,7 +1943,7 @@ gst_message_set_stream_status_object (GstMessage * message,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
gst_structure_id_set_value (structure, GST_QUARK (OBJECT), object); gst_structure_set_value_static_str (structure, "object", object);
} }
/** /**
@ -1994,7 +1968,7 @@ gst_message_get_stream_status_object (GstMessage * message)
NULL); NULL);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
result = gst_structure_id_get_value (structure, GST_QUARK (OBJECT)); result = gst_structure_get_value (structure, "object");
return result; return result;
} }
@ -2066,14 +2040,13 @@ gst_message_parse_step_done (GstMessage * message, GstFormat * format,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STEP_DONE); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STEP_DONE);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
gst_structure_id_get (structure, gst_structure_get (structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, "format", GST_TYPE_FORMAT, format,
GST_QUARK (AMOUNT), G_TYPE_UINT64, amount, "amount", G_TYPE_UINT64, amount,
GST_QUARK (RATE), G_TYPE_DOUBLE, rate, "rate", G_TYPE_DOUBLE, rate,
GST_QUARK (FLUSH), G_TYPE_BOOLEAN, flush, "flush", G_TYPE_BOOLEAN, flush,
GST_QUARK (INTERMEDIATE), G_TYPE_BOOLEAN, intermediate, "intermediate", G_TYPE_BOOLEAN, intermediate,
GST_QUARK (DURATION), G_TYPE_UINT64, duration, "duration", G_TYPE_UINT64, duration, "eos", G_TYPE_BOOLEAN, eos, NULL);
GST_QUARK (EOS), G_TYPE_BOOLEAN, eos, NULL);
} }
/** /**
@ -2145,13 +2118,13 @@ gst_message_parse_step_start (GstMessage * message, gboolean * active,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STEP_START); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STEP_START);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
gst_structure_id_get (structure, gst_structure_get (structure,
GST_QUARK (ACTIVE), G_TYPE_BOOLEAN, active, "active", G_TYPE_BOOLEAN, active,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, "format", GST_TYPE_FORMAT, format,
GST_QUARK (AMOUNT), G_TYPE_UINT64, amount, "amount", G_TYPE_UINT64, amount,
GST_QUARK (RATE), G_TYPE_DOUBLE, rate, "rate", G_TYPE_DOUBLE, rate,
GST_QUARK (FLUSH), G_TYPE_BOOLEAN, flush, "flush", G_TYPE_BOOLEAN, flush,
GST_QUARK (INTERMEDIATE), G_TYPE_BOOLEAN, intermediate, NULL); "intermediate", G_TYPE_BOOLEAN, intermediate, NULL);
} }
/** /**
@ -2228,10 +2201,10 @@ gst_message_set_qos_values (GstMessage * message, gint64 jitter,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
gst_structure_id_set (structure, gst_structure_set_static_str (structure,
GST_QUARK (JITTER), G_TYPE_INT64, jitter, "jitter", G_TYPE_INT64, jitter,
GST_QUARK (PROPORTION), G_TYPE_DOUBLE, proportion, "proportion", G_TYPE_DOUBLE, proportion,
GST_QUARK (QUALITY), G_TYPE_INT, quality, NULL); "quality", G_TYPE_INT, quality, NULL);
} }
/** /**
@ -2263,10 +2236,10 @@ gst_message_set_qos_stats (GstMessage * message, GstFormat format,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
gst_structure_id_set (structure, gst_structure_set_static_str (structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, "format", GST_TYPE_FORMAT, format,
GST_QUARK (PROCESSED), G_TYPE_UINT64, processed, "processed", G_TYPE_UINT64, processed,
GST_QUARK (DROPPED), G_TYPE_UINT64, dropped, NULL); "dropped", G_TYPE_UINT64, dropped, NULL);
} }
/** /**
@ -2301,12 +2274,12 @@ gst_message_parse_qos (GstMessage * message, gboolean * live,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
gst_structure_id_get (structure, gst_structure_get (structure,
GST_QUARK (LIVE), G_TYPE_BOOLEAN, live, "live", G_TYPE_BOOLEAN, live,
GST_QUARK (RUNNING_TIME), G_TYPE_UINT64, running_time, "running-time", G_TYPE_UINT64, running_time,
GST_QUARK (STREAM_TIME), G_TYPE_UINT64, stream_time, "stream-time", G_TYPE_UINT64, stream_time,
GST_QUARK (TIMESTAMP), G_TYPE_UINT64, timestamp, "timestamp", G_TYPE_UINT64, timestamp,
GST_QUARK (DURATION), G_TYPE_UINT64, duration, NULL); "duration", G_TYPE_UINT64, duration, NULL);
} }
/** /**
@ -2334,10 +2307,10 @@ gst_message_parse_qos_values (GstMessage * message, gint64 * jitter,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
gst_structure_id_get (structure, gst_structure_get (structure,
GST_QUARK (JITTER), G_TYPE_INT64, jitter, "jitter", G_TYPE_INT64, jitter,
GST_QUARK (PROPORTION), G_TYPE_DOUBLE, proportion, "proportion", G_TYPE_DOUBLE, proportion,
GST_QUARK (QUALITY), G_TYPE_INT, quality, NULL); "quality", G_TYPE_INT, quality, NULL);
} }
/** /**
@ -2370,10 +2343,10 @@ gst_message_parse_qos_stats (GstMessage * message, GstFormat * format,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
gst_structure_id_get (structure, gst_structure_get (structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, "format", GST_TYPE_FORMAT, format,
GST_QUARK (PROCESSED), G_TYPE_UINT64, processed, "processed", G_TYPE_UINT64, processed,
GST_QUARK (DROPPED), G_TYPE_UINT64, dropped, NULL); "dropped", G_TYPE_UINT64, dropped, NULL);
} }
/** /**
@ -2434,10 +2407,9 @@ gst_message_parse_progress (GstMessage * message, GstProgressType * type,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_PROGRESS); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_PROGRESS);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
gst_structure_id_get (structure, gst_structure_get (structure,
GST_QUARK (TYPE), GST_TYPE_PROGRESS_TYPE, type, "type", GST_TYPE_PROGRESS_TYPE, type,
GST_QUARK (CODE), G_TYPE_STRING, code, "code", G_TYPE_STRING, code, "text", G_TYPE_STRING, text, NULL);
GST_QUARK (TEXT), G_TYPE_STRING, text, NULL);
} }
/** /**
@ -2485,9 +2457,8 @@ gst_message_parse_toc (GstMessage * message, GstToc ** toc, gboolean * updated)
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TOC); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TOC);
g_return_if_fail (toc != NULL); g_return_if_fail (toc != NULL);
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (TOC), GST_TYPE_TOC, toc, "toc", GST_TYPE_TOC, toc, "updated", G_TYPE_BOOLEAN, updated, NULL);
GST_QUARK (UPDATED), G_TYPE_BOOLEAN, updated, NULL);
} }
/** /**
@ -2538,8 +2509,8 @@ gst_message_parse_reset_time (GstMessage * message, GstClockTime * running_time)
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
if (running_time) if (running_time)
*running_time = *running_time =
g_value_get_uint64 (gst_structure_id_get_value (structure, g_value_get_uint64 (gst_structure_get_value (structure,
GST_QUARK (RUNNING_TIME))); "running-time"));
} }
/** /**
@ -2595,8 +2566,7 @@ gst_message_set_group_id (GstMessage * message, guint group_id)
g_return_if_fail (group_id != GST_GROUP_ID_INVALID); g_return_if_fail (group_id != GST_GROUP_ID_INVALID);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
gst_structure_id_set (structure, GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, gst_structure_set (structure, "group-id", G_TYPE_UINT, group_id, NULL);
NULL);
} }
/** /**
@ -2630,7 +2600,7 @@ gst_message_parse_group_id (GstMessage * message, guint * group_id)
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
v = gst_structure_id_get_value (structure, GST_QUARK (GROUP_ID)); v = gst_structure_get_value (structure, "group-id");
if (!v) if (!v)
return FALSE; return FALSE;
@ -2690,7 +2660,7 @@ gst_message_parse_context_type (GstMessage * message,
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
if (context_type) { if (context_type) {
value = gst_structure_id_get_value (structure, GST_QUARK (CONTEXT_TYPE)); value = gst_structure_get_value (structure, "context-type");
*context_type = g_value_get_string (value); *context_type = g_value_get_string (value);
} }
@ -2743,8 +2713,8 @@ gst_message_parse_have_context (GstMessage * message, GstContext ** context)
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_HAVE_CONTEXT); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_HAVE_CONTEXT);
if (context) if (context)
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (CONTEXT), GST_TYPE_CONTEXT, context, NULL); "context", GST_TYPE_CONTEXT, context, NULL);
} }
/** /**
@ -2795,8 +2765,8 @@ gst_message_parse_device_added (GstMessage * message, GstDevice ** device)
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DEVICE_ADDED); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DEVICE_ADDED);
if (device) if (device)
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (DEVICE), GST_TYPE_DEVICE, device, NULL); "device", GST_TYPE_DEVICE, device, NULL);
} }
/** /**
@ -2847,8 +2817,8 @@ gst_message_parse_device_removed (GstMessage * message, GstDevice ** device)
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DEVICE_REMOVED); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DEVICE_REMOVED);
if (device) if (device)
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (DEVICE), GST_TYPE_DEVICE, device, NULL); "device", GST_TYPE_DEVICE, device, NULL);
} }
/** /**
@ -2907,12 +2877,12 @@ gst_message_parse_device_changed (GstMessage * message, GstDevice ** device,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DEVICE_CHANGED); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DEVICE_CHANGED);
if (device) if (device)
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (DEVICE), GST_TYPE_DEVICE, device, NULL); "device", GST_TYPE_DEVICE, device, NULL);
if (changed_device) if (changed_device)
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (DEVICE_CHANGED), GST_TYPE_DEVICE, changed_device, NULL); "device-changed", GST_TYPE_DEVICE, changed_device, NULL);
} }
/** /**
@ -2939,9 +2909,9 @@ gst_message_new_property_notify (GstObject * src, const gchar * property_name,
g_value_init (&name_val, G_TYPE_STRING); g_value_init (&name_val, G_TYPE_STRING);
/* should already be interned, but let's make sure */ /* should already be interned, but let's make sure */
g_value_set_static_string (&name_val, g_intern_string (property_name)); g_value_set_static_string (&name_val, g_intern_string (property_name));
gst_structure_id_take_value (structure, GST_QUARK (PROPERTY_NAME), &name_val); gst_structure_take_value (structure, "property-name", &name_val);
if (val != NULL) if (val != NULL)
gst_structure_id_take_value (structure, GST_QUARK (PROPERTY_VALUE), val); gst_structure_take_value (structure, "property-value", val);
return gst_message_new_custom (GST_MESSAGE_PROPERTY_NOTIFY, src, structure); return gst_message_new_custom (GST_MESSAGE_PROPERTY_NOTIFY, src, structure);
} }
@ -2979,13 +2949,12 @@ gst_message_parse_property_notify (GstMessage * message, GstObject ** object,
if (property_name) { if (property_name) {
const GValue *name_value; const GValue *name_value;
name_value = gst_structure_id_get_value (s, GST_QUARK (PROPERTY_NAME)); name_value = gst_structure_get_value (s, "property-name");
*property_name = g_value_get_string (name_value); *property_name = g_value_get_string (name_value);
} }
if (property_value) if (property_value)
*property_value = *property_value = gst_structure_get_value (s, "property-value");
gst_structure_id_get_value (s, GST_QUARK (PROPERTY_VALUE));
} }
/** /**
@ -3038,8 +3007,8 @@ gst_message_parse_stream_collection (GstMessage * message,
GST_MESSAGE_STREAM_COLLECTION); GST_MESSAGE_STREAM_COLLECTION);
if (collection) if (collection)
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (COLLECTION), GST_TYPE_STREAM_COLLECTION, collection, NULL); "collection", GST_TYPE_STREAM_COLLECTION, collection, NULL);
} }
/** /**
@ -3077,7 +3046,7 @@ gst_message_new_streams_selected (GstObject * src,
gst_structure_new_static_str ("GstMessageStreamsSelected", gst_structure_new_static_str ("GstMessageStreamsSelected",
"collection", GST_TYPE_STREAM_COLLECTION, collection, NULL); "collection", GST_TYPE_STREAM_COLLECTION, collection, NULL);
g_value_init (&val, GST_TYPE_ARRAY); g_value_init (&val, GST_TYPE_ARRAY);
gst_structure_id_take_value (structure, GST_QUARK (STREAMS), &val); gst_structure_take_value (structure, "streams", &val);
message = message =
gst_message_new_custom (GST_MESSAGE_STREAMS_SELECTED, src, structure); gst_message_new_custom (GST_MESSAGE_STREAMS_SELECTED, src, structure);
@ -3103,9 +3072,7 @@ gst_message_streams_selected_get_size (GstMessage * msg)
g_return_val_if_fail (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_STREAMS_SELECTED, g_return_val_if_fail (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_STREAMS_SELECTED,
0); 0);
val = val = gst_structure_get_value (GST_MESSAGE_STRUCTURE (msg), "streams");
gst_structure_id_get_value (GST_MESSAGE_STRUCTURE (msg),
GST_QUARK (STREAMS));
return gst_value_array_get_size (val); return gst_value_array_get_size (val);
} }
@ -3129,8 +3096,8 @@ gst_message_streams_selected_add (GstMessage * msg, GstStream * stream)
g_return_if_fail (GST_IS_STREAM (stream)); g_return_if_fail (GST_IS_STREAM (stream));
val = val =
(GValue *) gst_structure_id_get_value (GST_MESSAGE_STRUCTURE (msg), (GValue *) gst_structure_get_value (GST_MESSAGE_STRUCTURE (msg),
GST_QUARK (STREAMS)); "streams");
g_value_init (&to_add, GST_TYPE_STREAM); g_value_init (&to_add, GST_TYPE_STREAM);
g_value_set_object (&to_add, stream); g_value_set_object (&to_add, stream);
gst_value_array_append_and_take_value (val, &to_add); gst_value_array_append_and_take_value (val, &to_add);
@ -3156,9 +3123,7 @@ gst_message_streams_selected_get_stream (GstMessage * msg, guint idx)
g_return_val_if_fail (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_STREAMS_SELECTED, g_return_val_if_fail (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_STREAMS_SELECTED,
NULL); NULL);
streams = streams = gst_structure_get_value (GST_MESSAGE_STRUCTURE (msg), "streams");
gst_structure_id_get_value (GST_MESSAGE_STRUCTURE (msg),
GST_QUARK (STREAMS));
val = gst_value_array_get_value (streams, idx); val = gst_value_array_get_value (streams, idx);
if (val) { if (val) {
return (GstStream *) g_value_dup_object (val); return (GstStream *) g_value_dup_object (val);
@ -3185,8 +3150,8 @@ gst_message_parse_streams_selected (GstMessage * message,
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAMS_SELECTED); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAMS_SELECTED);
if (collection) if (collection)
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), gst_structure_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (COLLECTION), GST_TYPE_STREAM_COLLECTION, collection, NULL); "collection", GST_TYPE_STREAM_COLLECTION, collection, NULL);
} }
/** /**
@ -3243,11 +3208,11 @@ gst_message_new_redirect (GstObject * src, const gchar * location,
g_value_init (&entry_structures_gvalue, GST_TYPE_LIST); g_value_init (&entry_structures_gvalue, GST_TYPE_LIST);
structure = gst_structure_new_static_str_empty ("GstMessageRedirect"); structure = gst_structure_new_static_str_empty ("GstMessageRedirect");
gst_structure_id_take_value (structure, GST_QUARK (REDIRECT_ENTRY_LOCATIONS), gst_structure_take_value_static_str (structure, "redirect-entry-locations",
&entry_locations_gvalue); &entry_locations_gvalue);
gst_structure_id_take_value (structure, GST_QUARK (REDIRECT_ENTRY_TAGLISTS), gst_structure_take_value_static_str (structure, "redirect-entry-taglists",
&entry_taglists_gvalue); &entry_taglists_gvalue);
gst_structure_id_take_value (structure, GST_QUARK (REDIRECT_ENTRY_STRUCTURES), gst_structure_take_value_static_str (structure, "redirect-entry-structures",
&entry_structures_gvalue); &entry_structures_gvalue);
message = gst_message_new_custom (GST_MESSAGE_REDIRECT, src, structure); message = gst_message_new_custom (GST_MESSAGE_REDIRECT, src, structure);
@ -3289,16 +3254,15 @@ gst_message_add_redirect_entry (GstMessage * message, const gchar * location,
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
entry_locations_gvalue = entry_locations_gvalue =
(GValue *) gst_structure_id_get_value (structure, (GValue *) gst_structure_get_value (structure,
GST_QUARK (REDIRECT_ENTRY_LOCATIONS)); "redirect-entry-locations");
g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_locations_gvalue)); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_locations_gvalue));
entry_taglists_gvalue = entry_taglists_gvalue =
(GValue *) gst_structure_id_get_value (structure, (GValue *) gst_structure_get_value (structure, "redirect-entry-taglists");
GST_QUARK (REDIRECT_ENTRY_TAGLISTS));
g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_taglists_gvalue)); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_taglists_gvalue));
entry_structures_gvalue = entry_structures_gvalue =
(GValue *) gst_structure_id_get_value (structure, (GValue *) gst_structure_get_value (structure,
GST_QUARK (REDIRECT_ENTRY_STRUCTURES)); "redirect-entry-structures");
g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_structures_gvalue)); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_structures_gvalue));
g_value_init (&val, G_TYPE_STRING); g_value_init (&val, G_TYPE_STRING);
@ -3354,16 +3318,13 @@ gst_message_parse_redirect_entry (GstMessage * message, gsize entry_index,
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
entry_locations_gvalue = entry_locations_gvalue =
gst_structure_id_get_value (structure, gst_structure_get_value (structure, "redirect-entry-locations");
GST_QUARK (REDIRECT_ENTRY_LOCATIONS));
g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_locations_gvalue)); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_locations_gvalue));
entry_taglists_gvalue = entry_taglists_gvalue =
gst_structure_id_get_value (structure, gst_structure_get_value (structure, "redirect-entry-taglists");
GST_QUARK (REDIRECT_ENTRY_TAGLISTS));
g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_taglists_gvalue)); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_taglists_gvalue));
entry_structures_gvalue = entry_structures_gvalue =
gst_structure_id_get_value (structure, gst_structure_get_value (structure, "redirect-entry-structures");
GST_QUARK (REDIRECT_ENTRY_STRUCTURES));
g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_structures_gvalue)); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_structures_gvalue));
if (location) { if (location) {
@ -3408,16 +3369,13 @@ gst_message_get_num_redirect_entries (GstMessage * message)
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
entry_locations_gvalue = entry_locations_gvalue =
gst_structure_id_get_value (structure, gst_structure_get_value (structure, "redirect-entry-locations");
GST_QUARK (REDIRECT_ENTRY_LOCATIONS));
g_return_val_if_fail (GST_VALUE_HOLDS_LIST (entry_locations_gvalue), 0); g_return_val_if_fail (GST_VALUE_HOLDS_LIST (entry_locations_gvalue), 0);
entry_taglists_gvalue = entry_taglists_gvalue =
gst_structure_id_get_value (structure, gst_structure_get_value (structure, "redirect-entry-taglists");
GST_QUARK (REDIRECT_ENTRY_TAGLISTS));
g_return_val_if_fail (GST_VALUE_HOLDS_LIST (entry_taglists_gvalue), 0); g_return_val_if_fail (GST_VALUE_HOLDS_LIST (entry_taglists_gvalue), 0);
entry_structures_gvalue = entry_structures_gvalue =
gst_structure_id_get_value (structure, gst_structure_get_value (structure, "redirect-entry-structures");
GST_QUARK (REDIRECT_ENTRY_STRUCTURES));
g_return_val_if_fail (GST_VALUE_HOLDS_LIST (entry_structures_gvalue), 0); g_return_val_if_fail (GST_VALUE_HOLDS_LIST (entry_structures_gvalue), 0);
size = gst_value_list_get_size (entry_locations_gvalue); size = gst_value_list_get_size (entry_locations_gvalue);
@ -3481,8 +3439,7 @@ gst_message_parse_instant_rate_request (GstMessage * message,
GST_MESSAGE_INSTANT_RATE_REQUEST); GST_MESSAGE_INSTANT_RATE_REQUEST);
structure = GST_MESSAGE_STRUCTURE (message); structure = GST_MESSAGE_STRUCTURE (message);
gst_structure_id_get (structure, GST_QUARK (RATE), G_TYPE_DOUBLE, gst_structure_get (structure, "rate", G_TYPE_DOUBLE, rate_multiplier, NULL);
rate_multiplier, NULL);
} }
/** /**

View file

@ -59,9 +59,6 @@
#include "gstquery.h" #include "gstquery.h"
#include "gstvalue.h" #include "gstvalue.h"
#include "gstenumtypes.h" #include "gstenumtypes.h"
#include "gstquark.h"
#include "gsturi.h"
#include "gstbufferpool.h"
GST_DEBUG_CATEGORY_STATIC (gst_query_debug); GST_DEBUG_CATEGORY_STATIC (gst_query_debug);
#define GST_CAT_DEFAULT gst_query_debug #define GST_CAT_DEFAULT gst_query_debug
@ -262,12 +259,11 @@ gst_query_set_position (GstQuery * query, GstFormat format, gint64 cur)
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION); g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
s = GST_QUERY_STRUCTURE (query); s = GST_QUERY_STRUCTURE (query);
g_return_if_fail (format == g_value_get_enum (gst_structure_id_get_value (s, g_return_if_fail (format == g_value_get_enum (gst_structure_get_value (s,
GST_QUARK (FORMAT)))); "format")));
gst_structure_id_set (s, gst_structure_set (s,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, "format", GST_TYPE_FORMAT, format, "current", G_TYPE_INT64, cur, NULL);
GST_QUARK (CURRENT), G_TYPE_INT64, cur, NULL);
} }
/** /**
@ -290,11 +286,10 @@ gst_query_parse_position (GstQuery * query, GstFormat * format, gint64 * cur)
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (format) if (format)
*format = *format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, (GstFormat) g_value_get_enum (gst_structure_get_value (structure,
GST_QUARK (FORMAT))); "format"));
if (cur) if (cur)
*cur = g_value_get_int64 (gst_structure_id_get_value (structure, *cur = g_value_get_int64 (gst_structure_get_value (structure, "current"));
GST_QUARK (CURRENT)));
} }
@ -341,10 +336,10 @@ gst_query_set_duration (GstQuery * query, GstFormat format, gint64 duration)
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_DURATION); g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_DURATION);
s = GST_QUERY_STRUCTURE (query); s = GST_QUERY_STRUCTURE (query);
g_return_if_fail (format == g_value_get_enum (gst_structure_id_get_value (s, g_return_if_fail (format == g_value_get_enum (gst_structure_get_value (s,
GST_QUARK (FORMAT)))); "format")));
gst_structure_id_set (s, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, gst_structure_set (s, "format", GST_TYPE_FORMAT, format,
GST_QUARK (DURATION), G_TYPE_INT64, duration, NULL); "duration", G_TYPE_INT64, duration, NULL);
} }
/** /**
@ -368,11 +363,11 @@ gst_query_parse_duration (GstQuery * query, GstFormat * format,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (format) if (format)
*format = *format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, (GstFormat) g_value_get_enum (gst_structure_get_value (structure,
GST_QUARK (FORMAT))); "format"));
if (duration) if (duration)
*duration = g_value_get_int64 (gst_structure_id_get_value (structure, *duration = g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (DURATION))); "duration"));
} }
/** /**
@ -422,10 +417,10 @@ gst_query_set_latency (GstQuery * query, gboolean live,
g_return_if_fail (GST_CLOCK_TIME_IS_VALID (min_latency)); g_return_if_fail (GST_CLOCK_TIME_IS_VALID (min_latency));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, gst_structure_set (structure,
GST_QUARK (LIVE), G_TYPE_BOOLEAN, live, "live", G_TYPE_BOOLEAN, live,
GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, min_latency, "min-latency", G_TYPE_UINT64, min_latency,
GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, max_latency, NULL); "max-latency", G_TYPE_UINT64, max_latency, NULL);
} }
/** /**
@ -447,15 +442,13 @@ gst_query_parse_latency (GstQuery * query, gboolean * live,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (live) if (live)
*live = *live = g_value_get_boolean (gst_structure_get_value (structure, "live"));
g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (LIVE)));
if (min_latency) if (min_latency)
*min_latency = g_value_get_uint64 (gst_structure_id_get_value (structure, *min_latency = g_value_get_uint64 (gst_structure_get_value (structure,
GST_QUARK (MIN_LATENCY))); "min-latency"));
if (max_latency) if (max_latency)
*max_latency = g_value_get_uint64 (gst_structure_id_get_value (structure, *max_latency = g_value_get_uint64 (gst_structure_get_value (structure,
GST_QUARK (MAX_LATENCY))); "max-latency"));
} }
/** /**
@ -509,11 +502,11 @@ gst_query_set_convert (GstQuery * query, GstFormat src_format, gint64 src_value,
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONVERT); g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONVERT);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, gst_structure_set (structure,
GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format, "src_format", GST_TYPE_FORMAT, src_format,
GST_QUARK (SRC_VALUE), G_TYPE_INT64, src_value, "src_value", G_TYPE_INT64, src_value,
GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format, "dest_format", GST_TYPE_FORMAT, dest_format,
GST_QUARK (DEST_VALUE), G_TYPE_INT64, dest_value, NULL); "dest_value", G_TYPE_INT64, dest_value, NULL);
} }
/** /**
@ -541,18 +534,18 @@ gst_query_parse_convert (GstQuery * query, GstFormat * src_format,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (src_format) if (src_format)
*src_format = *src_format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, (GstFormat) g_value_get_enum (gst_structure_get_value (structure,
GST_QUARK (SRC_FORMAT))); "src_format"));
if (src_value) if (src_value)
*src_value = g_value_get_int64 (gst_structure_id_get_value (structure, *src_value = g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (SRC_VALUE))); "src_value"));
if (dest_format) if (dest_format)
*dest_format = *dest_format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, (GstFormat) g_value_get_enum (gst_structure_get_value (structure,
GST_QUARK (DEST_FORMAT))); "dest_format"));
if (dest_value) if (dest_value)
*dest_value = g_value_get_int64 (gst_structure_id_get_value (structure, *dest_value = g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (DEST_VALUE))); "dest_value"));
} }
/** /**
@ -613,11 +606,11 @@ gst_query_set_segment (GstQuery * query, gdouble rate, GstFormat format,
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT); g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, gst_structure_set (structure,
GST_QUARK (RATE), G_TYPE_DOUBLE, rate, "rate", G_TYPE_DOUBLE, rate,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, "format", GST_TYPE_FORMAT, format,
GST_QUARK (START_VALUE), G_TYPE_INT64, start_value, "start_value", G_TYPE_INT64, start_value,
GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop_value, NULL); "stop_value", G_TYPE_INT64, stop_value, NULL);
} }
/** /**
@ -644,18 +637,17 @@ gst_query_parse_segment (GstQuery * query, gdouble * rate, GstFormat * format,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (rate) if (rate)
*rate = g_value_get_double (gst_structure_id_get_value (structure, *rate = g_value_get_double (gst_structure_get_value (structure, "rate"));
GST_QUARK (RATE)));
if (format) if (format)
*format = *format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, (GstFormat) g_value_get_enum (gst_structure_get_value (structure,
GST_QUARK (FORMAT))); "format"));
if (start_value) if (start_value)
*start_value = g_value_get_int64 (gst_structure_id_get_value (structure, *start_value = g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (START_VALUE))); "start_value"));
if (stop_value) if (stop_value)
*stop_value = g_value_get_int64 (gst_structure_id_get_value (structure, *stop_value = g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (STOP_VALUE))); "stop_value"));
} }
/** /**
@ -801,11 +793,11 @@ gst_query_set_seeking (GstQuery * query, GstFormat format,
g_return_if_fail (gst_query_is_writable (query)); g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, gst_structure_set (structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, "format", GST_TYPE_FORMAT, format,
GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, seekable, "seekable", G_TYPE_BOOLEAN, seekable,
GST_QUARK (SEGMENT_START), G_TYPE_INT64, segment_start, "segment-start", G_TYPE_INT64, segment_start,
GST_QUARK (SEGMENT_END), G_TYPE_INT64, segment_end, NULL); "segment-end", G_TYPE_INT64, segment_end, NULL);
} }
/** /**
@ -832,27 +824,27 @@ gst_query_parse_seeking (GstQuery * query, GstFormat * format,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (format) if (format)
*format = *format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, (GstFormat) g_value_get_enum (gst_structure_get_value (structure,
GST_QUARK (FORMAT))); "format"));
if (seekable) if (seekable)
*seekable = g_value_get_boolean (gst_structure_id_get_value (structure, *seekable = g_value_get_boolean (gst_structure_get_value (structure,
GST_QUARK (SEEKABLE))); "seekable"));
if (segment_start) if (segment_start)
*segment_start = g_value_get_int64 (gst_structure_id_get_value (structure, *segment_start = g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (SEGMENT_START))); "segment-start"));
if (segment_end) if (segment_end)
*segment_end = g_value_get_int64 (gst_structure_id_get_value (structure, *segment_end = g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (SEGMENT_END))); "segment-end"));
} }
static GArray * static GArray *
ensure_array (GstStructure * s, GQuark quark, gsize element_size, ensure_array (GstStructure * s, const gchar * fieldname, gsize element_size,
GDestroyNotify clear_func) GDestroyNotify clear_func)
{ {
GArray *array; GArray *array;
const GValue *value; const GValue *value;
value = gst_structure_id_get_value (s, quark); value = gst_structure_get_value (s, fieldname);
if (value) { if (value) {
array = (GArray *) g_value_get_boxed (value); array = (GArray *) g_value_get_boxed (value);
} else { } else {
@ -865,7 +857,7 @@ ensure_array (GstStructure * s, GQuark quark, gsize element_size,
g_value_init (&new_array_val, G_TYPE_ARRAY); g_value_init (&new_array_val, G_TYPE_ARRAY);
g_value_take_boxed (&new_array_val, array); g_value_take_boxed (&new_array_val, array);
gst_structure_id_take_value (s, quark, &new_array_val); gst_structure_take_value (s, fieldname, &new_array_val);
} }
return array; return array;
} }
@ -1084,9 +1076,9 @@ gst_query_set_buffering_percent (GstQuery * query, gboolean busy, gint percent)
g_return_if_fail (percent >= 0 && percent <= 100); g_return_if_fail (percent >= 0 && percent <= 100);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, gst_structure_set (structure,
GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy, "busy", G_TYPE_BOOLEAN, busy,
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent, NULL); "buffer-percent", G_TYPE_INT, percent, NULL);
} }
/** /**
@ -1108,11 +1100,10 @@ gst_query_parse_buffering_percent (GstQuery * query, gboolean * busy,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (busy) if (busy)
*busy = g_value_get_boolean (gst_structure_id_get_value (structure, *busy = g_value_get_boolean (gst_structure_get_value (structure, "busy"));
GST_QUARK (BUSY)));
if (percent) if (percent)
*percent = g_value_get_int (gst_structure_id_get_value (structure, *percent = g_value_get_int (gst_structure_get_value (structure,
GST_QUARK (BUFFER_PERCENT))); "buffer-percent"));
} }
/** /**
@ -1135,11 +1126,11 @@ gst_query_set_buffering_stats (GstQuery * query, GstBufferingMode mode,
g_return_if_fail (gst_query_is_writable (query)); g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, gst_structure_set (structure,
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode, "buffering-mode", GST_TYPE_BUFFERING_MODE, mode,
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in, "avg-in-rate", G_TYPE_INT, avg_in,
GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out, "avg-out-rate", G_TYPE_INT, avg_out,
GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL); "buffering-left", G_TYPE_INT64, buffering_left, NULL);
} }
/** /**
@ -1165,18 +1156,18 @@ gst_query_parse_buffering_stats (GstQuery * query,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (mode) if (mode)
*mode = (GstBufferingMode) *mode = (GstBufferingMode)
g_value_get_enum (gst_structure_id_get_value (structure, g_value_get_enum (gst_structure_get_value (structure,
GST_QUARK (BUFFERING_MODE))); "buffering-mode"));
if (avg_in) if (avg_in)
*avg_in = g_value_get_int (gst_structure_id_get_value (structure, *avg_in = g_value_get_int (gst_structure_get_value (structure,
GST_QUARK (AVG_IN_RATE))); "avg-in-rate"));
if (avg_out) if (avg_out)
*avg_out = g_value_get_int (gst_structure_id_get_value (structure, *avg_out = g_value_get_int (gst_structure_get_value (structure,
GST_QUARK (AVG_OUT_RATE))); "avg-out-rate"));
if (buffering_left) if (buffering_left)
*buffering_left = *buffering_left =
g_value_get_int64 (gst_structure_id_get_value (structure, g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (BUFFERING_LEFT))); "buffering-left"));
} }
/** /**
@ -1200,11 +1191,11 @@ gst_query_set_buffering_range (GstQuery * query, GstFormat format,
g_return_if_fail (gst_query_is_writable (query)); g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, gst_structure_set (structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, "format", GST_TYPE_FORMAT, format,
GST_QUARK (START_VALUE), G_TYPE_INT64, start, "start_value", G_TYPE_INT64, start,
GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop, "stop_value", G_TYPE_INT64, stop,
GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, estimated_total, NULL); "estimated-total", G_TYPE_INT64, estimated_total, NULL);
} }
/** /**
@ -1232,18 +1223,18 @@ gst_query_parse_buffering_range (GstQuery * query, GstFormat * format,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (format) if (format)
*format = *format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, (GstFormat) g_value_get_enum (gst_structure_get_value (structure,
GST_QUARK (FORMAT))); "format"));
if (start) if (start)
*start = g_value_get_int64 (gst_structure_id_get_value (structure, *start = g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (START_VALUE))); "start_value"));
if (stop) if (stop)
*stop = g_value_get_int64 (gst_structure_id_get_value (structure, *stop = g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (STOP_VALUE))); "stop_value"));
if (estimated_total) if (estimated_total)
*estimated_total = *estimated_total =
g_value_get_int64 (gst_structure_id_get_value (structure, g_value_get_int64 (gst_structure_get_value (structure,
GST_QUARK (ESTIMATED_TOTAL))); "estimated-total"));
} }
/* GstQueryBufferingRange: internal struct for GArray */ /* GstQueryBufferingRange: internal struct for GArray */
@ -1278,7 +1269,7 @@ gst_query_add_buffering_range (GstQuery * query, gint64 start, gint64 stop)
return FALSE; return FALSE;
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES), array = ensure_array (structure, "buffering-ranges",
sizeof (GstQueryBufferingRange), NULL); sizeof (GstQueryBufferingRange), NULL);
if (array->len > 1) { if (array->len > 1) {
@ -1315,7 +1306,7 @@ gst_query_get_n_buffering_ranges (GstQuery * query)
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, 0); g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, 0);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES), array = ensure_array (structure, "buffering-ranges",
sizeof (GstQueryBufferingRange), NULL); sizeof (GstQueryBufferingRange), NULL);
return array->len; return array->len;
@ -1346,7 +1337,7 @@ gst_query_parse_nth_buffering_range (GstQuery * query, guint index,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES), array = ensure_array (structure, "buffering-ranges",
sizeof (GstQueryBufferingRange), NULL); sizeof (GstQueryBufferingRange), NULL);
g_return_val_if_fail (index < array->len, FALSE); g_return_val_if_fail (index < array->len, FALSE);
@ -1402,7 +1393,7 @@ gst_query_set_uri (GstQuery * query, const gchar * uri)
g_return_if_fail (gst_query_is_writable (query)); g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, GST_QUARK (URI), G_TYPE_STRING, uri, NULL); gst_structure_set (structure, "uri", G_TYPE_STRING, uri, NULL);
} }
/** /**
@ -1424,8 +1415,7 @@ gst_query_parse_uri (GstQuery * query, gchar ** uri)
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (uri) if (uri)
*uri = g_value_dup_string (gst_structure_id_get_value (structure, *uri = g_value_dup_string (gst_structure_get_value (structure, "uri"));
GST_QUARK (URI)));
} }
/** /**
@ -1446,8 +1436,7 @@ gst_query_set_uri_redirection (GstQuery * query, const gchar * uri)
g_return_if_fail (gst_query_is_writable (query)); g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, GST_QUARK (URI_REDIRECTION), gst_structure_set (structure, "uri-redirection", G_TYPE_STRING, uri, NULL);
G_TYPE_STRING, uri, NULL);
} }
/** /**
@ -1471,7 +1460,7 @@ gst_query_parse_uri_redirection (GstQuery * query, gchar ** uri)
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (uri) { if (uri) {
if (!gst_structure_id_get (structure, GST_QUARK (URI_REDIRECTION), if (!gst_structure_get (structure, "uri-redirection",
G_TYPE_STRING, uri, NULL)) G_TYPE_STRING, uri, NULL))
*uri = NULL; *uri = NULL;
} }
@ -1496,7 +1485,7 @@ gst_query_set_uri_redirection_permanent (GstQuery * query, gboolean permanent)
g_return_if_fail (gst_query_is_writable (query)); g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, GST_QUARK (URI_REDIRECTION_PERMANENT), gst_structure_set (structure, "uri-redirection-permanent",
G_TYPE_BOOLEAN, permanent, NULL); G_TYPE_BOOLEAN, permanent, NULL);
} }
@ -1523,7 +1512,7 @@ gst_query_parse_uri_redirection_permanent (GstQuery * query,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (permanent) { if (permanent) {
if (!gst_structure_id_get (structure, GST_QUARK (URI_REDIRECTION_PERMANENT), if (!gst_structure_get (structure, "uri-redirection-permanent",
G_TYPE_BOOLEAN, permanent, NULL)) G_TYPE_BOOLEAN, permanent, NULL))
*permanent = FALSE; *permanent = FALSE;
} }
@ -1578,11 +1567,9 @@ gst_query_parse_allocation (GstQuery * query, GstCaps ** caps,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (caps) { if (caps) {
*caps = g_value_get_boxed (gst_structure_id_get_value (structure, *caps = g_value_get_boxed (gst_structure_get_value (structure, "caps"));
GST_QUARK (CAPS)));
} }
gst_structure_id_get (structure, gst_structure_get (structure, "need-pool", G_TYPE_BOOLEAN, need_pool, NULL);
GST_QUARK (NEED_POOL), G_TYPE_BOOLEAN, need_pool, NULL);
} }
typedef struct typedef struct
@ -1622,7 +1609,7 @@ gst_query_add_allocation_pool (GstQuery * query, GstBufferPool * pool,
g_return_if_fail (gst_query_is_writable (query)); g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (POOL), array = ensure_array (structure, "pool",
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free); sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
if ((ap.pool = pool)) if ((ap.pool = pool))
@ -1652,7 +1639,7 @@ gst_query_get_n_allocation_pools (GstQuery * query)
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0); g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (POOL), array = ensure_array (structure, "pool",
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free); sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
return array->len; return array->len;
@ -1683,7 +1670,7 @@ gst_query_parse_nth_allocation_pool (GstQuery * query, guint index,
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION); g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (POOL), array = ensure_array (structure, "pool",
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free); sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
g_return_if_fail (index < array->len); g_return_if_fail (index < array->len);
@ -1722,7 +1709,7 @@ gst_query_set_nth_allocation_pool (GstQuery * query, guint index,
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION); g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (POOL), array = ensure_array (structure, "pool",
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free); sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
g_return_if_fail (index < array->len); g_return_if_fail (index < array->len);
@ -1757,7 +1744,7 @@ gst_query_remove_nth_allocation_pool (GstQuery * query, guint index)
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = array =
ensure_array (structure, GST_QUARK (POOL), sizeof (AllocationPool), ensure_array (structure, "pool", sizeof (AllocationPool),
(GDestroyNotify) allocation_pool_free); (GDestroyNotify) allocation_pool_free);
g_return_if_fail (index < array->len); g_return_if_fail (index < array->len);
@ -1799,7 +1786,7 @@ gst_query_add_allocation_meta (GstQuery * query, GType api,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = array =
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), ensure_array (structure, "meta", sizeof (AllocationMeta),
(GDestroyNotify) allocation_meta_free); (GDestroyNotify) allocation_meta_free);
am.api = api; am.api = api;
@ -1827,7 +1814,7 @@ gst_query_get_n_allocation_metas (GstQuery * query)
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = array =
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), ensure_array (structure, "meta", sizeof (AllocationMeta),
(GDestroyNotify) allocation_meta_free); (GDestroyNotify) allocation_meta_free);
return array->len; return array->len;
@ -1856,7 +1843,7 @@ gst_query_parse_nth_allocation_meta (GstQuery * query, guint index,
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = array =
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), ensure_array (structure, "meta", sizeof (AllocationMeta),
(GDestroyNotify) allocation_meta_free); (GDestroyNotify) allocation_meta_free);
g_return_val_if_fail (index < array->len, 0); g_return_val_if_fail (index < array->len, 0);
@ -1887,7 +1874,7 @@ gst_query_remove_nth_allocation_meta (GstQuery * query, guint index)
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = array =
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), ensure_array (structure, "meta", sizeof (AllocationMeta),
(GDestroyNotify) allocation_meta_free); (GDestroyNotify) allocation_meta_free);
g_return_if_fail (index < array->len); g_return_if_fail (index < array->len);
@ -1918,7 +1905,7 @@ gst_query_find_allocation_meta (GstQuery * query, GType api, guint * index)
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = array =
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), ensure_array (structure, "meta", sizeof (AllocationMeta),
(GDestroyNotify) allocation_meta_free); (GDestroyNotify) allocation_meta_free);
len = array->len; len = array->len;
@ -1967,7 +1954,7 @@ gst_query_add_allocation_param (GstQuery * query, GstAllocator * allocator,
g_return_if_fail (allocator != NULL || params != NULL); g_return_if_fail (allocator != NULL || params != NULL);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (ALLOCATOR), array = ensure_array (structure, "allocator",
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free); sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
if ((ap.allocator = allocator)) if ((ap.allocator = allocator))
@ -2003,7 +1990,7 @@ gst_query_get_n_allocation_params (GstQuery * query)
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0); g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (ALLOCATOR), array = ensure_array (structure, "allocator",
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free); sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
return array->len; return array->len;
@ -2030,7 +2017,7 @@ gst_query_parse_nth_allocation_param (GstQuery * query, guint index,
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION); g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (ALLOCATOR), array = ensure_array (structure, "allocator",
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free); sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
g_return_if_fail (index < array->len); g_return_if_fail (index < array->len);
@ -2064,7 +2051,7 @@ gst_query_set_nth_allocation_param (GstQuery * query, guint index,
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION); g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (ALLOCATOR), array = ensure_array (structure, "allocator",
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free); sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
g_return_if_fail (index < array->len); g_return_if_fail (index < array->len);
@ -2101,7 +2088,7 @@ gst_query_remove_nth_allocation_param (GstQuery * query, guint index)
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = array =
ensure_array (structure, GST_QUARK (ALLOCATOR), sizeof (AllocationParam), ensure_array (structure, "allocator", sizeof (AllocationParam),
(GDestroyNotify) allocation_param_free); (GDestroyNotify) allocation_param_free);
g_return_if_fail (index < array->len); g_return_if_fail (index < array->len);
@ -2152,11 +2139,10 @@ gst_query_set_scheduling (GstQuery * query, GstSchedulingFlags flags,
g_return_if_fail (gst_query_is_writable (query)); g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, gst_structure_set (structure,
GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, flags, "flags", GST_TYPE_SCHEDULING_FLAGS, flags,
GST_QUARK (MINSIZE), G_TYPE_INT, minsize, "minsize", G_TYPE_INT, minsize,
GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize, "maxsize", G_TYPE_INT, maxsize, "align", G_TYPE_INT, align, NULL);
GST_QUARK (ALIGN), G_TYPE_INT, align, NULL);
} }
/** /**
@ -2178,11 +2164,10 @@ gst_query_parse_scheduling (GstQuery * query, GstSchedulingFlags * flags,
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING); g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_get (structure, gst_structure_get (structure,
GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, flags, "flags", GST_TYPE_SCHEDULING_FLAGS, flags,
GST_QUARK (MINSIZE), G_TYPE_INT, minsize, "minsize", G_TYPE_INT, minsize,
GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize, "maxsize", G_TYPE_INT, maxsize, "align", G_TYPE_INT, align, NULL);
GST_QUARK (ALIGN), G_TYPE_INT, align, NULL);
} }
/** /**
@ -2202,8 +2187,7 @@ gst_query_add_scheduling_mode (GstQuery * query, GstPadMode mode)
g_return_if_fail (gst_query_is_writable (query)); g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = array = ensure_array (structure, "modes", sizeof (GstPadMode), NULL);
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
g_array_append_val (array, mode); g_array_append_val (array, mode);
} }
@ -2226,8 +2210,7 @@ gst_query_get_n_scheduling_modes (GstQuery * query)
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, 0); g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, 0);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = array = ensure_array (structure, "modes", sizeof (GstPadMode), NULL);
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
return array->len; return array->len;
} }
@ -2252,8 +2235,7 @@ gst_query_parse_nth_scheduling_mode (GstQuery * query, guint index)
GST_PAD_MODE_NONE); GST_PAD_MODE_NONE);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = array = ensure_array (structure, "modes", sizeof (GstPadMode), NULL);
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
g_return_val_if_fail (index < array->len, GST_PAD_MODE_NONE); g_return_val_if_fail (index < array->len, GST_PAD_MODE_NONE);
return g_array_index (array, GstPadMode, index); return g_array_index (array, GstPadMode, index);
@ -2284,8 +2266,7 @@ gst_query_has_scheduling_mode (GstQuery * query, GstPadMode mode)
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, FALSE); g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, FALSE);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
array = array = ensure_array (structure, "modes", sizeof (GstPadMode), NULL);
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
len = array->len; len = array->len;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
@ -2363,8 +2344,7 @@ gst_query_parse_accept_caps (GstQuery * query, GstCaps ** caps)
g_return_if_fail (caps != NULL); g_return_if_fail (caps != NULL);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
*caps = g_value_get_boxed (gst_structure_id_get_value (structure, *caps = g_value_get_boxed (gst_structure_get_value (structure, "caps"));
GST_QUARK (CAPS)));
} }
/** /**
@ -2383,8 +2363,7 @@ gst_query_set_accept_caps_result (GstQuery * query, gboolean result)
g_return_if_fail (gst_query_is_writable (query)); g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, gst_structure_set (structure, "result", G_TYPE_BOOLEAN, result, NULL);
GST_QUARK (RESULT), G_TYPE_BOOLEAN, result, NULL);
} }
/** /**
@ -2402,8 +2381,7 @@ gst_query_parse_accept_caps_result (GstQuery * query, gboolean * result)
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS); g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_get (structure, gst_structure_get (structure, "result", G_TYPE_BOOLEAN, result, NULL);
GST_QUARK (RESULT), G_TYPE_BOOLEAN, result, NULL);
} }
/** /**
@ -2463,8 +2441,7 @@ gst_query_parse_caps (GstQuery * query, GstCaps ** filter)
g_return_if_fail (filter != NULL); g_return_if_fail (filter != NULL);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
*filter = g_value_get_boxed (gst_structure_id_get_value (structure, *filter = g_value_get_boxed (gst_structure_get_value (structure, "filter"));
GST_QUARK (FILTER)));
} }
/** /**
@ -2483,7 +2460,7 @@ gst_query_set_caps_result (GstQuery * query, GstCaps * caps)
g_return_if_fail (gst_query_is_writable (query)); g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, GST_QUARK (CAPS), GST_TYPE_CAPS, caps, NULL); gst_structure_set (structure, "caps", GST_TYPE_CAPS, caps, NULL);
} }
/** /**
@ -2503,8 +2480,7 @@ gst_query_parse_caps_result (GstQuery * query, GstCaps ** caps)
g_return_if_fail (caps != NULL); g_return_if_fail (caps != NULL);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
*caps = g_value_get_boxed (gst_structure_id_get_value (structure, *caps = g_value_get_boxed (gst_structure_get_value (structure, "caps"));
GST_QUARK (CAPS)));
} }
#if 0 #if 0
@ -2592,8 +2568,7 @@ gst_query_set_context (GstQuery * query, GstContext * context)
s = GST_QUERY_STRUCTURE (query); s = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (s, gst_structure_set (s, "context", GST_TYPE_CONTEXT, context, NULL);
GST_QUARK (CONTEXT), GST_TYPE_CONTEXT, context, NULL);
} }
/** /**
@ -2616,7 +2591,7 @@ gst_query_parse_context (GstQuery * query, GstContext ** context)
g_return_if_fail (context != NULL); g_return_if_fail (context != NULL);
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
v = gst_structure_id_get_value (structure, GST_QUARK (CONTEXT)); v = gst_structure_get_value (structure, "context");
if (v) if (v)
*context = g_value_get_boxed (v); *context = g_value_get_boxed (v);
else else
@ -2645,7 +2620,7 @@ gst_query_parse_context_type (GstQuery * query, const gchar ** context_type)
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (context_type) { if (context_type) {
value = gst_structure_id_get_value (structure, GST_QUARK (CONTEXT_TYPE)); value = gst_structure_get_value (structure, "context-type");
*context_type = g_value_get_string (value); *context_type = g_value_get_string (value);
} }
@ -2695,8 +2670,7 @@ gst_query_set_bitrate (GstQuery * query, guint nominal_bitrate)
s = GST_QUERY_STRUCTURE (query); s = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (s, gst_structure_set (s, "nominal-bitrate", G_TYPE_UINT, nominal_bitrate, NULL);
GST_QUARK (NOMINAL_BITRATE), G_TYPE_UINT, nominal_bitrate, NULL);
} }
/** /**
@ -2719,7 +2693,7 @@ gst_query_parse_bitrate (GstQuery * query, guint * nominal_bitrate)
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (nominal_bitrate) { if (nominal_bitrate) {
value = gst_structure_id_get_value (structure, GST_QUARK (NOMINAL_BITRATE)); value = gst_structure_get_value (structure, "nominal-bitrate");
*nominal_bitrate = g_value_get_uint (value); *nominal_bitrate = g_value_get_uint (value);
} }
} }
@ -2766,8 +2740,7 @@ gst_query_set_selectable (GstQuery * query, gboolean selectable)
s = GST_QUERY_STRUCTURE (query); s = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (s, gst_structure_set (s, "selectable", G_TYPE_BOOLEAN, selectable, NULL);
GST_QUARK (SELECTABLE), G_TYPE_BOOLEAN, selectable, NULL);
} }
/** /**
@ -2789,8 +2762,7 @@ gst_query_parse_selectable (GstQuery * query, gboolean * selectable)
structure = GST_QUERY_STRUCTURE (query); structure = GST_QUERY_STRUCTURE (query);
if (selectable) { if (selectable) {
const GValue *value = const GValue *value = gst_structure_get_value (structure, "selectable");
gst_structure_id_get_value (structure, GST_QUARK (SELECTABLE));
if (value) if (value)
*selectable = g_value_get_boolean (value); *selectable = g_value_get_boolean (value);
else else

View file

@ -42,7 +42,6 @@
#include "gstinfo.h" #include "gstinfo.h"
#include "gstvalue.h" #include "gstvalue.h"
#include "gstbuffer.h" #include "gstbuffer.h"
#include "gstquark.h"
#include "gststructure.h" #include "gststructure.h"
#include "gstidstr-private.h" #include "gstidstr-private.h"
@ -69,12 +68,12 @@ typedef struct
{ {
GType type; /* type the data is in */ GType type; /* type the data is in */
GstIdStr name;
const gchar *nick; /* translated short description */ const gchar *nick; /* translated short description */
const gchar *blurb; /* translated long description */ const gchar *blurb; /* translated long description */
GstTagMergeFunc merge_func; /* functions to merge the values */ GstTagMergeFunc merge_func; /* functions to merge the values */
GstTagFlag flag; /* type of tag */ GstTagFlag flag; /* type of tag */
GQuark name_quark; /* quark for the name */
} }
GstTagInfo; GstTagInfo;
@ -551,10 +550,10 @@ gst_tag_register_static (const gchar * name, GstTagFlag flag, GType type,
return; return;
} }
info = g_new (GstTagInfo, 1); info = g_new0 (GstTagInfo, 1);
info->flag = flag; info->flag = flag;
info->type = type; info->type = type;
info->name_quark = g_quark_from_static_string (name); gst_id_str_set_static_str (&info->name, name);
info->nick = nick; info->nick = nick;
info->blurb = blurb; info->blurb = blurb;
info->merge_func = func; info->merge_func = func;
@ -957,11 +956,11 @@ gst_tag_list_is_empty (const GstTagList * list)
} }
static gboolean static gboolean
gst_tag_list_fields_equal (GQuark field_id, const GValue * value2, gst_tag_list_fields_equal (const GstIdStr * field, const GValue * value2,
gpointer data) gpointer data)
{ {
const GstStructure *struct1 = (const GstStructure *) data; const GstStructure *struct1 = (const GstStructure *) data;
const GValue *value1 = gst_structure_id_get_value (struct1, field_id); const GValue *value1 = gst_structure_id_str_get_value (struct1, field);
gdouble d1, d2; gdouble d1, d2;
if (value1 == NULL) { if (value1 == NULL) {
@ -1018,7 +1017,8 @@ gst_tag_list_is_equal (const GstTagList * list1, const GstTagList * list2)
return FALSE; return FALSE;
} }
return gst_structure_foreach (s1, gst_tag_list_fields_equal, (gpointer) s2); return gst_structure_foreach_id_str (s1, gst_tag_list_fields_equal,
(gpointer) s2);
} }
typedef struct typedef struct
@ -1034,7 +1034,7 @@ gst_tag_list_add_value_internal (GstTagList * tag_list, GstTagMergeMode mode,
{ {
GstStructure *list = GST_TAG_LIST_STRUCTURE (tag_list); GstStructure *list = GST_TAG_LIST_STRUCTURE (tag_list);
const GValue *value2; const GValue *value2;
GQuark tag_quark; const GstIdStr *tag_name;
if (info == NULL) { if (info == NULL) {
info = gst_tag_lookup (tag); info = gst_tag_lookup (tag);
@ -1052,23 +1052,23 @@ gst_tag_list_add_value_internal (GstTagList * tag_list, GstTagMergeMode mode,
return; return;
} }
tag_quark = info->name_quark; tag_name = &info->name;
if (info->merge_func if (info->merge_func
&& (value2 = gst_structure_id_get_value (list, tag_quark)) != NULL) { && (value2 = gst_structure_id_str_get_value (list, tag_name)) != NULL) {
GValue dest = { 0, }; GValue dest = { 0, };
switch (mode) { switch (mode) {
case GST_TAG_MERGE_REPLACE_ALL: case GST_TAG_MERGE_REPLACE_ALL:
case GST_TAG_MERGE_REPLACE: case GST_TAG_MERGE_REPLACE:
gst_structure_id_set_value (list, tag_quark, value); gst_structure_id_str_set_value (list, tag_name, value);
break; break;
case GST_TAG_MERGE_PREPEND: case GST_TAG_MERGE_PREPEND:
if (GST_VALUE_HOLDS_LIST (value2) && !GST_VALUE_HOLDS_LIST (value)) if (GST_VALUE_HOLDS_LIST (value2) && !GST_VALUE_HOLDS_LIST (value))
gst_value_list_prepend_value ((GValue *) value2, value); gst_value_list_prepend_value ((GValue *) value2, value);
else { else {
gst_value_list_merge (&dest, value, value2); gst_value_list_merge (&dest, value, value2);
gst_structure_id_take_value (list, tag_quark, &dest); gst_structure_id_str_take_value (list, tag_name, &dest);
} }
break; break;
case GST_TAG_MERGE_APPEND: case GST_TAG_MERGE_APPEND:
@ -1076,7 +1076,7 @@ gst_tag_list_add_value_internal (GstTagList * tag_list, GstTagMergeMode mode,
gst_value_list_append_value ((GValue *) value2, value); gst_value_list_append_value ((GValue *) value2, value);
else { else {
gst_value_list_merge (&dest, value2, value); gst_value_list_merge (&dest, value2, value);
gst_structure_id_take_value (list, tag_quark, &dest); gst_structure_id_str_take_value (list, tag_name, &dest);
} }
break; break;
case GST_TAG_MERGE_KEEP: case GST_TAG_MERGE_KEEP:
@ -1090,13 +1090,13 @@ gst_tag_list_add_value_internal (GstTagList * tag_list, GstTagMergeMode mode,
switch (mode) { switch (mode) {
case GST_TAG_MERGE_APPEND: case GST_TAG_MERGE_APPEND:
case GST_TAG_MERGE_KEEP: case GST_TAG_MERGE_KEEP:
if (gst_structure_id_get_value (list, tag_quark) != NULL) if (gst_structure_id_str_get_value (list, tag_name) != NULL)
break; break;
/* fall through */ /* fall through */
case GST_TAG_MERGE_REPLACE_ALL: case GST_TAG_MERGE_REPLACE_ALL:
case GST_TAG_MERGE_REPLACE: case GST_TAG_MERGE_REPLACE:
case GST_TAG_MERGE_PREPEND: case GST_TAG_MERGE_PREPEND:
gst_structure_id_set_value (list, tag_quark, value); gst_structure_id_str_set_value (list, tag_name, value);
break; break;
case GST_TAG_MERGE_KEEP_ALL: case GST_TAG_MERGE_KEEP_ALL:
break; break;
@ -1108,13 +1108,13 @@ gst_tag_list_add_value_internal (GstTagList * tag_list, GstTagMergeMode mode,
} }
static gboolean static gboolean
gst_tag_list_copy_foreach (GQuark tag_quark, const GValue * value, gst_tag_list_copy_foreach (const GstIdStr * field, const GValue * value,
gpointer user_data) gpointer user_data)
{ {
GstTagCopyData *copy = (GstTagCopyData *) user_data; GstTagCopyData *copy = (GstTagCopyData *) user_data;
const gchar *tag; const gchar *tag;
tag = g_quark_to_string (tag_quark); tag = gst_id_str_as_str (field);
gst_tag_list_add_value_internal (copy->list, copy->mode, tag, value, NULL); gst_tag_list_add_value_internal (copy->list, copy->mode, tag, value, NULL);
return TRUE; return TRUE;
@ -1144,7 +1144,7 @@ gst_tag_list_insert (GstTagList * into, const GstTagList * from,
if (mode == GST_TAG_MERGE_REPLACE_ALL) { if (mode == GST_TAG_MERGE_REPLACE_ALL) {
gst_structure_remove_all_fields (GST_TAG_LIST_STRUCTURE (into)); gst_structure_remove_all_fields (GST_TAG_LIST_STRUCTURE (into));
} }
gst_structure_foreach (GST_TAG_LIST_STRUCTURE (from), gst_structure_foreach_id_str (GST_TAG_LIST_STRUCTURE (from),
gst_tag_list_copy_foreach, &data); gst_tag_list_copy_foreach, &data);
} }
@ -1401,12 +1401,12 @@ typedef struct
TagForeachData; TagForeachData;
static int static int
structure_foreach_wrapper (GQuark field_id, const GValue * value, structure_foreach_wrapper (const GstIdStr * field, const GValue * value,
gpointer user_data) gpointer user_data)
{ {
TagForeachData *data = (TagForeachData *) user_data; TagForeachData *data = (TagForeachData *) user_data;
data->func (data->tag_list, g_quark_to_string (field_id), data->data); data->func (data->tag_list, gst_id_str_as_str (field), data->data);
return TRUE; return TRUE;
} }
@ -1431,7 +1431,7 @@ gst_tag_list_foreach (const GstTagList * list, GstTagForeachFunc func,
data.func = func; data.func = func;
data.tag_list = list; data.tag_list = list;
data.data = user_data; data.data = user_data;
gst_structure_foreach (GST_TAG_LIST_STRUCTURE (list), gst_structure_foreach_id_str (GST_TAG_LIST_STRUCTURE (list),
structure_foreach_wrapper, &data); structure_foreach_wrapper, &data);
} }

View file

@ -58,7 +58,8 @@ struct _GstTracerRecordClass
G_DEFINE_TYPE (GstTracerRecord, gst_tracer_record, GST_TYPE_OBJECT); G_DEFINE_TYPE (GstTracerRecord, gst_tracer_record, GST_TYPE_OBJECT);
static gboolean static gboolean
build_field_template (GQuark field_id, const GValue * value, gpointer user_data) build_field_template (const GstIdStr * field, const GValue * value,
gpointer user_data)
{ {
GString *s = (GString *) user_data; GString *s = (GString *) user_data;
const GstStructure *sub; const GstStructure *sub;
@ -69,7 +70,7 @@ build_field_template (GQuark field_id, const GValue * value, gpointer user_data)
if (G_VALUE_TYPE (value) != GST_TYPE_STRUCTURE) { if (G_VALUE_TYPE (value) != GST_TYPE_STRUCTURE) {
GST_ERROR ("expected field of type GstStructure, but %s is %s", GST_ERROR ("expected field of type GstStructure, but %s is %s",
g_quark_to_string (field_id), G_VALUE_TYPE_NAME (value)); gst_id_str_as_str (field), G_VALUE_TYPE_NAME (value));
return FALSE; return FALSE;
} }
@ -78,17 +79,19 @@ build_field_template (GQuark field_id, const GValue * value, gpointer user_data)
GST_TYPE_TRACER_VALUE_FLAGS, &flags, NULL); GST_TYPE_TRACER_VALUE_FLAGS, &flags, NULL);
if (flags & GST_TRACER_VALUE_FLAGS_OPTIONAL) { if (flags & GST_TRACER_VALUE_FLAGS_OPTIONAL) {
gchar *opt_name = g_strconcat ("have-", g_quark_to_string (field_id), NULL); gchar *opt_name = g_strconcat ("have-", gst_id_str_as_str (field), NULL);
/* add a boolean field, that indicates the presence of the next field */ /* add a boolean field, that indicates the presence of the next field */
g_value_init (&template_value, G_TYPE_BOOLEAN); g_value_init (&template_value, G_TYPE_BOOLEAN);
priv__gst_structure_append_template_to_gstring (opt_name, &template_value, s); priv__gst_structure_append_template_to_gstring (opt_name, &template_value,
s);
g_value_unset (&template_value); g_value_unset (&template_value);
g_free (opt_name); g_free (opt_name);
} }
g_value_init (&template_value, type); g_value_init (&template_value, type);
res = priv__gst_structure_append_template_to_gstring (g_quark_to_string (field_id), res =
priv__gst_structure_append_template_to_gstring (gst_id_str_as_str (field),
&template_value, s); &template_value, s);
g_value_unset (&template_value); g_value_unset (&template_value);
return res; return res;
@ -115,7 +118,7 @@ gst_tracer_record_build_format (GstTracerRecord * self)
s = g_string_sized_new (STRUCTURE_ESTIMATED_STRING_LEN (structure)); s = g_string_sized_new (STRUCTURE_ESTIMATED_STRING_LEN (structure));
g_string_append (s, name); g_string_append (s, name);
gst_structure_foreach (structure, build_field_template, s); gst_structure_foreach_id_str (structure, build_field_template, s);
g_string_append_c (s, ';'); g_string_append_c (s, ';');
self->format = g_string_free (s, FALSE); self->format = g_string_free (s, FALSE);
@ -188,7 +191,6 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
va_list varargs; va_list varargs;
gchar *err = NULL; gchar *err = NULL;
GType type; GType type;
GQuark id;
va_start (varargs, firstfield); va_start (varargs, firstfield);
structure = gst_structure_new_empty (name); structure = gst_structure_new_empty (name);
@ -196,7 +198,6 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
while (firstfield) { while (firstfield) {
GValue val = { 0, }; GValue val = { 0, };
id = g_quark_from_string (firstfield);
type = va_arg (varargs, GType); type = va_arg (varargs, GType);
/* all fields passed here must be GstStructures which we take over */ /* all fields passed here must be GstStructures which we take over */
@ -218,7 +219,7 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
* to this structure by unsetting the NOCOPY_CONTENTS collect-flag. * to this structure by unsetting the NOCOPY_CONTENTS collect-flag.
* see boxed_proxy_collect_value in glib's gobject/gboxed.c */ * see boxed_proxy_collect_value in glib's gobject/gboxed.c */
val.data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS; val.data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
gst_structure_id_take_value (structure, id, &val); gst_structure_take_value (structure, firstfield, &val);
firstfield = va_arg (varargs, gchar *); firstfield = va_arg (varargs, gchar *);
} }

View file

@ -2953,18 +2953,18 @@ gst_value_deserialize_segment_internal (GValue * dest, const gchar * s,
if (G_UNLIKELY (str == NULL)) if (G_UNLIKELY (str == NULL))
return FALSE; return FALSE;
res = gst_structure_id_get (str, res = gst_structure_get (str,
GST_QUARK (FLAGS), GST_TYPE_SEGMENT_FLAGS, &seg.flags, "flags", GST_TYPE_SEGMENT_FLAGS, &seg.flags,
GST_QUARK (RATE), G_TYPE_DOUBLE, &seg.rate, "rate", G_TYPE_DOUBLE, &seg.rate,
GST_QUARK (APPLIED_RATE), G_TYPE_DOUBLE, &seg.applied_rate, "applied-rate", G_TYPE_DOUBLE, &seg.applied_rate,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, &seg.format, "format", GST_TYPE_FORMAT, &seg.format,
GST_QUARK (BASE), G_TYPE_UINT64, &seg.base, "base", G_TYPE_UINT64, &seg.base,
GST_QUARK (OFFSET), G_TYPE_UINT64, &seg.offset, "offset", G_TYPE_UINT64, &seg.offset,
GST_QUARK (START), G_TYPE_UINT64, &seg.start, "start", G_TYPE_UINT64, &seg.start,
GST_QUARK (STOP), G_TYPE_UINT64, &seg.stop, "stop", G_TYPE_UINT64, &seg.stop,
GST_QUARK (TIME), G_TYPE_UINT64, &seg.time, "time", G_TYPE_UINT64, &seg.time,
GST_QUARK (POSITION), G_TYPE_UINT64, &seg.position, "position", G_TYPE_UINT64, &seg.position,
GST_QUARK (DURATION), G_TYPE_UINT64, &seg.duration, NULL); "duration", G_TYPE_UINT64, &seg.duration, NULL);
gst_structure_free (str); gst_structure_free (str);
if (res) if (res)
@ -4736,13 +4736,14 @@ gst_value_union_flagset_flagset (GValue * dest, const GValue * src1,
/* iterating over the result taking the union with the other structure's value */ /* iterating over the result taking the union with the other structure's value */
static gboolean static gboolean
structure_field_union_into (GQuark field_id, GValue * val, gpointer user_data) structure_field_union_into (const GstIdStr * field, GValue * val,
gpointer user_data)
{ {
GstStructure *other = user_data; GstStructure *other = user_data;
const GValue *other_value; const GValue *other_value;
GValue res_value = G_VALUE_INIT; GValue res_value = G_VALUE_INIT;
other_value = gst_structure_id_get_value (other, field_id); other_value = gst_structure_id_str_get_value (other, field);
/* no value in the other struct, just keep this value */ /* no value in the other struct, just keep this value */
if (!other_value) if (!other_value)
return TRUE; return TRUE;
@ -4757,15 +4758,15 @@ structure_field_union_into (GQuark field_id, GValue * val, gpointer user_data)
/* iterating over the other source structure adding missing values */ /* iterating over the other source structure adding missing values */
static gboolean static gboolean
structure_field_union_from (GQuark field_id, const GValue * other_val, structure_field_union_from (const GstIdStr * field, const GValue * other_val,
gpointer user_data) gpointer user_data)
{ {
GstStructure *result = user_data; GstStructure *result = user_data;
const GValue *result_value; const GValue *result_value;
result_value = gst_structure_id_get_value (result, field_id); result_value = gst_structure_id_str_get_value (result, field);
if (!result_value) if (!result_value)
gst_structure_id_set_value (result, field_id, other_val); gst_structure_id_str_set_value (result, field, other_val);
return TRUE; return TRUE;
} }
@ -4792,12 +4793,13 @@ gst_value_union_structure_structure (GValue * dest, const GValue * src1,
result = gst_structure_copy (s1); result = gst_structure_copy (s1);
ret = ret =
gst_structure_map_in_place (result, structure_field_union_into, gst_structure_map_in_place_id_str (result, structure_field_union_into,
(gpointer) s2); (gpointer) s2);
if (!ret) if (!ret)
goto out; goto out;
ret = ret =
gst_structure_foreach (s2, structure_field_union_from, (gpointer) result); gst_structure_foreach_id_str (s2, structure_field_union_from,
(gpointer) result);
if (ret) { if (ret) {
g_value_init (dest, GST_TYPE_STRUCTURE); g_value_init (dest, GST_TYPE_STRUCTURE);
@ -6819,7 +6821,7 @@ gst_value_deserialize_with_pspec (GValue * dest, const gchar * src,
} }
static gboolean static gboolean
structure_field_is_fixed (GQuark field_id, const GValue * val, structure_field_is_fixed (const GstIdStr * field, const GValue * val,
gpointer user_data) gpointer user_data)
{ {
return gst_value_is_fixed (val); return gst_value_is_fixed (val);
@ -6867,7 +6869,7 @@ gst_value_is_fixed (const GValue * value)
/* Flagsets are only fixed if there are no 'don't care' bits */ /* Flagsets are only fixed if there are no 'don't care' bits */
return (gst_value_get_flagset_mask (value) == GST_FLAG_SET_MASK_EXACT); return (gst_value_get_flagset_mask (value) == GST_FLAG_SET_MASK_EXACT);
} else if (GST_VALUE_HOLDS_STRUCTURE (value)) { } else if (GST_VALUE_HOLDS_STRUCTURE (value)) {
return gst_structure_foreach (gst_value_get_structure (value), return gst_structure_foreach_id_str (gst_value_get_structure (value),
structure_field_is_fixed, NULL); structure_field_is_fixed, NULL);
} }
return gst_type_is_fixed (type); return gst_type_is_fixed (type);

View file

@ -1111,7 +1111,7 @@ gst_base_parse_convert (GstBaseParse * parse,
} }
static gboolean static gboolean
update_upstream_provided (GQuark field_id, const GValue * value, update_upstream_provided (const GstIdStr * field, const GValue * value,
gpointer user_data) gpointer user_data)
{ {
GstCaps *default_caps = user_data; GstCaps *default_caps = user_data;
@ -1121,8 +1121,8 @@ update_upstream_provided (GQuark field_id, const GValue * value,
caps_size = gst_caps_get_size (default_caps); caps_size = gst_caps_get_size (default_caps);
for (i = 0; i < caps_size; i++) { for (i = 0; i < caps_size; i++) {
GstStructure *structure = gst_caps_get_structure (default_caps, i); GstStructure *structure = gst_caps_get_structure (default_caps, i);
if (!gst_structure_id_has_field (structure, field_id)) { if (!gst_structure_has_field (structure, gst_id_str_as_str (field))) {
gst_structure_id_set_value (structure, field_id, value); gst_structure_id_str_set_value (structure, field, value);
} }
/* XXX: maybe try to fixate better than gst_caps_fixate() the /* XXX: maybe try to fixate better than gst_caps_fixate() the
* downstream caps based on upstream values if possible */ * downstream caps based on upstream values if possible */
@ -1162,7 +1162,8 @@ gst_base_parse_negotiate_default_caps (GstBaseParse * parse)
if (sinkcaps) { if (sinkcaps) {
structure = gst_caps_get_structure (sinkcaps, 0); structure = gst_caps_get_structure (sinkcaps, 0);
gst_structure_foreach (structure, update_upstream_provided, default_caps); gst_structure_foreach_id_str (structure, update_upstream_provided,
default_caps);
} }
default_caps = gst_caps_fixate (default_caps); default_caps = gst_caps_fixate (default_caps);

View file

@ -59,10 +59,6 @@ static void latency_query_stack_destroy (gpointer data);
static GQuark latency_probe_id; static GQuark latency_probe_id;
static GQuark sub_latency_probe_id; static GQuark sub_latency_probe_id;
static GQuark latency_probe_pad;
static GQuark latency_probe_element;
static GQuark latency_probe_element_id;
static GQuark latency_probe_ts;
static GQuark drop_sub_latency_quark; static GQuark drop_sub_latency_quark;
static GstTracerRecord *tr_latency; static GstTracerRecord *tr_latency;
@ -182,16 +178,16 @@ log_latency (const GstStructure * data, GstElement * sink_parent,
g_return_if_fail (sink_parent); g_return_if_fail (sink_parent);
g_return_if_fail (sink_pad); g_return_if_fail (sink_pad);
value = gst_structure_id_get_value (data, latency_probe_ts); value = gst_structure_get_value (data, "latency_probe.ts");
src_ts = g_value_get_uint64 (value); src_ts = g_value_get_uint64 (value);
value = gst_structure_id_get_value (data, latency_probe_pad); value = gst_structure_get_value (data, "latency_probe.pad");
src = g_value_get_string (value); src = g_value_get_string (value);
value = gst_structure_id_get_value (data, latency_probe_element); value = gst_structure_get_value (data, "latency_probe.element");
element_src = g_value_get_string (value); element_src = g_value_get_string (value);
value = gst_structure_id_get_value (data, latency_probe_element_id); value = gst_structure_get_value (data, "latency_probe.element_id");
id_element_src = g_value_get_string (value); id_element_src = g_value_get_string (value);
id_element_sink = g_strdup_printf ("%p", sink_parent); id_element_sink = g_strdup_printf ("%p", sink_parent);
@ -222,7 +218,7 @@ log_element_latency (const GstStructure * data, GstElement * parent,
/* TODO filtering */ /* TODO filtering */
value = gst_structure_id_get_value (data, latency_probe_ts); value = gst_structure_get_value (data, "latency_probe.ts");
src_ts = g_value_get_uint64 (value); src_ts = g_value_get_uint64 (value);
gst_tracer_record_log (tr_element_latency, element_id, element_name, pad_name, gst_tracer_record_log (tr_element_latency, element_id, element_name, pad_name,
@ -387,9 +383,9 @@ do_drop_sub_latency_event (GstPad * pad, GstPadProbeInfo * info,
const gchar *value_element_id, *value_pad_name; const gchar *value_element_id, *value_pad_name;
/* Get the element id, element name and pad name from data */ /* Get the element id, element name and pad name from data */
value = gst_structure_id_get_value (data, latency_probe_element_id); value = gst_structure_get_value (data, "latency_probe.element_id");
value_element_id = g_value_get_string (value); value_element_id = g_value_get_string (value);
value = gst_structure_id_get_value (data, latency_probe_pad); value = gst_structure_get_value (data, "latency_probe.pad");
value_pad_name = g_value_get_string (value); value_pad_name = g_value_get_string (value);
if (pad_name == NULL || if (pad_name == NULL ||
@ -453,9 +449,9 @@ do_push_event_pre (GstTracer * self, guint64 ts, GstPad * pad, GstEvent * ev)
const gchar *value_element_id, *value_pad_name; const gchar *value_element_id, *value_pad_name;
/* Get the element id, element name and pad name from data */ /* Get the element id, element name and pad name from data */
value = gst_structure_id_get_value (data, latency_probe_element_id); value = gst_structure_get_value (data, "latency_probe.element_id");
value_element_id = g_value_get_string (value); value_element_id = g_value_get_string (value);
value = gst_structure_id_get_value (data, latency_probe_pad); value = gst_structure_get_value (data, "latency_probe.pad");
value_pad_name = g_value_get_string (value); value_pad_name = g_value_get_string (value);
if (!g_str_equal (value_element_id, element_id) || if (!g_str_equal (value_element_id, element_id) ||
@ -603,11 +599,6 @@ gst_latency_tracer_class_init (GstLatencyTracerClass * klass)
latency_probe_id = g_quark_from_static_string ("latency_probe.id"); latency_probe_id = g_quark_from_static_string ("latency_probe.id");
sub_latency_probe_id = g_quark_from_static_string ("sub_latency_probe.id"); sub_latency_probe_id = g_quark_from_static_string ("sub_latency_probe.id");
latency_probe_pad = g_quark_from_static_string ("latency_probe.pad");
latency_probe_element = g_quark_from_static_string ("latency_probe.element");
latency_probe_element_id =
g_quark_from_static_string ("latency_probe.element_id");
latency_probe_ts = g_quark_from_static_string ("latency_probe.ts");
drop_sub_latency_quark = drop_sub_latency_quark =
g_quark_from_static_string ("drop_sub_latency.quark"); g_quark_from_static_string ("drop_sub_latency.quark");

View file

@ -1160,7 +1160,8 @@ GST_START_TEST (test_union)
GST_END_TEST; GST_END_TEST;
static gboolean static gboolean
_caps_is_fixed_foreach (GQuark field_id, const GValue * value, gpointer unused) _caps_is_fixed_foreach (const GstIdStr * fieldname, const GValue * value,
gpointer unused)
{ {
return gst_value_is_fixed (value); return gst_value_is_fixed (value);
} }
@ -1179,7 +1180,8 @@ GST_START_TEST (test_normalize)
for (i = 0; i < gst_caps_get_size (norm); i++) { for (i = 0; i < gst_caps_get_size (norm); i++) {
GstStructure *st = gst_caps_get_structure (norm, i); GstStructure *st = gst_caps_get_structure (norm, i);
/* Make sure all fields of all structures are fixed */ /* Make sure all fields of all structures are fixed */
fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); fail_unless (gst_structure_foreach_id_str (st, _caps_is_fixed_foreach,
NULL));
} }
gst_caps_unref (out); gst_caps_unref (out);
@ -1197,7 +1199,8 @@ GST_START_TEST (test_normalize)
for (i = 0; i < gst_caps_get_size (norm); i++) { for (i = 0; i < gst_caps_get_size (norm); i++) {
GstStructure *st = gst_caps_get_structure (norm, i); GstStructure *st = gst_caps_get_structure (norm, i);
/* Make sure all fields of all structures are fixed */ /* Make sure all fields of all structures are fixed */
fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); fail_unless (gst_structure_foreach_id_str (st, _caps_is_fixed_foreach,
NULL));
} }
gst_caps_unref (out); gst_caps_unref (out);
@ -1214,7 +1217,8 @@ GST_START_TEST (test_normalize)
for (i = 0; i < gst_caps_get_size (norm); i++) { for (i = 0; i < gst_caps_get_size (norm); i++) {
GstStructure *st = gst_caps_get_structure (norm, i); GstStructure *st = gst_caps_get_structure (norm, i);
/* Make sure all fields of all structures are fixed */ /* Make sure all fields of all structures are fixed */
fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); fail_unless (gst_structure_foreach_id_str (st, _caps_is_fixed_foreach,
NULL));
} }
gst_caps_unref (out); gst_caps_unref (out);

View file

@ -864,6 +864,8 @@ GST_START_TEST (test_vararg_getters)
gst_buffer_unref (buf2); gst_buffer_unref (buf2);
buf2 = NULL; buf2 = NULL;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/* and now the _id variant */ /* and now the _id variant */
ret = gst_structure_id_get (s, g_quark_from_static_string ("double"), ret = gst_structure_id_get (s, g_quark_from_static_string ("double"),
G_TYPE_DOUBLE, &d, g_quark_from_static_string ("string"), G_TYPE_STRING, G_TYPE_DOUBLE, &d, g_quark_from_static_string ("string"), G_TYPE_STRING,
@ -892,6 +894,58 @@ GST_START_TEST (test_vararg_getters)
g_free (c); g_free (c);
gst_caps_unref (caps2); gst_caps_unref (caps2);
gst_buffer_unref (buf2); gst_buffer_unref (buf2);
#pragma GCC diagnostic pop
/* and now the _id_str variant */
GstIdStr string_fieldname = GST_ID_STR_INIT;
GstIdStr caps_fieldname = GST_ID_STR_INIT;
GstIdStr buf_fieldname = GST_ID_STR_INIT;
GstIdStr int_fieldname = GST_ID_STR_INIT;
GstIdStr int64_fieldname = GST_ID_STR_INIT;
GstIdStr double_fieldname = GST_ID_STR_INIT;
GstIdStr dooble_fieldname = GST_ID_STR_INIT;
gst_id_str_set_static_str (&string_fieldname, "string");
gst_id_str_set_static_str (&caps_fieldname, "caps");
gst_id_str_set_static_str (&buf_fieldname, "buf");
gst_id_str_set_static_str (&int_fieldname, "int");
gst_id_str_set_static_str (&int64_fieldname, "int64");
gst_id_str_set_static_str (&double_fieldname, "double");
gst_id_str_set_static_str (&dooble_fieldname, "dooble");
ret = gst_structure_id_str_get (s, &double_fieldname,
G_TYPE_DOUBLE, &d, &string_fieldname, G_TYPE_STRING,
&c, &caps_fieldname, GST_TYPE_CAPS, &caps2,
&buf_fieldname, GST_TYPE_BUFFER, &buf2,
&int_fieldname, G_TYPE_INT, &i,
&int64_fieldname, G_TYPE_INT64, &i64, NULL);
fail_unless (ret);
fail_unless_equals_string (c, "Hello World!");
fail_unless_equals_int (i, 12345678);
fail_unless_equals_float (d, G_MAXDOUBLE);
fail_unless (i64 == -99);
fail_unless (caps == caps2);
fail_unless (buf == buf2);
/* expected failures */
ASSERT_CRITICAL (gst_structure_get (s, 0, G_TYPE_INT, &i, NULL));
fail_if (gst_structure_id_str_get (s, &int_fieldname,
G_TYPE_INT, &i, &double_fieldname, G_TYPE_FLOAT, &d, NULL));
fail_if (gst_structure_id_str_get (s, &int_fieldname,
G_TYPE_INT, &i, &dooble_fieldname, G_TYPE_DOUBLE, &d, NULL));
g_free (c);
gst_caps_unref (caps2);
gst_buffer_unref (buf2);
gst_id_str_clear (&string_fieldname);
gst_id_str_clear (&caps_fieldname);
gst_id_str_clear (&buf_fieldname);
gst_id_str_clear (&int_fieldname);
gst_id_str_clear (&int64_fieldname);
gst_id_str_clear (&double_fieldname);
gst_id_str_clear (&dooble_fieldname);
/* finally make sure NULL as return location is handled gracefully */ /* finally make sure NULL as return location is handled gracefully */
ret = gst_structure_get (s, "double", G_TYPE_DOUBLE, NULL, "string", ret = gst_structure_get (s, "double", G_TYPE_DOUBLE, NULL, "string",
@ -925,6 +979,21 @@ foreach_func (GQuark field_id, const GValue * value, gpointer user_data)
return TRUE; return TRUE;
} }
static gboolean
foreach_id_str_func (const GstIdStr * fieldname, const GValue * value,
gpointer user_data)
{
gint *sum = user_data;
gint v = 0;
if (G_VALUE_HOLDS_INT (value))
v = g_value_get_int (value);
*sum += v;
return TRUE;
}
GST_START_TEST (test_foreach) GST_START_TEST (test_foreach)
{ {
GstStructure *s; GstStructure *s;
@ -932,10 +1001,16 @@ GST_START_TEST (test_foreach)
s = gst_structure_new ("foo/bar", "baz", G_TYPE_INT, 1, "bla", G_TYPE_INT, 3, s = gst_structure_new ("foo/bar", "baz", G_TYPE_INT, 1, "bla", G_TYPE_INT, 3,
NULL); NULL);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
fail_unless (gst_structure_foreach (s, foreach_func, &sum)); fail_unless (gst_structure_foreach (s, foreach_func, &sum));
#pragma GCC diagnostic pop
fail_unless_equals_int (sum, 4);
sum = 0;
fail_unless (gst_structure_foreach_id_str (s, foreach_id_str_func, &sum));
fail_unless_equals_int (sum, 4); fail_unless_equals_int (sum, 4);
gst_structure_free (s); gst_structure_free (s);
} }
GST_END_TEST; GST_END_TEST;
@ -949,6 +1024,15 @@ map_func (GQuark field_id, GValue * value, gpointer user_data)
return TRUE; return TRUE;
} }
static gboolean
map_id_str_func (const GstIdStr * fieldname, GValue * value, gpointer user_data)
{
if (G_VALUE_HOLDS_INT (value))
g_value_set_int (value, 123);
return TRUE;
}
GST_START_TEST (test_map_in_place) GST_START_TEST (test_map_in_place)
{ {
GstStructure *s, *s2; GstStructure *s, *s2;
@ -957,11 +1041,20 @@ GST_START_TEST (test_map_in_place)
NULL); NULL);
s2 = gst_structure_new ("foo/bar", "baz", G_TYPE_INT, 123, "bla", G_TYPE_INT, s2 = gst_structure_new ("foo/bar", "baz", G_TYPE_INT, 123, "bla", G_TYPE_INT,
123, NULL); 123, NULL);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
fail_unless (gst_structure_map_in_place (s, map_func, NULL)); fail_unless (gst_structure_map_in_place (s, map_func, NULL));
#pragma GCC diagnostic pop
fail_unless (gst_structure_is_equal (s, s2)); fail_unless (gst_structure_is_equal (s, s2));
gst_structure_free (s);
s = gst_structure_new ("foo/bar", "baz", G_TYPE_INT, 1, "bla", G_TYPE_INT, 3,
NULL);
fail_unless (gst_structure_map_in_place_id_str (s, map_id_str_func, NULL));
fail_unless (gst_structure_is_equal (s, s2));
gst_structure_free (s); gst_structure_free (s);
gst_structure_free (s2); gst_structure_free (s2);
} }
GST_END_TEST; GST_END_TEST;
@ -978,6 +1071,19 @@ filter_map_func (GQuark field_id, GValue * value, gpointer user_data)
return TRUE; return TRUE;
} }
static gboolean
filter_map_id_str_func (const GstIdStr * fieldname, GValue * value,
gpointer user_data)
{
if (gst_id_str_is_equal_to_str (fieldname, "bla"))
return FALSE;
if (G_VALUE_HOLDS_INT (value))
g_value_set_int (value, 2);
return TRUE;
}
GST_START_TEST (test_filter_and_map_in_place) GST_START_TEST (test_filter_and_map_in_place)
{ {
GstStructure *s, *s2; GstStructure *s, *s2;
@ -985,7 +1091,17 @@ GST_START_TEST (test_filter_and_map_in_place)
s = gst_structure_new ("foo/bar", "baz", G_TYPE_INT, 1, "bla", G_TYPE_INT, 3, s = gst_structure_new ("foo/bar", "baz", G_TYPE_INT, 1, "bla", G_TYPE_INT, 3,
NULL); NULL);
s2 = gst_structure_new ("foo/bar", "baz", G_TYPE_INT, 2, NULL); s2 = gst_structure_new ("foo/bar", "baz", G_TYPE_INT, 2, NULL);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
gst_structure_filter_and_map_in_place (s, filter_map_func, NULL); gst_structure_filter_and_map_in_place (s, filter_map_func, NULL);
#pragma GCC diagnostic pop
fail_unless (gst_structure_is_equal (s, s2));
gst_structure_free (s);
s = gst_structure_new ("foo/bar", "baz", G_TYPE_INT, 1, "bla", G_TYPE_INT, 3,
NULL);
gst_structure_filter_and_map_in_place_id_str (s, filter_map_id_str_func,
NULL);
fail_unless (gst_structure_is_equal (s, s2)); fail_unless (gst_structure_is_equal (s, s2));
gst_structure_free (s); gst_structure_free (s);
gst_structure_free (s2); gst_structure_free (s2);

View file

@ -182,13 +182,13 @@ n_print (const char *format, ...)
} }
static gboolean static gboolean
print_field (GQuark field, const GValue * value, gpointer pfx) print_field (const GstIdStr * fieldname, const GValue * value, gpointer pfx)
{ {
gchar *str = gst_value_serialize (value); gchar *str = gst_value_serialize (value);
n_print ("%s %s%15s%s: %s%s%s\n", n_print ("%s %s%15s%s: %s%s%s\n",
(gchar *) pfx, FIELD_NAME_COLOR, g_quark_to_string (field), RESET_COLOR, (gchar *) pfx, FIELD_NAME_COLOR, gst_id_str_as_str (fieldname),
FIELD_VALUE_COLOR, str, RESET_COLOR); RESET_COLOR, FIELD_VALUE_COLOR, str, RESET_COLOR);
g_free (str); g_free (str);
return TRUE; return TRUE;
} }
@ -226,7 +226,7 @@ print_caps (const GstCaps * caps, const gchar * pfx)
n_print ("%s%s%s%s\n", pfx, STRUCT_NAME_COLOR, n_print ("%s%s%s%s\n", pfx, STRUCT_NAME_COLOR,
gst_structure_get_name (structure), RESET_COLOR); gst_structure_get_name (structure), RESET_COLOR);
} }
gst_structure_foreach (structure, print_field, (gpointer) pfx); gst_structure_foreach_id_str (structure, print_field, (gpointer) pfx);
} }
} }
@ -719,7 +719,7 @@ print_object_properties_info (GObject * obj, GObjectClass * obj_class,
const GstStructure *s = gst_value_get_structure (&value); const GstStructure *s = gst_value_get_structure (&value);
if (s) { if (s) {
g_print ("\n"); g_print ("\n");
gst_structure_foreach (s, print_field, gst_structure_foreach_id_str (s, print_field,
(gpointer) " "); (gpointer) " ");
} }
} }