From: Sebastian Dröge Date: Thu, 20 Dec 2012 10:55:36 +0000 (+0100) Subject: omxvideodec: During negotiation of the output format make sure we use the correct... X-Git-Tag: 1.0.0~152 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a80e2b90536bee769703045c1c725dbdbe578e23;p=platform%2Fupstream%2Fgst-omx.git omxvideodec: During negotiation of the output format make sure we use the correct OpenMAX format --- diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index d7fde30..eeb4450 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -824,6 +824,12 @@ gst_omx_video_dec_stop (GstVideoDecoder * decoder) return TRUE; } +typedef struct +{ + GstVideoFormat format; + OMX_COLOR_FORMATTYPE type; +} VideoNegotiationMap; + static gboolean gst_omx_video_dec_negotiate (GstOMXVideoDec * self) { @@ -833,6 +839,7 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self) OMX_VIDEO_PARAM_PORTFORMATTYPE param; OMX_ERRORTYPE err; GstCaps *comp_supported_caps; + GList *negotiation_map = NULL, *l; GstCaps *intersection; GstVideoFormat format; gint old_index; @@ -852,6 +859,8 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self) old_index = -1; comp_supported_caps = gst_caps_new_empty (); do { + VideoNegotiationMap *m; + err = gst_omx_component_get_parameter (self->component, OMX_IndexParamVideoPortFormat, ¶m); @@ -866,11 +875,19 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self) if (err == OMX_ErrorNone) { switch (param.eColorFormat) { case OMX_COLOR_FormatYUV420Planar: + m = g_slice_new0 (VideoNegotiationMap); + m->format = GST_VIDEO_FORMAT_I420; + m->type = param.eColorFormat; + negotiation_map = g_list_append (negotiation_map, m); gst_caps_append_structure (comp_supported_caps, gst_structure_new ("video/x-raw", "format", G_TYPE_STRING, "I420", NULL)); break; case OMX_COLOR_FormatYUV420SemiPlanar: + m = g_slice_new0 (VideoNegotiationMap); + m->format = GST_VIDEO_FORMAT_NV12; + m->type = param.eColorFormat; + negotiation_map = g_list_append (negotiation_map, m); gst_caps_append_structure (comp_supported_caps, gst_structure_new ("video/x-raw", "format", G_TYPE_STRING, "NV12", NULL)); @@ -911,19 +928,18 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self) return FALSE; } - switch (format) { - case GST_VIDEO_FORMAT_I420: - param.eColorFormat = OMX_COLOR_FormatYUV420Planar; - break; - case GST_VIDEO_FORMAT_NV12: - param.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; - break; - default: - GST_ERROR_OBJECT (self, "Unknown color format: %u", format); - return FALSE; + for (l = negotiation_map; l; l = l->next) { + VideoNegotiationMap *m = l->data; + + if (m->format == format) { + param.eColorFormat = m->type; break; + } } + /* We must find something here */ + g_assert (l != NULL); + /* Reset framerate, we only care about the color format here */ param.xFramerate = 0;