From 1df82fc14fe79ed24301e078425d3e3e30aabb0c Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Tue, 31 Dec 2013 23:18:54 +1100 Subject: [PATCH] androidmedia: Add new color format, and enhance debug output Add a new color format seen on my Galaxy S3 (OMX_SEC_COLOR_FormatNV12Tiled = 0x7fc00002) to the table, but don't actually implement it - the decoder doesn't choose it. Remove an assert that makes the plugin fail noisily and take the app down if it sees a color format it doesn't recognise (just skip the codec instead) Modify the debug output when plugin scanning to print color format info to make this sort of thing easier in the future. --- sys/androidmedia/gstamc-constants.h | 8 +++++++- sys/androidmedia/gstamc.c | 15 +++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sys/androidmedia/gstamc-constants.h b/sys/androidmedia/gstamc-constants.h index f263cdd..a885f22 100644 --- a/sys/androidmedia/gstamc-constants.h +++ b/sys/androidmedia/gstamc-constants.h @@ -97,7 +97,13 @@ enum COLOR_QCOM_FormatYUV420SemiPlanar = 0x7fa30c00, COLOR_QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka = 0x7fa30c03, /* From hardware/ti/omap4xxx/domx/omx_core/inc/OMX_TI_IVCommon.h */ - COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced = 0x7f000001 + COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced = 0x7f000001, + /* This format is Exynos specific from the OMX vendor-specific + * numeric range, but is defined in the Android OMX headers, so + * we shouldn't find incompatible usage and crash horribly... right? + * FIXME: Not actually implemented in the video decoder, it will just error out + * The format seems to be equiv to V4L2_PIX_FMT_NV12MT_16X16 */ + COLOR_OMX_SEC_FormatNV12Tiled = 0x7fc00002 }; enum diff --git a/sys/androidmedia/gstamc.c b/sys/androidmedia/gstamc.c index e7159f0..67e3cdf 100644 --- a/sys/androidmedia/gstamc.c +++ b/sys/androidmedia/gstamc.c @@ -1848,7 +1848,7 @@ scan_codecs (GstPlugin * plugin) color_formats_elems[k] = COLOR_TI_FormatYUV420PackedSemiPlanar; } - GST_INFO ("Color format %d: %d", k, color_formats_elems[k]); + GST_INFO ("Color format %d: 0x%x", k, color_formats_elems[k]); gst_codec_type->color_formats[k] = color_formats_elems[k]; } @@ -1861,9 +1861,9 @@ scan_codecs (GstPlugin * plugin) if (!ignore_unknown_color_formats && !accepted_color_formats (gst_codec_type, is_encoder)) { - GST_ERROR ("Codec has unknown color formats, ignoring"); + GST_ERROR ("%s codec has unknown color formats, ignoring", + is_encoder ? "Encoder" : "Decoder"); valid_codec = FALSE; - g_assert_not_reached (); goto next_supported_type; } } @@ -2126,7 +2126,8 @@ static const struct COLOR_TI_FormatYUV420PackedSemiPlanar, GST_VIDEO_FORMAT_NV12}, { COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced, GST_VIDEO_FORMAT_NV12}, { COLOR_QCOM_FormatYUV420SemiPlanar, GST_VIDEO_FORMAT_NV12}, { - COLOR_QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka, GST_VIDEO_FORMAT_NV12} + COLOR_QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka, GST_VIDEO_FORMAT_NV12}, { + COLOR_OMX_SEC_FormatNV12Tiled, GST_VIDEO_FORMAT_NV12} }; static gboolean @@ -2144,12 +2145,14 @@ accepted_color_formats (GstAmcCodecType * type, gboolean is_encoder) for (j = 0; j < G_N_ELEMENTS (color_format_mapping_table); j++) { if (color_format_mapping_table[j].color_format == type->color_formats[i]) { found = TRUE; + accepted++; break; } } - if (found) - accepted++; + if (!found) { + GST_DEBUG ("Unknown color format 0x%x, ignoring", type->color_formats[i]); + } } if (is_encoder) -- 2.7.4