diff --git a/subprojects/gst-devtools/validate/gst/validate/flow/formatting.c b/subprojects/gst-devtools/validate/gst/validate/flow/formatting.c index 8149ac291e..1a4d91dcf7 100644 --- a/subprojects/gst-devtools/validate/gst/validate/flow/formatting.c +++ b/subprojects/gst-devtools/validate/gst/validate/flow/formatting.c @@ -148,9 +148,10 @@ typedef struct } StructureValues; 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 && g_strv_contains ((const gchar **) data->ignored_fields, field)) @@ -176,8 +177,8 @@ validate_flow_structure_cleanup (const GstStructure * structure, .ignored_fields = ignored_fields, }; - gst_structure_foreach (structure, - (GstStructureForeachFunc) structure_set_fields, &d); + gst_structure_foreach_id_str (structure, + (GstStructureForeachIdStrFunc) structure_set_fields, &d); d.fields = g_list_sort (d.fields, (GCompareFunc) g_ascii_strcasecmp); nstructure = gst_structure_new_empty (gst_structure_get_name (structure)); for (GList * tmp = d.fields; tmp; tmp = tmp->next) { diff --git a/subprojects/gst-devtools/validate/gst/validate/gst-validate-pipeline-monitor.c b/subprojects/gst-devtools/validate/gst/validate/gst-validate-pipeline-monitor.c index 54257bcaee..9d6e8fc8f5 100644 --- a/subprojects/gst-devtools/validate/gst/validate/gst-validate-pipeline-monitor.c +++ b/subprojects/gst-devtools/validate/gst/validate/gst-validate-pipeline-monitor.c @@ -301,12 +301,12 @@ _incompatible_fields_info_set_found (StructureIncompatibleFieldsInfo * info) } static gboolean -_find_structure_incompatible_fields (GQuark field_id, const GValue * value, - StructureIncompatibleFieldsInfo * info) +_find_structure_incompatible_fields (const GstIdStr * fieldname, + const GValue * value, StructureIncompatibleFieldsInfo * info) { gchar *value_str, *filter_str; - const GValue *filter_value = gst_structure_id_get_value (info->filter, - field_id); + const GValue *filter_value = gst_structure_id_str_get_value (info->filter, + fieldname); if (!filter_value) return TRUE; @@ -319,7 +319,7 @@ _find_structure_incompatible_fields (GQuark field_id, const GValue * value, g_string_append_printf (info->str, "\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.", - 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 (filter_value), filter_str); @@ -337,7 +337,7 @@ _find_structure_incompatible_fields (GQuark field_id, const GValue * value, g_string_append_printf (info->str, "\n -> Field '%s' downstream value from structure %d '(%s)%s' can't intersect with" " 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 (filter_value), filter_str); @@ -411,8 +411,9 @@ _append_query_caps_failure_details (GstValidatePadMonitor * monitor, continue; } - gst_structure_foreach (possible_struct, - (GstStructureForeachFunc) _find_structure_incompatible_fields, &info); + gst_structure_foreach_id_str (possible_struct, + (GstStructureForeachIdStrFunc) _find_structure_incompatible_fields, + &info); if (info.found) found = TRUE; @@ -481,8 +482,9 @@ _append_accept_caps_failure_details (GstValidatePadMonitor * monitor, continue; } - gst_structure_foreach (refused_struct, - (GstStructureForeachFunc) _find_structure_incompatible_fields, &info); + gst_structure_foreach_id_str (refused_struct, + (GstStructureForeachIdStrFunc) _find_structure_incompatible_fields, + &info); } } diff --git a/subprojects/gst-devtools/validate/gst/validate/gst-validate-report.c b/subprojects/gst-devtools/validate/gst/validate/gst-validate-report.c index 30ca2c33d1..1d11cac2c2 100644 --- a/subprojects/gst-devtools/validate/gst/validate/gst-validate-report.c +++ b/subprojects/gst-devtools/validate/gst/validate/gst-validate-report.c @@ -962,10 +962,11 @@ typedef struct } PrintActionFieldData; 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; - 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, "__")) return TRUE; @@ -1021,8 +1022,8 @@ gst_validate_print_action (GstValidateAction * action, const gchar * message) GST_VALIDATE_ACTION_N_REPEATS (action)); g_string_append (string, " ( "); - gst_structure_foreach (action->structure, - (GstStructureForeachFunc) _append_value, &d); + gst_structure_foreach_id_str (action->structure, + (GstStructureForeachIdStrFunc) _append_value, &d); if (d.printed) g_string_append_printf (string, "\n%*c)\n", indent, ' '); else diff --git a/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c b/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c index 6b0afef8da..e55ee4bde2 100644 --- a/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c +++ b/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c @@ -1265,9 +1265,10 @@ _pause_action_restore_playing (GstValidateScenario * scenario) } 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; } @@ -1276,14 +1277,14 @@ static GstValidateExecuteActionReturn _execute_define_vars (GstValidateScenario * scenario, GstValidateAction * action) { - gst_structure_foreach (action->structure, - (GstStructureForeachFunc) _set_const_func, scenario->priv->vars); + gst_structure_foreach_id_str (action->structure, + (GstStructureForeachIdStrFunc) _set_const_func, scenario->priv->vars); return GST_VALIDATE_EXECUTE_ACTION_OK; } static GstValidateExecuteActionReturn -_set_timed_value (GQuark field_id, const GValue * gvalue, +_set_timed_value (const GstIdStr * fieldname, const GValue * gvalue, GstStructure * structure) { GstValidateExecuteActionReturn res = GST_VALIDATE_EXECUTE_ACTION_OK; @@ -1295,7 +1296,7 @@ _set_timed_value (GQuark field_id, const GValue * gvalue, GstValidateAction *action; GstObject *obj = 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[] = { "binding-type", "source-type", "interpolation-mode", "timestamp", "__scenario__", "__action__", "__res__", "repeat", @@ -1408,8 +1409,8 @@ _set_timed_value_property (GstValidateScenario * scenario, gst_structure_set (action->structure, "__action__", G_TYPE_POINTER, action, "__scenario__", G_TYPE_POINTER, scenario, NULL); - gst_structure_foreach (action->structure, - (GstStructureForeachFunc) _set_timed_value, action->structure); + gst_structure_foreach_id_str (action->structure, + (GstStructureForeachIdStrFunc) _set_timed_value, action->structure); gst_structure_get_int (action->structure, "__res__", &res); gst_structure_remove_fields (action->structure, "__action__", "__scenario__", "__res__", NULL); @@ -1455,7 +1456,7 @@ _check_property (GstValidateScenario * scenario, GstValidateAction * action, } static GstValidateExecuteActionReturn -_set_or_check_properties (GQuark field_id, const GValue * value, +_set_or_check_properties (const GstIdStr * fieldname, const GValue * value, GstStructure * structure) { GstValidateExecuteActionReturn res = GST_VALIDATE_EXECUTE_ACTION_OK; @@ -1465,7 +1466,7 @@ _set_or_check_properties (GQuark field_id, const GValue * value, GParamSpec *paramspec = NULL; gboolean no_value_check = FALSE; 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__", "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, action, "__scenario__", G_TYPE_POINTER, scenario, NULL); - gst_structure_foreach (action->structure, - (GstStructureForeachFunc) _set_or_check_properties, action->structure); + gst_structure_foreach_id_str (action->structure, + (GstStructureForeachIdStrFunc) _set_or_check_properties, + action->structure); gst_structure_get_int (action->structure, "__res__", &res); gst_structure_remove_fields (action->structure, "__action__", "__scenario__", "__res__", NULL); @@ -2663,10 +2665,10 @@ gst_validate_parse_next_action_playback_time (GstValidateScenario * self) } static gboolean -_foreach_find_iterator (GQuark field_id, GValue * value, +_foreach_find_iterator (const GstIdStr * fieldname, GValue * value, 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")) return TRUE; @@ -3720,10 +3722,10 @@ done: } static gboolean -set_env_var (GQuark field_id, GValue * value, +set_env_var (const GstIdStr * fieldname, GValue * value, 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); return TRUE; @@ -3754,8 +3756,8 @@ _run_command (GstValidateScenario * scenario, GstValidateAction * action) "The `env` parameter should be a GstStructure, got %s", G_VALUE_TYPE_NAME (env)); if (env) { - gst_structure_foreach (gst_value_get_structure (env), - (GstStructureForeachFunc) set_env_var, subproc_launcher); + gst_structure_foreach_id_str (gst_value_get_structure (env), + (GstStructureForeachIdStrFunc) set_env_var, subproc_launcher); } REPORT_UNLESS ( @@ -4720,8 +4722,8 @@ gst_validate_foreach_prepare (GstValidateAction * action) g_free (GST_VALIDATE_ACTION_RANGE_NAME (action)); GST_VALIDATE_ACTION_RANGE_NAME (action) = NULL; - gst_structure_foreach (action->structure, - (GstStructureForeachFunc) _foreach_find_iterator, action); + gst_structure_foreach_id_str (action->structure, + (GstStructureForeachIdStrFunc) _foreach_find_iterator, action); /* Allow using the repeat field here too */ if (!GST_VALIDATE_ACTION_RANGE_NAME (action) @@ -4792,10 +4794,10 @@ gst_validate_foreach_prepare (GstValidateAction * action) } static gboolean -_check_structure_has_expected_value (GQuark field_id, const GValue * value, - GstStructure * message_struct) +_check_structure_has_expected_value (const GstIdStr * fieldname, + 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) { 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", G_TYPE_BOOLEAN, FALSE, NULL); - gst_structure_foreach (expected_values, - (GstStructureForeachFunc) _check_structure_has_expected_value, + gst_structure_foreach_id_str (expected_values, + (GstStructureForeachIdStrFunc) _check_structure_has_expected_value, message_struct); if (!gst_structure_get_boolean (message_struct, @@ -6078,13 +6080,14 @@ gst_validate_scenario_factory_create (GstValidateRunner * } 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 *tmpcompress = g_strcompress (tmp); 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 (tmp); @@ -6154,8 +6157,8 @@ _parse_scenario (GFile * f, GKeyFile * kf) gst_structure_remove_fields (meta, "__lineno__", "__filename__", "__debug__", NULL); - gst_structure_foreach (meta, - (GstStructureForeachFunc) _add_description, &kfg); + gst_structure_foreach_id_str (meta, + (GstStructureForeachIdStrFunc) _add_description, &kfg); gst_structure_free (meta); g_free (kfg.group_name); } else { diff --git a/subprojects/gst-devtools/validate/gst/validate/gst-validate-utils.c b/subprojects/gst-devtools/validate/gst/validate/gst-validate-utils.c index 60ae1f906e..5c3a48275d 100644 --- a/subprojects/gst-devtools/validate/gst/validate/gst-validate-utils.c +++ b/subprojects/gst-devtools/validate/gst/validate/gst-validate-utils.c @@ -50,10 +50,6 @@ static GRegex *_variables_regex = NULL; static GstStructure *global_vars = NULL; -static GQuark debug_quark = 0; -static GQuark lineno_quark = 0; -static GQuark filename_quark = 0; - typedef struct { const gchar *str; @@ -563,17 +559,6 @@ skip_spaces (gchar * 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 gst_validate_has_colored_output (void) { @@ -809,11 +794,10 @@ _file_get_structures (GFile * file, gchar ** err, } gst_structure_free (structure); } else { - setup_quarks (); - gst_structure_id_set (structure, - lineno_quark, G_TYPE_INT, current_lineno, - filename_quark, G_TYPE_STRING, filename, - debug_quark, G_TYPE_STRING, debug_line->str, NULL); + gst_structure_set_static_str (structure, + "__lineno__", G_TYPE_INT, current_lineno, + "__filename__", G_TYPE_STRING, filename, + "__debug__", G_TYPE_STRING, debug_line->str, NULL); structures = g_list_append (structures, structure); } } @@ -1356,10 +1340,17 @@ done: } 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 - || field_id == debug_quark) + static const gchar *skip_fields[] = { + "__filename__", + "__lineno__", + "__debug__", + NULL, + }; + + if (fieldname && g_strv_contains (skip_fields, gst_id_str_as_str (fieldname))) return TRUE; 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 }; - gst_structure_filter_and_map_in_place (structure, - (GstStructureFilterMapFunc) _structure_set_variables, &d); + gst_structure_filter_and_map_in_place_id_str (structure, + (GstStructureFilterMapIdStrFunc) _structure_set_variables, &d); } 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; } @@ -1462,8 +1454,8 @@ gst_validate_set_globals (GstStructure * structure) if (!structure) return; - gst_structure_foreach (structure, - (GstStructureForeachFunc) _set_vars_func, global_vars); + gst_structure_foreach_id_str (structure, + (GstStructureForeachIdStrFunc) _set_vars_func, global_vars); } /** diff --git a/subprojects/gst-devtools/validate/gst/validate/validate.c b/subprojects/gst-devtools/validate/gst/validate/validate.c index c808cc4a36..dd793a010c 100644 --- a/subprojects/gst-devtools/validate/gst/validate/validate.c +++ b/subprojects/gst-devtools/validate/gst/validate/validate.c @@ -138,9 +138,10 @@ gst_structure_validate_name (const gchar * name) } 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; } @@ -199,8 +200,8 @@ create_config (const gchar * config) if (gst_structure_has_field (structure, "set-vars")) { gst_structure_remove_field (structure, "set-vars"); - gst_structure_foreach (structure, - (GstStructureForeachFunc) _set_vars_func, local_vars); + gst_structure_foreach_id_str (structure, + (GstStructureForeachIdStrFunc) _set_vars_func, local_vars); gst_structure_free (structure); } else if (!loaded_globals && gst_structure_has_name (structure, "set-globals")) { diff --git a/subprojects/gst-devtools/validate/plugins/ssim/gstvalidatessim.c b/subprojects/gst-devtools/validate/plugins/ssim/gstvalidatessim.c index 37cad8a513..f2d00549bb 100644 --- a/subprojects/gst-devtools/validate/plugins/ssim/gstvalidatessim.c +++ b/subprojects/gst-devtools/validate/plugins/ssim/gstvalidatessim.c @@ -722,10 +722,11 @@ _handle_event (GstValidateOverride * override, } 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)) - gst_structure_id_set_value (structure, field_id, value); + if (!gst_structure_id_str_has_field (structure, fieldname)) + gst_structure_id_str_set_value (structure, fieldname, value); return TRUE; } @@ -760,8 +761,8 @@ gst_validate_ssim_init (GstPlugin * plugin) continue; if (config_structure) { - gst_structure_map_in_place (config_structure, - (GstStructureMapFunc) _map_confg, tmp->data); + gst_structure_map_in_place_id_str (config_structure, + (GstStructureMapIdStrFunc) _map_confg, tmp->data); } if ((name || target_element_classification)) { GstValidateOverride *override = diff --git a/subprojects/gst-editing-services/ges/ges-base-xml-formatter.c b/subprojects/gst-editing-services/ges/ges-base-xml-formatter.c index 3e99f4fe65..402c50ad7e 100644 --- a/subprojects/gst-editing-services/ges/ges-base-xml-formatter.c +++ b/subprojects/gst-editing-services/ges/ges-base-xml-formatter.c @@ -546,7 +546,7 @@ _loading_done_cb (GESFormatter * self) } static gboolean -_set_child_property (GQuark field_id, const GValue * value, +_set_child_property (const GstIdStr * fieldname, const GValue * value, GESTimelineElement * tlelement) { GParamSpec *pspec; @@ -554,11 +554,11 @@ _set_child_property (GQuark field_id, const GValue * value, /* FIXME: error handling? */ 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 gchar *tmp = gst_value_serialize (value); 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); #endif return TRUE; @@ -571,9 +571,10 @@ _set_child_property (GQuark field_id, const GValue * value, } 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; } @@ -602,12 +603,12 @@ _add_object_to_layer (GESBaseXmlFormatterPrivate * priv, const gchar * id, metadatas); if (properties) - gst_structure_foreach (properties, - (GstStructureForeachFunc) set_property_foreach, clip); + gst_structure_foreach_id_str (properties, + (GstStructureForeachIdStrFunc) set_property_foreach, clip); if (children_properties) - gst_structure_foreach (children_properties, - (GstStructureForeachFunc) _set_child_property, clip); + gst_structure_foreach_id_str (children_properties, + (GstStructureForeachIdStrFunc) _set_child_property, clip); g_hash_table_insert (priv->containers, g_strdup (id), gst_object_ref (clip)); return clip; @@ -635,8 +636,8 @@ _add_track_element (GESFormatter * self, GESClip * clip, GES_TIMELINE_ELEMENT (trackelement))) GST_ERROR ("%" GES_FORMAT " could not add child %p while" " reloading, this should never happen", GES_ARGS (clip), trackelement); - gst_structure_foreach (children_properties, - (GstStructureForeachFunc) _set_child_property, trackelement); + gst_structure_foreach_id_str (children_properties, + (GstStructureForeachIdStrFunc) _set_child_property, trackelement); if (properties) { gboolean has_internal_source; @@ -649,8 +650,8 @@ _add_track_element (GESFormatter * self, GESClip * clip, &has_internal_source) && has_internal_source) g_object_set (trackelement, "has-internal-source", has_internal_source, NULL); - gst_structure_foreach (properties, - (GstStructureForeachFunc) set_property_foreach, trackelement); + gst_structure_foreach_id_str (properties, + (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), passet->metadatas); if (passet->properties) - gst_structure_foreach (passet->properties, - (GstStructureForeachFunc) set_property_foreach, source); + gst_structure_foreach_id_str (passet->properties, + (GstStructureForeachIdStrFunc) set_property_foreach, source); possible_id = ges_project_try_updating_id (GES_FORMATTER (self)->project, source, error); @@ -922,8 +923,8 @@ ges_base_xml_formatter_set_timeline_properties (GESBaseXmlFormatter * self, &auto_transition)) gst_structure_remove_field (props, "auto-transition"); - gst_structure_foreach (props, - (GstStructureForeachFunc) set_property_foreach, timeline); + gst_structure_foreach_id_str (props, + (GstStructureForeachIdStrFunc) set_property_foreach, timeline); gst_structure_free (props); } } @@ -977,8 +978,8 @@ ges_base_xml_formatter_add_layer (GESBaseXmlFormatter * self, &auto_transition)) gst_structure_remove_field (properties, "auto-transition"); - gst_structure_foreach (properties, - (GstStructureForeachFunc) set_property_foreach, layer); + gst_structure_foreach_id_str (properties, + (GstStructureForeachIdStrFunc) set_property_foreach, layer); } if (metadatas) @@ -1047,8 +1048,8 @@ ges_base_xml_formatter_add_track (GESBaseXmlFormatter * self, } gst_structure_remove_fields (properties, "restriction-caps", "caps", "message-forward", NULL); - gst_structure_foreach (properties, - (GstStructureForeachFunc) set_property_foreach, track); + gst_structure_foreach_id_str (properties, + (GstStructureForeachIdStrFunc) set_property_foreach, track); g_free (restriction); } @@ -1133,12 +1134,12 @@ ges_base_xml_formatter_add_source (GESBaseXmlFormatter * self, } if (properties) - gst_structure_foreach (properties, - (GstStructureForeachFunc) set_property_foreach, element); + gst_structure_foreach_id_str (properties, + (GstStructureForeachIdStrFunc) set_property_foreach, element); if (children_properties) - gst_structure_foreach (children_properties, - (GstStructureForeachFunc) _set_child_property, element); + gst_structure_foreach_id_str (children_properties, + (GstStructureForeachIdStrFunc) _set_child_property, element); if (metadatas) ges_meta_container_add_metas_from_string (GES_META_CONTAINER diff --git a/subprojects/gst-editing-services/ges/ges-internal.h b/subprojects/gst-editing-services/ges/ges-internal.h index da7e10fc0f..9eaa07a5dd 100644 --- a/subprojects/gst-editing-services/ges/ges-internal.h +++ b/subprojects/gst-editing-services/ges/ges-internal.h @@ -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 gboolean set_property_foreach (GQuark field_id, +G_GNUC_INTERNAL gboolean set_property_foreach (const GstIdStr *fieldname, const GValue * value, GObject * object); diff --git a/subprojects/gst-editing-services/ges/ges-meta-container.c b/subprojects/gst-editing-services/ges/ges-meta-container.c index c82482356b..296ee5e873 100644 --- a/subprojects/gst-editing-services/ges/ges-meta-container.c +++ b/subprojects/gst-editing-services/ges/ges-meta-container.c @@ -152,19 +152,21 @@ typedef struct } MetadataForeachData; static gboolean -structure_foreach_wrapper (GQuark field_id, const GValue * value, +structure_foreach_wrapper (const GstIdStr * fieldname, const GValue * value, gpointer 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; } 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; } @@ -195,8 +197,8 @@ ges_meta_container_foreach (GESMetaContainer * container, foreach_data.container = container; foreach_data.data = user_data; - gst_structure_foreach (structure, - (GstStructureForeachFunc) structure_foreach_wrapper, &foreach_data); + gst_structure_foreach_id_str (structure, + (GstStructureForeachIdStrFunc) structure_foreach_wrapper, &foreach_data); } static gboolean @@ -563,8 +565,8 @@ ges_meta_container_add_metas_from_string (GESMetaContainer * container, return FALSE; } - gst_structure_foreach (n_structure, (GstStructureForeachFunc) _append_foreach, - container); + gst_structure_foreach_id_str (n_structure, + (GstStructureForeachIdStrFunc) _append_foreach, container); gst_structure_free (n_structure); return TRUE; diff --git a/subprojects/gst-editing-services/ges/ges-structured-interface.c b/subprojects/gst-editing-services/ges/ges-structured-interface.c index 2aff457782..b3576aadc7 100644 --- a/subprojects/gst-editing-services/ges/ges-structured-interface.c +++ b/subprojects/gst-editing-services/ges/ges-structured-interface.c @@ -156,18 +156,17 @@ enum_from_str (GType type, const gchar * str_enum, guint * enum_value) } 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 = g_quark_to_string (field_id); + const gchar *field = gst_id_str_as_str (fieldname); - for (i = 0; fields_error->fields[i]; i++) { - if (g_strcmp0 (fields_error->fields[i], field) == 0) { - - return TRUE; - } - } + if (g_strv_contains (fields_error->fields, gst_id_str_as_str (fieldname))) + 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 = g_list_append (fields_error->invalid_fields, (gpointer) field); @@ -178,8 +177,8 @@ static gboolean _check_fields (GstStructure * structure, FieldsError fields_error, GError ** error) { - gst_structure_foreach (structure, - (GstStructureForeachFunc) _check_field, &fields_error); + gst_structure_foreach_id_str (structure, + (GstStructureForeachIdStrFunc) _check_field, &fields_error); if (fields_error.invalid_fields) { GList *tmp; @@ -199,6 +198,7 @@ _check_fields (GstStructure * structure, FieldsError fields_error, g_list_free (fields_error.invalid_fields); g_string_free (msg, TRUE); + g_list_free (fields_error.invalid_fields); return FALSE; } @@ -351,24 +351,21 @@ value_to_double (const GValue * v) } static gboolean -un_set_keyframes_foreach (GQuark field_id, const GValue * value, +un_set_keyframes_foreach (const GstIdStr * fieldname, const GValue * value, SetKeyframesData * d) { GError **error = &d->error; gchar *tmp; - gint i; const gchar *valid_fields[] = { "element-name", "property-name", "value", "timestamp", "project-uri", "binding-type", "source-type", "interpolation-mode", "interpolation-mode", NULL }; - const gchar *field = g_quark_to_string (field_id); + const gchar *field = gst_id_str_as_str (fieldname); gdouble ts; - for (i = 0; valid_fields[i]; i++) { - if (g_quark_from_string (valid_fields[i]) == field_id) - return TRUE; - } + if (g_strv_contains (valid_fields, gst_id_str_as_str (fieldname))) + return TRUE; errno = 0; ts = g_strtod (field, &tmp); @@ -456,8 +453,8 @@ _ges_add_remove_keyframe_from_struct (GESTimeline * timeline, SetKeyframesData d = { source, structure, NULL, property_name, TRUE, }; - gst_structure_foreach (structure, - (GstStructureForeachFunc) un_set_keyframes_foreach, &d); + gst_structure_foreach_id_str (structure, + (GstStructureForeachIdStrFunc) un_set_keyframes_foreach, &d); if (!d.res) g_propagate_error (error, d.error); diff --git a/subprojects/gst-editing-services/ges/ges-track.c b/subprojects/gst-editing-services/ges/ges-track.c index 4b511ee321..398d1f5d8f 100644 --- a/subprojects/gst-editing-services/ges/ges-track.c +++ b/subprojects/gst-editing-services/ges/ges-track.c @@ -305,9 +305,10 @@ track_resort_and_fill_gaps (GESTrack * track) } 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; } @@ -1094,8 +1095,8 @@ ges_track_update_restriction_caps (GESTrack * self, const GstCaps * caps) if (gst_caps_get_size (new_restriction_caps) > i) { GstStructure *original = gst_caps_get_structure (new_restriction_caps, i); - gst_structure_foreach (new, (GstStructureForeachFunc) update_field, - original); + gst_structure_foreach_id_str (new, + (GstStructureForeachIdStrFunc) update_field, original); } else gst_caps_append_structure (new_restriction_caps, gst_structure_copy (new)); diff --git a/subprojects/gst-editing-services/ges/ges-validate.c b/subprojects/gst-editing-services/ges/ges-validate.c index 7163cfeafe..6189ebe886 100644 --- a/subprojects/gst-editing-services/ges/ges-validate.c +++ b/subprojects/gst-editing-services/ges/ges-validate.c @@ -534,11 +534,12 @@ typedef struct } PropertyData; 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, *observed_value; - const gchar *property = g_quark_to_string (field_id); + const gchar *property = gst_id_str_as_str (fieldname); GstControlBinding *binding = NULL; if (!data->on_children) { @@ -665,9 +666,10 @@ compare: } 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 (!ges_timeline_element_set_child_property (data->element, property, @@ -729,9 +731,9 @@ GES_START_VALIDATE_ACTION (set_or_check_properties) data.element = element; gst_structure_remove_fields (structure, "element-name", "at-time", "project-uri", NULL); - gst_structure_foreach (structure, - is_setting ? (GstStructureForeachFunc) set_property - : (GstStructureForeachFunc) check_property, &data); + gst_structure_foreach_id_str (structure, + is_setting ? (GstStructureForeachIdStrFunc) set_property + : (GstStructureForeachIdStrFunc) check_property, &data); gst_object_unref (element); local_done: diff --git a/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc-sendrecv.c b/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc-sendrecv.c index 35e77135e4..25f92943c2 100644 --- a/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc-sendrecv.c +++ b/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc-sendrecv.c @@ -380,14 +380,15 @@ on_ice_gathering_state_notify (GstElement * webrtcbin, GParamSpec * pspec, static gboolean webrtcbin_get_stats (GstElement * webrtcbin); 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)) { - 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)); } else { 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; @@ -401,7 +402,7 @@ on_webrtcbin_get_stats (GstPromise * promise, GstElement * webrtcbin) g_return_if_fail (gst_promise_wait (promise) == GST_PROMISE_RESULT_REPLIED); 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); } diff --git a/subprojects/gst-plugins-bad/ext/curl/gstcurlhttpsrc.c b/subprojects/gst-plugins-bad/ext/curl/gstcurlhttpsrc.c index 00ab5debb4..d778fa392c 100644 --- a/subprojects/gst-plugins-bad/ext/curl/gstcurlhttpsrc.c +++ b/subprojects/gst-plugins-bad/ext/curl/gstcurlhttpsrc.c @@ -1056,12 +1056,13 @@ escape: * understand. */ 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; 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)); *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 */ 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); if (curl_easy_setopt (handle, CURLOPT_HTTPHEADER, s->slist) != CURLE_OK) { GST_WARNING_OBJECT (s, "Failed to set HTTP headers!"); diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c index 10d0f36d5e..5a79e6f486 100644 --- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c +++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c @@ -3088,13 +3088,13 @@ done: /* https://tools.ietf.org/html/rfc5576#section-4.2 */ 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) { gchar *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)); gst_sdp_media_add_attribute (media, "ssrc-group", str); @@ -3111,7 +3111,8 @@ typedef struct } RtxSsrcData; 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; GstStructure *sdes; @@ -3164,8 +3165,8 @@ _media_add_ssrcs (GstSDPMedia * media, GstCaps * caps, GstWebRTCBin * webrtc, cname = gst_structure_get_string (sdes, "cname"); if (trans->local_rtx_ssrc_map) - gst_structure_foreach (trans->local_rtx_ssrc_map, - (GstStructureForeachFunc) _media_add_rtx_ssrc_group, media); + gst_structure_foreach_id_str (trans->local_rtx_ssrc_map, + (GstStructureForeachIdStrFunc) _media_add_rtx_ssrc_group, media); for (i = 0; i < gst_caps_get_size (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); if (trans->local_rtx_ssrc_map) - gst_structure_foreach (trans->local_rtx_ssrc_map, - (GstStructureForeachFunc) _media_add_rtx_ssrc, &data); + gst_structure_foreach_id_str (trans->local_rtx_ssrc_map, + (GstStructureForeachIdStrFunc) _media_add_rtx_ssrc, &data); } static void @@ -3229,7 +3230,8 @@ _add_fingerprint_to_media (GstWebRTCDTLSTransport * transport, } 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; @@ -3271,7 +3273,7 @@ _parse_extmap (GQuark field_id, const GValue * value, GError ** error) g_set_error (error, GST_WEBRTC_ERROR, 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); } @@ -3287,37 +3289,38 @@ typedef struct } ExtmapData; 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 = - 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) goto done; 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) { data->ret = FALSE; goto done; } - if (gst_structure_id_has_field (data->extmap, field_id)) { - gchar *old_value = - _parse_extmap (field_id, gst_structure_id_get_value (data->extmap, - field_id), NULL); + if (gst_structure_id_str_has_field (data->extmap, fieldname)) { + gchar *old_value = _parse_extmap (fieldname, + gst_structure_id_str_get_value (data->extmap, + fieldname), NULL); g_assert (old_value); if (g_strcmp0 (new_value, old_value)) { GST_ERROR ("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, GST_WEBRTC_ERROR_INTERNAL_FAILURE, "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; } @@ -3326,7 +3329,7 @@ _dedup_extmap_field (GQuark field_id, const GValue * value, ExtmapData * data) } 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); @@ -3348,8 +3351,8 @@ _gather_extmap (GstCaps * caps, GError ** error) for (i = 0; i < n; i++) { GstStructure *s = gst_caps_get_structure (caps, i); - gst_structure_filter_and_map_in_place (s, - (GstStructureFilterMapFunc) _dedup_extmap_field, &edata); + gst_structure_filter_and_map_in_place_id_str (s, + (GstStructureFilterMapIdStrFunc) _dedup_extmap_field, &edata); if (!edata.ret) { gst_clear_structure (&edata.extmap); @@ -3367,11 +3370,11 @@ struct hdrext_id }; static gboolean -structure_value_get_rtphdrext_id (GQuark field_id, const GValue * value, - gpointer user_data) +structure_value_get_rtphdrext_id (const GstIdStr * fieldname, + const GValue * value, gpointer 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-")) { 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); 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) return data.ext_id; @@ -3425,9 +3428,9 @@ caps_contain_rtp_header_extension (const GstCaps * caps, } 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; } @@ -3595,7 +3598,8 @@ sdp_media_from_transceiver (GstWebRTCBin * webrtc, GstSDPMedia * media, GstStructure *s = gst_structure_copy (gst_caps_get_structure (caps, i)); 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); @@ -4992,11 +4996,12 @@ _build_fec_encoder (GstWebRTCBin * webrtc, WebRTCTransceiver * trans) } 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; - gst_structure_id_set_value (s, field_id, value); + gst_structure_id_str_set_value (s, fieldname, value); return TRUE; } @@ -5147,7 +5152,7 @@ _set_internal_rtpbin_element_props_from_stream (GstWebRTCBin * webrtc, } 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); } } @@ -5452,11 +5457,11 @@ _add_end_of_candidate_to_sdp (GstWebRTCBin * webrtc, } static gboolean -_filter_sdp_fields (GQuark field_id, const GValue * value, +_filter_sdp_fields (const GstIdStr * fieldname, const GValue * value, GstStructure * new_structure) { - if (!g_str_has_prefix (g_quark_to_string (field_id), "a-")) { - gst_structure_id_set_value (new_structure, field_id, value); + if (!g_str_has_prefix (gst_id_str_as_str (fieldname), "a-")) { + gst_structure_id_str_set_value (new_structure, fieldname, value); } return TRUE; } @@ -5621,8 +5626,8 @@ _update_transport_ptmap_from_media (GstWebRTCBin * webrtc, GstStructure *filtered = gst_structure_new_empty (gst_structure_get_name (s)); - gst_structure_foreach (s, - (GstStructureForeachFunc) _filter_sdp_fields, filtered); + gst_structure_foreach_id_str (s, + (GstStructureForeachIdStrFunc) _filter_sdp_fields, filtered); gst_caps_append_structure (item.caps, filtered); } diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c b/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c index 2f6926210f..a0264d0fc8 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c @@ -85,28 +85,6 @@ gst_player_error_quark (void) 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 { PROP_0, @@ -185,23 +163,6 @@ gst_player_init (GstPlayer * self) 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 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_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL, NULL, NULL, G_TYPE_NONE, 1, GST_TYPE_CLOCK_TIME); - - config_quark_initialize (); } 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 (agent != NULL); - gst_structure_id_set (config, - CONFIG_QUARK (USER_AGENT), G_TYPE_STRING, agent, NULL); + gst_structure_set_static_str (config, + "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); - gst_structure_id_get (config, - CONFIG_QUARK (USER_AGENT), G_TYPE_STRING, &agent, NULL); + gst_structure_get (config, "user-agent", G_TYPE_STRING, &agent, NULL); 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 (interval <= 10000); - gst_structure_id_set (config, - CONFIG_QUARK (POSITION_INTERVAL_UPDATE), G_TYPE_UINT, interval, NULL); + gst_structure_set_static_str (config, + "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); - gst_structure_id_get (config, - CONFIG_QUARK (POSITION_INTERVAL_UPDATE), G_TYPE_UINT, &interval, NULL); + gst_structure_get (config, + "position-interval-update", G_TYPE_UINT, &interval, NULL); return interval; } @@ -1724,8 +1682,8 @@ gst_player_config_set_seek_accurate (GstStructure * config, gboolean accurate) { g_return_if_fail (config != NULL); - gst_structure_id_set (config, - CONFIG_QUARK (ACCURATE_SEEK), G_TYPE_BOOLEAN, accurate, NULL); + gst_structure_set_static_str (config, + "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); - gst_structure_id_get (config, - CONFIG_QUARK (ACCURATE_SEEK), G_TYPE_BOOLEAN, &accurate, NULL); + gst_structure_get (config, "accurate-seek", G_TYPE_BOOLEAN, &accurate, NULL); return accurate; } diff --git a/subprojects/gst-plugins-bad/gst/debugutils/gsttestsrcbin.c b/subprojects/gst-plugins-bad/gst/debugutils/gsttestsrcbin.c index 02a39002a2..876f5d41f4 100644 --- a/subprojects/gst-plugins-bad/gst/debugutils/gsttestsrcbin.c +++ b/subprojects/gst-plugins-bad/gst/debugutils/gsttestsrcbin.c @@ -235,20 +235,20 @@ gst_test_src_bin_chain (GstPad * pad, GstObject * object, GstBuffer * buffer) } static gboolean -gst_test_src_bin_set_element_property (GQuark property_id, const GValue * value, - GObject * element) +gst_test_src_bin_set_element_property (const GstIdStr * property, + 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; - if (property_id == g_quark_from_static_string ("caps")) + if (gst_id_str_is_equal_to_str (property, "caps")) return TRUE; 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)); 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; } @@ -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); stream_start = gst_event_new_stream_start (gst_stream_get_stream_id (stream)); - gst_structure_foreach (props, - (GstStructureForeachFunc) gst_test_src_bin_set_element_property, src); + gst_structure_foreach_id_str (props, + (GstStructureForeachIdStrFunc) gst_test_src_bin_set_element_property, + src); gst_event_set_stream (stream_start, stream); gst_event_set_group_id (stream_start, self->group_id); diff --git a/subprojects/gst-plugins-bad/sys/ipcpipeline/gstipcpipelinecomm.c b/subprojects/gst-plugins-bad/sys/ipcpipeline/gstipcpipelinecomm.c index afe61b8335..6879e6613b 100644 --- a/subprojects/gst-plugins-bad/sys/ipcpipeline/gstipcpipelinecomm.c +++ b/subprojects/gst-plugins-bad/sys/ipcpipeline/gstipcpipelinecomm.c @@ -1680,11 +1680,11 @@ gst_ipc_pipeline_comm_cancel (GstIpcPipelineComm * comm, gboolean cleanup) } 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; - gst_structure_id_set_value (structure, field_id, value); + gst_structure_id_str_set_value (structure, fieldname, value); return TRUE; } @@ -1711,7 +1711,7 @@ gst_ipc_pipeline_comm_reply_request (GstIpcPipelineComm * comm, guint32 id, will expect the object to be the same */ GstStructure *structure = gst_query_writable_structure (req->query); 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); } else { GST_WARNING_OBJECT (comm->element, diff --git a/subprojects/gst-plugins-bad/sys/kms/gstkmssink.c b/subprojects/gst-plugins-bad/sys/kms/gstkmssink.c index c1e9f64ae3..033da6f82f 100644 --- a/subprojects/gst-plugins-bad/sys/kms/gstkmssink.c +++ b/subprojects/gst-plugins-bad/sys/kms/gstkmssink.c @@ -931,14 +931,15 @@ typedef struct } SetPropsIter; 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; GstKMSSink *self = iter->self; const gchar *name; guint64 v; - name = g_quark_to_string (field_id); + name = gst_id_str_as_str (fieldname); if (G_VALUE_HOLDS (value, G_TYPE_INT)) 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->obj_type); - gst_structure_foreach (props, set_obj_prop, iter); + gst_structure_foreach_id_str (props, set_obj_prop, iter); drmModeFreeObjectProperties (iter->properties); } diff --git a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudaconverter.c b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudaconverter.c index 5f8bf5781e..85b14c029a 100644 --- a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudaconverter.c +++ b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudaconverter.c @@ -2207,11 +2207,12 @@ error: } 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; - gst_structure_id_set_value (self->priv->config, field_id, value); + gst_structure_id_str_set_value (self->priv->config, fieldname, value); return TRUE; } @@ -2219,7 +2220,7 @@ copy_config (GQuark field_id, const GValue * value, gpointer user_data) static void 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); } diff --git a/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c b/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c index 2a864f2b72..9541b97c10 100644 --- a/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c +++ b/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c @@ -1790,13 +1790,13 @@ struct stats_check_state }; static gboolean -validate_stats_foreach (GQuark field_id, const GValue * value, +validate_stats_foreach (const GstIdStr * fieldname, const GValue * value, gpointer user_data) { struct stats_check_state *state = (struct stats_check_state *) (user_data); 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; fail_unless (GST_VALUE_HOLDS_STRUCTURE (value)); @@ -1843,8 +1843,8 @@ validate_stats_foreach (GQuark field_id, const GValue * value, static void validate_stats (struct stats_check_state *state) { - gst_structure_foreach (state->stats, - (GstStructureForeachFunc) validate_stats_foreach, (gpointer) state); + gst_structure_foreach_id_str (state->stats, + (GstStructureForeachIdStrFunc) validate_stats_foreach, (gpointer) state); } static void diff --git a/subprojects/gst-plugins-bad/tests/examples/mxf/mxfdemux-structure.c b/subprojects/gst-plugins-bad/tests/examples/mxf/mxfdemux-structure.c index a24a310824..b7bebab2ce 100644 --- a/subprojects/gst-plugins-bad/tests/examples/mxf/mxfdemux-structure.c +++ b/subprojects/gst-plugins-bad/tests/examples/mxf/mxfdemux-structure.c @@ -51,11 +51,12 @@ g_value_to_string (const GValue * val) } 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 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); @@ -77,7 +78,7 @@ insert_field (GQuark field_id, const GValue * val, gpointer user_data) gtk_tree_store_set (treestore, &child_iter, 0, 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 { 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); - gst_structure_foreach (s, insert_field, &iter); + gst_structure_foreach_id_str (s, insert_field, &iter); } else { gchar *v = g_value_to_string (val); 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); - gst_structure_foreach (s, insert_field, iter); + gst_structure_foreach_id_str (s, insert_field, iter); } static gboolean diff --git a/subprojects/gst-plugins-base/ext/gl/gstglfiltershader.c b/subprojects/gst-plugins-base/ext/gl/gstglfiltershader.c index 543a27f975..617b520f0c 100644 --- a/subprojects/gst-plugins-base/ext/gl/gstglfiltershader.c +++ b/subprojects/gst-plugins-base/ext/gl/gstglfiltershader.c @@ -352,10 +352,11 @@ gst_gl_filtershader_filter_texture (GstGLFilter * filter, GstGLMemory * in_tex, } 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; - 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)) { 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) { gst_gl_shader_use (filtershader->shader); - gst_structure_foreach (filtershader->uniforms, - (GstStructureForeachFunc) _set_uniform, filtershader->shader); + gst_structure_foreach_id_str (filtershader->uniforms, + (GstStructureForeachIdStrFunc) _set_uniform, filtershader->shader); filtershader->new_uniforms = FALSE; } } diff --git a/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-converter.c b/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-converter.c index e8e556410d..523d62cf2c 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-converter.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-converter.c @@ -311,11 +311,12 @@ get_opt_value (GstAudioConverter * convert, const gchar * opt) GST_AUDIO_CONVERTER_OPT_MIX_MATRIX) 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; - gst_structure_id_set_value (convert->config, field_id, value); + gst_structure_id_str_set_value (convert->config, fieldname, value); return TRUE; } @@ -366,7 +367,7 @@ gst_audio_converter_update_config (GstAudioConverter * convert, gst_audio_resampler_update (convert->resampler, in_rate, out_rate, config); if (config) { - gst_structure_foreach (config, copy_config, convert); + gst_structure_foreach_id_str (config, copy_config, convert); gst_structure_free (config); } diff --git a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c index 7a6f70d77c..66eda1f7ba 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c @@ -60,14 +60,6 @@ GST_DEBUG_CATEGORY_STATIC (discoverer_debug); #define GST_CAT_DEFAULT discoverer_debug #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 { GstDiscoverer *dc; @@ -150,13 +142,6 @@ static void _do_init (void) { 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, @@ -849,15 +834,16 @@ collect_stream_information (GstDiscoverer * dc, PrivateStream * ps, guint idx) } if (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); } 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) - 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) - 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); return st; @@ -884,13 +870,12 @@ static void collect_common_information (GstDiscovererStreamInfo * info, const GstStructure * st) { - if (gst_structure_id_has_field (st, _TOC_QUARK)) { - gst_structure_id_get (st, _TOC_QUARK, GST_TYPE_TOC, &info->toc, NULL); + if (gst_structure_has_field (st, "toc")) { + gst_structure_get (st, "toc", GST_TYPE_TOC, &info->toc, NULL); } - if (gst_structure_id_has_field (st, _STREAM_ID_QUARK)) { - gst_structure_id_get (st, _STREAM_ID_QUARK, G_TYPE_STRING, &info->stream_id, - NULL); + if (gst_structure_has_field (st, "stream-id")) { + gst_structure_get (st, "stream-id", G_TYPE_STRING, &info->stream_id, NULL); } } @@ -924,19 +909,18 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, gint tmp, tmp2; guint utmp; - if (!st || (!gst_structure_id_has_field (st, _CAPS_QUARK) - && !gst_structure_id_has_field (st, _ELEMENT_SRCPAD_QUARK))) { + if (!st || (!gst_structure_has_field (st, "caps") + && !gst_structure_has_field (st, "element-srcpad"))) { GST_WARNING ("Couldn't find caps !"); return make_info (parent, GST_TYPE_DISCOVERER_STREAM_INFO, NULL); } - if (gst_structure_id_get (st, _ELEMENT_SRCPAD_QUARK, GST_TYPE_PAD, &srcpad, - NULL)) { + if (gst_structure_get (st, "element-srcpad", GST_TYPE_PAD, &srcpad, NULL)) { caps = gst_pad_get_current_caps (srcpad); gst_object_unref (srcpad); } 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)) { @@ -983,8 +967,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, info->depth = GST_AUDIO_FORMAT_INFO_DEPTH (finfo); } - if (gst_structure_id_has_field (st, _TAGS_QUARK)) { - gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, NULL); + if (gst_structure_has_field (st, "tags")) { + gst_structure_get (st, "tags", GST_TYPE_TAG_LIST, &tags_st, NULL); if (gst_tag_list_get_uint (tags_st, GST_TAG_BITRATE, &utmp) || gst_tag_list_get_uint (tags_st, GST_TAG_NOMINAL_BITRATE, &utmp)) info->bitrate = utmp; @@ -1057,8 +1041,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, else info->interlaced = TRUE; - if (gst_structure_id_has_field (st, _TAGS_QUARK)) { - gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, NULL); + if (gst_structure_has_field (st, "tags")) { + gst_structure_get (st, "tags", GST_TYPE_TAG_LIST, &tags_st, NULL); if (gst_tag_list_get_uint (tags_st, GST_TAG_BITRATE, &utmp) || gst_tag_list_get_uint (tags_st, GST_TAG_NOMINAL_BITRATE, &utmp)) info->bitrate = utmp; @@ -1081,10 +1065,10 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, info = (GstDiscovererSubtitleInfo *) make_info (parent, 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; - 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); if (language) @@ -1113,8 +1097,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, info = make_info (parent, GST_TYPE_DISCOVERER_STREAM_INFO, caps); - if (gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, - NULL)) { + if (gst_structure_get (st, "tags", GST_TYPE_TAG_LIST, &tags_st, NULL)) { 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; } - 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); return NULL; } - gst_structure_id_get (topology, _TOPOLOGY_PAD_QUARK, - GST_TYPE_PAD, &pad, NULL); + gst_structure_get (topology, "pad", GST_TYPE_PAD, &pad, NULL); for (i = 0, tmp = dc->priv->streams; tmp; tmp = tmp->next, i++) { ps = (PrivateStream *) tmp->data; @@ -1263,13 +1245,12 @@ parse_stream_topology (GstDiscoverer * dc, const GstStructure * topology, if (!parent) parent = res; - if (gst_structure_id_get (st, _ELEMENT_SRCPAD_QUARK, GST_TYPE_PAD, - &srcpad, NULL)) { + if (gst_structure_get (st, "element-srcpad", GST_TYPE_PAD, &srcpad, NULL)) { caps = gst_pad_get_current_caps (srcpad); gst_object_unref (srcpad); } 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) { @@ -1308,13 +1289,13 @@ parse_stream_topology (GstDiscoverer * dc, const GstStructure * topology, GstDiscovererContainerInfo *cont; 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)) { caps = gst_pad_get_current_caps (srcpad); gst_object_unref (srcpad); } 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) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtpbasepayload.c b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtpbasepayload.c index 4939001db7..77fdf0f0a1 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtpbasepayload.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtpbasepayload.c @@ -965,10 +965,11 @@ gst_rtp_base_payload_set_options (GstRTPBasePayload * payload, } 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)) { - gst_structure_id_set_value (dest, field_id, value); + gst_structure_id_str_set_value (dest, fieldname, value); } return TRUE; } @@ -989,9 +990,9 @@ update_max_ptime (GstRTPBasePayload * rtpbasepayload) } 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; } @@ -1022,7 +1023,8 @@ gst_rtp_base_payload_set_outcaps_structure (GstRTPBasePayload * payload, GST_DEBUG_OBJECT (payload, "defaults: %" GST_PTR_FORMAT, srccaps); 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); } @@ -1349,7 +1351,8 @@ gst_rtp_base_payload_negotiate (GstRTPBasePayload * payload) srccaps = gst_caps_new_empty_simple (gst_structure_get_name (s)); 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); diff --git a/subprojects/gst-plugins-base/gst-libs/gst/video/video-converter.c b/subprojects/gst-plugins-base/gst-libs/gst/video/video-converter.c index b4ebea8f99..00fbeaa002 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/video/video-converter.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/video/video-converter.c @@ -2689,11 +2689,12 @@ gst_video_converter_free (GstVideoConverter * convert) } 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; - gst_structure_id_set_value (convert->config, field_id, value); + gst_structure_id_str_set_value (convert->config, fieldname, value); 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 (config != NULL, FALSE); - gst_structure_foreach (config, copy_config, convert); + gst_structure_foreach_id_str (config, copy_config, convert); gst_structure_free (config); gst_video_converter_init_from_config (convert); diff --git a/subprojects/gst-plugins-base/gst/encoding/gstencodebasebin.c b/subprojects/gst-plugins-base/gst/encoding/gstencodebasebin.c index 52f0a20e05..c6f8712c6b 100644 --- a/subprojects/gst-plugins-base/gst/encoding/gstencodebasebin.c +++ b/subprojects/gst-plugins-base/gst/encoding/gstencodebasebin.c @@ -883,10 +883,11 @@ beach: } 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)); - g_object_set_property (element, g_quark_to_string (property_id), value); + GST_DEBUG_OBJECT (element, "Setting %s", gst_id_str_as_str (property)); + g_object_set_property (element, gst_id_str_as_str (property), value); return TRUE; } @@ -905,8 +906,8 @@ set_element_properties_from_encoding_profile (GstEncodingProfile * profile, return; if (!gst_structure_has_name (properties, "element-properties-map")) { - gst_structure_foreach (properties, - (GstStructureForeachFunc) _set_properties, element); + gst_structure_foreach_id_str (properties, + (GstStructureForeachIdStrFunc) _set_properties, element); goto done; } @@ -938,8 +939,8 @@ set_element_properties_from_encoding_profile (GstEncodingProfile * profile, GST_DEBUG_OBJECT (GST_OBJECT_PARENT (element), "Setting %" GST_PTR_FORMAT " on %" GST_PTR_FORMAT, tmp_properties, element); - gst_structure_foreach (tmp_properties, - (GstStructureForeachFunc) _set_properties, element); + gst_structure_foreach_id_str (tmp_properties, + (GstStructureForeachIdStrFunc) _set_properties, element); goto done; } @@ -2029,10 +2030,12 @@ cleanup: } 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; - 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)) 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++) { 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); if (res) goto end; diff --git a/subprojects/gst-plugins-base/gst/playback/gstplaysink.c b/subprojects/gst-plugins-base/gst/playback/gstplaysink.c index f4d7a0f8e1..1ccfa5bbf3 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstplaysink.c +++ b/subprojects/gst-plugins-base/gst/playback/gstplaysink.c @@ -402,7 +402,7 @@ static void update_text_offset (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 }; */ @@ -671,9 +671,6 @@ gst_play_sink_class_init (GstPlaySinkClass * klass) klass->reconfigure = GST_DEBUG_FUNCPTR (gst_play_sink_reconfigure); 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_COLOR_BALANCE_CHANNEL); @@ -2248,8 +2245,8 @@ gst_play_sink_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer, if (segment_event) gst_event_set_seqnum (event, gst_event_get_seqnum (segment_event)); structure = gst_event_writable_structure (event); - gst_structure_id_set (structure, - _playsink_reset_segment_event_marker_id, G_TYPE_BOOLEAN, TRUE, NULL); + gst_structure_set_static_str (structure, + PLAYSINK_RESET_SEGMENT_EVENT_MARKER, G_TYPE_BOOLEAN, TRUE, NULL); GST_DEBUG_OBJECT (pad, "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) gst_event_set_seqnum (event, gst_event_get_seqnum (segment_event)); structure = gst_event_writable_structure (event); - gst_structure_id_set (structure, - _playsink_reset_segment_event_marker_id, G_TYPE_BOOLEAN, TRUE, NULL); + gst_structure_set_static_str (structure, + PLAYSINK_RESET_SEGMENT_EVENT_MARKER, G_TYPE_BOOLEAN, TRUE, NULL); GST_DEBUG_OBJECT (pad, "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) { event = gst_event_copy (segment_event); structure = gst_event_writable_structure (event); - gst_structure_id_set (structure, - _playsink_reset_segment_event_marker_id, G_TYPE_BOOLEAN, TRUE, NULL); + gst_structure_set_static_str (structure, + PLAYSINK_RESET_SEGMENT_EVENT_MARKER, G_TYPE_BOOLEAN, TRUE, NULL); GST_DEBUG_OBJECT (playsink, "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); if (structure && - gst_structure_id_has_field (structure, - _playsink_reset_segment_event_marker_id)) { + gst_structure_has_field (structure, + PLAYSINK_RESET_SEGMENT_EVENT_MARKER)) { /* the events marked with a reset segment marker * are sent internally to reset the queue and * must be dropped here */ diff --git a/subprojects/gst-plugins-base/gst/playback/gstsubtitleoverlay.c b/subprojects/gst-plugins-base/gst/playback/gstsubtitleoverlay.c index 37ab008ad9..2f2dfcc81d 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstsubtitleoverlay.c +++ b/subprojects/gst-plugins-base/gst/playback/gstsubtitleoverlay.c @@ -88,12 +88,11 @@ enum #define gst_subtitle_overlay_parent_class parent_class 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 \ GST_DEBUG_CATEGORY_INIT (subtitle_overlay_debug, "subtitleoverlay", 0, "Subtitle Overlay"); \ - playback_element_init (plugin); \ - _subtitle_overlay_event_marker_id = g_quark_from_static_string ("gst-subtitle-overlay-event-marker") + playback_element_init (plugin); GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (subtitleoverlay, "subtitleoverlay", 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; 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, "Dropping event with marker: %" GST_PTR_FORMAT, 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)); 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); break; } diff --git a/subprojects/gst-plugins-base/tests/examples/encoding/gstcapslist.c b/subprojects/gst-plugins-base/tests/examples/encoding/gstcapslist.c index 0113116bad..5252267074 100644 --- a/subprojects/gst-plugins-base/tests/examples/encoding/gstcapslist.c +++ b/subprojects/gst-plugins-base/tests/examples/encoding/gstcapslist.c @@ -24,14 +24,15 @@ */ 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); /* const gchar *fname; */ if (ftype == GST_TYPE_INT_RANGE || ftype == GST_TYPE_DOUBLE_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; } @@ -61,8 +62,8 @@ clear_caps (GstCaps * caps, GstCaps * rescaps) st = gst_caps_get_structure (res, i - 1); /* Remove range fields */ - while (!gst_structure_foreach (st, - (GstStructureForeachFunc) remove_range_foreach, st)); + while (!gst_structure_foreach_id_str (st, + (GstStructureForeachIdStrFunc) remove_range_foreach, st)); } GST_DEBUG ("stripped %" GST_PTR_FORMAT, res); diff --git a/subprojects/gst-plugins-base/tools/gst-device-monitor.c b/subprojects/gst-plugins-base/tools/gst-device-monitor.c index 8edc74010d..aa847b8135 100644 --- a/subprojects/gst-plugins-base/tools/gst-device-monitor.c +++ b/subprojects/gst-plugins-base/tools/gst-device-monitor.c @@ -140,7 +140,7 @@ get_launch_line (GstDevice * device) static gboolean -print_structure_field (GQuark field_id, const GValue * value, +print_structure_field (const GstIdStr * fieldname, const GValue * value, gpointer user_data) { gchar *val; @@ -155,10 +155,10 @@ print_structure_field (GQuark field_id, const GValue * value, } 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 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); @@ -166,11 +166,11 @@ print_structure_field (GQuark field_id, const GValue * value, } 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); - g_print (", %s=%s", g_quark_to_string (field), str); + g_print (", %s=%s", gst_id_str_as_str (fieldname), str); g_free (str); return TRUE; } @@ -208,12 +208,12 @@ print_device (GstDevice * device, gboolean modified) g_print ("(%s)", 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"); } if (props) { 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); g_print ("\n"); } diff --git a/subprojects/gst-plugins-base/tools/gst-discoverer.c b/subprojects/gst-plugins-base/tools/gst-discoverer.c index b042be535d..e3f048bed5 100644 --- a/subprojects/gst-plugins-base/tools/gst-discoverer.c +++ b/subprojects/gst-plugins-base/tools/gst-discoverer.c @@ -51,7 +51,7 @@ typedef struct } PrivStruct; static gboolean -structure_remove_buffers_ip (GQuark field_id, GValue * value, +structure_remove_buffers_ip (const GstIdStr * fieldname, GValue * value, gpointer user_data) { if (G_VALUE_HOLDS (value, GST_TYPE_BUFFER)) @@ -75,7 +75,7 @@ static gboolean caps_remove_buffers_ip (GstCapsFeatures * features, GstStructure * structure, 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); return TRUE; diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c index d953d27be9..4f085117ca 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c @@ -1107,12 +1107,12 @@ struct http_headers_collector }; 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) { struct http_headers_collector *hdr_data = userdata; 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)) 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 *)); 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))); 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; 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)); cookies[0] = g_value_dup_string (value); } else { 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) { @@ -1260,7 +1260,7 @@ gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent, gst_structure_get (structure, "request-headers", GST_TYPE_STRUCTURE, &req_headers, NULL); if (req_headers) { - gst_structure_foreach (req_headers, + gst_structure_foreach_id_str (req_headers, gst_adaptive_demux_handle_upstream_http_header, &c); 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, &res_headers, NULL); if (res_headers) { - gst_structure_foreach (res_headers, + gst_structure_foreach_id_str (res_headers, gst_adaptive_demux_handle_upstream_http_header, &c); gst_structure_free (res_headers); } diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c index 69c73fff43..94af549779 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c @@ -2597,7 +2597,7 @@ gst_hls_media_playlist_recommended_buffering_threshold (GstHLSMediaPlaylist * 3 * (playlist->duration / playlist->segments->len) / 2; if (GST_HLS_MEDIA_PLAYLIST_IS_LIVE (playlist)) { - /* For live playlists, reduce the recommended buffering threshold + /* For live playlists, reduce the recommended buffering threshold * to match the starting hold back distance if needed, otherwise * we'll hit the live edge and have to wait before we hit 100% */ if (GST_CLOCK_TIME_IS_VALID (playlist->hold_back) @@ -3375,12 +3375,12 @@ hls_master_playlist_get_variant_for_bitrate (GstHLSMasterPlaylist * } static gboolean -remove_uncommon (GQuark field_id, GValue * value, GstStructure * st2) +remove_uncommon (const GstIdStr * fieldname, GValue * value, GstStructure * st2) { const GValue *other; 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))) return FALSE; @@ -3414,8 +3414,8 @@ gst_caps_merge_common (GstCaps * caps1, GstCaps * caps2) if (gst_structure_has_name (st2, name1)) { if (merged == NULL) merged = gst_structure_copy (st1); - gst_structure_filter_and_map_in_place (merged, - (GstStructureFilterMapFunc) remove_uncommon, st2); + gst_structure_filter_and_map_in_place_id_str (merged, + (GstStructureFilterMapIdStrFunc) remove_uncommon, st2); } } diff --git a/subprojects/gst-plugins-good/ext/pulse/pulseutil.c b/subprojects/gst-plugins-good/ext/pulse/pulseutil.c index 69fae00cc3..588b882c98 100644 --- a/subprojects/gst-plugins-good/ext/pulse/pulseutil.c +++ b/subprojects/gst-plugins-good/ext/pulse/pulseutil.c @@ -346,10 +346,11 @@ gst_pulse_cvolume_from_linear (pa_cvolume * v, unsigned channels, } 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; - 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 */ @@ -374,7 +375,7 @@ gst_pulse_make_proplist (const GstStructure * properties) pa_proplist *proplist = pa_proplist_new (); /* 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; } diff --git a/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c b/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c index 32d2e2039b..ebb2e8ef8b 100644 --- a/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c +++ b/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c @@ -940,10 +940,11 @@ gst_soup_http_src_add_range_header (GstSoupHTTPSrc * src, guint64 offset, } 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); - const gchar *field_name = g_quark_to_string (field_id); + const gchar *field_name = gst_id_str_as_str (fieldname); gchar *field_content = NULL; SoupMessageHeaders *request_headers = _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 -_append_extra_headers (GQuark field_id, const GValue * value, +_append_extra_headers (const GstIdStr * fieldname, const GValue * value, gpointer user_data) { 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++) { 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; } } 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++) { 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; } } else { - return _append_extra_header (field_id, value, user_data); + return _append_extra_header (fieldname, value, user_data); } return TRUE; @@ -1012,7 +1013,8 @@ gst_soup_http_src_add_extra_headers (GstSoupHTTPSrc * src) if (!src->extra_headers) 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 diff --git a/subprojects/gst-plugins-good/gst/debugutils/gstcapssetter.c b/subprojects/gst-plugins-good/gst/debugutils/gstcapssetter.c index f6dad048d8..f598f4046e 100644 --- a/subprojects/gst-plugins-good/gst/debugutils/gstcapssetter.c +++ b/subprojects/gst-plugins-good/gst/debugutils/gstcapssetter.c @@ -249,7 +249,7 @@ gst_caps_setter_transform_ip (GstBaseTransform * btrans, GstBuffer * in) } 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) { return gst_value_is_fixed (value); @@ -277,7 +277,7 @@ gst_caps_setter_set_property (GObject * object, guint prop_id, GstStructure *s; 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, new_caps); gst_caps_unref (new_caps); diff --git a/subprojects/gst-plugins-good/gst/isomp4/gstqtmux.c b/subprojects/gst-plugins-good/gst/isomp4/gstqtmux.c index 517f1fd4de..ea114bf7e3 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/gstqtmux.c +++ b/subprojects/gst-plugins-good/gst/isomp4/gstqtmux.c @@ -5714,20 +5714,19 @@ gst_qt_mux_aggregate (GstAggregator * agg, gboolean timeout) } static gboolean -field_is_in (GQuark field_id, const gchar * fieldname, ...) +field_is_in (const GstIdStr * fieldname, const gchar * name, ...) { va_list varargs; - gchar *name = (gchar *) fieldname; - va_start (varargs, fieldname); + va_start (varargs, 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); return TRUE; } - name = va_arg (varargs, char *); + name = va_arg (varargs, const char *); } va_end (varargs); @@ -5735,15 +5734,16 @@ field_is_in (GQuark field_id, const gchar * fieldname, ...) } 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; - 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); if (g_str_has_prefix (name, "video/")) { /* 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; } @@ -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 * not need to fail renegotiation when those change. */ - if (field_is_in (field_id, + if (field_is_in (fieldname, "codec_data", "tier", "level", "profile", "chroma-site", "chroma-format", "bit-depth-luma", "colorimetry", /* 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 (field_is_in (field_id, "interlace-mode", NULL) && + if (field_is_in (fieldname, "interlace-mode", NULL) && !g_strcmp0 (g_value_get_string (value), "progressive")) { 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))) 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 */ diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c b/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c index 8f1435983b..4e6b4731b4 100644 --- a/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c +++ b/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c @@ -977,7 +977,8 @@ gst_matroska_mux_set_codec_id (GstMatroskaTrackContext * context, } 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; 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. */ - if (field_id == g_quark_from_static_string ("codec_data")) { + if (gst_id_str_is_equal_to_str (fieldname, "codec_data")) { 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; - } else if (field_id == g_quark_from_static_string ("profile")) { + } else if (gst_id_str_is_equal_to_str (fieldname, "profile")) { 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; - } else if (field_id == g_quark_from_static_string ("width")) { + } else if (gst_id_str_is_equal_to_str (fieldname, "width")) { 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; } } else if (gst_structure_has_name (structure, "video/x-vp8") || gst_structure_has_name (structure, "video/x-vp9")) { /* We do not use profile and streamheader for VPX so let it change * mid stream */ - if (field_id == g_quark_from_static_string ("streamheader")) + if (gst_id_str_is_equal_to_str (fieldname, "streamheader")) 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; - else if (field_id == g_quark_from_static_string ("width")) + else if (gst_id_str_is_equal_to_str (fieldname, "width")) 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; } /* This fields aren't used and are not retained into the bitstream so we can * discard them. */ 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; - 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; - 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; /* 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 * 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_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 * 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); if (g_strcmp0 (s, "mono") == 0) 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); 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); old_s = gst_caps_get_structure (old_caps, 0); - gst_structure_filter_and_map_in_place (new_s, - (GstStructureFilterMapFunc) check_field, new_s); - gst_structure_filter_and_map_in_place (old_s, - (GstStructureFilterMapFunc) check_field, old_s); + gst_structure_filter_and_map_in_place_id_str (new_s, + (GstStructureFilterMapIdStrFunc) check_field, new_s); + gst_structure_filter_and_map_in_place_id_str (old_s, + (GstStructureFilterMapIdStrFunc) check_field, old_s); ret = gst_caps_is_subset (new_caps, old_caps); diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c index 15c937e80f..de619043b6 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c @@ -2123,10 +2123,10 @@ block_context (MqStreamCtx * ctx, GstSplitMuxSink * splitmux) } 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) { - 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); 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), splitmux->sink_preset); if (splitmux->sink_properties) - gst_structure_foreach (splitmux->sink_properties, + gst_structure_foreach_id_str (splitmux->sink_properties, _set_property_from_structure, splitmux->sink); splitmux->active_sink = 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), splitmux->muxer_preset); if (splitmux->muxer_properties) - gst_structure_foreach (splitmux->muxer_properties, + gst_structure_foreach_id_str (splitmux->muxer_properties, _set_property_from_structure, splitmux->muxer); g_signal_emit (splitmux, signals[SIGNAL_MUXER_ADDED], 0, splitmux->muxer); g_free (newname); @@ -3888,7 +3888,7 @@ create_muxer (GstSplitMuxSink * splitmux) gst_preset_load_preset (GST_PRESET (splitmux->muxer), splitmux->muxer_preset); if (splitmux->muxer_properties) - gst_structure_foreach (splitmux->muxer_properties, + gst_structure_foreach_id_str (splitmux->muxer_properties, _set_property_from_structure, splitmux->muxer); } else { /* 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), splitmux->sink_preset); if (splitmux->sink_properties) - gst_structure_foreach (splitmux->sink_properties, + gst_structure_foreach_id_str (splitmux->sink_properties, _set_property_from_structure, splitmux->sink); splitmux->active_sink = splitmux->sink; } else { diff --git a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpptdemux.c b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpptdemux.c index 7be4cc8945..01f5336cd8 100644 --- a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpptdemux.c +++ b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpptdemux.c @@ -314,15 +314,14 @@ gst_rtp_pt_demux_finalize (GObject * object) /* Removes "ssrc-*" attributes matching other SSRCs. */ 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 (field_name, "ssrc-")) + if (!g_str_has_prefix (gst_id_str_as_str (fieldname), "ssrc-")) return TRUE; 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 != '-') return TRUE; @@ -376,7 +375,7 @@ gst_rtp_pt_demux_get_caps (GstRtpPtDemux * rtpdemux, guint pt) caps = gst_caps_make_writable (caps); 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); if (have_ssrc) diff --git a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.c b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.c index 5d74c23503..c527220964 100644 --- a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.c +++ b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.c @@ -1002,14 +1002,14 @@ gst_rtp_rtx_receive_get_property (GObject * object, } 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) { const gchar *field_str; guint field_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); value_uint = g_value_get_uint (value); 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); rtx->external_ssrc_map = g_value_dup_boxed (value); 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); GST_OBJECT_UNLOCK (rtx); break; @@ -1041,7 +1041,7 @@ gst_rtp_rtx_receive_set_property (GObject * object, gst_structure_free (rtx->rtx_pt_map_structure); rtx->rtx_pt_map_structure = g_value_dup_boxed (value); 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); GST_OBJECT_UNLOCK (rtx); break; diff --git a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxsend.c b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxsend.c index 1c36e5272f..cb1afe3b08 100644 --- a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxsend.c +++ b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxsend.c @@ -1199,13 +1199,14 @@ gst_rtp_rtx_send_get_property (GObject * object, } 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; guint field_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); value_uint = g_value_get_uint (value); 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); rtx->rtx_pt_map_structure = g_value_dup_boxed (value); g_hash_table_remove_all (rtx->rtx_pt_map); - gst_structure_foreach (rtx->rtx_pt_map_structure, structure_to_hash_table, - rtx->rtx_pt_map); + gst_structure_foreach_id_str (rtx->rtx_pt_map_structure, + structure_to_hash_table, rtx->rtx_pt_map); GST_OBJECT_UNLOCK (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); rtx->clock_rate_map_structure = g_value_dup_boxed (value); 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); GST_OBJECT_UNLOCK (rtx); break; diff --git a/subprojects/gst-plugins-good/gst/rtpmanager/rtpsource.c b/subprojects/gst-plugins-good/gst/rtpmanager/rtpsource.c index 673f1ad682..bb57b1c90b 100644 --- a/subprojects/gst-plugins-good/gst/rtpmanager/rtpsource.c +++ b/subprojects/gst-plugins-good/gst/rtpmanager/rtpsource.c @@ -490,22 +490,20 @@ rtp_source_get_sdes_struct (RTPSource * src) } 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) { GstStructure *old; - const gchar *field; 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; g_assert (G_VALUE_HOLDS_STRING (value)); 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), "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) { gst_structure_free (src->sdes); diff --git a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c index c0ca7adbef..b3dd255264 100644 --- a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c +++ b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c @@ -5420,9 +5420,10 @@ accept_certificate_cb (GTlsConnection * conn, GTlsCertificate * peer_cert, } 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); 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) { - 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); } } diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2src.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2src.c index 3272480f76..0a65b2c7d3 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2src.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2src.c @@ -390,17 +390,18 @@ gst_v4l2src_get_property (GObject * object, } 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; - if (field_id == g_quark_from_string ("interlace-mode")) + if (gst_id_str_is_equal_to_str (fieldname, "interlace-mode")) return TRUE; - if (field_id == g_quark_from_string ("colorimetry")) + if (gst_id_str_is_equal_to_str (fieldname, "colorimetry")) 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; } @@ -421,7 +422,7 @@ gst_v4l2_src_fixate_struct_with_preference (GstStructure * s, /* Finally, fixate everything else except the interlace-mode and colorimetry * 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 diff --git a/subprojects/gst-plugins-good/sys/v4l2/v4l2_calls.c b/subprojects/gst-plugins-good/sys/v4l2/v4l2_calls.c index b2165bc13b..e1b58f484e 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/v4l2_calls.c +++ b/subprojects/gst-plugins-good/sys/v4l2/v4l2_calls.c @@ -1035,10 +1035,10 @@ ctrl_failed: } 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; - GQuark normalised_field_id; gpointer *d; /* 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)" would become "focus__absolute_" whereas now it becomes "focus_absolute". 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'; gst_v4l2_normalise_control_name (name); - normalised_field_id = g_quark_from_string (name); - if (normalised_field_id != field_id) + if (!gst_id_str_is_equal_to_str (fieldname, name)) g_warning ("In GStreamer 1.4 the way V4L2 control names were normalised " "changed. Instead of setting \"%s\" please use \"%s\". The former is " "deprecated and will be removed in a future version of GStreamer", - g_quark_to_string (field_id), name); - field_id = normalised_field_id; + gst_id_str_as_str (fieldname), name); - 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) { GST_WARNING_OBJECT (v4l2object, "Control '%s' does not exist or has an unsupported type.", - g_quark_to_string (field_id)); + gst_id_str_as_str (fieldname)); return TRUE; } if (G_VALUE_HOLDS (value, G_TYPE_INT)) { @@ -1078,7 +1077,7 @@ set_control (GQuark field_id, const GValue * value, gpointer user_data) } else { GST_WARNING_OBJECT (v4l2object, "no compatible value expected for control '%s'.", - g_quark_to_string (field_id)); + gst_id_str_as_str (fieldname)); return TRUE; } return TRUE; @@ -1087,7 +1086,7 @@ set_control (GQuark field_id, const GValue * value, gpointer user_data) gboolean 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 diff --git a/subprojects/gst-plugins-good/tests/examples/rtsp/test-onvif.c b/subprojects/gst-plugins-good/tests/examples/rtsp/test-onvif.c index 841178417a..c84dbb9243 100644 --- a/subprojects/gst-plugins-good/tests/examples/rtsp/test-onvif.c +++ b/subprojects/gst-plugins-good/tests/examples/rtsp/test-onvif.c @@ -50,10 +50,10 @@ setup_backchannel_shoveler (GstElement * rtspsrc, GstCaps * caps) } 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) { - 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 @@ -71,7 +71,7 @@ find_backchannel (GstElement * rtspsrc, guint idx, GstCaps * caps, caps = gst_caps_new_empty (); s = gst_structure_copy (s); 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); setup_backchannel_shoveler (rtspsrc, caps); } diff --git a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideomemory.c b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideomemory.c index aa0005650c..9288317eda 100644 --- a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideomemory.c +++ b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideomemory.c @@ -1255,32 +1255,6 @@ gst_vaapi_video_info_quark_get (void) 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 () static GQuark negotiated_vinfo_quark_get (void) @@ -1323,13 +1297,13 @@ gst_allocator_get_vaapi_video_info (GstAllocator * allocator, return NULL; 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) return NULL; *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) return NULL; return g_value_get_boxed (value); diff --git a/subprojects/gstreamer/docs/gst-hotdoc-plugins-scanner.c b/subprojects/gstreamer/docs/gst-hotdoc-plugins-scanner.c index ebe8c9d530..3a4c9d498b 100644 --- a/subprojects/gstreamer/docs/gst-hotdoc-plugins-scanner.c +++ b/subprojects/gstreamer/docs/gst-hotdoc-plugins-scanner.c @@ -593,12 +593,12 @@ _add_properties (GString * json, GString * other_types, } 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); - if (!g_strcmp0 (g_quark_to_string (field), "format") || - !g_strcmp0 (g_quark_to_string (field), "rate")) { + if (!g_strcmp0 (gst_id_str_as_str (fieldname), "format") || + !g_strcmp0 (gst_id_str_as_str (fieldname), "rate")) { if (!cleanup_caps_field) 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_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); return TRUE; } @@ -645,8 +646,8 @@ _build_caps (const GstCaps * caps) g_string_append_printf (jcaps, "%s:\n", gst_structure_get_name (structure)); } - gst_structure_foreach (structure, (GstStructureForeachFunc) print_field, - jcaps); + gst_structure_foreach_id_str (structure, + (GstStructureForeachIdStrFunc) print_field, jcaps); } res = json_strescape (jcaps->str); diff --git a/subprojects/gstreamer/gst/gstbufferpool.c b/subprojects/gstreamer/gst/gstbufferpool.c index 0d0889d1da..d90ad4b642 100644 --- a/subprojects/gstreamer/gst/gstbufferpool.c +++ b/subprojects/gstreamer/gst/gstbufferpool.c @@ -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 (caps == NULL || gst_caps_is_fixed (caps)); - gst_structure_id_set (config, - GST_QUARK (CAPS), GST_TYPE_CAPS, caps, - GST_QUARK (SIZE), G_TYPE_UINT, size, - GST_QUARK (MIN_BUFFERS), G_TYPE_UINT, min_buffers, - GST_QUARK (MAX_BUFFERS), G_TYPE_UINT, max_buffers, NULL); + gst_structure_set_static_str (config, + "caps", GST_TYPE_CAPS, caps, + "size", G_TYPE_UINT, size, + "min-buffers", G_TYPE_UINT, min_buffers, + "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 (allocator != NULL || params != NULL); - gst_structure_id_set (config, - GST_QUARK (ALLOCATOR), GST_TYPE_ALLOCATOR, allocator, - GST_QUARK (PARAMS), GST_TYPE_ALLOCATION_PARAMS, params, NULL); + gst_structure_set_static_str (config, + "allocator", GST_TYPE_ALLOCATOR, allocator, + "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); - value = gst_structure_id_get_value (config, GST_QUARK (OPTIONS)); + value = gst_structure_get_value (config, "options"); if (value) { len = gst_value_array_get_size (value); 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, }; g_value_init (&new_array_val, GST_TYPE_ARRAY); - gst_structure_id_take_value (config, GST_QUARK (OPTIONS), &new_array_val); - value = gst_structure_id_get_value (config, GST_QUARK (OPTIONS)); + gst_structure_take_value_static_str (config, "options", &new_array_val); + value = gst_structure_get_value (config, "options"); } g_value_init (&option_value, G_TYPE_STRING); 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); - value = gst_structure_id_get_value (config, GST_QUARK (OPTIONS)); + value = gst_structure_get_value (config, "options"); if (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); - value = gst_structure_id_get_value (config, GST_QUARK (OPTIONS)); + value = gst_structure_get_value (config, "options"); if (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); - value = gst_structure_id_get_value (config, GST_QUARK (OPTIONS)); + value = gst_structure_get_value (config, "options"); if (value) { len = gst_value_array_get_size (value); 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); if (caps) { - *caps = g_value_get_boxed (gst_structure_id_get_value (config, - GST_QUARK (CAPS))); + *caps = g_value_get_boxed (gst_structure_get_value (config, "caps")); } - return gst_structure_id_get (config, - GST_QUARK (SIZE), G_TYPE_UINT, size, - GST_QUARK (MIN_BUFFERS), G_TYPE_UINT, min_buffers, - GST_QUARK (MAX_BUFFERS), G_TYPE_UINT, max_buffers, NULL); + return gst_structure_get (config, + "size", G_TYPE_UINT, size, + "min-buffers", G_TYPE_UINT, min_buffers, + "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); if (allocator) - *allocator = g_value_get_object (gst_structure_id_get_value (config, - GST_QUARK (ALLOCATOR))); + *allocator = g_value_get_object (gst_structure_get_value (config, + "allocator")); if (params) { GstAllocationParams *p; - p = g_value_get_boxed (gst_structure_id_get_value (config, - GST_QUARK (PARAMS))); + p = g_value_get_boxed (gst_structure_get_value (config, "params")); if (p) { *params = *p; } else { diff --git a/subprojects/gstreamer/gst/gstcaps.c b/subprojects/gstreamer/gst/gstcaps.c index ce1dc2dba3..68b38ee952 100644 --- a/subprojects/gstreamer/gst/gstcaps.c +++ b/subprojects/gstreamer/gst/gstcaps.c @@ -68,6 +68,7 @@ #define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS #include "gst_private.h" +#include "gstidstr-private.h" #include #include @@ -1217,7 +1218,7 @@ gst_caps_is_empty (const GstCaps * caps) } 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) { 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); - 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; 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) { SubtractionEntry *e = user_data; @@ -1818,7 +1819,7 @@ gst_caps_structure_subtract_field (GQuark field_id, const GValue * value, const GValue *other; 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) { return FALSE; @@ -1832,7 +1833,7 @@ gst_caps_structure_subtract_field (GQuark field_id, const GValue * value, return FALSE; } else { 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); return TRUE; } @@ -1847,7 +1848,7 @@ gst_caps_structure_subtract (GSList ** into, const GstStructure * minuend, e.subtract_from = minuend; e.put_into = NULL; - ret = gst_structure_foreach ((GstStructure *) subtrahend, + ret = gst_structure_foreach_id_str ((GstStructure *) subtrahend, gst_caps_structure_subtract_field, &e); if (ret) { @@ -1972,7 +1973,7 @@ typedef struct _NormalizeForeach } NormalizeForeach; 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; 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); 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_features_copy_conditional (nf->features)); } 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; } @@ -2026,7 +2027,7 @@ gst_caps_normalize (GstCaps * caps) for (i = 0; i < gst_caps_get_size (nf.caps); i++) { nf.structure = gst_caps_get_structure_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)); } @@ -2053,20 +2054,20 @@ gst_caps_compare_structures (gconstpointer one, gconstpointer two) typedef struct { - GQuark name; + GstIdStr name; GValue value; GstStructure *compare; } UnionField; 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) { 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 (u->name) + if (G_VALUE_TYPE (&u->value) != G_TYPE_INVALID) g_value_unset (&u->value); 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) return TRUE; - if (u->name) { + if (G_VALUE_TYPE (&u->value) != G_TYPE_INVALID) { g_value_unset (&u->value); return FALSE; } - u->name = field_id; + gst_id_str_copy_into (&u->name, field); gst_value_union (&u->value, val, value); return TRUE; @@ -2090,7 +2091,7 @@ gst_caps_structure_simplify (GstStructure ** result, GstStructure * simplify, GstStructure * compare) { 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 */ if (gst_caps_structure_subtract (&list, simplify, compare)) { @@ -2110,7 +2111,7 @@ gst_caps_structure_simplify (GstStructure ** result, /* try to union both structs */ field.compare = compare; - if (gst_structure_foreach (simplify, + if (gst_structure_foreach_id_str (simplify, gst_caps_structure_figure_out_union, &field)) { gboolean ret = FALSE; @@ -2118,7 +2119,7 @@ gst_caps_structure_simplify (GstStructure ** result, * but at most one field: field.name */ if (G_IS_VALUE (&field.value)) { 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; ret = TRUE; } else { diff --git a/subprojects/gstreamer/gst/gstdebugutils.c b/subprojects/gstreamer/gst/gstdebugutils.c index b646eef6d0..d91faef7dd 100644 --- a/subprojects/gstreamer/gst/gstdebugutils.c +++ b/subprojects/gstreamer/gst/gstdebugutils.c @@ -62,6 +62,7 @@ #include "gstpad.h" #include "gstutils.h" #include "gstvalue.h" +#include "gstidstr-private.h" /*** PIPELINE GRAPHS **********************************************************/ @@ -375,14 +376,14 @@ debug_dump_element_pad (GstPad * pad, GstElement * element, } 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; gchar *value_str = gst_value_serialize (value); gchar *esc_value_str; 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; } @@ -413,7 +414,7 @@ string_append_field (GQuark field, const GValue * value, gpointer ptr) } 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); g_free (value_str); @@ -457,7 +458,8 @@ debug_dump_describe_caps (GstCaps * caps, GstDebugGraphDetails details) } 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); diff --git a/subprojects/gstreamer/gst/gstdeviceprovider.c b/subprojects/gstreamer/gst/gstdeviceprovider.c index f073ede51b..484e891d49 100644 --- a/subprojects/gstreamer/gst/gstdeviceprovider.c +++ b/subprojects/gstreamer/gst/gstdeviceprovider.c @@ -279,11 +279,11 @@ gst_device_provider_class_set_metadata (GstDeviceProviderClass * klass, g_return_if_fail (description != NULL && *description != '\0'); g_return_if_fail (author != NULL && *author != '\0'); - gst_structure_id_set ((GstStructure *) klass->metadata, - GST_QUARK (ELEMENT_METADATA_LONGNAME), G_TYPE_STRING, longname, - GST_QUARK (ELEMENT_METADATA_KLASS), G_TYPE_STRING, classification, - GST_QUARK (ELEMENT_METADATA_DESCRIPTION), G_TYPE_STRING, description, - GST_QUARK (ELEMENT_METADATA_AUTHOR), G_TYPE_STRING, author, NULL); + gst_structure_set_static_str ((GstStructure *) klass->metadata, + GST_ELEMENT_METADATA_LONGNAME, G_TYPE_STRING, longname, + GST_ELEMENT_METADATA_KLASS, G_TYPE_STRING, classification, + GST_ELEMENT_METADATA_DESCRIPTION, G_TYPE_STRING, description, + 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_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); - 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); - gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_DESCRIPTION), + gst_structure_set_value_static_str (s, GST_ELEMENT_METADATA_DESCRIPTION, &val); 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); } /** diff --git a/subprojects/gstreamer/gst/gstelement.c b/subprojects/gstreamer/gst/gstelement.c index 10ce62ba62..f34c33e90c 100644 --- a/subprojects/gstreamer/gst/gstelement.c +++ b/subprojects/gstreamer/gst/gstelement.c @@ -1659,11 +1659,11 @@ gst_element_class_set_metadata (GstElementClass * klass, g_return_if_fail (description != NULL && *description != '\0'); g_return_if_fail (author != NULL && *author != '\0'); - gst_structure_id_set ((GstStructure *) klass->metadata, - GST_QUARK (ELEMENT_METADATA_LONGNAME), G_TYPE_STRING, longname, - GST_QUARK (ELEMENT_METADATA_KLASS), G_TYPE_STRING, classification, - GST_QUARK (ELEMENT_METADATA_DESCRIPTION), G_TYPE_STRING, description, - GST_QUARK (ELEMENT_METADATA_AUTHOR), G_TYPE_STRING, author, NULL); + gst_structure_set_static_str ((GstStructure *) klass->metadata, + GST_ELEMENT_METADATA_LONGNAME, G_TYPE_STRING, longname, + GST_ELEMENT_METADATA_KLASS, G_TYPE_STRING, classification, + GST_ELEMENT_METADATA_DESCRIPTION, G_TYPE_STRING, description, + 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_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); - 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); - gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_DESCRIPTION), + gst_structure_set_value_static_str (s, GST_ELEMENT_METADATA_DESCRIPTION, &val); 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); } /** diff --git a/subprojects/gstreamer/gst/gstevent.c b/subprojects/gstreamer/gst/gstevent.c index ee1c44323e..3db61069e9 100644 --- a/subprojects/gstreamer/gst/gstevent.c +++ b/subprojects/gstreamer/gst/gstevent.c @@ -79,7 +79,6 @@ #include "gstevent.h" #include "gstenumtypes.h" #include "gstutils.h" -#include "gstquark.h" #include "gstvalue.h" GType _gst_event_type = 0; @@ -630,8 +629,7 @@ gst_event_parse_flush_stop (GstEvent * event, gboolean * reset_time) structure = GST_EVENT_STRUCTURE (event); if (G_LIKELY (reset_time)) *reset_time = - g_value_get_boolean (gst_structure_id_get_value (structure, - GST_QUARK (RESET_TIME))); + g_value_get_boolean (gst_structure_get_value (structure, "reset-time")); } /** @@ -675,7 +673,7 @@ gst_event_new_select_streams (GList * streams) g_value_set_string (&strval, str); 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); return event; @@ -701,8 +699,7 @@ gst_event_parse_select_streams (GstEvent * event, GList ** streams) structure = GST_EVENT_STRUCTURE (event); if (G_LIKELY (streams)) { - const GValue *vlist = - gst_structure_id_get_value (structure, GST_QUARK (STREAMS)); + const GValue *vlist = gst_structure_get_value (structure, "streams"); guint i, sz = gst_value_list_get_size (vlist); for (i = 0; i < sz; 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); if (group_id) { - gst_structure_id_get (GST_EVENT_STRUCTURE (event), - GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, NULL); + gst_structure_get (GST_EVENT_STRUCTURE (event), + "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); structure = GST_EVENT_STRUCTURE (event); - gst_structure_id_get (structure, - GST_QUARK (TIMESTAMP), GST_TYPE_CLOCK_TIME, timestamp, - GST_QUARK (DURATION), GST_TYPE_CLOCK_TIME, duration, NULL); + gst_structure_get (structure, + "timestamp", GST_TYPE_CLOCK_TIME, timestamp, + "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_is_writable (event)); - gst_structure_id_set (GST_EVENT_STRUCTURE (event), - GST_QUARK (GAP_FLAGS), GST_TYPE_GAP_FLAGS, flags, NULL); + gst_structure_set (GST_EVENT_STRUCTURE (event), + "gap-flags", GST_TYPE_GAP_FLAGS, flags, NULL); } /** @@ -890,8 +887,8 @@ gst_event_parse_gap_flags (GstEvent * event, GstGapFlags * flags) if (flags) *flags = 0; - gst_structure_id_get (GST_EVENT_STRUCTURE (event), - GST_QUARK (GAP_FLAGS), GST_TYPE_GAP_FLAGS, flags, NULL); + gst_structure_get (GST_EVENT_STRUCTURE (event), + "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); if (G_LIKELY (caps)) - *caps = - g_value_get_boxed (gst_structure_id_get_value (structure, - GST_QUARK (CAPS))); + *caps = g_value_get_boxed (gst_structure_get_value (structure, "caps")); } /** @@ -1021,8 +1016,8 @@ gst_event_parse_segment (GstEvent * event, const GstSegment ** segment) if (segment) { structure = GST_EVENT_STRUCTURE (event); - *segment = g_value_get_boxed (gst_structure_id_get_value (structure, - GST_QUARK (SEGMENT))); + *segment = g_value_get_boxed (gst_structure_get_value (structure, + "segment")); } } @@ -1076,7 +1071,7 @@ gst_event_new_tag (GstTagList * taglist) (taglist)]); g_value_init (&val, GST_TYPE_TAG_LIST); 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); } @@ -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_EVENT_TYPE (event) == GST_EVENT_TAG); - val = gst_structure_id_get_value (GST_EVENT_STRUCTURE (event), - GST_QUARK (TAGLIST)); + val = gst_structure_get_value (GST_EVENT_STRUCTURE (event), "taglist"); if (taglist) *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); if (format) *format = (GstFormat) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (FORMAT))); + g_value_get_enum (gst_structure_get_value (structure, "format")); if (minsize) *minsize = - g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (MINSIZE))); + g_value_get_int64 (gst_structure_get_value (structure, "minsize")); if (maxsize) *maxsize = - g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (MAXSIZE))); + g_value_get_int64 (gst_structure_get_value (structure, "maxsize")); if (async) - *async = - g_value_get_boolean (gst_structure_id_get_value (structure, - GST_QUARK (ASYNC))); + *async = g_value_get_boolean (gst_structure_get_value (structure, "async")); } /** @@ -1280,25 +1269,20 @@ gst_event_parse_qos (GstEvent * event, GstQOSType * type, structure = GST_EVENT_STRUCTURE (event); if (type) *type = (GstQOSType) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (TYPE))); + g_value_get_enum (gst_structure_get_value (structure, "type")); if (proportion) *proportion = - g_value_get_double (gst_structure_id_get_value (structure, - GST_QUARK (PROPORTION))); + g_value_get_double (gst_structure_get_value (structure, "proportion")); if (diff) - *diff = - g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (DIFF))); + *diff = g_value_get_int64 (gst_structure_get_value (structure, "diff")); if (timestamp) { gint64 offset = gst_event_get_running_time_offset (event); GstClockTimeDiff diff_ = - g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (DIFF))); + g_value_get_int64 (gst_structure_get_value (structure, + "diff")); *timestamp = - g_value_get_uint64 (gst_structure_id_get_value (structure, - GST_QUARK (TIMESTAMP))); + g_value_get_uint64 (gst_structure_get_value (structure, "timestamp")); /* Catch underflows */ if (*timestamp > -offset) *timestamp += offset; @@ -1436,33 +1420,23 @@ gst_event_parse_seek (GstEvent * event, gdouble * rate, structure = GST_EVENT_STRUCTURE (event); if (rate) - *rate = - g_value_get_double (gst_structure_id_get_value (structure, - GST_QUARK (RATE))); + *rate = g_value_get_double (gst_structure_get_value (structure, "rate")); if (format) *format = (GstFormat) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (FORMAT))); + g_value_get_enum (gst_structure_get_value (structure, "format")); if (flags) *flags = (GstSeekFlags) - g_value_get_flags (gst_structure_id_get_value (structure, - GST_QUARK (FLAGS))); + g_value_get_flags (gst_structure_get_value (structure, "flags")); if (start_type) *start_type = (GstSeekType) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (CUR_TYPE))); + g_value_get_enum (gst_structure_get_value (structure, "cur-type")); if (start) - *start = - g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (CUR))); + *start = g_value_get_int64 (gst_structure_get_value (structure, "cur")); if (stop_type) *stop_type = (GstSeekType) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (STOP_TYPE))); + g_value_get_enum (gst_structure_get_value (structure, "stop-type")); if (stop) - *stop = - g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (STOP))); + *stop = g_value_get_int64 (gst_structure_get_value (structure, "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_CLOCK_TIME_IS_VALID (interval)); - gst_structure_id_set (GST_EVENT_STRUCTURE (event), - GST_QUARK (TRICKMODE_INTERVAL), GST_TYPE_CLOCK_TIME, interval, NULL); + gst_structure_set_static_str (GST_EVENT_STRUCTURE (event), + "trickmode-interval", GST_TYPE_CLOCK_TIME, interval, NULL); } /** @@ -1506,8 +1480,8 @@ gst_event_parse_seek_trickmode_interval (GstEvent * event, if (interval) *interval = GST_CLOCK_TIME_NONE; - gst_structure_id_get (GST_EVENT_STRUCTURE (event), - GST_QUARK (TRICKMODE_INTERVAL), GST_TYPE_CLOCK_TIME, interval, NULL); + gst_structure_get (GST_EVENT_STRUCTURE (event), + "trickmode-interval", GST_TYPE_CLOCK_TIME, interval, NULL); } /** @@ -1574,8 +1548,8 @@ gst_event_parse_latency (GstEvent * event, GstClockTime * latency) if (latency) *latency = - g_value_get_uint64 (gst_structure_id_get_value (GST_EVENT_STRUCTURE - (event), GST_QUARK (LATENCY))); + g_value_get_uint64 (gst_structure_get_value (GST_EVENT_STRUCTURE + (event), "latency")); } /** @@ -1648,20 +1622,18 @@ gst_event_parse_step (GstEvent * event, GstFormat * format, guint64 * amount, structure = GST_EVENT_STRUCTURE (event); if (format) *format = - (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (FORMAT))); + (GstFormat) g_value_get_enum (gst_structure_get_value (structure, + "format")); if (amount) - *amount = g_value_get_uint64 (gst_structure_id_get_value (structure, - GST_QUARK (AMOUNT))); + *amount = g_value_get_uint64 (gst_structure_get_value (structure, + "amount")); if (rate) - *rate = g_value_get_double (gst_structure_id_get_value (structure, - GST_QUARK (RATE))); + *rate = g_value_get_double (gst_structure_get_value (structure, "rate")); if (flush) - *flush = g_value_get_boolean (gst_structure_id_get_value (structure, - GST_QUARK (FLUSH))); + *flush = g_value_get_boolean (gst_structure_get_value (structure, "flush")); if (intermediate) - *intermediate = g_value_get_boolean (gst_structure_id_get_value (structure, - GST_QUARK (INTERMEDIATE))); + *intermediate = g_value_get_boolean (gst_structure_get_value (structure, + "intermediate")); } /** @@ -1736,8 +1708,8 @@ gst_event_parse_sink_message (GstEvent * event, GstMessage ** msg) structure = GST_EVENT_STRUCTURE (event); if (msg) *msg = - GST_MESSAGE (g_value_dup_boxed (gst_structure_id_get_value - (structure, GST_QUARK (MESSAGE)))); + GST_MESSAGE (g_value_dup_boxed (gst_structure_get_value + (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); 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) *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_is_writable (event)); - gst_structure_id_set (GST_EVENT_STRUCTURE (event), - GST_QUARK (STREAM), GST_TYPE_STREAM, stream, NULL); + gst_structure_set (GST_EVENT_STRUCTURE (event), + "stream", GST_TYPE_STREAM, stream, NULL); } /** @@ -1845,8 +1817,8 @@ gst_event_parse_stream (GstEvent * event, GstStream ** stream) if (stream) { *stream = NULL; - gst_structure_id_get (GST_EVENT_STRUCTURE (event), - GST_QUARK (STREAM), GST_TYPE_STREAM, stream, NULL); + gst_structure_get (GST_EVENT_STRUCTURE (event), + "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_is_writable (event)); - gst_structure_id_set (GST_EVENT_STRUCTURE (event), - GST_QUARK (FLAGS), GST_TYPE_STREAM_FLAGS, flags, NULL); + gst_structure_set (GST_EVENT_STRUCTURE (event), + "flags", GST_TYPE_STREAM_FLAGS, flags, NULL); } /** @@ -1883,8 +1855,8 @@ gst_event_parse_stream_flags (GstEvent * event, GstStreamFlags * flags) if (flags) { *flags = 0; - gst_structure_id_get (GST_EVENT_STRUCTURE (event), - GST_QUARK (FLAGS), GST_TYPE_STREAM_FLAGS, flags, NULL); + gst_structure_get (GST_EVENT_STRUCTURE (event), + "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 (group_id != GST_GROUP_ID_INVALID); - gst_structure_id_set (GST_EVENT_STRUCTURE (event), - GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, NULL); + gst_structure_set (GST_EVENT_STRUCTURE (event), + "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) { *group_id = 0; - return gst_structure_id_get (GST_EVENT_STRUCTURE (event), - GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, NULL); + return gst_structure_get (GST_EVENT_STRUCTURE (event), + "group-id", G_TYPE_UINT, group_id, NULL); } return TRUE; @@ -1993,8 +1965,8 @@ gst_event_parse_stream_collection (GstEvent * event, structure = gst_event_get_structure (event); if (collection) { - gst_structure_id_get (structure, - GST_QUARK (COLLECTION), GST_TYPE_STREAM_COLLECTION, collection, NULL); + gst_structure_get (structure, + "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); - gst_structure_id_get (structure, - GST_QUARK (TOC), GST_TYPE_TOC, toc, - GST_QUARK (UPDATED), G_TYPE_BOOLEAN, updated, NULL); + gst_structure_get (structure, + "toc", GST_TYPE_TOC, toc, "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); 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) *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); - val = gst_structure_id_get_value (structure, GST_QUARK (FORMAT)); + val = gst_structure_get_value (structure, "format"); if (format != NULL) *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) *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); structure = GST_EVENT_STRUCTURE (event); - gst_structure_id_get (structure, GST_QUARK (RATE), G_TYPE_DOUBLE, - rate_multiplier, GST_QUARK (FLAGS), GST_TYPE_SEGMENT_FLAGS, new_flags, - NULL); + gst_structure_get (structure, "rate", G_TYPE_DOUBLE, + rate_multiplier, "flags", GST_TYPE_SEGMENT_FLAGS, new_flags, 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); structure = GST_EVENT_STRUCTURE (event); - gst_structure_id_get (structure, GST_QUARK (RATE), G_TYPE_DOUBLE, - rate_multiplier, GST_QUARK (RUNNING_TIME), GST_TYPE_CLOCK_TIME, - running_time, GST_QUARK (UPSTREAM_RUNNING_TIME), GST_TYPE_CLOCK_TIME, + gst_structure_get (structure, "rate", G_TYPE_DOUBLE, + rate_multiplier, "running-time", GST_TYPE_CLOCK_TIME, + running_time, "upstream-running-time", GST_TYPE_CLOCK_TIME, upstream_running_time, NULL); } diff --git a/subprojects/gstreamer/gst/gstmessage.c b/subprojects/gstreamer/gst/gstmessage.c index 1db529cd5c..e5b7f1bebb 100644 --- a/subprojects/gstreamer/gst/gstmessage.c +++ b/subprojects/gstreamer/gst/gstmessage.c @@ -46,13 +46,11 @@ #define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS #include "gst_private.h" #include /* memcpy */ -#include "gsterror.h" #include "gstenumtypes.h" #include "gstinfo.h" #include "gstmessage.h" #include "gsttaglist.h" #include "gstutils.h" -#include "gstquark.h" #include "gstvalue.h" @@ -116,8 +114,6 @@ static GstMessageQuarks message_quarks[] = { {0, NULL, 0} }; -static GQuark details_quark = 0; - GType _gst_message_type = 0; GST_DEFINE_MINI_OBJECT_TYPE (GstMessage, gst_message); @@ -132,7 +128,6 @@ _priv_gst_message_initialize (void) message_quarks[i].quark = g_quark_from_static_string (message_quarks[i].name); } - details_quark = g_quark_from_static_string ("details"); _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_take_boxed (&v, details); - gst_structure_id_take_value (GST_MESSAGE_STRUCTURE (message), details_quark, - &v); + gst_structure_take_value (GST_MESSAGE_STRUCTURE (message), "details", &v); } /** @@ -441,8 +435,7 @@ gst_message_set_details (GstMessage * message, GstStructure * details) g_return_if_fail (details); if (GST_MESSAGE_STRUCTURE (message) - && gst_structure_id_has_field (GST_MESSAGE_STRUCTURE (message), - details_quark)) { + && gst_structure_has_field (GST_MESSAGE_STRUCTURE (message), "details")) { gst_structure_free (details); g_critical ("Message already has details"); return; @@ -466,11 +459,9 @@ message_parse_details (GstMessage * message, GstStructure ** details, return; if (GST_MESSAGE_STRUCTURE (message) && - gst_structure_id_has_field (GST_MESSAGE_STRUCTURE (message), - details_quark)) { - const GValue *v = - gst_structure_id_get_value (GST_MESSAGE_STRUCTURE (message), - details_quark); + gst_structure_has_field (GST_MESSAGE_STRUCTURE (message), "details")) { + const GValue *v = gst_structure_get_value (GST_MESSAGE_STRUCTURE (message), + "details"); if (v && G_VALUE_TYPE (v) == GST_TYPE_STRUCTURE) { *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"); g_value_init (&val, GST_TYPE_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); 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 (tag_list != NULL); - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (TAGLIST), GST_TYPE_TAG_LIST, tag_list, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "taglist", GST_TYPE_TAG_LIST, tag_list, NULL); } /** @@ -1439,8 +1430,8 @@ gst_message_parse_buffering (GstMessage * message, gint * percent) if (percent) *percent = - g_value_get_int (gst_structure_id_get_value (GST_MESSAGE_STRUCTURE - (message), GST_QUARK (BUFFER_PERCENT))); + g_value_get_int (gst_structure_get_value (GST_MESSAGE_STRUCTURE + (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_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING); - gst_structure_id_set (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode, - GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in, - GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out, - GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL); + gst_structure_set (GST_MESSAGE_STRUCTURE (message), + "buffering-mode", GST_TYPE_BUFFERING_MODE, mode, + "avg-in-rate", G_TYPE_INT, avg_in, + "avg-out-rate", G_TYPE_INT, avg_out, + "buffering-left", G_TYPE_INT64, buffering_left, NULL); } /** @@ -1490,18 +1481,18 @@ gst_message_parse_buffering_stats (GstMessage * message, structure = GST_MESSAGE_STRUCTURE (message); if (mode) *mode = (GstBufferingMode) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (BUFFERING_MODE))); + g_value_get_enum (gst_structure_get_value (structure, + "buffering-mode")); if (avg_in) - *avg_in = g_value_get_int (gst_structure_id_get_value (structure, - GST_QUARK (AVG_IN_RATE))); + *avg_in = g_value_get_int (gst_structure_get_value (structure, + "avg-in-rate")); if (avg_out) - *avg_out = g_value_get_int (gst_structure_id_get_value (structure, - GST_QUARK (AVG_OUT_RATE))); + *avg_out = g_value_get_int (gst_structure_get_value (structure, + "avg-out-rate")); if (buffering_left) *buffering_left = - g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (BUFFERING_LEFT))); + g_value_get_int64 (gst_structure_get_value (structure, + "buffering-left")); } /** @@ -1546,16 +1537,13 @@ gst_message_parse_state_changed (GstMessage * message, structure = GST_MESSAGE_STRUCTURE (message); if (oldstate) *oldstate = (GstState) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (OLD_STATE))); + g_value_get_enum (gst_structure_get_value (structure, "old-state")); if (newstate) *newstate = (GstState) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (NEW_STATE))); + g_value_get_enum (gst_structure_get_value (structure, "new-state")); if (pending) *pending = (GstState) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (PENDING_STATE))); + g_value_get_enum (gst_structure_get_value (structure, "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); 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 (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK); if (ready) - *ready = - g_value_get_boolean (gst_structure_id_get_value (structure, - GST_QUARK (READY))); + *ready = g_value_get_boolean (gst_structure_get_value (structure, "ready")); if (clock) *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); 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 (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); 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 (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); 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 (G_VALUE_TYPE (owner_gvalue) == GST_TYPE_ELEMENT); if (type) *type = (GstStructureChangeType) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (TYPE))); + g_value_get_enum (gst_structure_get_value (structure, "type")); if (owner) *owner = (GstElement *) g_value_get_object (owner_gvalue); if (busy) - *busy = - g_value_get_boolean (gst_structure_id_get_value (structure, - GST_QUARK (BUSY))); + *busy = g_value_get_boolean (gst_structure_get_value (structure, "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_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR); - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (GERROR), G_TYPE_ERROR, gerror, - GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "gerror", G_TYPE_ERROR, gerror, "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_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING); - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (GERROR), G_TYPE_ERROR, gerror, - GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "gerror", G_TYPE_ERROR, gerror, "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_MESSAGE_TYPE (message) == GST_MESSAGE_INFO); - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (GERROR), G_TYPE_ERROR, gerror, - GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "gerror", G_TYPE_ERROR, gerror, "debug", G_TYPE_STRING, debug, NULL); } /** @@ -1803,12 +1783,10 @@ gst_message_parse_segment_start (GstMessage * message, GstFormat * format, structure = GST_MESSAGE_STRUCTURE (message); if (format) *format = (GstFormat) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (FORMAT))); + g_value_get_enum (gst_structure_get_value (structure, "format")); if (position) *position = - g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (POSITION))); + g_value_get_int64 (gst_structure_get_value (structure, "position")); } /** @@ -1833,12 +1811,10 @@ gst_message_parse_segment_done (GstMessage * message, GstFormat * format, structure = GST_MESSAGE_STRUCTURE (message); if (format) *format = (GstFormat) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (FORMAT))); + g_value_get_enum (gst_structure_get_value (structure, "format")); if (position) *position = - g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (POSITION))); + g_value_get_int64 (gst_structure_get_value (structure, "position")); } /** @@ -1861,8 +1837,8 @@ gst_message_parse_async_done (GstMessage * message, GstClockTime * running_time) structure = GST_MESSAGE_STRUCTURE (message); if (running_time) *running_time = - g_value_get_uint64 (gst_structure_id_get_value (structure, - GST_QUARK (RUNNING_TIME))); + g_value_get_uint64 (gst_structure_get_value (structure, + "running-time")); } /** @@ -1885,8 +1861,7 @@ gst_message_parse_request_state (GstMessage * message, GstState * state) structure = GST_MESSAGE_STRUCTURE (message); if (state) *state = (GstState) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (NEW_STATE))); + g_value_get_enum (gst_structure_get_value (structure, "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); 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); if (type) *type = (GstStreamStatusType) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (TYPE))); + g_value_get_enum (gst_structure_get_value (structure, "type")); if (owner) *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); 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); structure = GST_MESSAGE_STRUCTURE (message); - result = gst_structure_id_get_value (structure, GST_QUARK (OBJECT)); + result = gst_structure_get_value (structure, "object"); 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); structure = GST_MESSAGE_STRUCTURE (message); - gst_structure_id_get (structure, - GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, - GST_QUARK (AMOUNT), G_TYPE_UINT64, amount, - GST_QUARK (RATE), G_TYPE_DOUBLE, rate, - GST_QUARK (FLUSH), G_TYPE_BOOLEAN, flush, - GST_QUARK (INTERMEDIATE), G_TYPE_BOOLEAN, intermediate, - GST_QUARK (DURATION), G_TYPE_UINT64, duration, - GST_QUARK (EOS), G_TYPE_BOOLEAN, eos, NULL); + gst_structure_get (structure, + "format", GST_TYPE_FORMAT, format, + "amount", G_TYPE_UINT64, amount, + "rate", G_TYPE_DOUBLE, rate, + "flush", G_TYPE_BOOLEAN, flush, + "intermediate", G_TYPE_BOOLEAN, intermediate, + "duration", G_TYPE_UINT64, duration, "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); structure = GST_MESSAGE_STRUCTURE (message); - gst_structure_id_get (structure, - GST_QUARK (ACTIVE), G_TYPE_BOOLEAN, active, - GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, - GST_QUARK (AMOUNT), G_TYPE_UINT64, amount, - GST_QUARK (RATE), G_TYPE_DOUBLE, rate, - GST_QUARK (FLUSH), G_TYPE_BOOLEAN, flush, - GST_QUARK (INTERMEDIATE), G_TYPE_BOOLEAN, intermediate, NULL); + gst_structure_get (structure, + "active", G_TYPE_BOOLEAN, active, + "format", GST_TYPE_FORMAT, format, + "amount", G_TYPE_UINT64, amount, + "rate", G_TYPE_DOUBLE, rate, + "flush", G_TYPE_BOOLEAN, flush, + "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); structure = GST_MESSAGE_STRUCTURE (message); - gst_structure_id_set (structure, - GST_QUARK (JITTER), G_TYPE_INT64, jitter, - GST_QUARK (PROPORTION), G_TYPE_DOUBLE, proportion, - GST_QUARK (QUALITY), G_TYPE_INT, quality, NULL); + gst_structure_set_static_str (structure, + "jitter", G_TYPE_INT64, jitter, + "proportion", G_TYPE_DOUBLE, proportion, + "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); structure = GST_MESSAGE_STRUCTURE (message); - gst_structure_id_set (structure, - GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, - GST_QUARK (PROCESSED), G_TYPE_UINT64, processed, - GST_QUARK (DROPPED), G_TYPE_UINT64, dropped, NULL); + gst_structure_set_static_str (structure, + "format", GST_TYPE_FORMAT, format, + "processed", G_TYPE_UINT64, processed, + "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); structure = GST_MESSAGE_STRUCTURE (message); - gst_structure_id_get (structure, - GST_QUARK (LIVE), G_TYPE_BOOLEAN, live, - GST_QUARK (RUNNING_TIME), G_TYPE_UINT64, running_time, - GST_QUARK (STREAM_TIME), G_TYPE_UINT64, stream_time, - GST_QUARK (TIMESTAMP), G_TYPE_UINT64, timestamp, - GST_QUARK (DURATION), G_TYPE_UINT64, duration, NULL); + gst_structure_get (structure, + "live", G_TYPE_BOOLEAN, live, + "running-time", G_TYPE_UINT64, running_time, + "stream-time", G_TYPE_UINT64, stream_time, + "timestamp", G_TYPE_UINT64, timestamp, + "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); structure = GST_MESSAGE_STRUCTURE (message); - gst_structure_id_get (structure, - GST_QUARK (JITTER), G_TYPE_INT64, jitter, - GST_QUARK (PROPORTION), G_TYPE_DOUBLE, proportion, - GST_QUARK (QUALITY), G_TYPE_INT, quality, NULL); + gst_structure_get (structure, + "jitter", G_TYPE_INT64, jitter, + "proportion", G_TYPE_DOUBLE, proportion, + "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); structure = GST_MESSAGE_STRUCTURE (message); - gst_structure_id_get (structure, - GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, - GST_QUARK (PROCESSED), G_TYPE_UINT64, processed, - GST_QUARK (DROPPED), G_TYPE_UINT64, dropped, NULL); + gst_structure_get (structure, + "format", GST_TYPE_FORMAT, format, + "processed", G_TYPE_UINT64, processed, + "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); structure = GST_MESSAGE_STRUCTURE (message); - gst_structure_id_get (structure, - GST_QUARK (TYPE), GST_TYPE_PROGRESS_TYPE, type, - GST_QUARK (CODE), G_TYPE_STRING, code, - GST_QUARK (TEXT), G_TYPE_STRING, text, NULL); + gst_structure_get (structure, + "type", GST_TYPE_PROGRESS_TYPE, type, + "code", G_TYPE_STRING, code, "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 (toc != NULL); - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (TOC), GST_TYPE_TOC, toc, - GST_QUARK (UPDATED), G_TYPE_BOOLEAN, updated, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "toc", GST_TYPE_TOC, toc, "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); if (running_time) *running_time = - g_value_get_uint64 (gst_structure_id_get_value (structure, - GST_QUARK (RUNNING_TIME))); + g_value_get_uint64 (gst_structure_get_value (structure, + "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); structure = GST_MESSAGE_STRUCTURE (message); - gst_structure_id_set (structure, GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, - NULL); + gst_structure_set (structure, "group-id", G_TYPE_UINT, group_id, NULL); } /** @@ -2630,7 +2600,7 @@ gst_message_parse_group_id (GstMessage * message, guint * group_id) 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) return FALSE; @@ -2690,7 +2660,7 @@ gst_message_parse_context_type (GstMessage * message, structure = GST_MESSAGE_STRUCTURE (message); 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); } @@ -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); if (context) - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (CONTEXT), GST_TYPE_CONTEXT, context, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "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); if (device) - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (DEVICE), GST_TYPE_DEVICE, device, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "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); if (device) - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (DEVICE), GST_TYPE_DEVICE, device, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "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); if (device) - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (DEVICE), GST_TYPE_DEVICE, device, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "device", GST_TYPE_DEVICE, device, NULL); if (changed_device) - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (DEVICE_CHANGED), GST_TYPE_DEVICE, changed_device, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "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); /* should already be interned, but let's make sure */ 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) - 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); } @@ -2979,13 +2949,12 @@ gst_message_parse_property_notify (GstMessage * message, GstObject ** object, if (property_name) { 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); } if (property_value) - *property_value = - gst_structure_id_get_value (s, GST_QUARK (PROPERTY_VALUE)); + *property_value = gst_structure_get_value (s, "property-value"); } /** @@ -3038,8 +3007,8 @@ gst_message_parse_stream_collection (GstMessage * message, GST_MESSAGE_STREAM_COLLECTION); if (collection) - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (COLLECTION), GST_TYPE_STREAM_COLLECTION, collection, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "collection", GST_TYPE_STREAM_COLLECTION, collection, NULL); } /** @@ -3077,7 +3046,7 @@ gst_message_new_streams_selected (GstObject * src, gst_structure_new_static_str ("GstMessageStreamsSelected", "collection", GST_TYPE_STREAM_COLLECTION, collection, NULL); 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 = 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, 0); - val = - gst_structure_id_get_value (GST_MESSAGE_STRUCTURE (msg), - GST_QUARK (STREAMS)); + val = gst_structure_get_value (GST_MESSAGE_STRUCTURE (msg), "streams"); 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)); val = - (GValue *) gst_structure_id_get_value (GST_MESSAGE_STRUCTURE (msg), - GST_QUARK (STREAMS)); + (GValue *) gst_structure_get_value (GST_MESSAGE_STRUCTURE (msg), + "streams"); g_value_init (&to_add, GST_TYPE_STREAM); g_value_set_object (&to_add, stream); 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, NULL); - streams = - gst_structure_id_get_value (GST_MESSAGE_STRUCTURE (msg), - GST_QUARK (STREAMS)); + streams = gst_structure_get_value (GST_MESSAGE_STRUCTURE (msg), "streams"); val = gst_value_array_get_value (streams, idx); if (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); if (collection) - gst_structure_id_get (GST_MESSAGE_STRUCTURE (message), - GST_QUARK (COLLECTION), GST_TYPE_STREAM_COLLECTION, collection, NULL); + gst_structure_get (GST_MESSAGE_STRUCTURE (message), + "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); 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); - gst_structure_id_take_value (structure, GST_QUARK (REDIRECT_ENTRY_TAGLISTS), + gst_structure_take_value_static_str (structure, "redirect-entry-taglists", &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); 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); entry_locations_gvalue = - (GValue *) gst_structure_id_get_value (structure, - GST_QUARK (REDIRECT_ENTRY_LOCATIONS)); + (GValue *) gst_structure_get_value (structure, + "redirect-entry-locations"); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_locations_gvalue)); entry_taglists_gvalue = - (GValue *) gst_structure_id_get_value (structure, - GST_QUARK (REDIRECT_ENTRY_TAGLISTS)); + (GValue *) gst_structure_get_value (structure, "redirect-entry-taglists"); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_taglists_gvalue)); entry_structures_gvalue = - (GValue *) gst_structure_id_get_value (structure, - GST_QUARK (REDIRECT_ENTRY_STRUCTURES)); + (GValue *) gst_structure_get_value (structure, + "redirect-entry-structures"); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_structures_gvalue)); 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); entry_locations_gvalue = - gst_structure_id_get_value (structure, - GST_QUARK (REDIRECT_ENTRY_LOCATIONS)); + gst_structure_get_value (structure, "redirect-entry-locations"); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_locations_gvalue)); entry_taglists_gvalue = - gst_structure_id_get_value (structure, - GST_QUARK (REDIRECT_ENTRY_TAGLISTS)); + gst_structure_get_value (structure, "redirect-entry-taglists"); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_taglists_gvalue)); entry_structures_gvalue = - gst_structure_id_get_value (structure, - GST_QUARK (REDIRECT_ENTRY_STRUCTURES)); + gst_structure_get_value (structure, "redirect-entry-structures"); g_return_if_fail (GST_VALUE_HOLDS_LIST (entry_structures_gvalue)); if (location) { @@ -3408,16 +3369,13 @@ gst_message_get_num_redirect_entries (GstMessage * message) structure = GST_MESSAGE_STRUCTURE (message); entry_locations_gvalue = - gst_structure_id_get_value (structure, - GST_QUARK (REDIRECT_ENTRY_LOCATIONS)); + gst_structure_get_value (structure, "redirect-entry-locations"); g_return_val_if_fail (GST_VALUE_HOLDS_LIST (entry_locations_gvalue), 0); entry_taglists_gvalue = - gst_structure_id_get_value (structure, - GST_QUARK (REDIRECT_ENTRY_TAGLISTS)); + gst_structure_get_value (structure, "redirect-entry-taglists"); g_return_val_if_fail (GST_VALUE_HOLDS_LIST (entry_taglists_gvalue), 0); entry_structures_gvalue = - gst_structure_id_get_value (structure, - GST_QUARK (REDIRECT_ENTRY_STRUCTURES)); + gst_structure_get_value (structure, "redirect-entry-structures"); g_return_val_if_fail (GST_VALUE_HOLDS_LIST (entry_structures_gvalue), 0); 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); structure = GST_MESSAGE_STRUCTURE (message); - gst_structure_id_get (structure, GST_QUARK (RATE), G_TYPE_DOUBLE, - rate_multiplier, NULL); + gst_structure_get (structure, "rate", G_TYPE_DOUBLE, rate_multiplier, NULL); } /** diff --git a/subprojects/gstreamer/gst/gstquery.c b/subprojects/gstreamer/gst/gstquery.c index e7aba78d8b..2b911a6306 100644 --- a/subprojects/gstreamer/gst/gstquery.c +++ b/subprojects/gstreamer/gst/gstquery.c @@ -59,9 +59,6 @@ #include "gstquery.h" #include "gstvalue.h" #include "gstenumtypes.h" -#include "gstquark.h" -#include "gsturi.h" -#include "gstbufferpool.h" GST_DEBUG_CATEGORY_STATIC (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); s = GST_QUERY_STRUCTURE (query); - g_return_if_fail (format == g_value_get_enum (gst_structure_id_get_value (s, - GST_QUARK (FORMAT)))); + g_return_if_fail (format == g_value_get_enum (gst_structure_get_value (s, + "format"))); - gst_structure_id_set (s, - GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, - GST_QUARK (CURRENT), G_TYPE_INT64, cur, NULL); + gst_structure_set (s, + "format", GST_TYPE_FORMAT, format, "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); if (format) *format = - (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (FORMAT))); + (GstFormat) g_value_get_enum (gst_structure_get_value (structure, + "format")); if (cur) - *cur = g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (CURRENT))); + *cur = g_value_get_int64 (gst_structure_get_value (structure, "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); s = GST_QUERY_STRUCTURE (query); - g_return_if_fail (format == g_value_get_enum (gst_structure_id_get_value (s, - GST_QUARK (FORMAT)))); - gst_structure_id_set (s, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, - GST_QUARK (DURATION), G_TYPE_INT64, duration, NULL); + g_return_if_fail (format == g_value_get_enum (gst_structure_get_value (s, + "format"))); + gst_structure_set (s, "format", GST_TYPE_FORMAT, format, + "duration", G_TYPE_INT64, duration, NULL); } /** @@ -368,11 +363,11 @@ gst_query_parse_duration (GstQuery * query, GstFormat * format, structure = GST_QUERY_STRUCTURE (query); if (format) *format = - (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (FORMAT))); + (GstFormat) g_value_get_enum (gst_structure_get_value (structure, + "format")); if (duration) - *duration = g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (DURATION))); + *duration = g_value_get_int64 (gst_structure_get_value (structure, + "duration")); } /** @@ -422,10 +417,10 @@ gst_query_set_latency (GstQuery * query, gboolean live, g_return_if_fail (GST_CLOCK_TIME_IS_VALID (min_latency)); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (structure, - GST_QUARK (LIVE), G_TYPE_BOOLEAN, live, - GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, min_latency, - GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, max_latency, NULL); + gst_structure_set (structure, + "live", G_TYPE_BOOLEAN, live, + "min-latency", G_TYPE_UINT64, min_latency, + "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); if (live) - *live = - g_value_get_boolean (gst_structure_id_get_value (structure, - GST_QUARK (LIVE))); + *live = g_value_get_boolean (gst_structure_get_value (structure, "live")); if (min_latency) - *min_latency = g_value_get_uint64 (gst_structure_id_get_value (structure, - GST_QUARK (MIN_LATENCY))); + *min_latency = g_value_get_uint64 (gst_structure_get_value (structure, + "min-latency")); if (max_latency) - *max_latency = g_value_get_uint64 (gst_structure_id_get_value (structure, - GST_QUARK (MAX_LATENCY))); + *max_latency = g_value_get_uint64 (gst_structure_get_value (structure, + "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); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (structure, - GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format, - GST_QUARK (SRC_VALUE), G_TYPE_INT64, src_value, - GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format, - GST_QUARK (DEST_VALUE), G_TYPE_INT64, dest_value, NULL); + gst_structure_set (structure, + "src_format", GST_TYPE_FORMAT, src_format, + "src_value", G_TYPE_INT64, src_value, + "dest_format", GST_TYPE_FORMAT, dest_format, + "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); if (src_format) *src_format = - (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (SRC_FORMAT))); + (GstFormat) g_value_get_enum (gst_structure_get_value (structure, + "src_format")); if (src_value) - *src_value = g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (SRC_VALUE))); + *src_value = g_value_get_int64 (gst_structure_get_value (structure, + "src_value")); if (dest_format) *dest_format = - (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (DEST_FORMAT))); + (GstFormat) g_value_get_enum (gst_structure_get_value (structure, + "dest_format")); if (dest_value) - *dest_value = g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (DEST_VALUE))); + *dest_value = g_value_get_int64 (gst_structure_get_value (structure, + "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); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (structure, - GST_QUARK (RATE), G_TYPE_DOUBLE, rate, - GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, - GST_QUARK (START_VALUE), G_TYPE_INT64, start_value, - GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop_value, NULL); + gst_structure_set (structure, + "rate", G_TYPE_DOUBLE, rate, + "format", GST_TYPE_FORMAT, format, + "start_value", G_TYPE_INT64, start_value, + "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); if (rate) - *rate = g_value_get_double (gst_structure_id_get_value (structure, - GST_QUARK (RATE))); + *rate = g_value_get_double (gst_structure_get_value (structure, "rate")); if (format) *format = - (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (FORMAT))); + (GstFormat) g_value_get_enum (gst_structure_get_value (structure, + "format")); if (start_value) - *start_value = g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (START_VALUE))); + *start_value = g_value_get_int64 (gst_structure_get_value (structure, + "start_value")); if (stop_value) - *stop_value = g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (STOP_VALUE))); + *stop_value = g_value_get_int64 (gst_structure_get_value (structure, + "stop_value")); } /** @@ -801,11 +793,11 @@ gst_query_set_seeking (GstQuery * query, GstFormat format, g_return_if_fail (gst_query_is_writable (query)); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (structure, - GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, - GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, seekable, - GST_QUARK (SEGMENT_START), G_TYPE_INT64, segment_start, - GST_QUARK (SEGMENT_END), G_TYPE_INT64, segment_end, NULL); + gst_structure_set (structure, + "format", GST_TYPE_FORMAT, format, + "seekable", G_TYPE_BOOLEAN, seekable, + "segment-start", G_TYPE_INT64, segment_start, + "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); if (format) *format = - (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (FORMAT))); + (GstFormat) g_value_get_enum (gst_structure_get_value (structure, + "format")); if (seekable) - *seekable = g_value_get_boolean (gst_structure_id_get_value (structure, - GST_QUARK (SEEKABLE))); + *seekable = g_value_get_boolean (gst_structure_get_value (structure, + "seekable")); if (segment_start) - *segment_start = g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (SEGMENT_START))); + *segment_start = g_value_get_int64 (gst_structure_get_value (structure, + "segment-start")); if (segment_end) - *segment_end = g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (SEGMENT_END))); + *segment_end = g_value_get_int64 (gst_structure_get_value (structure, + "segment-end")); } static GArray * -ensure_array (GstStructure * s, GQuark quark, gsize element_size, +ensure_array (GstStructure * s, const gchar * fieldname, gsize element_size, GDestroyNotify clear_func) { GArray *array; const GValue *value; - value = gst_structure_id_get_value (s, quark); + value = gst_structure_get_value (s, fieldname); if (value) { array = (GArray *) g_value_get_boxed (value); } 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_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; } @@ -1084,9 +1076,9 @@ gst_query_set_buffering_percent (GstQuery * query, gboolean busy, gint percent) g_return_if_fail (percent >= 0 && percent <= 100); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (structure, - GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy, - GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent, NULL); + gst_structure_set (structure, + "busy", G_TYPE_BOOLEAN, busy, + "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); if (busy) - *busy = g_value_get_boolean (gst_structure_id_get_value (structure, - GST_QUARK (BUSY))); + *busy = g_value_get_boolean (gst_structure_get_value (structure, "busy")); if (percent) - *percent = g_value_get_int (gst_structure_id_get_value (structure, - GST_QUARK (BUFFER_PERCENT))); + *percent = g_value_get_int (gst_structure_get_value (structure, + "buffer-percent")); } /** @@ -1135,11 +1126,11 @@ gst_query_set_buffering_stats (GstQuery * query, GstBufferingMode mode, g_return_if_fail (gst_query_is_writable (query)); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (structure, - GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode, - GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in, - GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out, - GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL); + gst_structure_set (structure, + "buffering-mode", GST_TYPE_BUFFERING_MODE, mode, + "avg-in-rate", G_TYPE_INT, avg_in, + "avg-out-rate", G_TYPE_INT, avg_out, + "buffering-left", G_TYPE_INT64, buffering_left, NULL); } /** @@ -1165,18 +1156,18 @@ gst_query_parse_buffering_stats (GstQuery * query, structure = GST_QUERY_STRUCTURE (query); if (mode) *mode = (GstBufferingMode) - g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (BUFFERING_MODE))); + g_value_get_enum (gst_structure_get_value (structure, + "buffering-mode")); if (avg_in) - *avg_in = g_value_get_int (gst_structure_id_get_value (structure, - GST_QUARK (AVG_IN_RATE))); + *avg_in = g_value_get_int (gst_structure_get_value (structure, + "avg-in-rate")); if (avg_out) - *avg_out = g_value_get_int (gst_structure_id_get_value (structure, - GST_QUARK (AVG_OUT_RATE))); + *avg_out = g_value_get_int (gst_structure_get_value (structure, + "avg-out-rate")); if (buffering_left) *buffering_left = - g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (BUFFERING_LEFT))); + g_value_get_int64 (gst_structure_get_value (structure, + "buffering-left")); } /** @@ -1200,11 +1191,11 @@ gst_query_set_buffering_range (GstQuery * query, GstFormat format, g_return_if_fail (gst_query_is_writable (query)); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (structure, - GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, - GST_QUARK (START_VALUE), G_TYPE_INT64, start, - GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop, - GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, estimated_total, NULL); + gst_structure_set (structure, + "format", GST_TYPE_FORMAT, format, + "start_value", G_TYPE_INT64, start, + "stop_value", G_TYPE_INT64, stop, + "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); if (format) *format = - (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure, - GST_QUARK (FORMAT))); + (GstFormat) g_value_get_enum (gst_structure_get_value (structure, + "format")); if (start) - *start = g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (START_VALUE))); + *start = g_value_get_int64 (gst_structure_get_value (structure, + "start_value")); if (stop) - *stop = g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (STOP_VALUE))); + *stop = g_value_get_int64 (gst_structure_get_value (structure, + "stop_value")); if (estimated_total) *estimated_total = - g_value_get_int64 (gst_structure_id_get_value (structure, - GST_QUARK (ESTIMATED_TOTAL))); + g_value_get_int64 (gst_structure_get_value (structure, + "estimated-total")); } /* GstQueryBufferingRange: internal struct for GArray */ @@ -1278,7 +1269,7 @@ gst_query_add_buffering_range (GstQuery * query, gint64 start, gint64 stop) return FALSE; structure = GST_QUERY_STRUCTURE (query); - array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES), + array = ensure_array (structure, "buffering-ranges", sizeof (GstQueryBufferingRange), NULL); 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); structure = GST_QUERY_STRUCTURE (query); - array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES), + array = ensure_array (structure, "buffering-ranges", sizeof (GstQueryBufferingRange), NULL); return array->len; @@ -1346,7 +1337,7 @@ gst_query_parse_nth_buffering_range (GstQuery * query, guint index, structure = GST_QUERY_STRUCTURE (query); - array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES), + array = ensure_array (structure, "buffering-ranges", sizeof (GstQueryBufferingRange), NULL); 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)); 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); if (uri) - *uri = g_value_dup_string (gst_structure_id_get_value (structure, - GST_QUARK (URI))); + *uri = g_value_dup_string (gst_structure_get_value (structure, "uri")); } /** @@ -1446,8 +1436,7 @@ gst_query_set_uri_redirection (GstQuery * query, const gchar * uri) g_return_if_fail (gst_query_is_writable (query)); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (structure, GST_QUARK (URI_REDIRECTION), - G_TYPE_STRING, uri, NULL); + gst_structure_set (structure, "uri-redirection", G_TYPE_STRING, uri, NULL); } /** @@ -1471,7 +1460,7 @@ gst_query_parse_uri_redirection (GstQuery * query, gchar ** uri) structure = GST_QUERY_STRUCTURE (query); if (uri) { - if (!gst_structure_id_get (structure, GST_QUARK (URI_REDIRECTION), + if (!gst_structure_get (structure, "uri-redirection", G_TYPE_STRING, 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)); 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); } @@ -1523,7 +1512,7 @@ gst_query_parse_uri_redirection_permanent (GstQuery * query, structure = GST_QUERY_STRUCTURE (query); 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)) *permanent = FALSE; } @@ -1578,11 +1567,9 @@ gst_query_parse_allocation (GstQuery * query, GstCaps ** caps, structure = GST_QUERY_STRUCTURE (query); if (caps) { - *caps = g_value_get_boxed (gst_structure_id_get_value (structure, - GST_QUARK (CAPS))); + *caps = g_value_get_boxed (gst_structure_get_value (structure, "caps")); } - gst_structure_id_get (structure, - GST_QUARK (NEED_POOL), G_TYPE_BOOLEAN, need_pool, NULL); + gst_structure_get (structure, "need-pool", G_TYPE_BOOLEAN, need_pool, NULL); } typedef struct @@ -1622,7 +1609,7 @@ gst_query_add_allocation_pool (GstQuery * query, GstBufferPool * pool, g_return_if_fail (gst_query_is_writable (query)); structure = GST_QUERY_STRUCTURE (query); - array = ensure_array (structure, GST_QUARK (POOL), + array = ensure_array (structure, "pool", sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free); 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); structure = GST_QUERY_STRUCTURE (query); - array = ensure_array (structure, GST_QUARK (POOL), + array = ensure_array (structure, "pool", sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free); 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); structure = GST_QUERY_STRUCTURE (query); - array = ensure_array (structure, GST_QUARK (POOL), + array = ensure_array (structure, "pool", sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free); 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); structure = GST_QUERY_STRUCTURE (query); - array = ensure_array (structure, GST_QUARK (POOL), + array = ensure_array (structure, "pool", sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free); 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); array = - ensure_array (structure, GST_QUARK (POOL), sizeof (AllocationPool), + ensure_array (structure, "pool", sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free); 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); array = - ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), + ensure_array (structure, "meta", sizeof (AllocationMeta), (GDestroyNotify) allocation_meta_free); am.api = api; @@ -1827,7 +1814,7 @@ gst_query_get_n_allocation_metas (GstQuery * query) structure = GST_QUERY_STRUCTURE (query); array = - ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), + ensure_array (structure, "meta", sizeof (AllocationMeta), (GDestroyNotify) allocation_meta_free); return array->len; @@ -1856,7 +1843,7 @@ gst_query_parse_nth_allocation_meta (GstQuery * query, guint index, structure = GST_QUERY_STRUCTURE (query); array = - ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), + ensure_array (structure, "meta", sizeof (AllocationMeta), (GDestroyNotify) allocation_meta_free); 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); array = - ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), + ensure_array (structure, "meta", sizeof (AllocationMeta), (GDestroyNotify) allocation_meta_free); 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); array = - ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), + ensure_array (structure, "meta", sizeof (AllocationMeta), (GDestroyNotify) allocation_meta_free); len = array->len; @@ -1967,7 +1954,7 @@ gst_query_add_allocation_param (GstQuery * query, GstAllocator * allocator, g_return_if_fail (allocator != NULL || params != NULL); structure = GST_QUERY_STRUCTURE (query); - array = ensure_array (structure, GST_QUARK (ALLOCATOR), + array = ensure_array (structure, "allocator", sizeof (AllocationParam), (GDestroyNotify) allocation_param_free); 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); structure = GST_QUERY_STRUCTURE (query); - array = ensure_array (structure, GST_QUARK (ALLOCATOR), + array = ensure_array (structure, "allocator", sizeof (AllocationParam), (GDestroyNotify) allocation_param_free); 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); structure = GST_QUERY_STRUCTURE (query); - array = ensure_array (structure, GST_QUARK (ALLOCATOR), + array = ensure_array (structure, "allocator", sizeof (AllocationParam), (GDestroyNotify) allocation_param_free); 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); structure = GST_QUERY_STRUCTURE (query); - array = ensure_array (structure, GST_QUARK (ALLOCATOR), + array = ensure_array (structure, "allocator", sizeof (AllocationParam), (GDestroyNotify) allocation_param_free); 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); array = - ensure_array (structure, GST_QUARK (ALLOCATOR), sizeof (AllocationParam), + ensure_array (structure, "allocator", sizeof (AllocationParam), (GDestroyNotify) allocation_param_free); 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)); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (structure, - GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, flags, - GST_QUARK (MINSIZE), G_TYPE_INT, minsize, - GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize, - GST_QUARK (ALIGN), G_TYPE_INT, align, NULL); + gst_structure_set (structure, + "flags", GST_TYPE_SCHEDULING_FLAGS, flags, + "minsize", G_TYPE_INT, minsize, + "maxsize", G_TYPE_INT, maxsize, "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); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_get (structure, - GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, flags, - GST_QUARK (MINSIZE), G_TYPE_INT, minsize, - GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize, - GST_QUARK (ALIGN), G_TYPE_INT, align, NULL); + gst_structure_get (structure, + "flags", GST_TYPE_SCHEDULING_FLAGS, flags, + "minsize", G_TYPE_INT, minsize, + "maxsize", G_TYPE_INT, maxsize, "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)); structure = GST_QUERY_STRUCTURE (query); - array = - ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL); + array = ensure_array (structure, "modes", sizeof (GstPadMode), NULL); 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); structure = GST_QUERY_STRUCTURE (query); - array = - ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL); + array = ensure_array (structure, "modes", sizeof (GstPadMode), NULL); return array->len; } @@ -2252,8 +2235,7 @@ gst_query_parse_nth_scheduling_mode (GstQuery * query, guint index) GST_PAD_MODE_NONE); structure = GST_QUERY_STRUCTURE (query); - array = - ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL); + array = ensure_array (structure, "modes", sizeof (GstPadMode), NULL); g_return_val_if_fail (index < array->len, GST_PAD_MODE_NONE); 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); structure = GST_QUERY_STRUCTURE (query); - array = - ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL); + array = ensure_array (structure, "modes", sizeof (GstPadMode), NULL); len = array->len; 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); structure = GST_QUERY_STRUCTURE (query); - *caps = g_value_get_boxed (gst_structure_id_get_value (structure, - GST_QUARK (CAPS))); + *caps = g_value_get_boxed (gst_structure_get_value (structure, "caps")); } /** @@ -2383,8 +2363,7 @@ gst_query_set_accept_caps_result (GstQuery * query, gboolean result) g_return_if_fail (gst_query_is_writable (query)); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (structure, - GST_QUARK (RESULT), G_TYPE_BOOLEAN, result, NULL); + gst_structure_set (structure, "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); structure = GST_QUERY_STRUCTURE (query); - gst_structure_id_get (structure, - GST_QUARK (RESULT), G_TYPE_BOOLEAN, result, NULL); + gst_structure_get (structure, "result", G_TYPE_BOOLEAN, result, NULL); } /** @@ -2463,8 +2441,7 @@ gst_query_parse_caps (GstQuery * query, GstCaps ** filter) g_return_if_fail (filter != NULL); structure = GST_QUERY_STRUCTURE (query); - *filter = g_value_get_boxed (gst_structure_id_get_value (structure, - GST_QUARK (FILTER))); + *filter = g_value_get_boxed (gst_structure_get_value (structure, "filter")); } /** @@ -2483,7 +2460,7 @@ gst_query_set_caps_result (GstQuery * query, GstCaps * caps) g_return_if_fail (gst_query_is_writable (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); structure = GST_QUERY_STRUCTURE (query); - *caps = g_value_get_boxed (gst_structure_id_get_value (structure, - GST_QUARK (CAPS))); + *caps = g_value_get_boxed (gst_structure_get_value (structure, "caps")); } #if 0 @@ -2592,8 +2568,7 @@ gst_query_set_context (GstQuery * query, GstContext * context) s = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (s, - GST_QUARK (CONTEXT), GST_TYPE_CONTEXT, context, NULL); + gst_structure_set (s, "context", GST_TYPE_CONTEXT, context, NULL); } /** @@ -2616,7 +2591,7 @@ gst_query_parse_context (GstQuery * query, GstContext ** context) g_return_if_fail (context != NULL); structure = GST_QUERY_STRUCTURE (query); - v = gst_structure_id_get_value (structure, GST_QUARK (CONTEXT)); + v = gst_structure_get_value (structure, "context"); if (v) *context = g_value_get_boxed (v); else @@ -2645,7 +2620,7 @@ gst_query_parse_context_type (GstQuery * query, const gchar ** context_type) structure = GST_QUERY_STRUCTURE (query); 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); } @@ -2695,8 +2670,7 @@ gst_query_set_bitrate (GstQuery * query, guint nominal_bitrate) s = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (s, - GST_QUARK (NOMINAL_BITRATE), G_TYPE_UINT, nominal_bitrate, NULL); + gst_structure_set (s, "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); 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); } } @@ -2766,8 +2740,7 @@ gst_query_set_selectable (GstQuery * query, gboolean selectable) s = GST_QUERY_STRUCTURE (query); - gst_structure_id_set (s, - GST_QUARK (SELECTABLE), G_TYPE_BOOLEAN, selectable, NULL); + gst_structure_set (s, "selectable", G_TYPE_BOOLEAN, selectable, NULL); } /** @@ -2789,8 +2762,7 @@ gst_query_parse_selectable (GstQuery * query, gboolean * selectable) structure = GST_QUERY_STRUCTURE (query); if (selectable) { - const GValue *value = - gst_structure_id_get_value (structure, GST_QUARK (SELECTABLE)); + const GValue *value = gst_structure_get_value (structure, "selectable"); if (value) *selectable = g_value_get_boolean (value); else diff --git a/subprojects/gstreamer/gst/gsttaglist.c b/subprojects/gstreamer/gst/gsttaglist.c index 59169881f1..34dd521c2a 100644 --- a/subprojects/gstreamer/gst/gsttaglist.c +++ b/subprojects/gstreamer/gst/gsttaglist.c @@ -42,7 +42,6 @@ #include "gstinfo.h" #include "gstvalue.h" #include "gstbuffer.h" -#include "gstquark.h" #include "gststructure.h" #include "gstidstr-private.h" @@ -69,12 +68,12 @@ typedef struct { GType type; /* type the data is in */ + GstIdStr name; const gchar *nick; /* translated short description */ const gchar *blurb; /* translated long description */ GstTagMergeFunc merge_func; /* functions to merge the values */ GstTagFlag flag; /* type of tag */ - GQuark name_quark; /* quark for the name */ } GstTagInfo; @@ -551,10 +550,10 @@ gst_tag_register_static (const gchar * name, GstTagFlag flag, GType type, return; } - info = g_new (GstTagInfo, 1); + info = g_new0 (GstTagInfo, 1); info->flag = flag; 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->blurb = blurb; info->merge_func = func; @@ -957,11 +956,11 @@ gst_tag_list_is_empty (const GstTagList * list) } 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) { 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; if (value1 == NULL) { @@ -1018,7 +1017,8 @@ gst_tag_list_is_equal (const GstTagList * list1, const GstTagList * list2) 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 @@ -1034,7 +1034,7 @@ gst_tag_list_add_value_internal (GstTagList * tag_list, GstTagMergeMode mode, { GstStructure *list = GST_TAG_LIST_STRUCTURE (tag_list); const GValue *value2; - GQuark tag_quark; + const GstIdStr *tag_name; if (info == NULL) { info = gst_tag_lookup (tag); @@ -1052,23 +1052,23 @@ gst_tag_list_add_value_internal (GstTagList * tag_list, GstTagMergeMode mode, return; } - tag_quark = info->name_quark; + tag_name = &info->name; 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, }; switch (mode) { case GST_TAG_MERGE_REPLACE_ALL: 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; case GST_TAG_MERGE_PREPEND: if (GST_VALUE_HOLDS_LIST (value2) && !GST_VALUE_HOLDS_LIST (value)) gst_value_list_prepend_value ((GValue *) value2, value); else { 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; 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); else { 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; case GST_TAG_MERGE_KEEP: @@ -1090,13 +1090,13 @@ gst_tag_list_add_value_internal (GstTagList * tag_list, GstTagMergeMode mode, switch (mode) { case GST_TAG_MERGE_APPEND: 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; /* fall through */ case GST_TAG_MERGE_REPLACE_ALL: case GST_TAG_MERGE_REPLACE: 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; case GST_TAG_MERGE_KEEP_ALL: break; @@ -1108,13 +1108,13 @@ gst_tag_list_add_value_internal (GstTagList * tag_list, GstTagMergeMode mode, } 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) { GstTagCopyData *copy = (GstTagCopyData *) user_data; 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); return TRUE; @@ -1144,7 +1144,7 @@ gst_tag_list_insert (GstTagList * into, const GstTagList * from, if (mode == GST_TAG_MERGE_REPLACE_ALL) { 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); } @@ -1401,12 +1401,12 @@ typedef struct TagForeachData; static int -structure_foreach_wrapper (GQuark field_id, const GValue * value, +structure_foreach_wrapper (const GstIdStr * field, const GValue * value, gpointer 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; } @@ -1431,7 +1431,7 @@ gst_tag_list_foreach (const GstTagList * list, GstTagForeachFunc func, data.func = func; data.tag_list = list; 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); } diff --git a/subprojects/gstreamer/gst/gsttracerrecord.c b/subprojects/gstreamer/gst/gsttracerrecord.c index f8b10ed599..26e1ba2ca0 100644 --- a/subprojects/gstreamer/gst/gsttracerrecord.c +++ b/subprojects/gstreamer/gst/gsttracerrecord.c @@ -58,7 +58,8 @@ struct _GstTracerRecordClass G_DEFINE_TYPE (GstTracerRecord, gst_tracer_record, GST_TYPE_OBJECT); 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; 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) { 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; } @@ -78,17 +79,19 @@ build_field_template (GQuark field_id, const GValue * value, gpointer user_data) GST_TYPE_TRACER_VALUE_FLAGS, &flags, NULL); 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 */ 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_free (opt_name); } 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); g_value_unset (&template_value); return res; @@ -115,7 +118,7 @@ gst_tracer_record_build_format (GstTracerRecord * self) s = g_string_sized_new (STRUCTURE_ESTIMATED_STRING_LEN (structure)); 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, ';'); self->format = g_string_free (s, FALSE); @@ -188,7 +191,6 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...) va_list varargs; gchar *err = NULL; GType type; - GQuark id; va_start (varargs, firstfield); structure = gst_structure_new_empty (name); @@ -196,7 +198,6 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...) while (firstfield) { GValue val = { 0, }; - id = g_quark_from_string (firstfield); type = va_arg (varargs, GType); /* 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. * see boxed_proxy_collect_value in glib's gobject/gboxed.c */ 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 *); } diff --git a/subprojects/gstreamer/gst/gstvalue.c b/subprojects/gstreamer/gst/gstvalue.c index b9eb1f48ad..44978589a3 100644 --- a/subprojects/gstreamer/gst/gstvalue.c +++ b/subprojects/gstreamer/gst/gstvalue.c @@ -2953,18 +2953,18 @@ gst_value_deserialize_segment_internal (GValue * dest, const gchar * s, if (G_UNLIKELY (str == NULL)) return FALSE; - res = gst_structure_id_get (str, - GST_QUARK (FLAGS), GST_TYPE_SEGMENT_FLAGS, &seg.flags, - GST_QUARK (RATE), G_TYPE_DOUBLE, &seg.rate, - GST_QUARK (APPLIED_RATE), G_TYPE_DOUBLE, &seg.applied_rate, - GST_QUARK (FORMAT), GST_TYPE_FORMAT, &seg.format, - GST_QUARK (BASE), G_TYPE_UINT64, &seg.base, - GST_QUARK (OFFSET), G_TYPE_UINT64, &seg.offset, - GST_QUARK (START), G_TYPE_UINT64, &seg.start, - GST_QUARK (STOP), G_TYPE_UINT64, &seg.stop, - GST_QUARK (TIME), G_TYPE_UINT64, &seg.time, - GST_QUARK (POSITION), G_TYPE_UINT64, &seg.position, - GST_QUARK (DURATION), G_TYPE_UINT64, &seg.duration, NULL); + res = gst_structure_get (str, + "flags", GST_TYPE_SEGMENT_FLAGS, &seg.flags, + "rate", G_TYPE_DOUBLE, &seg.rate, + "applied-rate", G_TYPE_DOUBLE, &seg.applied_rate, + "format", GST_TYPE_FORMAT, &seg.format, + "base", G_TYPE_UINT64, &seg.base, + "offset", G_TYPE_UINT64, &seg.offset, + "start", G_TYPE_UINT64, &seg.start, + "stop", G_TYPE_UINT64, &seg.stop, + "time", G_TYPE_UINT64, &seg.time, + "position", G_TYPE_UINT64, &seg.position, + "duration", G_TYPE_UINT64, &seg.duration, NULL); gst_structure_free (str); 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 */ 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; const GValue *other_value; 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 */ if (!other_value) 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 */ 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) { GstStructure *result = user_data; 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) - gst_structure_id_set_value (result, field_id, other_val); + gst_structure_id_str_set_value (result, field, other_val); return TRUE; } @@ -4792,12 +4793,13 @@ gst_value_union_structure_structure (GValue * dest, const GValue * src1, result = gst_structure_copy (s1); 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); if (!ret) goto out; 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) { g_value_init (dest, GST_TYPE_STRUCTURE); @@ -6819,7 +6821,7 @@ gst_value_deserialize_with_pspec (GValue * dest, const gchar * src, } 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) { 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 */ return (gst_value_get_flagset_mask (value) == GST_FLAG_SET_MASK_EXACT); } 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); } return gst_type_is_fixed (type); diff --git a/subprojects/gstreamer/libs/gst/base/gstbaseparse.c b/subprojects/gstreamer/libs/gst/base/gstbaseparse.c index 422e489c32..6b9636dbbb 100644 --- a/subprojects/gstreamer/libs/gst/base/gstbaseparse.c +++ b/subprojects/gstreamer/libs/gst/base/gstbaseparse.c @@ -1111,7 +1111,7 @@ gst_base_parse_convert (GstBaseParse * parse, } static gboolean -update_upstream_provided (GQuark field_id, const GValue * value, +update_upstream_provided (const GstIdStr * field, const GValue * value, gpointer 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); for (i = 0; i < caps_size; i++) { GstStructure *structure = gst_caps_get_structure (default_caps, i); - if (!gst_structure_id_has_field (structure, field_id)) { - gst_structure_id_set_value (structure, field_id, value); + if (!gst_structure_has_field (structure, gst_id_str_as_str (field))) { + gst_structure_id_str_set_value (structure, field, value); } /* XXX: maybe try to fixate better than gst_caps_fixate() the * downstream caps based on upstream values if possible */ @@ -1162,7 +1162,8 @@ gst_base_parse_negotiate_default_caps (GstBaseParse * parse) if (sinkcaps) { 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); diff --git a/subprojects/gstreamer/plugins/tracers/gstlatency.c b/subprojects/gstreamer/plugins/tracers/gstlatency.c index 461bd6b46e..9f840cbbbb 100644 --- a/subprojects/gstreamer/plugins/tracers/gstlatency.c +++ b/subprojects/gstreamer/plugins/tracers/gstlatency.c @@ -59,10 +59,6 @@ static void latency_query_stack_destroy (gpointer data); static GQuark 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 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_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); - 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); - 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); - 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_sink = g_strdup_printf ("%p", sink_parent); @@ -222,7 +218,7 @@ log_element_latency (const GstStructure * data, GstElement * parent, /* 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); 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; /* 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 = 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); 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; /* 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 = 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); 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"); 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 = g_quark_from_static_string ("drop_sub_latency.quark"); diff --git a/subprojects/gstreamer/tests/check/gst/gstcaps.c b/subprojects/gstreamer/tests/check/gst/gstcaps.c index b6c15417cf..14118f4dd7 100644 --- a/subprojects/gstreamer/tests/check/gst/gstcaps.c +++ b/subprojects/gstreamer/tests/check/gst/gstcaps.c @@ -1160,7 +1160,8 @@ GST_START_TEST (test_union) GST_END_TEST; 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); } @@ -1179,7 +1180,8 @@ GST_START_TEST (test_normalize) for (i = 0; i < gst_caps_get_size (norm); i++) { GstStructure *st = gst_caps_get_structure (norm, i); /* 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); @@ -1197,7 +1199,8 @@ GST_START_TEST (test_normalize) for (i = 0; i < gst_caps_get_size (norm); i++) { GstStructure *st = gst_caps_get_structure (norm, i); /* 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); @@ -1214,7 +1217,8 @@ GST_START_TEST (test_normalize) for (i = 0; i < gst_caps_get_size (norm); i++) { GstStructure *st = gst_caps_get_structure (norm, i); /* 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); diff --git a/subprojects/gstreamer/tests/check/gst/gststructure.c b/subprojects/gstreamer/tests/check/gst/gststructure.c index 80bc05a61b..961f205c77 100644 --- a/subprojects/gstreamer/tests/check/gst/gststructure.c +++ b/subprojects/gstreamer/tests/check/gst/gststructure.c @@ -864,6 +864,8 @@ GST_START_TEST (test_vararg_getters) gst_buffer_unref (buf2); buf2 = NULL; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" /* and now the _id variant */ 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, @@ -892,6 +894,58 @@ GST_START_TEST (test_vararg_getters) g_free (c); gst_caps_unref (caps2); 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 */ 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; } +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) { 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, NULL); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" 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); gst_structure_free (s); - } GST_END_TEST; @@ -949,6 +1024,15 @@ map_func (GQuark field_id, GValue * value, gpointer user_data) 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) { GstStructure *s, *s2; @@ -957,11 +1041,20 @@ GST_START_TEST (test_map_in_place) NULL); s2 = gst_structure_new ("foo/bar", "baz", G_TYPE_INT, 123, "bla", G_TYPE_INT, 123, NULL); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" fail_unless (gst_structure_map_in_place (s, 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); + 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 (s2); - } GST_END_TEST; @@ -978,6 +1071,19 @@ filter_map_func (GQuark field_id, GValue * value, gpointer user_data) 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) { 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, 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); +#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)); gst_structure_free (s); gst_structure_free (s2); diff --git a/subprojects/gstreamer/tools/gst-inspect.c b/subprojects/gstreamer/tools/gst-inspect.c index e31900c10a..7195c9c34e 100644 --- a/subprojects/gstreamer/tools/gst-inspect.c +++ b/subprojects/gstreamer/tools/gst-inspect.c @@ -182,13 +182,13 @@ n_print (const char *format, ...) } 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); n_print ("%s %s%15s%s: %s%s%s\n", - (gchar *) pfx, FIELD_NAME_COLOR, g_quark_to_string (field), RESET_COLOR, - FIELD_VALUE_COLOR, str, RESET_COLOR); + (gchar *) pfx, FIELD_NAME_COLOR, gst_id_str_as_str (fieldname), + RESET_COLOR, FIELD_VALUE_COLOR, str, RESET_COLOR); g_free (str); 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, 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); if (s) { g_print ("\n"); - gst_structure_foreach (s, print_field, + gst_structure_foreach_id_str (s, print_field, (gpointer) " "); } }