static void gst_rtp_pt_demux_finalize (GObject * object);
-static void gst_rtp_pt_demux_release (GstElement * element);
-static gboolean gst_rtp_pt_demux_setup (GstElement * element);
+static void gst_rtp_pt_demux_release (GstRtpPtDemux * ptdemux);
+static gboolean gst_rtp_pt_demux_setup (GstRtpPtDemux * ptdemux);
static GstFlowReturn gst_rtp_pt_demux_chain (GstPad * pad, GstBuffer * buf);
static GstStateChangeReturn gst_rtp_pt_demux_change_state (GstElement * element,
static void
gst_rtp_pt_demux_finalize (GObject * object)
{
- gst_rtp_pt_demux_release (GST_ELEMENT (object));
+ gst_rtp_pt_demux_release (GST_RTP_PT_DEMUX (object));
G_OBJECT_CLASS (parent_class)->finalize (object);
}
* Reserves resources for the object.
*/
static gboolean
-gst_rtp_pt_demux_setup (GstElement * element)
+gst_rtp_pt_demux_setup (GstRtpPtDemux * ptdemux)
{
- GstRtpPtDemux *ptdemux = GST_RTP_PT_DEMUX (element);
- gboolean res = TRUE;
+ ptdemux->srcpads = NULL;
+ ptdemux->last_pt = 0xFFFF;
- if (ptdemux) {
- ptdemux->srcpads = NULL;
- ptdemux->last_pt = 0xFFFF;
- }
-
- return res;
+ return TRUE;
}
/**
* Free resources for the object.
*/
static void
-gst_rtp_pt_demux_release (GstElement * element)
+gst_rtp_pt_demux_release (GstRtpPtDemux * ptdemux)
{
- GstRtpPtDemux *ptdemux = GST_RTP_PT_DEMUX (element);
+ GSList *walk;
+
+ for (walk = ptdemux->srcpads; walk; walk = g_slist_next (walk)) {
+ GstRtpPtDemuxPad *pad = walk->data;
- if (ptdemux) {
- /* note: GstElement's dispose() will handle the pads */
- g_slist_foreach (ptdemux->srcpads, (GFunc) g_free, NULL);
- g_slist_free (ptdemux->srcpads);
- ptdemux->srcpads = NULL;
+ gst_pad_set_active (pad->pad, FALSE);
+ gst_element_remove_pad (GST_ELEMENT_CAST (ptdemux), pad->pad);
+ g_free (pad);
}
+ g_slist_free (ptdemux->srcpads);
+ ptdemux->srcpads = NULL;
}
static GstStateChangeReturn
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
- if (gst_rtp_pt_demux_setup (element) != TRUE)
+ if (gst_rtp_pt_demux_setup (ptdemux) != TRUE)
ret = GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
case GST_STATE_CHANGE_PAUSED_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_NULL:
- gst_rtp_pt_demux_release (element);
+ gst_rtp_pt_demux_release (ptdemux);
break;
default:
break;
gst_segment_init (&demux->segment, GST_FORMAT_UNDEFINED);
}
+static void
+gst_rtp_ssrc_demux_reset (GstRtpSsrcDemux * demux)
+{
+ GSList *walk;
+
+ for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) {
+ GstRtpSsrcDemuxPad *dpad = (GstRtpSsrcDemuxPad *) walk->data;
+
+ gst_pad_set_active (dpad->rtp_pad, FALSE);
+ gst_pad_set_active (dpad->rtcp_pad, FALSE);
+
+ 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);
+ }
+ g_slist_free (demux->srcpads);
+ demux->srcpads = NULL;
+}
+
static void
gst_rtp_ssrc_demux_dispose (GObject * object)
{
demux = GST_RTP_SSRC_DEMUX (object);
- g_slist_foreach (demux->srcpads, (GFunc) g_free, NULL);
- g_slist_free (demux->srcpads);
- demux->srcpads = NULL;
+ gst_rtp_ssrc_demux_reset (demux);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
"latency for SSRC %08x, latency %" GST_TIME_FORMAT, demuxpad->ssrc,
GST_TIME_ARGS (demuxpad->first_ts));
-#if 0
- min_latency += demuxpad->first_ts;
- if (max_latency != -1)
- max_latency += demuxpad->first_ts;
-#endif
-
gst_query_set_latency (query, live, min_latency, max_latency);
}
break;
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
case GST_STATE_CHANGE_PAUSED_TO_READY:
+ gst_rtp_ssrc_demux_reset (demux);
+ break;
case GST_STATE_CHANGE_READY_TO_NULL:
default:
break;