gst/rtpmanager/gstrtpbin-marshal.list: Add marshaller for new action signal.
authorHåvard Graff <havard.graff@tandberg.com>
Tue, 7 Oct 2008 18:54:41 +0000 (18:54 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 7 Oct 2008 18:54:41 +0000 (18:54 +0000)
Original commit message from CVS:
Patch by: Håvard Graff <havard dot graff at tandberg dot com>
* gst/rtpmanager/gstrtpbin-marshal.list:
Add marshaller for new action signal.
* gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_get_internal_session),
(gst_rtp_bin_class_init):
* gst/rtpmanager/gstrtpbin.h:
Add action signal to retrieve the internal RTPSession object.
* gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_class_init),
(gst_rtp_session_get_property), (gst_rtp_session_release_pad):
Add property to access the internal RTPSession object.
* gst/rtpmanager/rtpsession.c: (rtp_session_class_init),
(check_collision):
* gst/rtpmanager/rtpsession.h:
Add action signal to retrieve an RTPSource object by SSRC.
See #555396.

ChangeLog
gst/rtpmanager/gstrtpbin-marshal.list
gst/rtpmanager/gstrtpbin.c
gst/rtpmanager/gstrtpbin.h
gst/rtpmanager/gstrtpsession.c
gst/rtpmanager/rtpsession.c
gst/rtpmanager/rtpsession.h

index 95e5d69..0d4860e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2008-10-07  Wim Taymans  <wim.taymans@collabora.co.uk>
+
+       Patch by: Håvard Graff <havard dot graff at tandberg dot com>
+
+       * gst/rtpmanager/gstrtpbin-marshal.list:
+       Add marshaller for new action signal.
+
+       * gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_get_internal_session),
+       (gst_rtp_bin_class_init):
+       * gst/rtpmanager/gstrtpbin.h:
+       Add action signal to retrieve the internal RTPSession object.
+
+       * gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_class_init),
+       (gst_rtp_session_get_property), (gst_rtp_session_release_pad):
+       Add property to access the internal RTPSession object.
+
+       * gst/rtpmanager/rtpsession.c: (rtp_session_class_init),
+       (check_collision):
+       * gst/rtpmanager/rtpsession.h:
+       Add action signal to retrieve an RTPSource object by SSRC. 
+       See #555396.
+
 2008-10-07  Stefan Kost  <ensonic@users.sf.net>
 
        * gst/selector/gstoutputselector.c:
index e5c5fc4..c4bc0bb 100644 (file)
@@ -1,6 +1,7 @@
 UINT:UINT
 BOXED:UINT
 BOXED:UINT,UINT
+OBJECT:UINT
 VOID:UINT,OBJECT
 VOID:UINT,UINT
 VOID:OBJECT,OBJECT
index 19d1765..605a73d 100644 (file)
 
 #include "gstrtpbin-marshal.h"
 #include "gstrtpbin.h"
+#include "rtpsession.h"
 #include "gstrtpsession.h"
 #include "gstrtpjitterbuffer.h"
 
@@ -228,6 +229,7 @@ enum
 {
   SIGNAL_REQUEST_PT_MAP,
   SIGNAL_CLEAR_PT_MAP,
+  SIGNAL_GET_INTERNAL_SESSION,
 
   SIGNAL_ON_NEW_SSRC,
   SIGNAL_ON_SSRC_COLLISION,
@@ -734,6 +736,25 @@ gst_rtp_bin_clear_pt_map (GstRtpBin * bin)
   GST_RTP_BIN_UNLOCK (bin);
 }
 
+static RTPSession *
+gst_rtp_bin_get_internal_session (GstRtpBin * bin, guint session_id)
+{
+  RTPSession *internal_session = NULL;
+  GstRtpBinSession *session;
+
+  GST_RTP_BIN_LOCK (bin);
+  GST_DEBUG_OBJECT (bin, "retrieving internal RTPSession object, index: %d",
+      session_id);
+  session = find_session_by_id (bin, (gint) session_id);
+  if (session) {
+    g_object_get (session->session, "internal-session", &internal_session,
+        NULL);
+  }
+  GST_RTP_BIN_UNLOCK (bin);
+
+  return internal_session;
+}
+
 static void
 gst_rtp_bin_propagate_property_to_jitterbuffer (GstRtpBin * bin,
     const gchar * name, const GValue * value)
@@ -1290,6 +1311,18 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
       G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRtpBinClass,
           clear_pt_map), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,
       0, G_TYPE_NONE);
