From 5a50a4138efc847ab9d7bd1a13de3398acbe7fea Mon Sep 17 00:00:00 2001
From: Wim Taymans <wim.taymans@collabora.co.uk>
Date: Tue, 2 Jun 2009 17:46:08 +0200
Subject: rtpbin: removed old gstrtpclient

---
 gst/rtpmanager/Makefile.am     |   2 -
 gst/rtpmanager/gstrtpclient.c  | 484 -----------------------------------------
 gst/rtpmanager/gstrtpclient.h  |  56 -----
 gst/rtpmanager/gstrtpmanager.c |   5 -
 4 files changed, 547 deletions(-)
 delete mode 100644 gst/rtpmanager/gstrtpclient.c
 delete mode 100644 gst/rtpmanager/gstrtpclient.h

(limited to 'gst/rtpmanager')

diff --git a/gst/rtpmanager/Makefile.am b/gst/rtpmanager/Makefile.am
index 2d53d63e..8080f303 100644
--- a/gst/rtpmanager/Makefile.am
+++ b/gst/rtpmanager/Makefile.am
@@ -12,7 +12,6 @@ BUILT_SOURCES = $(built_sources) $(built_headers)
 
 libgstrtpmanager_la_SOURCES = gstrtpmanager.c \
 			      gstrtpbin.c \
-			      gstrtpclient.c \
 			      gstrtpjitterbuffer.c \
 			      gstrtpptdemux.c \
 			      gstrtpssrcdemux.c \
@@ -26,7 +25,6 @@ nodist_libgstrtpmanager_la_SOURCES = \
       $(built_sources)
 
 noinst_HEADERS = gstrtpbin.h \
-		 gstrtpclient.h \
 		 gstrtpjitterbuffer.h \
                  gstrtpptdemux.h \
                  gstrtpssrcdemux.h \
