From 92affe2dec1446c38ae65cf3c8f03363009c22fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Par=C3=ADs=20D=C3=ADaz?= Date: Thu, 10 Dec 2015 12:15:52 +0100 Subject: rtpbin: add "get-session" signal This gets the GstRTPSession element, as compared to the RTPSession object that is returned by get-internal-session. https://bugzilla.gnome.org/show_bug.cgi?id=759293 --- gst/rtpmanager/gstrtpbin.c | 34 ++++++++++++++++++++++++++++++++++ gst/rtpmanager/gstrtpbin.h | 1 + 2 files changed, 35 insertions(+) diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c index bc7ec6de4..227c7d7b5 100644 --- a/gst/rtpmanager/gstrtpbin.c +++ b/gst/rtpmanager/gstrtpbin.c @@ -249,6 +249,7 @@ enum SIGNAL_PAYLOAD_TYPE_CHANGE, SIGNAL_CLEAR_PT_MAP, SIGNAL_RESET_SYNC, + SIGNAL_GET_SESSION, SIGNAL_GET_INTERNAL_SESSION, SIGNAL_ON_NEW_SSRC, @@ -935,6 +936,23 @@ gst_rtp_bin_clear_pt_map (GstRtpBin * bin) gst_rtp_bin_reset_sync (bin); } +static GstElement * +gst_rtp_bin_get_session (GstRtpBin * bin, guint session_id) +{ + GstRtpBinSession *session; + GstElement *ret = NULL; + + GST_RTP_BIN_LOCK (bin); + GST_DEBUG_OBJECT (bin, "retrieving GstRtpSession, index: %d", session_id); + session = find_session_by_id (bin, (gint) session_id); + if (session) { + ret = gst_object_ref (session->session); + } + GST_RTP_BIN_UNLOCK (bin); + + return ret; +} + static RTPSession * gst_rtp_bin_get_internal_session (GstRtpBin * bin, guint session_id) { @@ -1846,6 +1864,21 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass) reset_sync), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE); + /** + * GstRtpBin::get-session: + * @rtpbin: the object which received the signal + * @id: the session id + * + * Request the related GstRtpSession as #GstElement related with session @id. + * + * Since: 1.8 + */ + gst_rtp_bin_signals[SIGNAL_GET_SESSION] = + g_signal_new ("get-session", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRtpBinClass, + get_session), NULL, NULL, g_cclosure_marshal_generic, + GST_TYPE_ELEMENT, 1, G_TYPE_UINT); + /** * GstRtpBin::get-internal-session: * @rtpbin: the object which received the signal @@ -2311,6 +2344,7 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass) klass->clear_pt_map = GST_DEBUG_FUNCPTR (gst_rtp_bin_clear_pt_map); klass->reset_sync = GST_DEBUG_FUNCPTR (gst_rtp_bin_reset_sync); + 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->request_rtp_encoder = GST_DEBUG_FUNCPTR (gst_rtp_bin_request_encoder); diff --git a/gst/rtpmanager/gstrtpbin.h b/gst/rtpmanager/gstrtpbin.h index e74a71804..01539d24e 100644 --- a/gst/rtpmanager/gstrtpbin.h +++ b/gst/rtpmanager/gstrtpbin.h @@ -100,6 +100,7 @@ struct _GstRtpBinClass { /* action signals */ void (*clear_pt_map) (GstRtpBin *rtpbin); void (*reset_sync) (GstRtpBin *rtpbin); + GstElement* (*get_session) (GstRtpBin *rtpbin, guint session); RTPSession* (*get_internal_session) (GstRtpBin *rtpbin, guint session); /* session manager signals */ -- cgit v1.2.1