-inspect fixes for formats

Original commit message from CVS:
-inspect fixes for formats
-launch uses the default error/deep_notify handlers
This commit is contained in:
Wim Taymans 2002-07-30 19:25:24 +00:00
parent 992f55fe4c
commit 7fc1800892
2 changed files with 23 additions and 57 deletions

View file

@ -110,21 +110,17 @@ print_props (GstProps *properties, gchar *pfx)
static void
print_formats (const GstFormat *formats)
{
GType format_type;
GEnumClass *klass;
format_type = gst_format_get_type();
klass = (GEnumClass *) g_type_class_ref (format_type);
while (formats && *formats) {
GEnumValue *value;
const gchar *nick;
const gchar *description;
value = g_enum_get_value (klass, *formats);
printf ("\t\t(%d):\t%s (%s)\n", value->value, value->value_nick, value->value_name);
if (gst_format_get_details (*formats, &nick, &description))
g_print ("\t\t(%d):\t%s (%s)\n", *formats, nick, description);
else
g_print ("\t\t(%d):\tUnknown format\n", *formats);
formats++;
}
g_type_class_unref (klass);
}
static void
@ -315,12 +311,22 @@ print_element_properties (GstElement *element)
else if (G_IS_PARAM_SPEC_ENUM (param)) {
GEnumValue *values;
guint j = 0;
gint enum_value;
printf("%-23.23s Enum \"%s\" (default %d)", "",
g_type_name (G_VALUE_TYPE (&value)),
g_value_get_enum (&value));
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)
break;
j++;
}
g_print ("%-23.23s Enum \"%s\" (default %d, \"%s\")", "",
g_type_name (G_VALUE_TYPE (&value)),
enum_value, values[j].value_nick);
j = 0;
while (values[j].value_name) {
printf("\n%-23.23s (%d): \t%s", "", values[j].value, values[j].value_nick);
j++;

View file

@ -40,47 +40,6 @@ idle_func (gpointer data)
return busy;
}
static void
property_change_callback (GObject *object, GstObject *orig, GParamSpec *pspec, gchar **excluded_props)
{
GValue value = { 0, }; /* the important thing is that value.type = 0 */
gchar *str = 0;
if (pspec->flags & G_PARAM_READABLE) {
/* let's not print these out for excluded properties... */
while (excluded_props != NULL && *excluded_props != NULL)
{
if (strcmp (pspec->name, *excluded_props) == 0)
return;
excluded_props++;
}
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_object_get_property (G_OBJECT (orig), pspec->name, &value);
if (G_IS_PARAM_SPEC_ENUM (pspec)) {
GEnumValue *enum_value;
enum_value = g_enum_get_value (G_ENUM_CLASS (g_type_class_ref (pspec->value_type)),
g_value_get_enum (&value));
str = g_strdup_printf ("%s (%d)", enum_value->value_nick, enum_value->value);
}
else {
str = g_strdup_value_contents (&value);
}
g_print ("%s: %s = %s\n", GST_OBJECT_NAME (orig), pspec->name, str);
g_free (str);
g_value_unset(&value);
} else {
g_warning ("Parameter not readable. What's up with that?");
}
}
static void
error_callback (GObject *object, GstObject *orig, gchar *error)
{
g_print ("ERROR: %s: %s\n", GST_OBJECT_NAME (orig), error);
}
static GstElement*
xmllaunch_parse_cmdline (const gchar **argv)
{
@ -190,9 +149,9 @@ main(int argc, char *argv[])
if (!silent)
{
gchar **exclude_list = exclude_args ? g_strsplit (exclude_args, ",", 0) : NULL;
g_signal_connect (pipeline, "deep_notify", G_CALLBACK (property_change_callback), exclude_list);
g_signal_connect (pipeline, "deep_notify", G_CALLBACK (gst_element_default_deep_notify), exclude_list);
}
g_signal_connect (pipeline, "error", G_CALLBACK (error_callback), NULL);
g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error), NULL);
#ifndef GST_DISABLE_LOADSAVE
if (savefile) {
@ -218,6 +177,7 @@ main(int argc, char *argv[])
} else {
g_print ("waiting for the state change...\n");
gst_element_wait_state_change (pipeline);
g_print ("got the state change...\n");
}
gst_element_set_state (pipeline, GST_STATE_NULL);