diff --git a/gst/rtpmanager/gstrtpclient.c b/gst/rtpmanager/gstrtpclient.c
deleted file mode 100644
index 2fccbfd7..00000000
--- a/gst/rtpmanager/gstrtpclient.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-gstrtpclient
- * @see_also: gstrtpjitterbuffer, gstrtpbin, gstrtpsession
- *
- * This element handles RTP data from one client. It accepts multiple RTP streams that
- * should be synchronized together.
- * 
- * Normally the SSRCs that map to the same CNAME (as given in the RTCP SDES messages)
- * should be synchronized.
- * 
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * FIXME: gst-launch
- * ]| FIXME: describe
- * </refsect2>
- *
- * Last reviewed on 2007-04-02 (0.10.5)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "gstrtpclient.h"
-
-/* elementfactory information */
-static const GstElementDetails rtpclient_details =
-GST_ELEMENT_DETAILS ("RTP Client",
-    "Filter/Network/RTP",
-    "Implement an RTP client",
-    "Wim Taymans <wim.taymans@gmail.com>");
-
-/* sink pads */
-static GstStaticPadTemplate rtpclient_rtp_sink_template =
-GST_STATIC_PAD_TEMPLATE ("rtp_sink_%d",
-    GST_PAD_SINK,
-    GST_PAD_REQUEST,
-    GST_STATIC_CAPS ("application/x-rtp")
-    );
-
-static GstStaticPadTemplate rtpclient_sync_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sync_sink_%d",
-    GST_PAD_SINK,
-    GST_PAD_REQUEST,
-    GST_STATIC_CAPS ("application/x-rtcp")
-    );
-
-/* src pads */
-static GstStaticPadTemplate rtpclient_rtp_src_template =
-GST_STATIC_PAD_TEMPLATE ("rtp_src_%d_%d",
-    GST_PAD_SRC,
-    GST_PAD_SOMETIMES,
-    GST_STATIC_CAPS ("application/x-rtp")
-    );
-
-#define GST_RTP_CLIENT_GET_PRIVATE(obj)  \
-   (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_RTP_CLIENT, GstRtpClientPrivate))
-
-struct _GstRtpClientPrivate
-{
-  gint foo;
-};
-
-/* all the info needed to handle the stream with SSRC */
-typedef struct
-{
-  GstRtpClient *client;
-
-  /* the SSRC of this stream */
-  guint32 ssrc;
-
-  /* RTP and RTCP in */
-  GstPad *rtp_sink;
-  GstPad *sync_sink;
-
-  /* the jitterbuffer */
-  GstElement *jitterbuffer;
-  /* the payload demuxer */
-  GstElement *ptdemux;
-  /* the new-pad signal */
-  gulong new_pad_sig;
-} GstRtpClientStream;
-
-/* the PT demuxer found a new payload type */
-static void
-new_pad (GstElement * element, GstPad * pad, GstRtpClientStream * stream)
-{
-}
-
-/* create a new stream for SSRC.
- *
- * We create a jitterbuffer and an payload demuxer for the SSRC. The sinkpad of
- * the jitterbuffer is ghosted to the bin. We connect a pad-added signal to
- * rtpptdemux so that we can ghost the payload pads outside.
- *
- *       +-----------------+     +---------------+
- *       | rtpjitterbuffer |     |  rtpptdemux   |
- *   +- sink              src - sink             |
- *  /    +-----------------+     +---------------+
- *
- */
-static GstRtpClientStream *
-create_stream (GstRtpClient * rtpclient, guint32 ssrc)
-{
-  GstRtpClientStream *stream;
-  gchar *name;
-  GstPad *srcpad, *sinkpad;
-  GstPadLinkReturn res;
-
-  stream = g_new0 (GstRtpClientStream, 1);
-  stream->ssrc = ssrc;
-  stream->client = rtpclient;
-
-  stream->jitterbuffer = gst_element_factory_make ("gstrtpjitterbuffer", NULL);
-  if (!stream->jitterbuffer)
-    goto no_jitterbuffer;
-
-  stream->ptdemux = gst_element_factory_make ("gstrtpptdemux", NULL);
-  if (!stream->ptdemux)
-    goto no_ptdemux;
-
-  /* add elements to bin */
-  gst_bin_add (GST_BIN_CAST (rtpclient), stream->jitterbuffer);
-  gst_bin_add (GST_BIN_CAST (rtpclient), stream->ptdemux);
-
-  /* link jitterbuffer and PT demuxer */
-  srcpad = gst_element_get_static_pad (stream->jitterbuffer, "src");
-  sinkpad = gst_element_get_static_pad (stream->ptdemux, "sink");
-  res = gst_pad_link (srcpad, sinkpad);
-  gst_object_unref (srcpad);
-  gst_object_unref (sinkpad);
-
-  if (res != GST_PAD_LINK_OK)
-    goto could_not_link;
-
-  /* add stream to list */
-  rtpclient->streams = g_list_prepend (rtpclient->streams, stream);
-
-  /* ghost sinkpad */
-  name = g_strdup_printf ("rtp_sink_%d", ssrc);
-  sinkpad = gst_element_get_static_pad (stream->jitterbuffer, "sink");
-  stream->rtp_sink = gst_ghost_pad_new (name, sinkpad);
-  gst_object_unref (sinkpad);
-  g_free (name);
-  gst_element_add_pad (GST_ELEMENT_CAST (rtpclient), stream->rtp_sink);
-
-  /* add signal to ptdemuxer */
-  stream->new_pad_sig =
-      g_signal_connect (G_OBJECT (stream->ptdemux), "pad-added",
-      G_CALLBACK (new_pad), stream);
-
-  return stream;
-
-  /* ERRORS */
-no_jitterbuffer:
-  {
-    g_free (stream);
-    g_warning ("gstrtpclient: could not create gstrtpjitterbuffer element");
-    return NULL;
-  }
-no_ptdemux:
-  {
-    gst_object_unref (stream->jitterbuffer);
-    g_free (stream);
-    g_warning ("gstrtpclient: could not create gstrtpptdemux element");
-    return NULL;
-  }
-could_not_link:
-  {
-    gst_bin_remove (GST_BIN_CAST (rtpclient), stream->jitterbuffer);
-    gst_bin_remove (GST_BIN_CAST (rtpclient), stream->ptdemux);
-    g_free (stream);
-    g_warning ("gstrtpclient: could not link jitterbuffer and ptdemux element");
-    return NULL;
-  }
-}
-
-#if 0
-static void
-free_stream (GstRtpClientStream * stream)
-{
-  gst_object_unref (stream->jitterbuffer);
-  g_free (stream);
-}
-#endif
-
-/* find the stream for the given SSRC, return NULL if the stream did not exist
- */
-static GstRtpClientStream *
-find_stream_by_ssrc (GstRtpClient * client, guint32 ssrc)
-{
-  GstRtpClientStream *stream;
-  GList *walk;
-
-  for (walk = client->streams; walk; walk = g_list_next (walk)) {
-    stream = (GstRtpClientStream *) walk->data;
-    if (stream->ssrc == ssrc)
-      return stream;
-  }
-  return NULL;
-}
-
-/* signals and args */
-enum
-{
-  /* FILL ME */
-  LAST_SIGNAL
-};
-
-enum
-{
-  PROP_0
-};
-
-/* GObject vmethods */
-static void gst_rtp_client_finalize (GObject * object);
-static void gst_rtp_client_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec);
-static void gst_rtp_client_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec);
-
-/* GstElement vmethods */
-static GstStateChangeReturn gst_rtp_client_change_state (GstElement * element,
-    GstStateChange transition);
-static GstPad *gst_rtp_client_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * name);
-static void gst_rtp_client_release_pad (GstElement * element, GstPad * pad);
-
-/*static guint gst_rtp_client_signals[LAST_SIGNAL] = { 0 }; */
-
-GST_BOILERPLATE (GstRtpClient, gst_rtp_client, GstBin, GST_TYPE_BIN);
-
-static void
-gst_rtp_client_base_init (gpointer klass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  /* sink pads */
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&rtpclient_rtp_sink_template));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&rtpclient_sync_sink_template));
-
-  /* src pads */
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&rtpclient_rtp_src_template));
-
-  gst_element_class_set_details (element_class, &rtpclient_details);
-}
-
-static void
-gst_rtp_client_class_init (GstRtpClientClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-
-  gobject_class = (GObjectClass *) klass;
-  gstelement_class = (GstElementClass *) klass;
-
-  g_type_class_add_private (klass, sizeof (GstRtpClientPrivate));
-
-  gobject_class->finalize = gst_rtp_client_finalize;
-  gobject_class->set_property = gst_rtp_client_set_property;
-  gobject_class->get_property = gst_rtp_client_get_property;
-
-  gstelement_class->change_state =
-      GST_DEBUG_FUNCPTR (gst_rtp_client_change_state);
-  gstelement_class->request_new_pad =
-      GST_DEBUG_FUNCPTR (gst_rtp_client_request_new_pad);
-  gstelement_class->release_pad =
-      GST_DEBUG_FUNCPTR (gst_rtp_client_release_pad);
-}
-
-static void
-gst_rtp_client_init (GstRtpClient * rtpclient, GstRtpClientClass * klass)
-{
-  rtpclient->priv = GST_RTP_CLIENT_GET_PRIVATE (rtpclient);
-}
-
-static void
-gst_rtp_client_finalize (GObject * object)
-{
-  GstRtpClient *rtpclient;
-
-  rtpclient = GST_RTP_CLIENT (object);
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_rtp_client_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstRtpClient *rtpclient;
-
-  rtpclient = GST_RTP_CLIENT (object);
-
-  switch (prop_id) {
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_rtp_client_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstRtpClient *rtpclient;
-
-  rtpclient = GST_RTP_CLIENT (object);
-
-  switch (prop_id) {
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static GstStateChangeReturn
-gst_rtp_client_change_state (GstElement * element, GstStateChange transition)
-{
-  GstStateChangeReturn res;
-  GstRtpClient *rtpclient;
-
-  rtpclient = GST_RTP_CLIENT (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_NULL_TO_READY:
-      break;
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-      break;
-    default:
-      break;
-  }
-
-  res = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      break;
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      break;
-    default:
-      break;
-  }
-  return res;
-}
-
-/* We have 2 request pads (rtp_sink_%d and sync_sink_%d), the %d is assumed to
- * be the SSRC of the stream.
- *
- * We require that the rtp pad is requested first for a particular SSRC, then
- * (optionaly) the sync pad can be requested. If no sync pad is requested, no
- * sync information can be exchanged for this stream.
- */
-static GstPad *
-gst_rtp_client_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * name)
-{
-  GstRtpClient *rtpclient;
-  GstElementClass *klass;
-  GstPadTemplate *rtp_sink_templ, *sync_sink_templ;
-  guint32 ssrc;
-  GstRtpClientStream *stream;
-  GstPad *result;
-
-  g_return_val_if_fail (templ != NULL, NULL);
-  g_return_val_if_fail (GST_IS_RTP_CLIENT (element), NULL);
-
-  if (templ->direction != GST_PAD_SINK)
-    goto wrong_direction;
-
-  rtpclient = GST_RTP_CLIENT (element);
-  klass = GST_ELEMENT_GET_CLASS (element);
-
-  /* figure out the template */
-  rtp_sink_templ = gst_element_class_get_pad_template (klass, "rtp_sink_%d");
-  sync_sink_templ = gst_element_class_get_pad_template (klass, "sync_sink_%d");
-
-  if (templ != rtp_sink_templ && templ != sync_sink_templ)
-    goto wrong_template;
-
-  if (templ == rtp_sink_templ) {
-    /* create new rtp sink pad. If a stream with the pad number already exists
-     * we have an error, else we create the sinkpad, add a jitterbuffer and
-     * ptdemuxer. */
-    if (name == NULL || strlen (name) < 9)
-      goto no_name;
-
-    ssrc = atoi (&name[9]);
-
-    /* see if a stream with that name exists, if so we have an error. */
-    stream = find_stream_by_ssrc (rtpclient, ssrc);
-    if (stream != NULL)
-      goto stream_exists;
-
-    /* ok, create new stream */
-    stream = create_stream (rtpclient, ssrc);
-    if (stream == NULL)
-      goto stream_not_found;
-
-    result = stream->rtp_sink;
-  } else {
-    /* create new rtp sink pad. We can only do this if the RTP pad was
-     * requested before, meaning the session with the padnumber must exist. */
-    if (name == NULL || strlen (name) < 10)
-      goto no_name;
-
-    ssrc = atoi (&name[10]);
-
-    /* find stream */
-    stream = find_stream_by_ssrc (rtpclient, ssrc);
-    if (stream == NULL)
-      goto stream_not_found;
-
-    stream->sync_sink =
-        gst_pad_new_from_static_template (&rtpclient_sync_sink_template, name);
-    gst_element_add_pad (GST_ELEMENT_CAST (rtpclient), stream->sync_sink);
-
-    result = stream->sync_sink;
-  }
-
-  return result;
-
-  /* ERRORS */
-wrong_direction:
-  {
-    g_warning ("gstrtpclient: request pad that is not a SINK pad");
-    return NULL;
-  }
-wrong_template:
-  {
-    g_warning ("gstrtpclient: this is not our template");
-    return NULL;
-  }
-no_name:
-  {
-    g_warning ("gstrtpclient: no padname was specified");
-    return NULL;
-  }
-stream_exists:
-  {
-    g_warning ("gstrtpclient: stream with SSRC %d already registered", ssrc);
-    return NULL;
-  }
-stream_not_found:
-  {
-    g_warning ("gstrtpclient: stream with SSRC %d not yet registered", ssrc);
-    return NULL;
-  }
-}
-
-static void
-gst_rtp_client_release_pad (GstElement * element, GstPad * pad)
-{
-}
diff --git a/gst/rtpmanager/gstrtpclient.h b/gst/rtpmanager/gstrtpclient.h
deleted file mode 100644
index cb2f7753..00000000
--- a/gst/rtpmanager/gstrtpclient.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_RTP_CLIENT_H__
-#define __GST_RTP_CLIENT_H__
-
-#include <gst/gst.h>
-
-#define GST_TYPE_RTP_CLIENT \
-  (gst_rtp_client_get_type())
-#define GST_RTP_CLIENT(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_CLIENT,GstRtpClient))
-#define GST_RTP_CLIENT_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_CLIENT,GstRtpClientClass))
-#define GST_IS_RTP_CLIENT(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_CLIENT))
-#define GST_IS_RTP_CLIENT_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_CLIENT))
-
-typedef struct _GstRtpClient GstRtpClient;
-typedef struct _GstRtpClientClass GstRtpClientClass;
-typedef struct _GstRtpClientPrivate GstRtpClientPrivate;
-
-struct _GstRtpClient {
-  GstBin         parent_bin;
-
-  /* a list of streams from a client */
-  GList         *streams;
-
-  /*< private >*/
-  GstRtpClientPrivate *priv;
-};
-
-struct _GstRtpClientClass {
-  GstBinClass   parent_class;
-};
-
-GType gst_rtp_client_get_type (void);
-
-#endif /* __GST_RTP_CLIENT_H__ */
diff --git a/gst/rtpmanager/gstrtpmanager.c b/gst/rtpmanager/gstrtpmanager.c
index 99779522..f38a77a8 100644
--- a/gst/rtpmanager/gstrtpmanager.c
+++ b/gst/rtpmanager/gstrtpmanager.c
@@ -22,7 +22,6 @@
 #endif
 
 #include "gstrtpbin.h"
-#include "gstrtpclient.h"
 #include "gstrtpjitterbuffer.h"
 #include "gstrtpptdemux.h"
 #include "gstrtpsession.h"
@@ -35,10 +34,6 @@ plugin_init (GstPlugin * plugin)
           GST_TYPE_RTP_BIN))
     return FALSE;
 
-  if (!gst_element_register (plugin, "gstrtpclient", GST_RANK_NONE,
-          GST_TYPE_RTP_CLIENT))
-    return FALSE;
-
   if (!gst_element_register (plugin, "gstrtpjitterbuffer", GST_RANK_NONE,
           GST_TYPE_RTP_JITTER_BUFFER))
     return FALSE;
-- 
cgit v1.2.1


From ed6002ada8aa6b905abd63854709bbf0a7dd6cec Mon Sep 17 00:00:00 2001
From: Wim Taymans <wim.taymans@collabora.co.uk>
Date: Mon, 29 Jun 2009 16:21:05 +0200
Subject: rtpbin: add SDES property that takes GstStructure

Remove all individual SDES properties and use one sdes property that takes a
GstStructure instead. This will allow us to add more custom stuff to the SDES
messages later.
---
 gst/rtpmanager/rtpsession.c | 151 ++++++++++++++------------------------------
 gst/rtpmanager/rtpsession.h |   3 +
 gst/rtpmanager/rtpsource.c  |  52 ++++++++++++++-
 gst/rtpmanager/rtpsource.h  |   3 +
 4 files changed, 104 insertions(+), 105 deletions(-)

(limited to 'gst/rtpmanager')

diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c
index cda04182..1583cb79 100644
--- a/gst/rtpmanager/rtpsession.c
+++ b/gst/rtpmanager/rtpsession.c
@@ -49,13 +49,7 @@ enum
 #define DEFAULT_BANDWIDTH            RTP_STATS_BANDWIDTH
 #define DEFAULT_RTCP_FRACTION        RTP_STATS_RTCP_BANDWIDTH
 #define DEFAULT_RTCP_MTU             1400
-#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
 #define DEFAULT_NUM_SOURCES          0
 #define DEFAULT_NUM_ACTIVE_SOURCES   0
 #define DEFAULT_SOURCES              NULL
@@ -68,13 +62,7 @@ enum
   PROP_BANDWIDTH,
   PROP_RTCP_FRACTION,
   PROP_RTCP_MTU,
-  PROP_SDES_CNAME,
-  PROP_SDES_NAME,
-  PROP_SDES_EMAIL,
-  PROP_SDES_PHONE,
-  PROP_SDES_LOCATION,
-  PROP_SDES_TOOL,
-  PROP_SDES_NOTE,
+  PROP_SDES,
   PROP_NUM_SOURCES,
   PROP_NUM_ACTIVE_SOURCES,
   PROP_SOURCES,
@@ -273,40 +261,10 @@ rtp_session_class_init (RTPSessionClass * klass)
           16, G_MAXINT16, DEFAULT_RTCP_MTU,
           G_PARAM_READWRITE | 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 session",