+  /**
+   * GstRtpBin::get-internal-session:
+   * @rtpbin: the object which received the signal
+   * @id: the session id
+   *
+   * Request the internal RTPSession object as #GObject in session @id.
+   */
+  gst_rtp_bin_signals[SIGNAL_GET_INTERNAL_SESSION] =
+      g_signal_new ("get-internal-session", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRtpBinClass,
+          get_internal_session), NULL, NULL, gst_rtp_bin_marshal_OBJECT__UINT,
+      RTP_TYPE_SESSION, 1, G_TYPE_UINT);
 
   /**
    * GstRtpBin::on-new-ssrc:
@@ -1460,6 +1493,8 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
   gstbin_class->handle_message = GST_DEBUG_FUNCPTR (gst_rtp_bin_handle_message);
 
   klass->clear_pt_map = GST_DEBUG_FUNCPTR (gst_rtp_bin_clear_pt_map);
+  klass->get_internal_session =
+      GST_DEBUG_FUNCPTR (gst_rtp_bin_get_internal_session);
 
   GST_DEBUG_CATEGORY_INIT (gst_rtp_bin_debug, "rtpbin", 0, "RTP bin");
 }
index 7ef605d..71235fd 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <gst/gst.h>
 
+#include "rtpsession.h"
+
 #define GST_TYPE_RTP_BIN \
   (gst_rtp_bin_get_type())
 #define GST_RTP_BIN(obj) \
@@ -63,9 +65,13 @@ struct _GstRtpBinClass {
   GstBinClass  parent_class;
 
   /* get the caps for pt */
-  GstCaps* (*request_pt_map)  (GstRtpBin *rtpbin, guint session, guint pt);
-  void     (*clear_pt_map)    (GstRtpBin *rtpbin);
+  GstCaps*    (*request_pt_map)       (GstRtpBin *rtpbin, guint session, guint pt);
+
+  /* action signals */
+  void        (*clear_pt_map)         (GstRtpBin *rtpbin);
+  RTPSession* (*get_internal_session) (GstRtpBin *rtpbin, guint session_id);
 
+  /* session manager signals */
   void     (*on_new_ssrc)       (GstRtpBin *rtpbin, guint session, guint32 ssrc);
   void     (*on_ssrc_collision) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
   void     (*on_ssrc_validated) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
index 5257b50..fdc4ea2 100644 (file)
@@ -225,6 +225,7 @@ enum
   PROP_SDES_NOTE,
   PROP_NUM_SOURCES,
   PROP_NUM_ACTIVE_SOURCES,
+  PROP_INTERNAL_SESSION,
   PROP_LAST
 };
 
@@ -655,6 +656,11 @@ gst_rtp_session_class_init (GstRtpSessionClass * klass)
           "The number of active sources in the session", 0, G_MAXUINT,
           DEFAULT_NUM_ACTIVE_SOURCES, G_PARAM_READABLE));
 
+  g_object_class_install_property (gobject_class, PROP_INTERNAL_SESSION,
+      g_param_spec_object ("internal-session", "Internal Session",
+          "The internal RTPSession object", RTP_TYPE_SESSION,
+          G_PARAM_READABLE));
+
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_rtp_session_change_state);
   gstelement_class->request_new_pad =
@@ -845,6 +851,9 @@ gst_rtp_session_get_property (GObject * object, guint prop_id,
       g_value_set_uint (value,
           rtp_session_get_num_active_sources (priv->session));
       break;
+    case PROP_INTERNAL_SESSION:
+      g_value_set_object (value, priv->session);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1982,9 +1991,3 @@ wrong_pad:
     return;
   }
 }
-
-void
-gst_rtp_session_set_ssrc (GstRtpSession * sess, guint32 ssrc)
-{
-  rtp_session_set_internal_ssrc (sess->priv->session, ssrc);
-}
index 8e543b3..bf0a0aa 100644 (file)
@@ -23,7 +23,7 @@
 #include <gst/rtp/gstrtcpbuffer.h>
 #include <gst/netbuffer/gstnetbuffer.h>
 
-
+#include "gstrtpbin-marshal.h"
 #include "rtpsession.h"
 
 GST_DEBUG_CATEGORY_STATIC (rtp_session_debug);
