[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    Re: gst-plugins-bad: fpsdisplay: Add verbose property
From:       Stefan Kost <ensonic () hora-obscura ! de>
Date:       2011-04-08 17:47:31
Message-ID: 4D9F4A33.1020501 () hora-obscura ! de
[Download RAW message or body]

Am 08.04.2011 15:08, schrieb Sebastian DrXXge:
> Module: gst-plugins-bad
> Branch: master
> Commit: 26bc5537cef13164f5396f4a33e0cb50da248d5b
> URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=26bc5537cef13164f5396f4a33e0cb50da248d5b
>  
> Author: Philippe Normand <pnormand@igalia.com>
> Date:   Thu Apr  7 15:15:57 2011 +0200
> 
> fpsdisplay: Add verbose property
> 
> When this property is set to TRUE the element will display statistics
> on stdout.
> 
> Fixes https://bugzilla.gnome.org/show_bug.cgi?id=647030

Many other elements (fakesrc, fakesink, identity, queue) have a "silent"
property instead.

Stefan
> 
> ---
> 
> gst/debugutils/fpsdisplaysink.c |   19 +++++++++++++++++--
> gst/debugutils/fpsdisplaysink.h |    1 +
> 2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/gst/debugutils/fpsdisplaysink.c b/gst/debugutils/fpsdisplaysink.c
> index 450a580..58c6847 100644
> --- a/gst/debugutils/fpsdisplaysink.c
> +++ b/gst/debugutils/fpsdisplaysink.c
> @@ -54,6 +54,7 @@
> #define DEFAULT_SIGNAL_FPS_MEASUREMENTS FALSE
> #define DEFAULT_FPS_UPDATE_INTERVAL_MS 500      /* 500 ms */
> #define DEFAULT_FONT "Sans 15"
> +#define DEFAULT_VERBOSE FALSE
> 
> /* generic templates */
> static GstStaticPadTemplate fps_display_sink_template =
> @@ -85,7 +86,8 @@ enum
> ARG_MIN_FPS,
> ARG_SIGNAL_FPS_MEASUREMENTS,
> ARG_FRAMES_DROPPED,
> -  ARG_FRAMES_RENDERED
> +  ARG_FRAMES_RENDERED,
> +  ARG_VERBOSE
> /* FILL ME */
> };
> 
> @@ -162,6 +164,10 @@ fps_display_sink_class_init (GstFPSDisplaySinkClass * klass)
> "Number of frames rendered", 0, G_MAXUINT, 0,
> G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
> 
> +  g_object_class_install_property (gobject_klass, ARG_VERBOSE,
> +      g_param_spec_boolean ("verbose", "enable stdout output",
> +          "If the element should display statistics on stdout", DEFAULT_VERBOSE,
> +          G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
> 
> g_object_class_install_property (gobject_klass, ARG_SIGNAL_FPS_MEASUREMENTS,
> g_param_spec_boolean ("signal-fps-measurements",
> @@ -332,6 +338,7 @@ fps_display_sink_init (GstFPSDisplaySink * self,
> self->video_sink = NULL;
> self->max_fps = -1;
> self->min_fps = -1;
> +  self->verbose = DEFAULT_VERBOSE;
> 
> self->ghost_pad = gst_ghost_pad_new_no_target ("sink", GST_PAD_SINK);
> gst_element_add_pad (GST_ELEMENT (self), self->ghost_pad);
> @@ -400,7 +407,9 @@ display_current_fps (gpointer data)
> 
> if (self->use_text_overlay) {
> g_object_set (self->text_overlay, "text", fps_message, NULL);
> -  } else {
> +  }
> +
> +  if (self->verbose) {
> g_print ("%s\n", fps_message);
> }
> 
> @@ -536,6 +545,9 @@ fps_display_sink_set_property (GObject * object, guint prop_id,
> case ARG_SIGNAL_FPS_MEASUREMENTS:
> self->signal_measurements = g_value_get_boolean (value);
> break;
> +    case ARG_VERBOSE:
> +      self->verbose = g_value_get_boolean (value);
> +      break;
> default:
> G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
> break;
> @@ -576,6 +588,9 @@ fps_display_sink_get_property (GObject * object, guint prop_id,
> case ARG_SIGNAL_FPS_MEASUREMENTS:
> g_value_set_boolean (value, self->signal_measurements);
> break;
> +    case ARG_VERBOSE:
> +      g_value_set_boolean (value, self->verbose);
> +      break;
> default:
> G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
> break;
> diff --git a/gst/debugutils/fpsdisplaysink.h b/gst/debugutils/fpsdisplaysink.h
> index 1654256..1d50412 100644
> --- a/gst/debugutils/fpsdisplaysink.h
> +++ b/gst/debugutils/fpsdisplaysink.h
> @@ -66,6 +66,7 @@ struct _GstFPSDisplaySink
> GstClockTime fps_update_interval;
> gdouble max_fps;
> gdouble min_fps;
> +  gboolean verbose;
> };
> 
> struct _GstFPSDisplaySinkClass
> 
> _______________________________________________
> gstreamer-commits mailing list
> gstreamer-commits@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits

_______________________________________________
gstreamer-commits mailing list
gstreamer-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic