wtay gst-plugins-good: gst-plugins-good/ gst-plugins-good/tests/examples/rtp/

[email protected] Tue, 13 Jan 2009 09:49:21 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
--===============6932860339033272195==

CVS Root:       /cvs/gstreamer
Module:         gst-plugins-good
Changes by:     wtay
Date:           Tue Jan 13 2009  17:49:21 UTC

Log message:
* tests/examples/rtp/server-alsasrc-PCMA.c: (print_source_stats),
(print_stats), (main):
Add some example code for printing the RTP manager stats.

Modified files:
    .               : ChangeLog
    tests/examples/rtp: server-alsasrc-PCMA.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ChangeLog.diff?r1=1.3892&r2=1.3893
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/tests/examples/rtp/server-alsasrc-PCMA.c.diff?r1=1.1&r2=1.2

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-good/ChangeLog,v
retrieving revision 1.3892
retrieving revision 1.3893
diff -u -d -r1.3892 -r1.3893
--- ChangeLog	13 Jan 2009 08:24:22 -0000	1.3892
+++ ChangeLog	13 Jan 2009 17:49:05 -0000	1.3893
@@ -1,3 +1,9 @@
+2009-01-13  Wim Taymans  <[email protected]>
+
+	* tests/examples/rtp/server-alsasrc-PCMA.c: (print_source_stats),
+	(print_stats), (main):
+	Add some example code for printing the RTP manager stats.
 2009-01-13  Sebastian Dröge  <[email protected]>
 
 	* gst/audiofx/audiochebband.c: (gst_audio_cheb_band_class_init),
Index: server-alsasrc-PCMA.c
RCS file: /cvs/gstreamer/gst-plugins-good/tests/examples/rtp/server-alsasrc-PCMA.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- server-alsasrc-PCMA.c	2 Jan 2009 15:20:48 -0000	1.1
+++ server-alsasrc-PCMA.c	13 Jan 2009 17:49:07 -0000	1.2
@@ -52,6 +52,56 @@
 #define AUDIO_ENC  "alawenc"
 #define AUDIO_PAY  "rtppcmapay"
+/* print the stats of a source */
+static void
+print_source_stats (GObject * source)
+{
+  GstStructure *stats;
+  gchar *str;
+  /* get the source stats */
+  g_object_get (source, "stats", &stats, NULL);
+  /* simply dump the stats structure */
+  str = gst_structure_to_string (stats);
+  g_print ("source stats: %s\n", str);
+  gst_structure_free (stats);
+  g_free (str);
+}
+/* this function is called every second and dumps the RTP manager stats */
+static gboolean
+print_stats (GstElement * rtpbin)
+  GObject *session;
+  GValueArray *arr;
+  GValue *val;
+  guint i;
+  g_print ("***********************************\n");
+  /* get session 0 */
+  g_signal_emit_by_name (rtpbin, "get-internal-session", 0, &session);
+  /* print all the sources in the session, this includes the internal source */
+  g_object_get (session, "sources", &arr, NULL);
+  for (i = 0; i < arr->n_values; i++) {
+    GObject *source;
+    val = g_value_array_get_nth (arr, i);
+    source = g_value_get_object (val);
+    print_source_stats (source);
+  }
+  g_value_array_free (arr);
+  g_object_unref (session);
+  return TRUE;
 /* build a pipeline equivalent to:
  *
  * gst-launch -v gstrtpbin name=rtpbin \
@@ -157,6 +207,9 @@
   g_print ("starting sender pipeline\n");
   gst_element_set_state (pipeline, GST_STATE_PLAYING);
+  /* print stats every second */
+  g_timeout_add (1000, (GSourceFunc) print_stats, rtpbin);
   /* we need to run a GLib main loop to get the messages */
   loop = g_main_loop_new (NULL, FALSE);
   g_main_loop_run (loop);


--===============6932860339033272195==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--===============6932860339033272195==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose

--===============6932860339033272195==--