From 709b831a72fd580ebf5dfcf498fa112962bfc736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 16 May 2011 11:04:30 +0200 Subject: [PATCH] encodebin: Update for negotiation related API changes --- gst/encoding/gstencodebin.c | 2 +- gst/encoding/gstsmartencoder.c | 13 ++++++------- gst/encoding/gststreamcombiner.c | 4 ++-- gst/encoding/gststreamsplitter.c | 10 +++++----- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c index 8f1498f453..15d1fd3433 100644 --- a/gst/encoding/gstencodebin.c +++ b/gst/encoding/gstencodebin.c @@ -1108,7 +1108,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof, /* Check if stream format is compatible */ srcpad = gst_element_get_static_pad (sgroup->smartencoder, "src"); - tmpcaps = gst_pad_get_caps (srcpad); + tmpcaps = gst_pad_get_caps (srcpad, NULL); if (!gst_caps_can_intersect (tmpcaps, format)) { GST_DEBUG ("We don't have a smart encoder for the stream format"); gst_object_unref (sgroup->smartencoder); diff --git a/gst/encoding/gstsmartencoder.c b/gst/encoding/gstsmartencoder.c index 15e15b7534..a6a8b7cfe6 100644 --- a/gst/encoding/gstsmartencoder.c +++ b/gst/encoding/gstsmartencoder.c @@ -80,7 +80,7 @@ static gboolean setup_recoder_pipeline (GstSmartEncoder * smart_encoder); static GstFlowReturn gst_smart_encoder_chain (GstPad * pad, GstBuffer * buf); static gboolean smart_encoder_sink_event (GstPad * pad, GstEvent * event); -static GstCaps *smart_encoder_sink_getcaps (GstPad * pad); +static GstCaps *smart_encoder_sink_getcaps (GstPad * pad, GstCaps * filter); static GstStateChangeReturn gst_smart_encoder_change_state (GstElement * element, GstStateChange transition); @@ -381,25 +381,24 @@ smart_encoder_sink_event (GstPad * pad, GstEvent * event) } static GstCaps * -smart_encoder_sink_getcaps (GstPad * pad) +smart_encoder_sink_getcaps (GstPad * pad, GstCaps * filter) { GstCaps *peer, *tmpl, *res; GstSmartEncoder *smart_encoder = GST_SMART_ENCODER (gst_pad_get_parent (pad)); - /* Try getting it from downstream */ - peer = gst_pad_peer_get_caps_reffed (smart_encoder->srcpad); - /* Use computed caps */ if (smart_encoder->available_caps) tmpl = gst_caps_ref (smart_encoder->available_caps); else tmpl = gst_static_pad_template_get_caps (&src_template); + /* Try getting it from downstream */ + peer = gst_pad_peer_get_caps (smart_encoder->srcpad, tmpl); + if (peer == NULL) { res = tmpl; } else { - res = gst_caps_intersect (peer, tmpl); - gst_caps_unref (peer); + res = peer; gst_caps_unref (tmpl); } diff --git a/gst/encoding/gststreamcombiner.c b/gst/encoding/gststreamcombiner.c index d317907433..ca1bd7dbc8 100644 --- a/gst/encoding/gststreamcombiner.c +++ b/gst/encoding/gststreamcombiner.c @@ -132,12 +132,12 @@ gst_stream_combiner_sink_event (GstPad * pad, GstEvent * event) } static GstCaps * -gst_stream_combiner_sink_getcaps (GstPad * pad) +gst_stream_combiner_sink_getcaps (GstPad * pad, GstCaps * filter) { GstStreamCombiner *stream_combiner = (GstStreamCombiner *) GST_PAD_PARENT (pad); - return gst_pad_peer_get_caps_reffed (stream_combiner->srcpad); + return gst_pad_peer_get_caps (stream_combiner->srcpad, filter); } static gboolean diff --git a/gst/encoding/gststreamsplitter.c b/gst/encoding/gststreamsplitter.c index 1f448959fb..69e277ea72 100644 --- a/gst/encoding/gststreamsplitter.c +++ b/gst/encoding/gststreamsplitter.c @@ -242,7 +242,7 @@ beach: } static GstCaps * -gst_stream_splitter_sink_getcaps (GstPad * pad) +gst_stream_splitter_sink_getcaps (GstPad * pad, GstCaps * filter) { GstStreamSplitter *stream_splitter = (GstStreamSplitter *) GST_PAD_PARENT (pad); @@ -256,7 +256,7 @@ gst_stream_splitter_sink_getcaps (GstPad * pad) resync: if (G_UNLIKELY (stream_splitter->srcpads == NULL)) { - res = gst_caps_new_any (); + res = (filter ? gst_caps_ref (filter) : gst_caps_new_any ()); goto beach; } @@ -269,9 +269,9 @@ resync: STREAMS_UNLOCK (stream_splitter); if (res) - gst_caps_merge (res, gst_pad_peer_get_caps_reffed (srcpad)); + gst_caps_merge (res, gst_pad_peer_get_caps (srcpad, filter)); else - res = gst_pad_peer_get_caps (srcpad); + res = gst_pad_peer_get_caps (srcpad, filter); STREAMS_LOCK (stream_splitter); if (G_UNLIKELY (cookie != stream_splitter->cookie)) { @@ -316,7 +316,7 @@ resync: GstCaps *peercaps; STREAMS_UNLOCK (stream_splitter); - peercaps = gst_pad_peer_get_caps_reffed (srcpad); + peercaps = gst_pad_peer_get_caps (srcpad, NULL); if (peercaps) { res = gst_caps_can_intersect (caps, peercaps); gst_caps_unref (peercaps);