diff --git a/Android.mk b/Android.mk index 10b28a865d..8f20a4d09e 100644 --- a/Android.mk +++ b/Android.mk @@ -36,6 +36,7 @@ GST_BUILT_SOURCES := \ plugins/Android.mk \ plugins/elements/Android.mk \ plugins/indexers/Android.mk \ + tests/examples/controller/Android.mk \ tools/Android.mk GST_BUILT_SOURCES := $(patsubst %, $(abspath $(gstreamer_TOP))/%, $(GST_BUILT_SOURCES)) @@ -68,3 +69,4 @@ CONFIGURE_TARGETS += gst-configure -include $(gstreamer_TOP)/libs/Android.mk -include $(gstreamer_TOP)/plugins/Android.mk -include $(gstreamer_TOP)/tools/Android.mk +-include $(gstreamer_TOP)/tests/examples/controller/Android.mk diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index d0bfb6f359..5c14a3260d 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -769,7 +769,7 @@ GList * gst_element_factory_list_filter (GList * list, const GstCaps * caps, GstPadDirection direction, gboolean subsetonly) { - GList *result = NULL; + GQueue results = G_QUEUE_INIT; GST_DEBUG ("finding factories"); @@ -803,7 +803,7 @@ gst_element_factory_list_filter (GList * list, if ((subsetonly && gst_caps_is_subset (caps, tmpl_caps)) || (!subsetonly && gst_caps_can_intersect (caps, tmpl_caps))) { /* non empty intersection, we can use this element */ - result = g_list_prepend (result, gst_object_ref (factory)); + g_queue_push_tail (&results, gst_object_ref (factory)); gst_caps_unref (tmpl_caps); break; } @@ -811,5 +811,5 @@ gst_element_factory_list_filter (GList * list, } } } - return g_list_reverse (result); + return results.head; } diff --git a/gst/gstparse.c b/gst/gstparse.c index 910fc8f702..a2d3d3deaf 100644 --- a/gst/gstparse.c +++ b/gst/gstparse.c @@ -44,12 +44,6 @@ #include "parse/types.h" #endif -static void -_prepend_missing_element (gchar * element, GList ** list) -{ - *list = g_list_prepend (*list, g_strdup (element)); -} - static GstParseContext * gst_parse_context_copy (const GstParseContext * context) { @@ -58,9 +52,13 @@ gst_parse_context_copy (const GstParseContext * context) ret = gst_parse_context_new (); if (context) { - g_list_foreach (context->missing_elements, (GFunc) _prepend_missing_element, - &ret->missing_elements); - ret->missing_elements = g_list_reverse (ret->missing_elements); + GQueue missing_copy = G_QUEUE_INIT; + GList *l; + + for (l = context->missing_elements; l != NULL; l = l->next) + g_queue_push_tail (&missing_copy, g_strdup ((const gchar *) l->data)); + + ret->missing_elements = missing_copy.head; } #endif return ret; diff --git a/gst/gstplugin.c b/gst/gstplugin.c index dfb5f0c24f..2c13e68b3e 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -1419,12 +1419,11 @@ _priv_plugin_deps_env_vars_changed (GstPlugin * plugin) return FALSE; } -static GList * +static void gst_plugin_ext_dep_extract_env_vars_paths (GstPlugin * plugin, - GstPluginDep * dep) + GstPluginDep * dep, GQueue * paths) { gchar **evars; - GList *paths = NULL; for (evars = dep->env_vars; evars != NULL && *evars != NULL; ++evars) { const gchar *e; @@ -1471,9 +1470,9 @@ gst_plugin_ext_dep_extract_env_vars_paths (GstPlugin * plugin, full_path = g_strdup (arr[i]); } - if (!g_list_find_custom (paths, full_path, (GCompareFunc) strcmp)) { + if (!g_queue_find_custom (paths, full_path, (GCompareFunc) strcmp)) { GST_LOG_OBJECT (plugin, "path: '%s'", full_path); - paths = g_list_prepend (paths, full_path); + g_queue_push_tail (paths, full_path); full_path = NULL; } else { GST_LOG_OBJECT (plugin, "path: '%s' (duplicate,ignoring)", full_path); @@ -1487,10 +1486,7 @@ gst_plugin_ext_dep_extract_env_vars_paths (GstPlugin * plugin, g_strfreev (components); } - GST_LOG_OBJECT (plugin, "Extracted %d paths from environment", - g_list_length (paths)); - - return paths; + GST_LOG_OBJECT (plugin, "Extracted %d paths from environment", paths->length); } static guint @@ -1636,43 +1632,37 @@ static guint gst_plugin_ext_dep_get_stat_hash (GstPlugin * plugin, GstPluginDep * dep) { gboolean paths_are_default_only; - GList *scan_paths; + GQueue scan_paths = G_QUEUE_INIT; guint scan_hash = 0; + gchar *path; GST_LOG_OBJECT (plugin, "start"); paths_are_default_only = dep->flags & GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY; - scan_paths = gst_plugin_ext_dep_extract_env_vars_paths (plugin, dep); + gst_plugin_ext_dep_extract_env_vars_paths (plugin, dep, &scan_paths); - if (scan_paths == NULL || !paths_are_default_only) { + if (g_queue_is_empty (&scan_paths) || !paths_are_default_only) { gchar **paths; for (paths = dep->paths; paths != NULL && *paths != NULL; ++paths) { const gchar *path = *paths; - if (!g_list_find_custom (scan_paths, path, (GCompareFunc) strcmp)) { + if (!g_queue_find_custom (&scan_paths, path, (GCompareFunc) strcmp)) { GST_LOG_OBJECT (plugin, "path: '%s'", path); - scan_paths = g_list_prepend (scan_paths, g_strdup (path)); + g_queue_push_tail (&scan_paths, g_strdup (path)); } else { GST_LOG_OBJECT (plugin, "path: '%s' (duplicate, ignoring)", path); } } } - /* not that the order really matters, but it makes debugging easier */ - scan_paths = g_list_reverse (scan_paths); - - while (scan_paths != NULL) { - const gchar *path = scan_paths->data; - + while ((path = g_queue_pop_head (&scan_paths))) { scan_hash += gst_plugin_ext_dep_scan_path_with_filenames (plugin, path, (const gchar **) dep->names, dep->flags); scan_hash = scan_hash << 1; - - g_free (scan_paths->data); - scan_paths = g_list_delete_link (scan_paths, scan_paths); + g_free (path); } GST_LOG_OBJECT (plugin, "done, scan_hash: %08x", scan_hash); diff --git a/libs/gst/controller/gstinterpolationcontrolsource.c b/libs/gst/controller/gstinterpolationcontrolsource.c index 2b2515ce8c..9b25f24169 100644 --- a/libs/gst/controller/gstinterpolationcontrolsource.c +++ b/libs/gst/controller/gstinterpolationcontrolsource.c @@ -607,9 +607,9 @@ gst_interpolation_control_source_unset_all (GstInterpolationControlSource * } static void -_append_control_point (GstControlPoint * cp, GList ** l) +_append_control_point (GstControlPoint * cp, GQueue * res) { - *l = g_list_prepend (*l, cp); + g_queue_push_tail (res, cp); } /** @@ -625,7 +625,7 @@ _append_control_point (GstControlPoint * cp, GList ** l) GList * gst_interpolation_control_source_get_all (GstInterpolationControlSource * self) { - GList *res = NULL; + GQueue res = G_QUEUE_INIT; g_return_val_if_fail (GST_IS_INTERPOLATION_CONTROL_SOURCE (self), NULL); @@ -635,7 +635,7 @@ gst_interpolation_control_source_get_all (GstInterpolationControlSource * self) &res); g_mutex_unlock (self->lock); - return g_list_reverse (res); + return res.head; } /** diff --git a/tests/examples/controller/Makefile.am b/tests/examples/controller/Makefile.am index 0255ea7a2e..98c1b65c28 100644 --- a/tests/examples/controller/Makefile.am +++ b/tests/examples/controller/Makefile.am @@ -4,3 +4,15 @@ audio_example_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir)/libs audio_example_LDADD = \ $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la \ $(GST_OBJ_LIBS) + +Android.mk: Makefile.am audio-example.c + androgenizer \ + -:PROJECT audio-example -:EXECUTABLE audio-example \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES audio-example.c \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(audio_example_CFLAGS) \ + -:LDFLAGS -lgstcontroller-@GST_MAJORMINOR@ \ + $(GST_OBJ_LIBS) -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + > $@ diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 53da01e818..bc4c618f43 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -331,6 +331,11 @@ print_element_properties_info (GstElement * element) readable = TRUE; g_print ("%s%s", (first_flag) ? "" : ", ", _("readable")); first_flag = FALSE; + } else { + /* if we can't read the property value, assume it's set to the default + * (which might not be entirely true for sub-classes, but that's an + * unlikely corner-case anyway) */ + g_param_value_set_default (param, &value); } if (param->flags & G_PARAM_WRITABLE) { g_print ("%s%s", (first_flag) ? "" : ", ", _("writable")); @@ -356,34 +361,23 @@ print_element_properties_info (GstElement * element) switch (G_VALUE_TYPE (&value)) { case G_TYPE_STRING: { - GParamSpecString *pstring = G_PARAM_SPEC_STRING (param); + const char *string_val = g_value_get_string (&value); n_print ("%-23.23s String. ", ""); - if (pstring->default_value == NULL) - g_print ("Default: null "); + if (string_val == NULL) + g_print ("Default: null"); else - g_print ("Default: \"%s\" ", pstring->default_value); - - if (readable) { - const char *string_val = g_value_get_string (&value); - - if (string_val == NULL) - g_print ("Current: null"); - else - g_print ("Current: \"%s\"", string_val); - } + g_print ("Default: \"%s\"", string_val); break; } case G_TYPE_BOOLEAN: { - GParamSpecBoolean *pboolean = G_PARAM_SPEC_BOOLEAN (param); + gboolean bool_val = g_value_get_boolean (&value); n_print ("%-23.23s Boolean. ", ""); - g_print ("Default: %s ", (pboolean->default_value ? "true" : "false")); - if (readable) - g_print ("Current: %s", - (g_value_get_boolean (&value) ? "true" : "false")); + + g_print ("Default: %s", bool_val ? "true" : "false"); break; } case G_TYPE_ULONG: @@ -392,9 +386,7 @@ print_element_properties_info (GstElement * element) n_print ("%-23.23s Unsigned Long. ", ""); g_print ("Range: %lu - %lu Default: %lu ", - pulong->minimum, pulong->maximum, pulong->default_value); - if (readable) - g_print ("Current: %lu", g_value_get_ulong (&value)); + pulong->minimum, pulong->maximum, g_value_get_ulong (&value)); break; } case G_TYPE_LONG: @@ -403,9 +395,7 @@ print_element_properties_info (GstElement * element) n_print ("%-23.23s Long. ", ""); g_print ("Range: %ld - %ld Default: %ld ", - plong->minimum, plong->maximum, plong->default_value); - if (readable) - g_print ("Current: %ld", g_value_get_long (&value)); + plong->minimum, plong->maximum, g_value_get_long (&value)); break; } case G_TYPE_UINT: @@ -414,9 +404,7 @@ print_element_properties_info (GstElement * element) n_print ("%-23.23s Unsigned Integer. ", ""); g_print ("Range: %u - %u Default: %u ", - puint->minimum, puint->maximum, puint->default_value); - if (readable) - g_print ("Current: %u", g_value_get_uint (&value)); + puint->minimum, puint->maximum, g_value_get_uint (&value)); break; } case G_TYPE_INT: @@ -425,9 +413,7 @@ print_element_properties_info (GstElement * element) n_print ("%-23.23s Integer. ", ""); g_print ("Range: %d - %d Default: %d ", - pint->minimum, pint->maximum, pint->default_value); - if (readable) - g_print ("Current: %d", g_value_get_int (&value)); + pint->minimum, pint->maximum, g_value_get_int (&value)); break; } case G_TYPE_UINT64: @@ -437,9 +423,7 @@ print_element_properties_info (GstElement * element) n_print ("%-23.23s Unsigned Integer64. ", ""); g_print ("Range: %" G_GUINT64_FORMAT " - %" G_GUINT64_FORMAT " Default: %" G_GUINT64_FORMAT " ", - puint64->minimum, puint64->maximum, puint64->default_value); - if (readable) - g_print ("Current: %" G_GUINT64_FORMAT, g_value_get_uint64 (&value)); + puint64->minimum, puint64->maximum, g_value_get_uint64 (&value)); break; } case G_TYPE_INT64: @@ -449,9 +433,7 @@ print_element_properties_info (GstElement * element) n_print ("%-23.23s Integer64. ", ""); g_print ("Range: %" G_GINT64_FORMAT " - %" G_GINT64_FORMAT " Default: %" G_GINT64_FORMAT " ", - pint64->minimum, pint64->maximum, pint64->default_value); - if (readable) - g_print ("Current: %" G_GINT64_FORMAT, g_value_get_int64 (&value)); + pint64->minimum, pint64->maximum, g_value_get_int64 (&value)); break; } case G_TYPE_FLOAT: @@ -460,9 +442,7 @@ print_element_properties_info (GstElement * element) n_print ("%-23.23s Float. ", ""); g_print ("Range: %15.7g - %15.7g Default: %15.7g ", - pfloat->minimum, pfloat->maximum, pfloat->default_value); - if (readable) - g_print ("Current: %15.7g", g_value_get_float (&value)); + pfloat->minimum, pfloat->maximum, g_value_get_float (&value)); break; } case G_TYPE_DOUBLE: @@ -471,9 +451,7 @@ print_element_properties_info (GstElement * element) n_print ("%-23.23s Double. ", ""); g_print ("Range: %15.7g - %15.7g Default: %15.7g ", - pdouble->minimum, pdouble->maximum, pdouble->default_value); - if (readable) - g_print ("Current: %15.7g", g_value_get_double (&value)); + pdouble->minimum, pdouble->maximum, g_value_get_double (&value)); break; } default: @@ -486,27 +464,22 @@ print_element_properties_info (GstElement * element) print_caps (caps, " "); } } else if (G_IS_PARAM_SPEC_ENUM (param)) { - GParamSpecEnum *penum = G_PARAM_SPEC_ENUM (param); GEnumValue *values; guint j = 0; gint enum_value; - const gchar *def_val_nick = "", *cur_val_nick = ""; + const gchar *value_nick = ""; values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values; enum_value = g_value_get_enum (&value); while (values[j].value_name) { if (values[j].value == enum_value) - cur_val_nick = values[j].value_nick; - if (values[j].value == penum->default_value) - def_val_nick = values[j].value_nick; + value_nick = values[j].value_nick; j++; } - n_print - ("%-23.23s Enum \"%s\" Default: %d, \"%s\" Current: %d, \"%s\"", - "", g_type_name (G_VALUE_TYPE (&value)), penum->default_value, - def_val_nick, enum_value, cur_val_nick); + n_print ("%-23.23s Enum \"%s\" Default: %d, \"%s\"", "", + g_type_name (G_VALUE_TYPE (&value)), enum_value, value_nick); j = 0; while (values[j].value_name) { @@ -521,17 +494,15 @@ print_element_properties_info (GstElement * element) } else if (G_IS_PARAM_SPEC_FLAGS (param)) { GParamSpecFlags *pflags = G_PARAM_SPEC_FLAGS (param); GFlagsValue *vals; - gchar *cur, *def; + gchar *cur; vals = pflags->flags_class->values; cur = flags_to_string (vals, g_value_get_flags (&value)); - def = flags_to_string (vals, pflags->default_value); - n_print - ("%-23.23s Flags \"%s\" Default: 0x%08x, \"%s\" Current: 0x%08x, \"%s\"", - "", g_type_name (G_VALUE_TYPE (&value)), pflags->default_value, - def, g_value_get_flags (&value), cur); + n_print ("%-23.23s Flags \"%s\" Default: 0x%08x, \"%s\"", "", + g_type_name (G_VALUE_TYPE (&value)), + g_value_get_flags (&value), cur); while (vals[0].value_name) { g_print ("\n"); @@ -543,7 +514,6 @@ print_element_properties_info (GstElement * element) } g_free (cur); - g_free (def); } else if (G_IS_PARAM_SPEC_OBJECT (param)) { n_print ("%-23.23s Object of type \"%s\"", "", g_type_name (param->value_type)); @@ -574,12 +544,8 @@ print_element_properties_info (GstElement * element) g_print ("Range: %d/%d - %d/%d Default: %d/%d ", pfraction->min_num, pfraction->min_den, pfraction->max_num, pfraction->max_den, - pfraction->def_num, pfraction->def_den); - if (readable) - g_print ("Current: %d/%d", - gst_value_get_fraction_numerator (&value), - gst_value_get_fraction_denominator (&value)); - + gst_value_get_fraction_numerator (&value), + gst_value_get_fraction_denominator (&value)); } else { n_print ("%-23.23s Unknown type %ld \"%s\"", "", param->value_type, g_type_name (param->value_type));