encodebin: Update for negotiation related API changes

This commit is contained in:
Sebastian Dröge 2011-05-16 11:04:30 +02:00
parent c020add91e
commit 709b831a72
4 changed files with 14 additions and 15 deletions

View file

@ -1108,7 +1108,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
/* Check if stream format is compatible */ /* Check if stream format is compatible */
srcpad = gst_element_get_static_pad (sgroup->smartencoder, "src"); 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)) { if (!gst_caps_can_intersect (tmpcaps, format)) {
GST_DEBUG ("We don't have a smart encoder for the stream format"); GST_DEBUG ("We don't have a smart encoder for the stream format");
gst_object_unref (sgroup->smartencoder); gst_object_unref (sgroup->smartencoder);

View file

@ -80,7 +80,7 @@ static gboolean setup_recoder_pipeline (GstSmartEncoder * smart_encoder);
static GstFlowReturn gst_smart_encoder_chain (GstPad * pad, GstBuffer * buf); static GstFlowReturn gst_smart_encoder_chain (GstPad * pad, GstBuffer * buf);
static gboolean smart_encoder_sink_event (GstPad * pad, GstEvent * event); 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 static GstStateChangeReturn
gst_smart_encoder_change_state (GstElement * element, gst_smart_encoder_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
@ -381,25 +381,24 @@ smart_encoder_sink_event (GstPad * pad, GstEvent * event)
} }
static GstCaps * static GstCaps *
smart_encoder_sink_getcaps (GstPad * pad) smart_encoder_sink_getcaps (GstPad * pad, GstCaps * filter)
{ {
GstCaps *peer, *tmpl, *res; GstCaps *peer, *tmpl, *res;
GstSmartEncoder *smart_encoder = GST_SMART_ENCODER (gst_pad_get_parent (pad)); 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 */ /* Use computed caps */
if (smart_encoder->available_caps) if (smart_encoder->available_caps)
tmpl = gst_caps_ref (smart_encoder->available_caps); tmpl = gst_caps_ref (smart_encoder->available_caps);
else else
tmpl = gst_static_pad_template_get_caps (&src_template); 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) { if (peer == NULL) {
res = tmpl; res = tmpl;
} else { } else {
res = gst_caps_intersect (peer, tmpl); res = peer;
gst_caps_unref (peer);
gst_caps_unref (tmpl); gst_caps_unref (tmpl);
} }

View file

@ -132,12 +132,12 @@ gst_stream_combiner_sink_event (GstPad * pad, GstEvent * event)
} }
static GstCaps * static GstCaps *
gst_stream_combiner_sink_getcaps (GstPad * pad) gst_stream_combiner_sink_getcaps (GstPad * pad, GstCaps * filter)
{ {
GstStreamCombiner *stream_combiner = GstStreamCombiner *stream_combiner =
(GstStreamCombiner *) GST_PAD_PARENT (pad); (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 static gboolean

View file

@ -242,7 +242,7 @@ beach:
} }
static GstCaps * static GstCaps *
gst_stream_splitter_sink_getcaps (GstPad * pad) gst_stream_splitter_sink_getcaps (GstPad * pad, GstCaps * filter)
{ {
GstStreamSplitter *stream_splitter = GstStreamSplitter *stream_splitter =
(GstStreamSplitter *) GST_PAD_PARENT (pad); (GstStreamSplitter *) GST_PAD_PARENT (pad);
@ -256,7 +256,7 @@ gst_stream_splitter_sink_getcaps (GstPad * pad)
resync: resync:
if (G_UNLIKELY (stream_splitter->srcpads == NULL)) { if (G_UNLIKELY (stream_splitter->srcpads == NULL)) {
res = gst_caps_new_any (); res = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
goto beach; goto beach;
} }
@ -269,9 +269,9 @@ resync:
STREAMS_UNLOCK (stream_splitter); STREAMS_UNLOCK (stream_splitter);
if (res) 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 else
res = gst_pad_peer_get_caps (srcpad); res = gst_pad_peer_get_caps (srcpad, filter);
STREAMS_LOCK (stream_splitter); STREAMS_LOCK (stream_splitter);
if (G_UNLIKELY (cookie != stream_splitter->cookie)) { if (G_UNLIKELY (cookie != stream_splitter->cookie)) {
@ -316,7 +316,7 @@ resync:
GstCaps *peercaps; GstCaps *peercaps;
STREAMS_UNLOCK (stream_splitter); STREAMS_UNLOCK (stream_splitter);
peercaps = gst_pad_peer_get_caps_reffed (srcpad); peercaps = gst_pad_peer_get_caps (srcpad, NULL);
if (peercaps) { if (peercaps) {
res = gst_caps_can_intersect (caps, peercaps); res = gst_caps_can_intersect (caps, peercaps);
gst_caps_unref (peercaps); gst_caps_unref (peercaps);