[farsight2/master] Instantiate the GstRtpBin element

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:19:01 PST 2008


---
 gst/fsrtpconference/fs-rtp-conference.c |   46 ++++++++++++++++++++++++++++---
 1 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-conference.c b/gst/fsrtpconference/fs-rtp-conference.c
index df587e3..7552274 100644
--- a/gst/fsrtpconference/fs-rtp-conference.c
+++ b/gst/fsrtpconference/fs-rtp-conference.c
@@ -79,7 +79,9 @@ static GstStaticPadTemplate fs_rtp_conference_src_template =
 
 struct _FsRtpConferencePrivate
 {
-  gint something;
+  GstElement *gstrtpbin;
+
+  gboolean disposed;
 };
 
 static void fs_rtp_conference_do_init (gpointer g_class);
@@ -103,6 +105,25 @@ fs_rtp_conference_do_init (gpointer g_class)
 }
 
 static void
+fs_rtp_conference_dispose (GObject * object)
+{
+  FsRtpConference *self = FS_RTP_CONFERENCE (object);
+
+  if (self->priv->disposed)
+    return;
+
+  if (self->priv->gstrtpbin) {
+    gst_object_unref (self->priv->gstrtpbin);
+    self->priv->gstrtpbin = NULL;
+  }
+
+  self->priv->disposed = TRUE;
+
+  G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+
+static void
 fs_rtp_conference_finalize (GObject * object)
 {
   FsRtpConference *conf = FS_RTP_CONFERENCE (object);
@@ -126,6 +147,7 @@ fs_rtp_conference_class_init (FsRtpConferenceClass * klass)
     GST_DEBUG_FUNCPTR (fs_rtp_conference_new_participant);
 
   gobject_class->finalize = GST_DEBUG_FUNCPTR (fs_rtp_conference_finalize);
+  gobject_class->dispose = GST_DEBUG_FUNCPTR (fs_rtp_conference_dispose);
 
   gst_element_class_set_details (gstelement_class, &fs_rtp_conference_details);
 
@@ -146,11 +168,27 @@ static void
 fs_rtp_conference_init (FsRtpConference *conf,
     FsRtpConferenceClass *bclass)
 {
-  GstPadTemplate *pad_template;
-
-  GST_DEBUG ("fs_rtp_conference_init");
+  GST_DEBUG_OBJECT (conf, "fs_rtp_conference_init");
 
   conf->priv = FS_RTP_CONFERENCE_GET_PRIVATE (conf);
+
+  conf->priv->disposed = FALSE;
+
+  conf->priv->gstrtpbin = gst_element_factory_make ("gstrtpbin", NULL);
+
+  if (!conf->priv->gstrtpbin) {
+    GST_ERROR_OBJECT (conf, "Could not create GstRtpBin element");
+    return;
+  }
+
+  if (!gst_bin_add (GST_BIN (conf), conf->priv->gstrtpbin)) {
+    GST_ERROR_OBJECT (conf, "Could not create GstRtpBin element");
+    gst_object_unref (conf->priv->gstrtpbin);
+    return;
+  }
+
+  gst_object_ref (conf->priv->gstrtpbin);
+
 }
 
 
-- 
1.5.6.5




More information about the farsight-commits mailing list