mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
omxvideodec: During negotiation of the output format make sure we use the correct OpenMAX format
This commit is contained in:
parent
07e0d674a0
commit
a80e2b9053
1 changed files with 26 additions and 10 deletions
|
@ -824,6 +824,12 @@ gst_omx_video_dec_stop (GstVideoDecoder * decoder)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GstVideoFormat format;
|
||||||
|
OMX_COLOR_FORMATTYPE type;
|
||||||
|
} VideoNegotiationMap;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
|
gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
|
||||||
{
|
{
|
||||||
|
@ -833,6 +839,7 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
|
||||||
OMX_VIDEO_PARAM_PORTFORMATTYPE param;
|
OMX_VIDEO_PARAM_PORTFORMATTYPE param;
|
||||||
OMX_ERRORTYPE err;
|
OMX_ERRORTYPE err;
|
||||||
GstCaps *comp_supported_caps;
|
GstCaps *comp_supported_caps;
|
||||||
|
GList *negotiation_map = NULL, *l;
|
||||||
GstCaps *intersection;
|
GstCaps *intersection;
|
||||||
GstVideoFormat format;
|
GstVideoFormat format;
|
||||||
gint old_index;
|
gint old_index;
|
||||||
|
@ -852,6 +859,8 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
|
||||||
old_index = -1;
|
old_index = -1;
|
||||||
comp_supported_caps = gst_caps_new_empty ();
|
comp_supported_caps = gst_caps_new_empty ();
|
||||||
do {
|
do {
|
||||||
|
VideoNegotiationMap *m;
|
||||||
|
|
||||||
err =
|
err =
|
||||||
gst_omx_component_get_parameter (self->component,
|
gst_omx_component_get_parameter (self->component,
|
||||||
OMX_IndexParamVideoPortFormat, ¶m);
|
OMX_IndexParamVideoPortFormat, ¶m);
|
||||||
|
@ -866,11 +875,19 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
|
||||||
if (err == OMX_ErrorNone) {
|
if (err == OMX_ErrorNone) {
|
||||||
switch (param.eColorFormat) {
|
switch (param.eColorFormat) {
|
||||||
case OMX_COLOR_FormatYUV420Planar:
|
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_caps_append_structure (comp_supported_caps,
|
||||||
gst_structure_new ("video/x-raw",
|
gst_structure_new ("video/x-raw",
|
||||||
"format", G_TYPE_STRING, "I420", NULL));
|
"format", G_TYPE_STRING, "I420", NULL));
|
||||||
break;
|
break;
|
||||||
case OMX_COLOR_FormatYUV420SemiPlanar:
|
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_caps_append_structure (comp_supported_caps,
|
||||||
gst_structure_new ("video/x-raw",
|
gst_structure_new ("video/x-raw",
|
||||||
"format", G_TYPE_STRING, "NV12", NULL));
|
"format", G_TYPE_STRING, "NV12", NULL));
|
||||||
|
@ -911,19 +928,18 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (format) {
|
for (l = negotiation_map; l; l = l->next) {
|
||||||
case GST_VIDEO_FORMAT_I420:
|
VideoNegotiationMap *m = l->data;
|
||||||
param.eColorFormat = OMX_COLOR_FormatYUV420Planar;
|
|
||||||
break;
|
if (m->format == format) {
|
||||||
case GST_VIDEO_FORMAT_NV12:
|
param.eColorFormat = m->type;
|
||||||
param.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
GST_ERROR_OBJECT (self, "Unknown color format: %u", format);
|
|
||||||
return FALSE;
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We must find something here */
|
||||||
|
g_assert (l != NULL);
|
||||||
|
|
||||||
/* Reset framerate, we only care about the color format here */
|
/* Reset framerate, we only care about the color format here */
|
||||||
param.xFramerate = 0;
|
param.xFramerate = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue