[farsight2/master] Implement request-pt-map signal handler shell
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:19:02 PST 2008
---
gst/fsrtpconference/fs-rtp-conference.c | 83 ++++++++++++++++++++++++++++++-
gst/fsrtpconference/fs-rtp-session.c | 7 +++
gst/fsrtpconference/fs-rtp-session.h | 4 ++
3 files changed, 92 insertions(+), 2 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-conference.c b/gst/fsrtpconference/fs-rtp-conference.c
index 8a8dbcd..c8d2a1f 100644
--- a/gst/fsrtpconference/fs-rtp-conference.c
+++ b/gst/fsrtpconference/fs-rtp-conference.c
@@ -197,19 +197,98 @@ fs_rtp_conference_init (FsRtpConference *conf,
gst_object_ref (conf->priv->gstrtpbin);
+ g_signal_connect (conf->priv->gstrtpbin, "request-pt-map",
+ G_CALLBACK (fs_rtp_conference_request_pt_map), conf);
}
+static GstCaps *
+fs_rtp_conference_request_pt_map (GstElement *element, guint session_id,
+ guint pt, gpointer user_data)
+{
+ FsRtpConference *self = FS_RTP_CONFERENCE (user_data);
+ FsRtpSession *session = NULL;
+ GstCaps *caps = NULL;
+
+ session = fs_rtp_conference_get_session_by_id (self, session_id);
+
+ if (session) {
+ caps = fs_rtp_session_request_pt_map (session, pt);
+ g_object_unref (session);
+ } else {
+ GST_WARNING_OBJECT(self,"GstRtpBin %p tried to request the caps for "
+ " payload type %u for non-existent session %u",
+ element, pt, session_id);
+ }
+
+ return caps;
+}
+
+/**
+ * fs_rtp_conference_get_session_by_id
+ * @self: The #FsRtpConference
+ * @session_id: The session id
+ *
+ * Gets the #FsRtpSession from a list of sessions or NULL if it doesnt exist
+ *
+ * Return value: A #FsRtpSession (unref after use) or NULL if it doesn't exist
+ */
+static FsRtpSession *
+fs_rtp_conference_get_session_by_id (FsRtpConference *self, guint session_id)
+{
+ GList *item = NULL;
+
+ GST_OBJECT_LOCK (self->priv->sessions);
+
+ for (item = g_list_first (self->priv->sessions);
+ item;
+ item = g_list_next (item)) {
+ /*
+ Must implement ID
+
+ FsRtpSession *session = item->data;
+ if (session->id == session_id) {
+ g_object_ref(session);
+ break;
+ }
+ */
+ }
+
+ GST_OBJECT_UNLOCK (self->priv->sessions);
+
+ if (item)
+ return FS_RTP_SESSION (item->data);
+ else
+ return NULL;
+
+}
+
+static void
+_remove_session (gpointer user_data,
+ GObject *where_the_object_was)
+{
+ FsRtpConference *self = FS_RTP_CONFERENCE (user_data);
+
+ GST_OBJECT_LOCK (self);
+ self->priv->sessions =
+ g_list_remove_all (self->priv->sessions, where_the_object_was);
+ GST_OBJECT_UNLOCK (self);
+}
static FsSession *
fs_rtp_conference_new_session (FsBaseConference *conf,
FsMediaType media_type)
{
- FsRtpConference *rtp_conf = FS_RTP_CONFERENCE (conf);
-
+ FsRtpConference *self = FS_RTP_CONFERENCE (conf);
FsSession *new_session = NULL;
new_session = FS_SESSION_CAST (fs_rtp_session_new (media_type));
+ GST_OBJECT_LOCK (self);
+ self->priv->sessions = g_list_append (self->priv->sessions, new_session);
+ GST_OBJECT_UNLOCK (self);
+
+ g_object_weak_ref (G_OBJECT (new_session), _remove_session, self);
+
return new_session;
}
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 5cf6f00..953e36c 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -342,3 +342,10 @@ fs_rtp_session_new (FsMediaType media_type)
{
return g_object_new (FS_TYPE_RTP_SESSION, "media-type", media_type, NULL);
}
+
+
+GstCaps *
+fs_rtp_session_request_pt_map (FsRtpSession *session, guint pt)
+{
+ return NULL;
+}
diff --git a/gst/fsrtpconference/fs-rtp-session.h b/gst/fsrtpconference/fs-rtp-session.h
index 9a075aa..0cc4d1e 100644
--- a/gst/fsrtpconference/fs-rtp-session.h
+++ b/gst/fsrtpconference/fs-rtp-session.h
@@ -25,6 +25,8 @@
#ifndef __FS_RTP_SESSION_H__
#define __FS_RTP_SESSION_H__
+#include <gst/gst.h>
+
#include <gst/farsight/fs-session.h>
G_BEGIN_DECLS
@@ -66,6 +68,8 @@ GType fs_rtp_session_get_type (void);
FsRtpSession *fs_rtp_session_new (FsMediaType media_type);
+GstCaps *fs_rtp_session_request_pt_map (FsRtpSession *session, guint pt);
+
G_END_DECLS
#endif /* __FS_RTP_SESSION_H__ */
--
1.5.6.5
More information about the farsight-commits
mailing list