jitterbuffer: Use iterate internal links instead of deprecated get internal links

This commit is contained in:
Sebastian Dröge 2009-08-19 16:48:25 +02:00
parent 97cb7bdb6c
commit c8c02d2c7a

View file

@ -242,7 +242,7 @@ static void gst_rtp_jitter_buffer_release_pad (GstElement * element,
/* pad overrides */ /* pad overrides */
static GstCaps *gst_rtp_jitter_buffer_getcaps (GstPad * pad); static GstCaps *gst_rtp_jitter_buffer_getcaps (GstPad * pad);
static GList *gst_rtp_jitter_buffer_internal_links (GstPad * pad); static GstIterator *gst_rtp_jitter_buffer_iterate_internal_links (GstPad * pad);
/* sinkpad overrides */ /* sinkpad overrides */
static gboolean gst_jitter_buffer_sink_setcaps (GstPad * pad, GstCaps * caps); static gboolean gst_jitter_buffer_sink_setcaps (GstPad * pad, GstCaps * caps);
@ -466,27 +466,88 @@ gst_rtp_jitter_buffer_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
static GList * typedef struct
gst_rtp_jitter_buffer_internal_links (GstPad * pad)
{ {
GstIterator parent;
GstRtpJitterBuffer *jitterbuffer; GstRtpJitterBuffer *jitterbuffer;
GstPad *pad;
gboolean start;
} GstRtpJitterBufferIterator;
static void
_iterate_free (GstIterator * it)
{
GstRtpJitterBufferIterator *jit = (GstRtpJitterBufferIterator *) it;
g_object_unref (jit->jitterbuffer);
g_object_unref (jit->pad);
g_free (it);
}
static GstIteratorResult
_iterate_next (GstIterator * it, gpointer * result)
{
GstRtpJitterBufferIterator *jit = (GstRtpJitterBufferIterator *) it;
GstPad *res = NULL;
GstRtpJitterBufferPrivate *priv; GstRtpJitterBufferPrivate *priv;
GList *res = NULL;
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad)); priv = jit->jitterbuffer->priv;
priv = jitterbuffer->priv;
if (pad == priv->sinkpad) { if (!jit->start) {
res = g_list_prepend (res, priv->srcpad); /* go out */
} else if (pad == priv->srcpad) { } else if (jit->pad == priv->sinkpad) {
res = g_list_prepend (res, priv->sinkpad); res = priv->srcpad;
} else if (pad == priv->rtcpsinkpad) { } else if (jit->pad == priv->srcpad) {
res = priv->sinkpad;
} else if (jit->pad == priv->rtcpsinkpad) {
res = NULL; res = NULL;
} }
*result = res;
return res ? GST_ITERATOR_OK : GST_ITERATOR_DONE;
}
static GstIteratorItem
_iterate_item (GstIterator * it, gpointer item)
{
GstPad *pad = (GstPad *) item;
gst_object_ref (pad);
return GST_ITERATOR_ITEM_PASS;
}
static void
_iterate_resync (GstIterator * it)
{
GstRtpJitterBufferIterator *jit = (GstRtpJitterBufferIterator *) it;
jit->start = TRUE;
}
static GstIterator *
gst_rtp_jitter_buffer_iterate_internal_links (GstPad * pad)
{
GstRtpJitterBuffer *jitterbuffer;
GstRtpJitterBufferIterator *it;
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
it = (GstRtpJitterBufferIterator *)
gst_iterator_new (sizeof (GstRtpJitterBufferIterator),
GST_TYPE_PAD,
GST_OBJECT_CAST (jitterbuffer)->lock,
&GST_ELEMENT_CAST (jitterbuffer)->pads_cookie,
_iterate_next, _iterate_item, _iterate_resync, _iterate_free);
it->start = TRUE;
it->jitterbuffer = gst_object_ref (jitterbuffer);
it->pad = gst_object_ref (pad);
gst_object_unref (jitterbuffer); gst_object_unref (jitterbuffer);
return res; return (GstIterator *) it;
} }
static GstPad * static GstPad *
@ -505,8 +566,8 @@ create_rtcp_sink (GstRtpJitterBuffer * jitterbuffer)
gst_rtp_jitter_buffer_chain_rtcp); gst_rtp_jitter_buffer_chain_rtcp);
gst_pad_set_event_function (priv->rtcpsinkpad, gst_pad_set_event_function (priv->rtcpsinkpad,
(GstPadEventFunction) gst_rtp_jitter_buffer_sink_rtcp_event); (GstPadEventFunction) gst_rtp_jitter_buffer_sink_rtcp_event);
gst_pad_set_internal_link_function (priv->rtcpsinkpad, gst_pad_set_iterate_internal_links_function (priv->rtcpsinkpad,
gst_rtp_jitter_buffer_internal_links); gst_rtp_jitter_buffer_iterate_internal_links);
gst_pad_set_active (priv->rtcpsinkpad, TRUE); gst_pad_set_active (priv->rtcpsinkpad, TRUE);
gst_element_add_pad (GST_ELEMENT_CAST (jitterbuffer), priv->rtcpsinkpad); gst_element_add_pad (GST_ELEMENT_CAST (jitterbuffer), priv->rtcpsinkpad);