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
This commit is contained in:
Miguel París Díaz 2015-12-10 12:15:52 +01:00 committed by Sebastian Dröge
parent 9d0f127703
commit 92affe2dec
2 changed files with 35 additions and 0 deletions

View file

@ -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);

View file

@ -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 */