wtay gst-plugins-bad: gst-plugins-bad/ gst-plugins-bad/gst/rtpmanager/

[email protected]
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-bad
Changes by:     wtay
Date:           Sat Nov 22 2008  15:25:01 UTC

Log message:
* gst/rtpmanager/rtpsession.c: (rtp_session_class_init),
(copy_source), (rtp_session_create_sources),
(rtp_session_get_property):
Add G_PARAM_STATIC_STRINGS.
Add property to return a GValueArray of all known RTPSources in the
session.
* gst/rtpmanager/rtpsource.c: (rtp_source_class_init),
(rtp_source_create_sdes), (rtp_source_set_property),
(rtp_source_get_property):
Remove properties to set the various SDES items, an application is never
supposed to change the RTPSource data.
Change the SDES getter properties to one SDES property that returns all
SDES items in a GstStructure.

Modified files:
    .               : ChangeLog
    gst/rtpmanager  : rtpsession.c rtpsource.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.3728&r2=1.3729
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/rtpmanager/rtpsession.c.diff?r1=1.37&r2=1.38
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/rtpmanager/rtpsource.c.diff?r1=1.31&r2=1.32

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v
retrieving revision 1.3728
retrieving revision 1.3729
diff -u -d -r1.3728 -r1.3729
--- ChangeLog	22 Nov 2008 15:02:14 -0000	1.3728
+++ ChangeLog	22 Nov 2008 15:24:45 -0000	1.3729
@@ -1,3 +1,20 @@
+2008-11-22  Wim Taymans  <[email protected]>
+
+	* gst/rtpmanager/rtpsession.c: (rtp_session_class_init),
+	(copy_source), (rtp_session_create_sources),
+	(rtp_session_get_property):
+	Add G_PARAM_STATIC_STRINGS.
+	Add property to return a GValueArray of all known RTPSources in the
+	session.
+	* gst/rtpmanager/rtpsource.c: (rtp_source_class_init),
+	(rtp_source_create_sdes), (rtp_source_set_property),
+	(rtp_source_get_property):
+	Remove properties to set the various SDES items, an application is never
+	supposed to change the RTPSource data.
+	Change the SDES getter properties to one SDES property that returns all
+	SDES items in a GstStructure.
 2008-11-22  Sebastian Dröge  <[email protected]>
 
 	* tests/check/elements/speexresample.c: (GST_START_TEST):
Index: rtpsession.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/rtpmanager/rtpsession.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- rtpsession.c	20 Nov 2008 18:41:33 -0000	1.37
+++ rtpsession.c	22 Nov 2008 15:24:46 -0000	1.38
@@ -57,6 +57,7 @@
 #define DEFAULT_SDES_NOTE            NULL
 #define DEFAULT_NUM_SOURCES          0
 #define DEFAULT_NUM_ACTIVE_SOURCES   0
+#define DEFAULT_SOURCES              NULL
 enum
 {
@@ -73,6 +74,7 @@
   PROP_SDES_NOTE,
   PROP_NUM_SOURCES,
   PROP_NUM_ACTIVE_SOURCES,
+  PROP_SOURCES,
   PROP_LAST
 };
