From: Jindrich Makovicka Date: Thu, 26 May 2011 08:48:05 +0000 (+0200) Subject: textrender: Correctly negotiate with downstream instead of just using random caps X-Git-Tag: 1.19.3~511^2~6555^2~842 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ba4a56d7497a26af24ed27699ff72144bc9e4dd;p=platform%2Fupstream%2Fgstreamer.git textrender: Correctly negotiate with downstream instead of just using random caps Fixes bug #638897. --- diff --git a/ext/pango/gsttextrender.c b/ext/pango/gsttextrender.c index c0129f5..e200758 100644 --- a/ext/pango/gsttextrender.c +++ b/ext/pango/gsttextrender.c @@ -467,7 +467,7 @@ gst_text_render_chain (GstPad * pad, GstBuffer * inbuf) GstTextRender *render; GstFlowReturn ret; GstBuffer *outbuf; - GstCaps *caps = NULL; + GstCaps *caps = NULL, *padcaps, *peercaps; guint8 *data = GST_BUFFER_DATA (inbuf); guint size = GST_BUFFER_SIZE (inbuf); gint n; @@ -489,16 +489,21 @@ gst_text_render_chain (GstPad * pad, GstBuffer * inbuf) gst_text_render_check_argb (render); - if (!render->use_ARGB) { - caps = - gst_video_format_new_caps (GST_VIDEO_FORMAT_AYUV, render->width, - render->height, 1, 1, 1, 1); - } else { - caps = - gst_video_format_new_caps (GST_VIDEO_FORMAT_ARGB, render->width, - render->height, 1, 1, 1, 1); + peercaps = gst_pad_peer_get_caps (render->srcpad); + padcaps = gst_pad_get_caps (render->srcpad); + caps = gst_caps_intersect (padcaps, peercaps); + gst_caps_unref (padcaps); + gst_caps_unref (peercaps); + + if (!caps || gst_caps_is_empty (caps)) { + GST_ELEMENT_ERROR (render, CORE, NEGOTIATION, (NULL), (NULL)); + ret = GST_FLOW_ERROR; + goto done; } + gst_caps_truncate (caps); + gst_pad_fixate_caps (render->srcpad, caps); + if (!gst_pad_set_caps (render->srcpad, caps)) { GST_ELEMENT_ERROR (render, CORE, NEGOTIATION, (NULL), (NULL)); ret = GST_FLOW_ERROR;