@@ -32,6 +32,7 @@ GST_DEBUG_CATEGORY_STATIC (rtp_session_debug);
 /* signals and args */
 enum
 {
+  SIGNAL_GET_SOURCE_BY_SSRC,
   SIGNAL_ON_NEW_SSRC,
   SIGNAL_ON_SSRC_COLLISION,
   SIGNAL_ON_SSRC_VALIDATED,
@@ -118,6 +119,19 @@ rtp_session_class_init (RTPSessionClass * klass)
   gobject_class->get_property = rtp_session_get_property;
 
   /**
+   * RTPSession::get-source-by-ssrc:
+   * @session: the object which received the signal
+   * @ssrc: the SSRC of the RTPSource
+   *
+   * Request the #RTPSource object with SSRC @ssrc in @session.
+   */
+  rtp_session_signals[SIGNAL_GET_SOURCE_BY_SSRC] =
+      g_signal_new ("get-source-by-ssrc", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (RTPSessionClass,
+          get_source_by_ssrc), NULL, NULL, gst_rtp_bin_marshal_OBJECT__UINT,
+      RTP_TYPE_SOURCE, 1, G_TYPE_UINT);
+
+  /**
    * RTPSession::on-new-ssrc:
    * @session: the object which received the signal
    * @src: the new RTPSource
@@ -286,6 +300,9 @@ rtp_session_class_init (RTPSessionClass * klass)
           "The number of active sources in the session", 0, G_MAXUINT,
           DEFAULT_NUM_ACTIVE_SOURCES, G_PARAM_READABLE));
 
+  klass->get_source_by_ssrc =
+      GST_DEBUG_FUNCPTR (rtp_session_get_source_by_ssrc);
+
   GST_DEBUG_CATEGORY_INIT (rtp_session_debug, "rtpsession", 0, "RTP Session");
 }
 
@@ -947,7 +964,7 @@ static gboolean
 check_collision (RTPSession * sess, RTPSource * source,
     RTPArrivalStats * arrival, gboolean rtp)
 {
-  /* If we have not arrival address, we can't do collision checking */
+  /* If we have no arrival address, we can't do collision checking */
   if (!arrival->have_address)
     return FALSE;
 
index dd3fbc1..8231119 100644 (file)
@@ -149,7 +149,6 @@ typedef struct {
  * This structure is used to account for addresses that have conflicted to find
  * loops.
  */
-
 typedef struct {
   GstNetAddress address;
   GstClockTime time;
@@ -219,6 +218,9 @@ struct _RTPSession {
 struct _RTPSessionClass {
   GObjectClass   parent_class;
 
+  /* action signals */
+  RTPSource* (*get_source_by_ssrc) (RTPSession *sess, guint32 ssrc);
+
   /* signals */
   void (*on_new_ssrc)       (RTPSession *sess, RTPSource *source);
   void (*on_ssrc_collision) (RTPSession *sess, RTPSource *source);
@@ -279,17 +281,22 @@ RTPSource*      rtp_session_get_source_by_cname    (RTPSession *sess, const gcha
 RTPSource*      rtp_session_create_source          (RTPSession *sess);
 
 /* processing packets from receivers */
-GstFlowReturn   rtp_session_process_rtp            (RTPSession *sess, GstBuffer *buffer, GstClockTime current_time, guint64 ntpnstime);
-GstFlowReturn   rtp_session_process_rtcp           (RTPSession *sess, GstBuffer *buffer, GstClockTime current_time);
+GstFlowReturn   rtp_session_process_rtp            (RTPSession *sess, GstBuffer *buffer,
+                                                    GstClockTime current_time, guint64 ntpnstime);
+GstFlowReturn   rtp_session_process_rtcp           (RTPSession *sess, GstBuffer *buffer,
+                                                    GstClockTime current_time);
 
 /* processing packets for sending */
-GstFlowReturn   rtp_session_send_rtp               (RTPSession *sess, GstBuffer *buffer, GstClockTime current_time, guint64 ntpnstime);
+GstFlowReturn   rtp_session_send_rtp               (RTPSession *sess, GstBuffer *buffer,
+                                                    GstClockTime current_time, guint64 ntpnstime);
 
 /* stopping the session */
-GstFlowReturn   rtp_session_send_bye               (RTPSession *sess, const gchar *reason, GstClockTime current_time);
+GstFlowReturn   rtp_session_send_bye               (RTPSession *sess, const gchar *reason,
+                                                    GstClockTime current_time);
 
 /* get interval for next RTCP interval */
 GstClockTime    rtp_session_next_timeout           (RTPSession *sess, GstClockTime current_time);
-GstFlowReturn   rtp_session_on_timeout             (RTPSession *sess, GstClockTime current_time, guint64 ntpnstime);
+GstFlowReturn   rtp_session_on_timeout             (RTPSession *sess, GstClockTime current_time,
+                                                    guint64 ntpnstime);
 
 #endif /* __RTP_SESSION_H__ */