@@ -243,62 +245,95 @@
   g_object_class_install_property (gobject_class, PROP_INTERNAL_SOURCE,
       g_param_spec_object ("internal-source", "Internal Source",
           "The internal source element of the session",
-          RTP_TYPE_SOURCE, G_PARAM_READABLE));
+          RTP_TYPE_SOURCE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_BANDWIDTH,
       g_param_spec_double ("bandwidth", "Bandwidth",
           "The bandwidth of the session",
-          0.0, G_MAXDOUBLE, DEFAULT_BANDWIDTH, G_PARAM_READWRITE));
+          0.0, G_MAXDOUBLE, DEFAULT_BANDWIDTH,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_RTCP_FRACTION,
       g_param_spec_double ("rtcp-fraction", "RTCP Fraction",
           "The fraction of the bandwidth used for RTCP",
-          0.0, G_MAXDOUBLE, DEFAULT_RTCP_FRACTION, G_PARAM_READWRITE));
+          0.0, G_MAXDOUBLE, DEFAULT_RTCP_FRACTION,
   g_object_class_install_property (gobject_class, PROP_SDES_CNAME,
       g_param_spec_string ("sdes-cname", "SDES CNAME",
           "The CNAME to put in SDES messages of this session",
-          DEFAULT_SDES_CNAME, G_PARAM_READWRITE));
+          DEFAULT_SDES_CNAME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_SDES_NAME,
       g_param_spec_string ("sdes-name", "SDES NAME",
           "The NAME to put in SDES messages of this session",
-          DEFAULT_SDES_NAME, G_PARAM_READWRITE));
+          DEFAULT_SDES_NAME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_SDES_EMAIL,
       g_param_spec_string ("sdes-email", "SDES EMAIL",
           "The EMAIL to put in SDES messages of this session",
-          DEFAULT_SDES_EMAIL, G_PARAM_READWRITE));
+          DEFAULT_SDES_EMAIL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_SDES_PHONE,
       g_param_spec_string ("sdes-phone", "SDES PHONE",
           "The PHONE to put in SDES messages of this session",
-          DEFAULT_SDES_PHONE, G_PARAM_READWRITE));
+          DEFAULT_SDES_PHONE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_SDES_LOCATION,
       g_param_spec_string ("sdes-location", "SDES LOCATION",
           "The LOCATION to put in SDES messages of this session",
-          DEFAULT_SDES_LOCATION, G_PARAM_READWRITE));
+          DEFAULT_SDES_LOCATION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_SDES_TOOL,
       g_param_spec_string ("sdes-tool", "SDES TOOL",
           "The TOOL to put in SDES messages of this session",
-          DEFAULT_SDES_TOOL, G_PARAM_READWRITE));
+          DEFAULT_SDES_TOOL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_SDES_NOTE,
       g_param_spec_string ("sdes-note", "SDES NOTE",
           "The NOTE to put in SDES messages of this session",
-          DEFAULT_SDES_NOTE, G_PARAM_READWRITE));
+          DEFAULT_SDES_NOTE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_NUM_SOURCES,
       g_param_spec_uint ("num-sources", "Num Sources",
           "The number of sources in the session", 0, G_MAXUINT,
-          DEFAULT_NUM_SOURCES, G_PARAM_READABLE));
+          DEFAULT_NUM_SOURCES, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_NUM_ACTIVE_SOURCES,
       g_param_spec_uint ("num-active-sources", "Num Active Sources",
           "The number of active sources in the session", 0, G_MAXUINT,
-          DEFAULT_NUM_ACTIVE_SOURCES, G_PARAM_READABLE));
+          DEFAULT_NUM_ACTIVE_SOURCES,
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+  /**
+   * RTPSource::sources
+   *
+   * Get a GValue Array of all sources in the session.
+   * <example>
+   * <title>Getting the #RTPSources of a session
+   * <programlisting>
+   * {
+   *   GValueArray *arr;
+   *   GValue *val;
+   *   guint i;
+   *   g_object_get (sess, "sources", &arr, NULL);
+   *   for (i = 0; i < arr->n_values; i++) {
+   *     RTPSource *source;
+   *     val = g_value_array_get_nth (arr, i);
+   *     source = g_value_get_object (val);
+   *   }
+   *   g_value_array_free (arr);
+   * }
+   * </programlisting>
+   * </example>
+   */
+  g_object_class_install_property (gobject_class, PROP_SOURCES,
+      g_param_spec_boxed ("sources", "Sources",
+          "An array of all known sources in the session",
+          G_TYPE_VALUE_ARRAY, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   klass->get_source_by_ssrc =
       GST_DEBUG_FUNCPTR (rtp_session_get_source_by_ssrc);
@@ -371,6 +406,35 @@
 }
 static void
+copy_source (gpointer key, RTPSource * source, GValueArray * arr)
+{
+  GValue value = { 0 };
+  g_value_init (&value, RTP_TYPE_SOURCE);
+  g_value_take_object (&value, source);
+  g_value_array_append (arr, &value);
+}
+static GValueArray *
+rtp_session_create_sources (RTPSession * sess)
+  GValueArray *res;
+  guint size;
+  RTP_SESSION_LOCK (sess);
+  /* get number of elements in the table */
+  size = g_hash_table_size (sess->ssrcs[sess->mask_idx]);
+  /* create the result value array */
+  res = g_value_array_new (size);
+  /* and copy all values into the array */
+  g_hash_table_foreach (sess->ssrcs[sess->mask_idx], (GHFunc) copy_source, res);
+  RTP_SESSION_UNLOCK (sess);
+  return res;
+static void
 rtp_session_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
@@ -471,6 +535,9 @@
     case PROP_NUM_ACTIVE_SOURCES:
       g_value_set_uint (value, rtp_session_get_num_active_sources (sess));
       break;
+    case PROP_SOURCES:
+      g_value_take_boxed (value, rtp_session_create_sources (sess));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
Index: rtpsource.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/rtpmanager/rtpsource.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- rtpsource.c	20 Nov 2008 18:41:34 -0000	1.31
+++ rtpsource.c	22 Nov 2008 15:24:47 -0000	1.32
@@ -38,13 +38,7 @@
 #define DEFAULT_IS_CSRC              FALSE
 #define DEFAULT_IS_VALIDATED         FALSE
 #define DEFAULT_IS_SENDER            FALSE
-#define DEFAULT_SDES_CNAME           NULL
-#define DEFAULT_SDES_NAME            NULL
-#define DEFAULT_SDES_EMAIL           NULL
-#define DEFAULT_SDES_PHONE           NULL
-#define DEFAULT_SDES_LOCATION        NULL
-#define DEFAULT_SDES_TOOL            NULL
-#define DEFAULT_SDES_NOTE            NULL
+#define DEFAULT_SDES                 NULL
@@ -53,13 +47,7 @@
   PROP_IS_CSRC,
   PROP_IS_VALIDATED,
   PROP_IS_SENDER,
-  PROP_SDES_CNAME,
-  PROP_SDES_NAME,
-  PROP_SDES_EMAIL,
-  PROP_SDES_PHONE,
-  PROP_SDES_LOCATION,
-  PROP_SDES_TOOL,
-  PROP_SDES_NOTE,
+  PROP_SDES,
   PROP_STATS,
@@ -89,8 +77,7 @@
   g_object_class_install_property (gobject_class, PROP_SSRC,
       g_param_spec_uint ("ssrc", "SSRC",
-          "The SSRC of this source", 0, G_MAXUINT,
-          DEFAULT_SSRC,
+          "The SSRC of this source", 0, G_MAXUINT, DEFAULT_SSRC,
           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_IS_CSRC,
@@ -108,49 +95,30 @@
           "If this SSRC is a sender", DEFAULT_IS_SENDER,
           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, PROP_SDES_CNAME,
-      g_param_spec_string ("sdes-cname", "SDES CNAME",
-          "The CNAME to put in SDES messages of this source",
-          DEFAULT_SDES_CNAME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, PROP_SDES_NAME,
-      g_param_spec_string ("sdes-name", "SDES NAME",
-          "The NAME to put in SDES messages of this source",
-          DEFAULT_SDES_NAME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, PROP_SDES_EMAIL,
-      g_param_spec_string ("sdes-email", "SDES EMAIL",
-          "The EMAIL to put in SDES messages of this source",
-          DEFAULT_SDES_EMAIL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, PROP_SDES_PHONE,
-      g_param_spec_string ("sdes-phone", "SDES PHONE",
-          "The PHONE to put in SDES messages of this source",
-          DEFAULT_SDES_PHONE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, PROP_SDES_LOCATION,
-      g_param_spec_string ("sdes-location", "SDES LOCATION",
-          "The LOCATION to put in SDES messages of this source",
-          DEFAULT_SDES_LOCATION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, PROP_SDES_TOOL,
-      g_param_spec_string ("sdes-tool", "SDES TOOL",
-          "The TOOL to put in SDES messages of this source",
-          DEFAULT_SDES_TOOL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, PROP_SDES_NOTE,
-      g_param_spec_string ("sdes-note", "SDES NOTE",
-          "The NOTE to put in SDES messages of this source",
-          DEFAULT_SDES_NOTE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+   * RTPSource::sdes
+   * The current SDES items of the source. Returns a structure with the
+   * following fields:
+   *  'cname'    G_TYPE_STRING  : The canonical name 
+   *  'name'     G_TYPE_STRING  : The user name 
+   *  'email'    G_TYPE_STRING  : The user's electronic mail address
+   *  'phone'    G_TYPE_STRING  : The user's phone number
+   *  'location' G_TYPE_STRING  : The geographic user location
+   *  'tool'     G_TYPE_STRING  : The name of application or tool
+   *  'note'     G_TYPE_STRING  : A notice about the source
+  g_object_class_install_property (gobject_class, PROP_SDES,
+      g_param_spec_boxed ("sdes", "SDES",
+          "The SDES information for this source",
+          GST_TYPE_STRUCTURE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   /**
    * RTPSource::stats
    *
    * The statistics of the source. This property returns a GstStructure with
    * name application/x-rtp-source-stats with the following fields:
-   *
-   *  
    * 
    */
   g_object_class_install_property (gobject_class, PROP_STATS,
@@ -298,6 +266,45 @@
   return s;
+static GstStructure *
+rtp_source_create_sdes (RTPSource * src)
+  GstStructure *s;
+  gchar *str;
+  s = gst_structure_new ("application/x-rtp-source-sdes", NULL);
+  if ((str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_CNAME))) {
+    gst_structure_set (s, "cname", G_TYPE_STRING, str, NULL);
+    g_free (str);
+  }
+  if ((str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_NAME))) {
+    gst_structure_set (s, "name", G_TYPE_STRING, str, NULL);
+  if ((str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_EMAIL))) {
+    gst_structure_set (s, "email", G_TYPE_STRING, str, NULL);
+  if ((str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_PHONE))) {
+    gst_structure_set (s, "phone", G_TYPE_STRING, str, NULL);
+  if ((str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_LOC))) {
+    gst_structure_set (s, "location", G_TYPE_STRING, str, NULL);
+  if ((str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_TOOL))) {
+    gst_structure_set (s, "tool", G_TYPE_STRING, str, NULL);
+  if ((str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_NOTE))) {
+    gst_structure_set (s, "note", G_TYPE_STRING, str, NULL);
+  return s;
 rtp_source_set_property (GObject * object, guint prop_id,
@@ -310,34 +317,6 @@
     case PROP_SSRC:
       src->ssrc = g_value_get_uint (value);
-    case PROP_SDES_CNAME:
-      rtp_source_set_sdes_string (src, GST_RTCP_SDES_CNAME,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_NAME:
-      rtp_source_set_sdes_string (src, GST_RTCP_SDES_NAME,
-    case PROP_SDES_EMAIL:
-      rtp_source_set_sdes_string (src, GST_RTCP_SDES_EMAIL,
-    case PROP_SDES_PHONE:
-      rtp_source_set_sdes_string (src, GST_RTCP_SDES_PHONE,
-    case PROP_SDES_LOCATION:
-      rtp_source_set_sdes_string (src, GST_RTCP_SDES_LOC,
-    case PROP_SDES_TOOL:
-      rtp_source_set_sdes_string (src, GST_RTCP_SDES_TOOL,
-    case PROP_SDES_NOTE:
-      rtp_source_set_sdes_string (src, GST_RTCP_SDES_NOTE,
@@ -365,33 +344,8 @@
     case PROP_IS_SENDER:
       g_value_set_boolean (value, rtp_source_is_sender (src));
-      g_value_take_string (value, rtp_source_get_sdes_string (src,
-              GST_RTCP_SDES_CNAME));
-              GST_RTCP_SDES_NAME));
-              GST_RTCP_SDES_EMAIL));
-              GST_RTCP_SDES_PHONE));
-              GST_RTCP_SDES_LOC));
-              GST_RTCP_SDES_TOOL));
-              GST_RTCP_SDES_NOTE));
+    case PROP_SDES:
+      g_value_take_boxed (value, rtp_source_create_sdes (src));
     case PROP_STATS:
       g_value_take_boxed (value, rtp_source_create_stats (src));

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.