summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager
diff options
context:
space:
mode:
authorAli Sabil <ali.sabil at gmail.com>2009-05-22 16:35:20 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2009-05-22 16:35:20 +0200
commit0d014baaa4c61010c98c6899cd2338da1423014b (patch)
tree8aef11c1e09c3289c25e87ea0a3f1e2a41bc88b1 /gst/rtpmanager
parent9353ceb53049a2fe31a6b986d039dc64208779df (diff)
downloadgst-plugins-bad-0d014baaa4c61010c98c6899cd2338da1423014b.tar.gz
gst-plugins-bad-0d014baaa4c61010c98c6899cd2338da1423014b.tar.bz2
gst-plugins-bad-0d014baaa4c61010c98c6899cd2338da1423014b.zip
ssrcdemux: emit signal when pads are removed
Add action signal to clear an SSRC in the ssrc demuxer. Add signal to notify of removed ssrc. See #554839
Diffstat (limited to 'gst/rtpmanager')
-rw-r--r--gst/rtpmanager/gstrtpbin-marshal.list1
-rw-r--r--gst/rtpmanager/gstrtpssrcdemux.c74
-rw-r--r--gst/rtpmanager/gstrtpssrcdemux.h6
3 files changed, 80 insertions, 1 deletions
diff --git a/gst/rtpmanager/gstrtpbin-marshal.list b/gst/rtpmanager/gstrtpbin-marshal.list
index c4bc0bb2..ed73e43b 100644
--- a/gst/rtpmanager/gstrtpbin-marshal.list
+++ b/gst/rtpmanager/gstrtpbin-marshal.list
@@ -3,5 +3,6 @@ BOXED:UINT
BOXED:UINT,UINT
OBJECT:UINT
VOID:UINT,OBJECT
+VOID:UINT
VOID:UINT,UINT
VOID:OBJECT,OBJECT
diff --git a/gst/rtpmanager/gstrtpssrcdemux.c b/gst/rtpmanager/gstrtpssrcdemux.c
index b9a279c2..6a305d8e 100644
--- a/gst/rtpmanager/gstrtpssrcdemux.c
+++ b/gst/rtpmanager/gstrtpssrcdemux.c
@@ -97,6 +97,8 @@ static GstElementDetails gst_rtp_ssrc_demux_details = {
enum
{
SIGNAL_NEW_SSRC_PAD,
+ SIGNAL_REMOVED_SSRC_PAD,
+ SIGNAL_CLEAR_SSRC,
LAST_SIGNAL
};
@@ -112,6 +114,9 @@ static void gst_rtp_ssrc_demux_finalize (GObject * object);
static GstStateChangeReturn gst_rtp_ssrc_demux_change_state (GstElement *
element, GstStateChange transition);
+static void gst_rtp_ssrc_demux_clear_ssrc (GstRtpSsrcDemux * demux,
+ guint32 ssrc);
+
/* sinkpad stuff */
static GstFlowReturn gst_rtp_ssrc_demux_chain (GstPad * pad, GstBuffer * buf);
static gboolean gst_rtp_ssrc_demux_sink_event (GstPad * pad, GstEvent * event);
@@ -245,9 +250,11 @@ gst_rtp_ssrc_demux_class_init (GstRtpSsrcDemuxClass * klass)
{
GObjectClass *gobject_klass;
GstElementClass *gstelement_klass;
+ GstRtpSsrcDemuxClass *gstrtpssrcdemux_klass;
gobject_klass = (GObjectClass *) klass;
gstelement_klass = (GstElementClass *) klass;
+ gstrtpssrcdemux_klass = (GstRtpSsrcDemuxClass *) klass;
gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_dispose);
gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_finalize);
@@ -267,8 +274,38 @@ gst_rtp_ssrc_demux_class_init (GstRtpSsrcDemuxClass * klass)
NULL, NULL, gst_rtp_bin_marshal_VOID__UINT_OBJECT,
G_TYPE_NONE, 2, G_TYPE_UINT, GST_TYPE_PAD);
+ /**
+ * GstRtpSsrcDemux::removed-ssrc-pad:
+ * @demux: the object which received the signal
+ * @ssrc: the SSRC of the pad
+ * @pad: the removed pad.
+ *
+ * Emited when a SSRC pad has been removed.
+ */
+ gst_rtp_ssrc_demux_signals[SIGNAL_REMOVED_SSRC_PAD] =
+ g_signal_new ("removed-ssrc-pad",
+ G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstRtpSsrcDemuxClass, removed_ssrc_pad),
+ NULL, NULL, gst_rtp_bin_marshal_VOID__UINT_OBJECT,
+ G_TYPE_NONE, 2, G_TYPE_UINT, GST_TYPE_PAD);
+
+ /**
+ * GstRtpSsrcDemux::clear-ssrc:
+ * @demux: the object which received the signal
+ * @ssrc: the SSRC of the pad
+ *
+ * Action signal to remove the pad for SSRC.
+ */
+ gst_rtp_ssrc_demux_signals[SIGNAL_CLEAR_SSRC] =
+ g_signal_new ("clear-ssrc",
+ G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GstRtpSsrcDemuxClass, clear_ssrc),
+ NULL, NULL, gst_rtp_bin_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
+
gstelement_klass->change_state =
GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_change_state);
+ gstrtpssrcdemux_klass->clear_ssrc =
+ GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_clear_ssrc);
GST_DEBUG_CATEGORY_INIT (gst_rtp_ssrc_demux_debug,
"rtpssrcdemux", 0, "RTP SSRC demuxer");
@@ -342,6 +379,43 @@ gst_rtp_ssrc_demux_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static void
+gst_rtp_ssrc_demux_clear_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc)
+{
+ GstRtpSsrcDemuxPad *dpad;
+
+ GST_PAD_LOCK (demux);
+ dpad = find_demux_pad_for_ssrc (demux, ssrc);
+ if (dpad != NULL)
+ goto unknown_pad;
+
+ GST_DEBUG_OBJECT (demux, "clearing pad for SSRC %08x", ssrc);
+
+ demux->srcpads = g_slist_remove (demux->srcpads, dpad);
+ GST_PAD_UNLOCK (demux);
+
+ gst_pad_set_active (dpad->rtp_pad, FALSE);
+ gst_pad_set_active (dpad->rtcp_pad, FALSE);
+
+ g_signal_emit (G_OBJECT (demux),
+ gst_rtp_ssrc_demux_signals[SIGNAL_REMOVED_SSRC_PAD], 0, ssrc,
+ dpad->rtp_pad);
+
+ gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpad->rtp_pad);
+ gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpad->rtcp_pad);
+
+ g_free (dpad);
+
+ return;
+
+ /* ERRORS */
+unknown_pad:
+ {
+ g_warning ("unknown SSRC %08x", ssrc);
+ return;
+ }
+}
+
static gboolean
gst_rtp_ssrc_demux_sink_event (GstPad * pad, GstEvent * event)
{
diff --git a/gst/rtpmanager/gstrtpssrcdemux.h b/gst/rtpmanager/gstrtpssrcdemux.h
index d89472af..d5a13caf 100644
--- a/gst/rtpmanager/gstrtpssrcdemux.h
+++ b/gst/rtpmanager/gstrtpssrcdemux.h
@@ -50,7 +50,11 @@ struct _GstRtpSsrcDemuxClass
GstElementClass parent_class;
/* signals */
- void (*new_ssrc_pad) (GstElement *element, guint32 ssrc, GstPad *pad);
+ void (*new_ssrc_pad) (GstRtpSsrcDemux *demux, guint32 ssrc, GstPad *pad);
+ void (*removed_ssrc_pad) (GstRtpSsrcDemux *demux, guint32 ssrc, GstPad *pad);
+
+ /* actions */
+ void (*clear_ssrc) (GstRtpSsrcDemux *demux, guint32 ssrc);
};
GType gst_rtp_ssrc_demux_get_type (void);