From f2da156af70293d9b84f9f5643537349836eeac0 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Tue, 1 Jul 2008 05:53:32 +0000 Subject: [PATCH] gst/gstevent.c: Use gst_format_get_name() to improve debug output. Original commit message from CVS: * gst/gstevent.c: Use gst_format_get_name() to improve debug output. * gst/gstpreset.c: Remove #ifdef'ed code. Add TODO comment. * gst/gstsegment.c: Add debug output to ease spotting format != segment.format assertions. --- ChangeLog | 11 +++++ gst/gstevent.c | 14 +++--- gst/gstpreset.c | 118 ++++++++--------------------------------------- gst/gstsegment.c | 6 +++ 4 files changed, 45 insertions(+), 104 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0b7bde1c4..74b1d4b7d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-07-01 Stefan Kost + + * gst/gstevent.c: + Use gst_format_get_name() to improve debug output. + + * gst/gstpreset.c: + Remove #ifdef'ed code. Add TODO comment. + + * gst/gstsegment.c: + Add debug output to ease spotting format != segment.format assertions. + 2008-06-30 Sebastian Dröge * tests/check/libs/gdp.c: (gst_dp_suite): diff --git a/gst/gstevent.c b/gst/gstevent.c index 85b0381007..8f27e908f1 100644 --- a/gst/gstevent.c +++ b/gst/gstevent.c @@ -557,9 +557,10 @@ gst_event_new_new_segment_full (gboolean update, gdouble rate, GST_TIME_ARGS (stop), GST_TIME_ARGS (position)); } else { GST_CAT_INFO (GST_CAT_EVENT, - "creating newsegment update %d, rate %lf, format %d, " + "creating newsegment update %d, rate %lf, format %s, " "start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT ", position %" - G_GINT64_FORMAT, update, rate, format, start, stop, position); + G_GINT64_FORMAT, update, rate, gst_format_get_name (format), start, + stop, position); } g_return_val_if_fail (position != -1, NULL); @@ -679,8 +680,8 @@ gst_event_new_buffer_size (GstFormat format, gint64 minsize, gint64 maxsize, gboolean async) { GST_CAT_INFO (GST_CAT_EVENT, - "creating buffersize format %d, minsize %" G_GINT64_FORMAT - ", maxsize %" G_GINT64_FORMAT ", async %d", format, + "creating buffersize format %s, minsize %" G_GINT64_FORMAT + ", maxsize %" G_GINT64_FORMAT ", async %d", gst_format_get_name (format), minsize, maxsize, async); return gst_event_new_custom (GST_EVENT_BUFFERSIZE, @@ -873,10 +874,11 @@ gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags, stop_type, GST_TIME_ARGS (stop)); } else { GST_CAT_INFO (GST_CAT_EVENT, - "creating seek rate %lf, format %d, flags %d, " + "creating seek rate %lf, format %s, flags %d, " "start_type %d, start %" G_GINT64_FORMAT ", " "stop_type %d, stop %" G_GINT64_FORMAT, - rate, format, flags, start_type, start, stop_type, stop); + rate, gst_format_get_name (format), flags, start_type, start, stop_type, + stop); } return gst_event_new_custom (GST_EVENT_SEEK, diff --git a/gst/gstpreset.c b/gst/gstpreset.c index 775535ea6a..8ddef4ab43 100644 --- a/gst/gstpreset.c +++ b/gst/gstpreset.c @@ -62,10 +62,24 @@ * - this would alloow to hanve preset-bundles too (a preset on bins that * specifies presets for children * - * - meta presets : presets that load presets for children (childproxy/bin) - * [] - * _child/= - * _child/... + * - GstChildProxy suport + * - if we stick with GParamSpec **_list_properties() + * we need to use g_param_spec_set_qdata() to specify the instance on each GParamSpec + * OBJECT_LOCK(obj); // ChildProxy needs GstIterator support + * num=gst_child_proxy_get_children_count(obj); + * for(i=0;i +#endif #include #define GST_CAT_DEFAULT preset_debug @@ -842,99 +857,6 @@ no_presets: } } -#if 0 -static void -gst_preset_default_randomize (GstPreset * preset) -{ - GList *properties; - GType base, parent; - - if ((properties = gst_preset_get_property_names (preset))) { - GParamSpec *property; - GList *node; - gdouble rnd; - - for (node = properties; node; node = g_list_next (node)) { - property = g_object_class_find_property (G_OBJECT_CLASS - (GST_ELEMENT_GET_CLASS (preset)), node->data); - - rnd = ((gdouble) rand ()) / (RAND_MAX + 1.0); - - /* get base type */ - base = property->value_type; - while ((parent = g_type_parent (base))) - base = parent; - GST_INFO ("set random value for property: %s (type is %s)", - property->name, g_type_name (base)); - - switch (base) { - case G_TYPE_BOOLEAN:{ - g_object_set (preset, property->name, (gboolean) (2.0 * rnd), NULL); - } - break; - case G_TYPE_INT:{ - const GParamSpecInt *int_property = G_PARAM_SPEC_INT (property); - - g_object_set (preset, property->name, - (gint) (int_property->minimum + ((int_property->maximum - - int_property->minimum) * rnd)), NULL); - } break; - case G_TYPE_UINT:{ - const GParamSpecUInt *uint_property = G_PARAM_SPEC_UINT (property); - - g_object_set (preset, property->name, - (guint) (uint_property->minimum + ((uint_property->maximum - - uint_property->minimum) * rnd)), NULL); - } break; - case G_TYPE_DOUBLE:{ - const GParamSpecDouble *double_property = - G_PARAM_SPEC_DOUBLE (property); - - g_object_set (preset, property->name, - (gdouble) (double_property->minimum + ((double_property->maximum - - double_property->minimum) * rnd)), NULL); - } break; - case G_TYPE_ENUM:{ - const GParamSpecEnum *enum_property = G_PARAM_SPEC_ENUM (property); - const GEnumClass *enum_class = enum_property->enum_class; - - g_object_set (preset, property->name, - (gulong) (enum_class->minimum + ((enum_class->maximum - - enum_class->minimum) * rnd)), NULL); - } break; - default: - GST_WARNING ("incomplete implementation for GParamSpec type '%s'", - G_PARAM_SPEC_TYPE_NAME (property)); - } - } - /* FIXME: handle childproxy properties as well */ - } -} - -static void -gst_preset_default_reset (GstPreset * preset) -{ - GList *properties; - - if ((properties = gst_preset_get_property_names (preset))) { - GParamSpec *property; - GList *node; - GValue gvalue = { 0, }; - - for (node = properties; node; node = g_list_next (node)) { - property = g_object_class_find_property (G_OBJECT_CLASS - (GST_ELEMENT_GET_CLASS (preset)), node->data); - - g_value_init (&gvalue, property->value_type); - g_param_value_set_default (property, &gvalue); - g_object_set_property (G_OBJECT (preset), property->name, &gvalue); - g_value_unset (&gvalue); - } - /* FIXME: handle childproxy properties as well */ - } -} -#endif - /* wrapper */ /** diff --git a/gst/gstsegment.c b/gst/gstsegment.c index f3f9812da3..df48053e80 100644 --- a/gst/gstsegment.c +++ b/gst/gstsegment.c @@ -446,6 +446,12 @@ gst_segment_set_newsegment_full (GstSegment * segment, gboolean update, g_return_if_fail (applied_rate != 0.0); g_return_if_fail (segment != NULL); + GST_DEBUG ("configuring segment update %d, rate %lf, format %s, " + "start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT ", position %" + G_GINT64_FORMAT, update, rate, gst_format_get_name (format), start, + stop, time); + GST_DEBUG ("old segment was: %" GST_SEGMENT_FORMAT, segment); + if (G_UNLIKELY (segment->format == GST_FORMAT_UNDEFINED)) segment->format = format;