[farsight2/master] Catch new recv pad in pad-added from GstRtpBin and call the appropriate FsRtpStream method
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:19:06 PST 2008
---
gst/fsrtpconference/fs-rtp-conference.c | 39 +++++++++++++++++++++++++++++++
gst/fsrtpconference/fs-rtp-session.c | 7 +++++
gst/fsrtpconference/fs-rtp-session.h | 4 +++
gst/fsrtpconference/fs-rtp-stream.c | 6 ++++
gst/fsrtpconference/fs-rtp-stream.h | 1 +
5 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-conference.c b/gst/fsrtpconference/fs-rtp-conference.c
index 6338953..027f961 100644
--- a/gst/fsrtpconference/fs-rtp-conference.c
+++ b/gst/fsrtpconference/fs-rtp-conference.c
@@ -35,6 +35,7 @@
#include "fs-rtp-conference.h"
#include "fs-rtp-session.h"
+#include "fs-rtp-stream.h"
#include "fs-rtp-participant.h"
GST_DEBUG_CATEGORY_STATIC (fs_rtp_conference_debug);
@@ -108,6 +109,9 @@ static GstCaps *fs_rtp_conference_rtpbin_request_pt_map (GstElement *element,
guint session_id,
guint pt,
gpointer user_data);
+static void fs_rtp_conference_rtpbin_pad_added (GstElement *rtpbin,
+ GstPad *new_pad,
+ gpointer user_data);
static void
@@ -203,6 +207,8 @@ fs_rtp_conference_init (FsRtpConference *conf,
g_signal_connect (conf->gstrtpbin, "request-pt-map",
G_CALLBACK (fs_rtp_conference_rtpbin_request_pt_map), conf);
+ g_signal_connect (conf->gstrtpbin, "pad-added",
+ G_CALLBACK (fs_rtp_conference_rtpbin_pad_added), conf);
}
static GstCaps *
@@ -227,6 +233,39 @@ fs_rtp_conference_rtpbin_request_pt_map (GstElement *element, guint session_id,
return caps;
}
+static void
+fs_rtp_conference_rtpbin_pad_added (GstElement *rtpbin, GstPad *new_pad,
+ gpointer user_data)
+{
+ FsRtpConference *self = FS_RTP_CONFERENCE (user_data);
+ gchar *name;
+
+ GST_DEBUG_OBJECT (self, "pad added %"GST_PTR_FORMAT, GST_PAD_CAPS (new_pad));
+
+ name = gst_pad_get_name (new_pad);
+
+ if (g_str_has_prefix (name, "recv_rtp_src_")) {
+ guint session_id, stream_id, pt;
+
+ if (sscanf (name, "recv_rtp_src_%u_%u_%u",
+ &session_id, &stream_id, &pt) == 3) {
+ FsRtpSession *session =
+ fs_rtp_conference_get_session_by_id (self, session_id);
+
+ if (session) {
+ FsRtpStream *stream =FS_RTP_STREAM_CAST (
+ fs_rtp_session_get_stream_by_id (session, stream_id));
+
+ if (stream)
+ fs_rtp_stream_new_recv_pad (stream, new_pad, pt);
+ }
+ }
+ }
+
+ g_free (name);
+}
+
+
/**
* fs_rtp_conference_get_session_by_id_locked
* @self: The #FsRtpConference
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 385ffbe..8691aff 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -473,3 +473,10 @@ fs_rtp_session_request_pt_map (FsRtpSession *session, guint pt)
{
return NULL;
}
+
+FsStream *
+fs_rtp_session_get_stream_by_id (FsRtpSession *session, guint stream_id)
+{
+ return NULL;
+}
+
diff --git a/gst/fsrtpconference/fs-rtp-session.h b/gst/fsrtpconference/fs-rtp-session.h
index db14e0e..221877d 100644
--- a/gst/fsrtpconference/fs-rtp-session.h
+++ b/gst/fsrtpconference/fs-rtp-session.h
@@ -29,6 +29,7 @@
#include <gst/farsight/fs-session.h>
+#include "fs-rtp-session.h"
#include "fs-rtp-conference.h"
G_BEGIN_DECLS
@@ -75,6 +76,9 @@ FsRtpSession *fs_rtp_session_new (FsMediaType media_type,
GstCaps *fs_rtp_session_request_pt_map (FsRtpSession *session, guint pt);
+FsStream *fs_rtp_session_get_stream_by_id (FsRtpSession *session,
+ guint stream_id);
+
G_END_DECLS
#endif /* __FS_RTP_SESSION_H__ */
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index 31ce710..833b02d 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -336,3 +336,9 @@ fs_rtp_stream_new (FsRtpSession *session,
"transmitter", transmitter,
NULL);
}
+
+
+void
+fs_rtp_stream_new_recv_pad (FsRtpStream *stream, GstPad *pad, guint pt)
+{
+}
diff --git a/gst/fsrtpconference/fs-rtp-stream.h b/gst/fsrtpconference/fs-rtp-stream.h
index 097d783..17d1f6d 100644
--- a/gst/fsrtpconference/fs-rtp-stream.h
+++ b/gst/fsrtpconference/fs-rtp-stream.h
@@ -75,6 +75,7 @@ FsRtpStream *fs_rtp_stream_new (FsRtpSession *session,
FsStreamDirection direction,
FsStreamTransmitter *transmitter);
+void fs_rtp_stream_new_recv_pad (FsRtpStream *stream, GstPad *pad, guint pt);
G_END_DECLS
--
1.5.6.5
More information about the farsight-commits
mailing list