From 7354baec6618df4efe22d822966c0e549f731373 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 20 Dec 2012 11:40:13 +0100 Subject: [PATCH] omxvideodec: Improve format negotiation a bit Don't leak caps and make sure to fixate caps. --- omx/gstomxvideodec.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index aee615d..65fcdbc 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -833,24 +833,13 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self) OMX_VIDEO_PARAM_PORTFORMATTYPE param; OMX_ERRORTYPE err; GstCaps *comp_supported_caps; - GstCaps *templ_caps; - GstCaps *peer_caps, *intersection; + GstCaps *intersection; GstVideoFormat format; gint old_index; GstStructure *s; const gchar *format_str; - templ_caps = - gst_caps_copy (gst_pad_get_pad_template_caps (GST_VIDEO_DECODER_SRC_PAD - (self))); - peer_caps = - gst_pad_peer_query_caps (GST_VIDEO_DECODER_SRC_PAD (self), templ_caps); - if (peer_caps) { - intersection = peer_caps; - gst_caps_unref (templ_caps); - } else { - intersection = templ_caps; - } + intersection = gst_pad_get_allowed_caps (GST_VIDEO_DECODER_SRC_PAD (self)); GST_OMX_INIT_STRUCT (¶m); param.nPortIndex = port->index; @@ -901,6 +890,8 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self) intersection = tmp; } + gst_caps_unref (comp_supported_caps); + if (gst_caps_is_empty (intersection)) { gst_caps_unref (intersection); GST_ERROR_OBJECT (self, "Empty caps"); @@ -908,6 +899,7 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self) } intersection = gst_caps_truncate (intersection); + intersection = gst_caps_fixate (intersection); s = gst_caps_get_structure (intersection, 0); format_str = gst_structure_get_string (s, "format"); -- 2.7.4