rtpbin: new signal "get-storage"
authorMathieu Duponchelle <mathieu@centricular.com>
Mon, 2 Apr 2018 21:04:06 +0000 (23:04 +0200)
committerMathieu Duponchelle <mathieu@centricular.com>
Fri, 6 Apr 2018 18:21:43 +0000 (20:21 +0200)
Similar to the get-session and get-internal-session signals,
we expose a get-storage signal in addition to the
get-internal-storage signal to give access to the actual
element for applications that need to set properties on the
element, in particular "size-time"

https://bugzilla.gnome.org/show_bug.cgi?id=794910

gst/rtpmanager/gstrtpbin.c
gst/rtpmanager/gstrtpbin.h

index ad99c5b..569b027 100644 (file)
@@ -262,6 +262,7 @@ enum
   SIGNAL_RESET_SYNC,
   SIGNAL_GET_SESSION,
   SIGNAL_GET_INTERNAL_SESSION,
+  SIGNAL_GET_STORAGE,
   SIGNAL_GET_INTERNAL_STORAGE,
 
   SIGNAL_ON_NEW_SSRC,
@@ -1146,6 +1147,24 @@ gst_rtp_bin_get_internal_session (GstRtpBin * bin, guint session_id)
   return internal_session;
 }
 
+static GstElement *
+gst_rtp_bin_get_storage (GstRtpBin * bin, guint session_id)
+{
+  GstRtpBinSession *session;
+  GstElement *res = NULL;
+
+  GST_RTP_BIN_LOCK (bin);
+  GST_DEBUG_OBJECT (bin, "retrieving internal storage object, index: %u",
+      session_id);
+  session = find_session_by_id (bin, (gint) session_id);
+  if (session && session->storage) {
+    res = gst_object_ref (session->storage);
+  }
+  GST_RTP_BIN_UNLOCK (bin);
+
+  return res;
+}
+
 static GObject *
 gst_rtp_bin_get_internal_storage (GstRtpBin * bin, guint session_id)
 {
@@ -2126,6 +2145,21 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
       G_TYPE_OBJECT, 1, G_TYPE_UINT);
 
   /**
+   * GstRtpBin::get-storage:
+   * @rtpbin: the object which received the signal
+   * @id: the session id
+   *
+   * Request the RTPStorage element as #GObject in session @id.
+   *
+   * Since: 1.16
+   */
+  gst_rtp_bin_signals[SIGNAL_GET_STORAGE] =
+      g_signal_new ("get-storage", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRtpBinClass,
+          get_storage), NULL, NULL, g_cclosure_marshal_generic,
+      GST_TYPE_ELEMENT, 1, G_TYPE_UINT);
+
+  /**
    * GstRtpBin::on-new-ssrc:
    * @rtpbin: the object which received the signal
    * @session: the session
@@ -2704,6 +2738,7 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
   klass->get_session = GST_DEBUG_FUNCPTR (gst_rtp_bin_get_session);
   klass->get_internal_session =
       GST_DEBUG_FUNCPTR (gst_rtp_bin_get_internal_session);
+  klass->get_storage = GST_DEBUG_FUNCPTR (gst_rtp_bin_get_storage);
   klass->get_internal_storage =
       GST_DEBUG_FUNCPTR (gst_rtp_bin_get_internal_storage);
   klass->request_rtp_encoder = GST_DEBUG_FUNCPTR (gst_rtp_bin_request_encoder);
index aa93b0b..00f7654 100644 (file)
@@ -109,6 +109,7 @@ struct _GstRtpBinClass {
   void        (*reset_sync)           (GstRtpBin *rtpbin);
   GstElement* (*get_session)          (GstRtpBin *rtpbin, guint session);
   RTPSession* (*get_internal_session) (GstRtpBin *rtpbin, guint session);
+  GstElement* (*get_storage)          (GstRtpBin *rtpbin, guint session);
   GObject*    (*get_internal_storage) (GstRtpBin *rtpbin, guint session);
 
   /* session manager signals */