-          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 | 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 | 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 | 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 | 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 | 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 | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_SDES,
+      g_param_spec_boxed ("sdes", "SDES",
+          "The SDES items of this session",
+          GST_TYPE_STRUCTURE, 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",
@@ -469,33 +427,8 @@ rtp_session_set_property (GObject * object, guint prop_id,
     case PROP_RTCP_MTU:
       sess->mtu = g_value_get_uint (value);
       break;
-    case PROP_SDES_CNAME:
-      rtp_session_set_sdes_string (sess, GST_RTCP_SDES_CNAME,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_NAME:
-      rtp_session_set_sdes_string (sess, GST_RTCP_SDES_NAME,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_EMAIL:
-      rtp_session_set_sdes_string (sess, GST_RTCP_SDES_EMAIL,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_PHONE:
-      rtp_session_set_sdes_string (sess, GST_RTCP_SDES_PHONE,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_LOCATION:
-      rtp_session_set_sdes_string (sess, GST_RTCP_SDES_LOC,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_TOOL:
-      rtp_session_set_sdes_string (sess, GST_RTCP_SDES_TOOL,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_NOTE:
-      rtp_session_set_sdes_string (sess, GST_RTCP_SDES_NOTE,
-          g_value_get_string (value));
+    case PROP_SDES:
+      rtp_session_set_sdes_struct (sess, g_value_get_boxed (value));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -527,33 +460,8 @@ rtp_session_get_property (GObject * object, guint prop_id,
     case PROP_RTCP_MTU:
       g_value_set_uint (value, sess->mtu);
       break;
-    case PROP_SDES_CNAME:
-      g_value_take_string (value, rtp_session_get_sdes_string (sess,
-              GST_RTCP_SDES_CNAME));
-      break;
-    case PROP_SDES_NAME:
-      g_value_take_string (value, rtp_session_get_sdes_string (sess,
-              GST_RTCP_SDES_NAME));
-      break;
-    case PROP_SDES_EMAIL:
-      g_value_take_string (value, rtp_session_get_sdes_string (sess,
-              GST_RTCP_SDES_EMAIL));
-      break;
-    case PROP_SDES_PHONE:
-      g_value_take_string (value, rtp_session_get_sdes_string (sess,
-              GST_RTCP_SDES_PHONE));
-      break;
-    case PROP_SDES_LOCATION:
-      g_value_take_string (value, rtp_session_get_sdes_string (sess,
-              GST_RTCP_SDES_LOC));
-      break;
-    case PROP_SDES_TOOL:
-      g_value_take_string (value, rtp_session_get_sdes_string (sess,
-              GST_RTCP_SDES_TOOL));
-      break;
-    case PROP_SDES_NOTE:
-      g_value_take_string (value, rtp_session_get_sdes_string (sess,
-              GST_RTCP_SDES_NOTE));
+    case PROP_SDES:
+      g_value_take_boxed (value, rtp_session_get_sdes_struct (sess));
       break;
     case PROP_NUM_SOURCES:
       g_value_set_uint (value, rtp_session_get_num_sources (sess));
@@ -957,6 +865,45 @@ rtp_session_get_sdes_string (RTPSession * sess, GstRTCPSDESType type)
   return result;
 }
 
+/**
+ * rtp_session_get_sdes_struct:
+ * @sess: an #RTSPSession
+ *
+ * Get the SDES data as a #GstStructure
+ *
+ * Returns: a GstStructure with SDES items for @sess.
+ */
+GstStructure *
+rtp_session_get_sdes_struct (RTPSession * sess)
+{
+  GstStructure *result;
+
+  g_return_val_if_fail (RTP_IS_SESSION (sess), NULL);
+
+  RTP_SESSION_LOCK (sess);
+  result = rtp_source_get_sdes_struct (sess->source);
+  RTP_SESSION_UNLOCK (sess);
+
+  return result;
+}
+
+/**
+ * rtp_session_set_sdes_struct:
+ * @sess: an #RTSPSession
+ * @sdes: a #GstStructure
+ *
+ * Set the SDES data as a #GstStructure.
+ */
+void
+rtp_session_set_sdes_struct (RTPSession * sess, const GstStructure * sdes)
+{
+  g_return_if_fail (RTP_IS_SESSION (sess));
+
+  RTP_SESSION_LOCK (sess);
+  rtp_source_set_sdes_struct (sess->source, sdes);
+  RTP_SESSION_UNLOCK (sess);
+}
+
 static GstFlowReturn
 source_push_rtp (RTPSource * source, gpointer data, RTPSession * session)
 {
diff --git a/gst/rtpmanager/rtpsession.h b/gst/rtpmanager/rtpsession.h
index 6312f1c1..25e228b0 100644
--- a/gst/rtpmanager/rtpsession.h
+++ b/gst/rtpmanager/rtpsession.h
@@ -267,6 +267,9 @@ gboolean        rtp_session_set_sdes_string        (RTPSession *sess, GstRTCPSDE
                                                     const gchar *cname);
 gchar*          rtp_session_get_sdes_string        (RTPSession *sess, GstRTCPSDESType type);
 
+GstStructure *  rtp_session_get_sdes_struct        (RTPSession *sess);
+void            rtp_session_set_sdes_struct        (RTPSession *sess, const GstStructure *sdes);
+
 /* handling sources */
 RTPSource*      rtp_session_get_internal_source    (RTPSession *sess);
 
diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c
index 209c17b5..4d7c468d 100644
--- a/gst/rtpmanager/rtpsource.c
+++ b/gst/rtpmanager/rtpsource.c
@@ -316,8 +316,16 @@ rtp_source_create_stats (RTPSource * src)
   return s;
 }
 
-static GstStructure *
-rtp_source_create_sdes (RTPSource * src)
+/**
+ * rtp_source_get_sdes_struct:
+ * @src: an #RTSPSource
+ *
+ * Get the SDES data as a GstStructure
+ *
+ * Returns: a GstStructure with SDES items for @src.
+ */
+GstStructure *
+rtp_source_get_sdes_struct (RTPSource * src)
 {
   GstStructure *s;
   gchar *str;
@@ -356,6 +364,44 @@ rtp_source_create_sdes (RTPSource * src)
   return s;
 }
 
+/**
+ * rtp_source_set_sdes_struct:
+ * @src: an #RTSPSource
+ * @sdes: a #GstStructure with SDES info
+ *
+ * Set the SDES items from @sdes.
+ */
+void
+rtp_source_set_sdes_struct (RTPSource * src, const GstStructure * sdes)
+{
+  const gchar *str;
+
+  if (!gst_structure_has_name (sdes, "application/x-rtp-source-sdes"))
+    return;
+
+  if ((str = gst_structure_get_string (sdes, "cname"))) {
+    rtp_source_set_sdes_string (src, GST_RTCP_SDES_CNAME, str);
+  }
+  if ((str = gst_structure_get_string (sdes, "name"))) {
+    rtp_source_set_sdes_string (src, GST_RTCP_SDES_NAME, str);
+  }
+  if ((str = gst_structure_get_string (sdes, "email"))) {
+    rtp_source_set_sdes_string (src, GST_RTCP_SDES_EMAIL, str);
+  }
+  if ((str = gst_structure_get_string (sdes, "phone"))) {
+    rtp_source_set_sdes_string (src, GST_RTCP_SDES_PHONE, str);
+  }
+  if ((str = gst_structure_get_string (sdes, "location"))) {
+    rtp_source_set_sdes_string (src, GST_RTCP_SDES_LOC, str);
+  }
+  if ((str = gst_structure_get_string (sdes, "tool"))) {
+    rtp_source_set_sdes_string (src, GST_RTCP_SDES_TOOL, str);
+  }
+  if ((str = gst_structure_get_string (sdes, "note"))) {
+    rtp_source_set_sdes_string (src, GST_RTCP_SDES_NOTE, str);
+  }
+}
+
 static void
 rtp_source_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
@@ -396,7 +442,7 @@ rtp_source_get_property (GObject * object, guint prop_id,
       g_value_set_boolean (value, rtp_source_is_sender (src));
       break;
     case PROP_SDES:
-      g_value_take_boxed (value, rtp_source_create_sdes (src));
+      g_value_take_boxed (value, rtp_source_get_sdes_struct (src));
       break;
     case PROP_STATS:
       g_value_take_boxed (value, rtp_source_create_stats (src));
diff --git a/gst/rtpmanager/rtpsource.h b/gst/rtpmanager/rtpsource.h
index 8286f2ec..8355bc0c 100644
--- a/gst/rtpmanager/rtpsource.h
+++ b/gst/rtpmanager/rtpsource.h
@@ -187,6 +187,9 @@ gboolean        rtp_source_get_sdes            (RTPSource *src, GstRTCPSDESType
                                                 guint8 **data, guint *len);
 gchar*          rtp_source_get_sdes_string     (RTPSource *src, GstRTCPSDESType type);
 
+GstStructure *  rtp_source_get_sdes_struct     (RTPSource * src);
+void            rtp_source_set_sdes_struct     (RTPSource * src, const GstStructure *sdes);
+
 /* handling network address */
 void            rtp_source_set_rtp_from        (RTPSource *src, GstNetAddress *address);
 void            rtp_source_set_rtcp_from       (RTPSource *src, GstNetAddress *address);
-- 
cgit v1.2.1


From f9cc6b7b1c0abcffd1b0b80750ab6d109cbbaafb Mon Sep 17 00:00:00 2001
From: Wim Taymans <wim.taymans@collabora.co.uk>
Date: Mon, 29 Jun 2009 16:37:54 +0200
Subject: rtpbin: add SDES property

Remove all individual SDES properties and use one sdes property that takes a
GstStructure instead. This will allow us to add more custom stuff to the SDES
messages later.
---
 gst/rtpmanager/gstrtpbin.c     | 196 ++++++-----------------------------------
 gst/rtpmanager/gstrtpbin.h     |   2 +-
 gst/rtpmanager/gstrtpsession.c | 112 +++--------------------
 3 files changed, 39 insertions(+), 271 deletions(-)

(limited to 'gst/rtpmanager')

diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c
index 482cf017..ea391cf1 100644
--- a/gst/rtpmanager/gstrtpbin.c
+++ b/gst/rtpmanager/gstrtpbin.c
@@ -238,26 +238,14 @@ enum
 };
 
 #define DEFAULT_LATENCY_MS	     200
-#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
 #define DEFAULT_DO_LOST              FALSE
 
 enum
 {
   PROP_0,
   PROP_LATENCY,
-  PROP_SDES_CNAME,
-  PROP_SDES_NAME,
-  PROP_SDES_EMAIL,
-  PROP_SDES_PHONE,
-  PROP_SDES_LOCATION,
-  PROP_SDES_TOOL,
-  PROP_SDES_NOTE,
+  PROP_SDES,
   PROP_DO_LOST,
   PROP_LAST
 };
@@ -271,10 +259,6 @@ static guint gst_rtp_bin_signals[LAST_SIGNAL] = { 0 };
 
 static GstCaps *pt_map_requested (GstElement * element, guint pt,
     GstRtpBinSession * session);
-static const gchar *sdes_type_to_name (GstRTCPSDESType type);
-static void gst_rtp_bin_set_sdes_string (GstRtpBin * bin,
-    GstRTCPSDESType type, const gchar * data);
-
 static void free_stream (GstRtpBinStream * stream);
 
 /* Manages the RTP stream for one SSRC.
@@ -515,7 +499,6 @@ create_session (GstRtpBin * rtpbin, gint id)
 {
   GstRtpBinSession *sess;
   GstElement *session, *demux;
-  gint i;
   GstState target;
 
   if (!(session = gst_element_factory_make ("gstrtpsession", NULL)))
@@ -538,9 +521,7 @@ create_session (GstRtpBin * rtpbin, gint id)
   g_object_set (session, "ntp-ns-base", rtpbin->priv->ntp_ns_base, NULL);
   /* configure SDES items */
   GST_OBJECT_LOCK (rtpbin);
-  for (i = GST_RTCP_SDES_CNAME; i < GST_RTCP_SDES_PRIV; i++) {
-    g_object_set (session, sdes_type_to_name (i), rtpbin->sdes[i], NULL);
-  }
+  g_object_set (session, "sdes", rtpbin->sdes, NULL);
   GST_OBJECT_UNLOCK (rtpbin);
 
   /* provide clock_rate to the session manager when needed */
@@ -1448,40 +1429,10 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
       NULL, NULL, gst_rtp_bin_marshal_VOID__UINT_UINT, G_TYPE_NONE, 2,
       G_TYPE_UINT, G_TYPE_UINT);
 
-  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));
-
-  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));
-
-  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));
-
-  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));
-
-  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));
-
-  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));
-
-  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));
+  g_object_class_install_property (gobject_class, PROP_SDES,
+      g_param_spec_boxed ("sdes", "SDES",
+          "The SDES items of this session",
+          GST_TYPE_STRUCTURE, G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, PROP_DO_LOST,
       g_param_spec_boolean ("do-lost", "Do Lost",
@@ -1517,11 +1468,11 @@ gst_rtp_bin_init (GstRtpBin * rtpbin, GstRtpBinClass * klass)
 
   /* some default SDES entries */
   str = g_strdup_printf ("%s@%s", g_get_user_name (), g_get_host_name ());
-  gst_rtp_bin_set_sdes_string (rtpbin, GST_RTCP_SDES_CNAME, str);
+  rtpbin->sdes = gst_structure_new ("application/x-rtp-source-sdes",
+      "cname", G_TYPE_STRING, str,
+      "name", G_TYPE_STRING, g_get_real_name (),
+      "tool", G_TYPE_STRING, "GStreamer", NULL);
   g_free (str);
-
-  gst_rtp_bin_set_sdes_string (rtpbin, GST_RTCP_SDES_NAME, g_get_real_name ());
-  gst_rtp_bin_set_sdes_string (rtpbin, GST_RTCP_SDES_TOOL, "GStreamer");
 }
 
 static void
@@ -1547,12 +1498,11 @@ static void
 gst_rtp_bin_finalize (GObject * object)
 {
   GstRtpBin *rtpbin;
-  gint i;
 
   rtpbin = GST_RTP_BIN (object);
 
-  for (i = 0; i < 9; i++)
-    g_free (rtpbin->sdes[i]);
+  if (rtpbin->sdes)
+    gst_structure_free (rtpbin->sdes);
 
   g_mutex_free (rtpbin->priv->bin_lock);
   g_mutex_free (rtpbin->priv->dyn_lock);
@@ -1560,77 +1510,37 @@ gst_rtp_bin_finalize (GObject * object)
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
-static const gchar *
-sdes_type_to_name (GstRTCPSDESType type)
-{
-  const gchar *result;
-
-  switch (type) {
-    case GST_RTCP_SDES_CNAME:
-      result = "sdes-cname";
-      break;
-    case GST_RTCP_SDES_NAME:
-      result = "sdes-name";
-      break;
-    case GST_RTCP_SDES_EMAIL:
-      result = "sdes-email";
-      break;
-    case GST_RTCP_SDES_PHONE:
-      result = "sdes-phone";
-      break;
-    case GST_RTCP_SDES_LOC:
-      result = "sdes-location";
-      break;
-    case GST_RTCP_SDES_TOOL:
-      result = "sdes-tool";
-      break;
-    case GST_RTCP_SDES_NOTE:
-      result = "sdes-note";
-      break;
-    case GST_RTCP_SDES_PRIV:
-      result = "sdes-priv";
-      break;
-    default:
-      result = NULL;
-      break;
-  }
-  return result;
-}
 
 static void
-gst_rtp_bin_set_sdes_string (GstRtpBin * bin, GstRTCPSDESType type,
-    const gchar * data)
+gst_rtp_bin_set_sdes_struct (GstRtpBin * bin, const GstStructure * sdes)
 {
   GSList *item;
-  const gchar *name;
 
-  if (type < 0 || type > 8)
+  if (sdes == NULL)
     return;
 
   GST_RTP_BIN_LOCK (bin);
 
   GST_OBJECT_LOCK (bin);
-  g_free (bin->sdes[type]);
-  bin->sdes[type] = g_strdup (data);
-  name = sdes_type_to_name (type);
+  if (bin->sdes)
+    gst_structure_free (bin->sdes);
+  bin->sdes = gst_structure_copy (sdes);
+
   /* store in all sessions */
   for (item = bin->sessions; item; item = g_slist_next (item))
-    g_object_set (item->data, name, bin->sdes[type], NULL);
+    g_object_set (item->data, "sdes", sdes, NULL);
   GST_OBJECT_UNLOCK (bin);
 
   GST_RTP_BIN_UNLOCK (bin);
 }
 
-static gchar *
-gst_rtp_bin_get_sdes_string (GstRtpBin * bin, GstRTCPSDESType type)
+static GstStructure *
+gst_rtp_bin_get_sdes_struct (GstRtpBin * bin)
 {
-  gchar *result;
-
-  if (type < 0 || type > 8)
-    return NULL;
+  GstStructure *result;
 
   GST_OBJECT_LOCK (bin);
-  result = g_strdup (bin->sdes[type]);
+  result = gst_structure_copy (bin->sdes);
   GST_OBJECT_UNLOCK (bin);
 
   return result;
@@ -1652,33 +1562,8 @@ gst_rtp_bin_set_property (GObject * object, guint prop_id,
       /* propegate the property down to the jitterbuffer */
       gst_rtp_bin_propagate_property_to_jitterbuffer (rtpbin, "latency", value);
       break;
-    case PROP_SDES_CNAME:
-      gst_rtp_bin_set_sdes_string (rtpbin, GST_RTCP_SDES_CNAME,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_NAME:
-      gst_rtp_bin_set_sdes_string (rtpbin, GST_RTCP_SDES_NAME,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_EMAIL:
-      gst_rtp_bin_set_sdes_string (rtpbin, GST_RTCP_SDES_EMAIL,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_PHONE:
-      gst_rtp_bin_set_sdes_string (rtpbin, GST_RTCP_SDES_PHONE,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_LOCATION:
-      gst_rtp_bin_set_sdes_string (rtpbin, GST_RTCP_SDES_LOC,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_TOOL:
-      gst_rtp_bin_set_sdes_string (rtpbin, GST_RTCP_SDES_TOOL,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_NOTE:
-      gst_rtp_bin_set_sdes_string (rtpbin, GST_RTCP_SDES_NOTE,
-          g_value_get_string (value));
+    case PROP_SDES:
+      gst_rtp_bin_set_sdes_struct (rtpbin, g_value_get_boxed (value));
       break;
     case PROP_DO_LOST:
       GST_RTP_BIN_LOCK (rtpbin);
@@ -1706,33 +1591,8 @@ gst_rtp_bin_get_property (GObject * object, guint prop_id,
       g_value_set_uint (value, rtpbin->latency);
       GST_RTP_BIN_UNLOCK (rtpbin);
       break;
-    case PROP_SDES_CNAME:
-      g_value_take_string (value, gst_rtp_bin_get_sdes_string (rtpbin,
-              GST_RTCP_SDES_CNAME));
-      break;
-    case PROP_SDES_NAME:
-      g_value_take_string (value, gst_rtp_bin_get_sdes_string (rtpbin,
-              GST_RTCP_SDES_NAME));
-      break;
-    case PROP_SDES_EMAIL:
-      g_value_take_string (value, gst_rtp_bin_get_sdes_string (rtpbin,
-              GST_RTCP_SDES_EMAIL));
-      break;
-    case PROP_SDES_PHONE:
-      g_value_take_string (value, gst_rtp_bin_get_sdes_string (rtpbin,
-              GST_RTCP_SDES_PHONE));
-      break;
-    case PROP_SDES_LOCATION:
-      g_value_take_string (value, gst_rtp_bin_get_sdes_string (rtpbin,
-              GST_RTCP_SDES_LOC));
-      break;
-    case PROP_SDES_TOOL:
-      g_value_take_string (value, gst_rtp_bin_get_sdes_string (rtpbin,
-              GST_RTCP_SDES_TOOL));
-      break;
-    case PROP_SDES_NOTE:
-      g_value_take_string (value, gst_rtp_bin_get_sdes_string (rtpbin,
-              GST_RTCP_SDES_NOTE));
+    case PROP_SDES:
+      g_value_take_boxed (value, gst_rtp_bin_get_sdes_struct (rtpbin));
       break;
     case PROP_DO_LOST:
       GST_RTP_BIN_LOCK (rtpbin);
diff --git a/gst/rtpmanager/gstrtpbin.h b/gst/rtpmanager/gstrtpbin.h
index f47048e5..bed6ad02 100644
--- a/gst/rtpmanager/gstrtpbin.h
+++ b/gst/rtpmanager/gstrtpbin.h
@@ -53,7 +53,7 @@ struct _GstRtpBin {
   GSList         *clients;
 
   /* the default SDES items for sessions */
-  gchar          *sdes[9];
+  GstStructure   *sdes;
 
   /*< private >*/
   GstRtpBinPrivate *priv;
diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c
index 9407ee52..dcddb689 100644
--- a/gst/rtpmanager/gstrtpsession.c
+++ b/gst/rtpmanager/gstrtpsession.c
@@ -200,13 +200,7 @@ enum
 #define DEFAULT_NTP_NS_BASE          0
 #define DEFAULT_BANDWIDTH            RTP_STATS_BANDWIDTH
 #define DEFAULT_RTCP_FRACTION        RTP_STATS_RTCP_BANDWIDTH
-#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
 #define DEFAULT_NUM_SOURCES          0
 #define DEFAULT_NUM_ACTIVE_SOURCES   0
 
@@ -216,13 +210,7 @@ enum
   PROP_NTP_NS_BASE,
   PROP_BANDWIDTH,
   PROP_RTCP_FRACTION,
-  PROP_SDES_CNAME,
-  PROP_SDES_NAME,
-  PROP_SDES_EMAIL,
-  PROP_SDES_PHONE,
-  PROP_SDES_LOCATION,
-  PROP_SDES_TOOL,
-  PROP_SDES_NOTE,
+  PROP_SDES,
   PROP_NUM_SOURCES,
   PROP_NUM_ACTIVE_SOURCES,
   PROP_INTERNAL_SESSION,
@@ -555,40 +543,10 @@ gst_rtp_session_class_init (GstRtpSessionClass * klass)
           "The fraction of the bandwidth used for RTCP",
           0.0, G_MAXDOUBLE, DEFAULT_RTCP_FRACTION, G_PARAM_READWRITE));
 
-  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));
-
-  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));
-
-  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));
-
-  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));
-
-  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));
-
-  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));
-
-  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));
+  g_object_class_install_property (gobject_class, PROP_SDES,
+      g_param_spec_boxed ("sdes", "SDES",
+          "The SDES items of this session",
+          GST_TYPE_STRUCTURE, G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, PROP_NUM_SOURCES,
       g_param_spec_uint ("num-sources", "Num Sources",
@@ -704,33 +662,8 @@ gst_rtp_session_set_property (GObject * object, guint prop_id,
     case PROP_RTCP_FRACTION:
       rtp_session_set_rtcp_fraction (priv->session, g_value_get_double (value));
       break;
-    case PROP_SDES_CNAME:
-      rtp_session_set_sdes_string (priv->session, GST_RTCP_SDES_CNAME,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_NAME:
-      rtp_session_set_sdes_string (priv->session, GST_RTCP_SDES_NAME,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_EMAIL:
-      rtp_session_set_sdes_string (priv->session, GST_RTCP_SDES_EMAIL,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_PHONE:
-      rtp_session_set_sdes_string (priv->session, GST_RTCP_SDES_PHONE,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_LOCATION:
-      rtp_session_set_sdes_string (priv->session, GST_RTCP_SDES_LOC,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_TOOL:
-      rtp_session_set_sdes_string (priv->session, GST_RTCP_SDES_TOOL,
-          g_value_get_string (value));
-      break;
-    case PROP_SDES_NOTE:
-      rtp_session_set_sdes_string (priv->session, GST_RTCP_SDES_NOTE,
-          g_value_get_string (value));
+    case PROP_SDES:
+      rtp_session_set_sdes_struct (priv->session, g_value_get_boxed (value));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -760,33 +693,8 @@ gst_rtp_session_get_property (GObject * object, guint prop_id,
     case PROP_RTCP_FRACTION:
       g_value_set_double (value, rtp_session_get_rtcp_fraction (priv->session));
       break;
-    case PROP_SDES_CNAME:
-      g_value_take_string (value, rtp_session_get_sdes_string (priv->session,
-              GST_RTCP_SDES_CNAME));
-      break;
-    case PROP_SDES_NAME:
-      g_value_take_string (value, rtp_session_get_sdes_string (priv->session,
-              GST_RTCP_SDES_NAME));
-      break;
-    case PROP_SDES_EMAIL:
-      g_value_take_string (value, rtp_session_get_sdes_string (priv->session,
-              GST_RTCP_SDES_EMAIL));
-      break;
-    case PROP_SDES_PHONE:
-      g_value_take_string (value, rtp_session_get_sdes_string (priv->session,
-              GST_RTCP_SDES_PHONE));
-      break;
-    case PROP_SDES_LOCATION:
-      g_value_take_string (value, rtp_session_get_sdes_string (priv->session,
-              GST_RTCP_SDES_LOC));
-      break;
-    case PROP_SDES_TOOL:
-      g_value_take_string (value, rtp_session_get_sdes_string (priv->session,
-              GST_RTCP_SDES_TOOL));
-      break;
-    case PROP_SDES_NOTE:
-      g_value_take_string (value, rtp_session_get_sdes_string (priv->session,
-              GST_RTCP_SDES_NOTE));
+    case PROP_SDES:
+      g_value_take_boxed (value, rtp_session_get_sdes_struct (priv->session));
       break;
     case PROP_NUM_SOURCES:
       g_value_set_uint (value, rtp_session_get_num_sources (priv->session));
-- 
cgit v1.2.1


From 6eb961e51028da76f51462d44f242dc875520d9b Mon Sep 17 00:00:00 2001
From: Wim Taymans <wim.taymans@collabora.co.uk>
Date: Thu, 28 May 2009 19:08:40 +0200
Subject: rtpsession: add a comment

---
 gst/rtpmanager/rtpsession.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'gst/rtpmanager')

diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c
index 1583cb79..fa46f501 100644
--- a/gst/rtpmanager/rtpsession.c
+++ b/gst/rtpmanager/rtpsession.c
@@ -384,6 +384,7 @@ copy_source (gpointer key, RTPSource * source, GValueArray * arr)
 
   g_value_init (&value, RTP_TYPE_SOURCE);
   g_value_take_object (&value, source);
+  /* copies the value */
   g_value_array_append (arr, &value);
 }
 
@@ -1339,7 +1340,6 @@ rtp_session_create_new_ssrc (RTPSession * sess)
             GINT_TO_POINTER (ssrc)) == NULL)
       break;
   }
-
   return ssrc;
 }
 
-- 
cgit v1.2.1


From 4bc5e2f61ed93072f3e96933af25b08fd6a2807f Mon Sep 17 00:00:00 2001
From: Wim Taymans <wim.taymans@collabora.co.uk>
Date: Mon, 29 Jun 2009 18:48:33 +0200
Subject: rtpbin: do better cleanup of the src ghostpads

Connect to the pad-removed signal of the ptdemux elements so that we remove the
ghostpads for them. Fixes cleanup when going to NULL as well as when releasing
the sinkpads.

Fixes #561752
---
 gst/rtpmanager/gstrtpbin.c | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)

(limited to 'gst/rtpmanager')

diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c
index ea391cf1..c09b0ab9 100644
--- a/gst/rtpmanager/gstrtpbin.c
+++ b/gst/rtpmanager/gstrtpbin.c
@@ -288,10 +288,9 @@ struct _GstRtpBinStream
   /* the PT demuxer of the SSRC */
   GstElement *demux;
   gulong demux_newpad_sig;
+  gulong demux_padremoved_sig;
   gulong demux_ptreq_sig;
   gulong demux_pt_change_sig;
-  /* ghostpads from the ptdemuxer */
-  GSList *pads;
 
   /* if we have calculated a valid unix_delta for this stream */
   gboolean have_sync;
@@ -1152,7 +1151,6 @@ static void
 free_stream (GstRtpBinStream * stream)
 {
   GstRtpBinSession *session;
-  GSList *walk;
 
   session = stream->session;
 
@@ -1165,17 +1163,13 @@ free_stream (GstRtpBinStream * stream)
   gst_element_set_state (stream->demux, GST_STATE_NULL);
   gst_element_set_state (stream->buffer, GST_STATE_NULL);
 
+  /* now remove this signal, we need this while going to NULL because it to 
+   * do some cleanups */
+  g_signal_handler_disconnect (stream->demux, stream->demux_padremoved_sig);
+
   gst_bin_remove (GST_BIN_CAST (session->bin), stream->buffer);
   gst_bin_remove (GST_BIN_CAST (session->bin), stream->demux);
 
-  for (walk = stream->pads; walk; walk = g_slist_next (walk)) {
-    GstPad *gpad = GST_PAD_CAST (walk->data);
-
-    gst_pad_set_active (gpad, FALSE);
-    gst_element_remove_pad (GST_ELEMENT_CAST (session->bin), gpad);
-  }
-  g_slist_free (stream->pads);
-
   g_free (stream);
 }
 
@@ -1744,13 +1738,11 @@ new_payload_found (GstElement * element, guint pt, GstPad * pad,
       stream->session->id, stream->ssrc, pt);
   gpad = gst_ghost_pad_new_from_template (padname, pad, templ);
   g_free (padname);
+  g_object_set_data (G_OBJECT (pad), "GstRTPBin.ghostpad", gpad);
 
   gst_pad_set_caps (gpad, GST_PAD_CAPS (pad));
   gst_pad_set_active (gpad, TRUE);
   gst_element_add_pad (GST_ELEMENT_CAST (rtpbin), gpad);
-
-  stream->pads = g_slist_prepend (stream->pads, gpad);
-
   GST_RTP_BIN_SHUTDOWN_UNLOCK (rtpbin);
 
   return;
@@ -1762,6 +1754,27 @@ shutdown:
   }
 }
 
+static void
+payload_pad_removed (GstElement * element, GstPad * pad,
+    GstRtpBinStream * stream)
+{
+  GstRtpBin *rtpbin;
+  GstPad *gpad;
+
+  rtpbin = stream->bin;
+
+  GST_DEBUG ("payload pad removed");
+
+  GST_RTP_BIN_DYN_LOCK (rtpbin);
+  if ((gpad = g_object_get_data (G_OBJECT (pad), "GstRTPBin.ghostpad"))) {
+    g_object_set_data (G_OBJECT (pad), "GstRTPBin.ghostpad", NULL);
+
+    gst_pad_set_active (gpad, FALSE);
+    gst_element_remove_pad (GST_ELEMENT_CAST (rtpbin), gpad);
+  }
+  GST_RTP_BIN_DYN_UNLOCK (rtpbin);
+}
+
 static GstCaps *
 pt_map_requested (GstElement * element, guint pt, GstRtpBinSession * session)
 {
@@ -1869,6 +1882,9 @@ new_ssrc_pad_found (GstElement * element, guint ssrc, GstPad * pad,
    * new pad by ghosting it. */
   stream->demux_newpad_sig = g_signal_connect (stream->demux,
       "new-payload-type", (GCallback) new_payload_found, stream);
+  stream->demux_padremoved_sig = g_signal_connect (stream->demux,
+      "pad-removed", (GCallback) payload_pad_removed, stream);
+
   /* connect to the request-pt-map signal. This signal will be emited by the
    * demuxer so that it can apply a proper caps on the buffers for the
    * depayloaders. */
-- 
cgit v1.2.1


From 80856964b52a089d5d286fd1543b89d2a3ea4a39 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wim.taymans@collabora.co.uk>
Date: Wed, 1 Jul 2009 12:55:03 +0200
Subject: rtpbin: use new method for netaddress to string

---
 gst/rtpmanager/rtpsource.c | 47 +++++-----------------------------------------
 1 file changed, 5 insertions(+), 42 deletions(-)

(limited to 'gst/rtpmanager')

diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c
index 4d7c468d..40cdd238 100644
--- a/gst/rtpmanager/rtpsource.c
+++ b/gst/rtpmanager/rtpsource.c
@@ -188,52 +188,13 @@ rtp_source_finalize (GObject * object)
   G_OBJECT_CLASS (rtp_source_parent_class)->finalize (object);
 }
 
-#define MAX_ADDRESS  64
-static void
-make_address_string (GstNetAddress * addr, gchar * dest, gulong n)
-{
-  switch (gst_netaddress_get_net_type (addr)) {
-    case GST_NET_TYPE_IP4:
-    {
-      guint32 address;
-      guint16 port;
-
-      gst_netaddress_get_ip4_address (addr, &address, &port);
-      address = g_ntohl (address);
-
-      g_snprintf (dest, n, "%d.%d.%d.%d:%d", (address >> 24) & 0xff,
-          (address >> 16) & 0xff, (address >> 8) & 0xff, address & 0xff,
-          g_ntohs (port));
-      break;
-    }
-    case GST_NET_TYPE_IP6:
-    {
-      guint8 address[16];
-      guint16 port;
-
-      gst_netaddress_get_ip6_address (addr, address, &port);
-
-      g_snprintf (dest, n, "[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]:%d",
-          (address[0] << 8) | address[1], (address[2] << 8) | address[3],
-          (address[4] << 8) | address[5], (address[6] << 8) | address[7],
-          (address[8] << 8) | address[9], (address[10] << 8) | address[11],
-          (address[12] << 8) | address[13], (address[14] << 8) | address[15],
-          g_ntohs (port));
-      break;
-    }
-    default:
-      dest[0] = 0;
-      break;
-  }
-}
-
 static GstStructure *
 rtp_source_create_stats (RTPSource * src)
 {
   GstStructure *s;
   gboolean is_sender = src->is_sender;
   gboolean internal = src->internal;
-  gchar address_str[MAX_ADDRESS];
+  gchar address_str[GST_NETADDRESS_MAX_LEN];
 
   /* common data for all types of sources */
   s = gst_structure_new ("application/x-rtp-source-stats",
@@ -246,11 +207,13 @@ rtp_source_create_stats (RTPSource * src)
 
   /* add address and port */
   if (src->have_rtp_from) {
-    make_address_string (&src->rtp_from, address_str, sizeof (address_str));
+    gst_netaddress_to_string (&src->rtp_from, address_str,
+        sizeof (address_str));
     gst_structure_set (s, "rtp-from", G_TYPE_STRING, address_str, NULL);
   }
   if (src->have_rtcp_from) {
-    make_address_string (&src->rtcp_from, address_str, sizeof (address_str));
+    gst_netaddress_to_string (&src->rtcp_from, address_str,
+        sizeof (address_str));
     gst_structure_set (s, "rtcp-from", G_TYPE_STRING, address_str, NULL);
   }
 
-- 
cgit v1.2.1