androidmedia: Add new color format, and enhance debug output
authorJan Schmidt <jan@centricular.com>
Tue, 31 Dec 2013 12:18:54 +0000 (23:18 +1100)
committerJan Schmidt <jan@centricular.com>
Tue, 31 Dec 2013 12:24:06 +0000 (23:24 +1100)
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
sys/androidmedia/gstamc.c

index f263cdd..a885f22 100644 (file)
@@ -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
index e7159f0..67e3cdf 100644 (file)
@@ -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)