const char *mimetype_name;
} image_format_mimetype_pair_s;
-static const image_format_mimetype_pair_s image_format_mimetype_table[MM_UTIL_COLOR_NUM] = {
+static const image_format_mimetype_pair_s image_format_mimetype_table[] = {
{ MM_UTIL_COLOR_YUV420, MEDIA_FORMAT_YV12, "MEDIA_FORMAT_YV12" },
{ MM_UTIL_COLOR_YUV422, MEDIA_FORMAT_422P, "MEDIA_FORMAT_422P" },
{ MM_UTIL_COLOR_I420, MEDIA_FORMAT_I420, "MEDIA_FORMAT_I420" },
{ MM_UTIL_COLOR_NV61, -1, "Not support" }
};
+static const unsigned int image_format_mimetype_table_size = sizeof(image_format_mimetype_table) / sizeof(image_format_mimetype_pair_s);
+
static int _convert_colorspace_tbl[] = {
MM_UTIL_COLOR_YUV420, /* IMAGE_UTIL_COLORSPACE_YUV420 */
MM_UTIL_COLOR_YUV422, /* IMAGE_UTIL_COLORSPACE_YUV422 */
{
unsigned int i = 0;
- for (i = 0; i < MM_UTIL_COLOR_NUM; i++) {
+ for (i = 0; i < image_format_mimetype_table_size; i++) {
if (image_format_mimetype_table[i].image_format == format) {
image_util_debug("imgp fmt: %d mimetype fmt: %s", format, image_format_mimetype_table[i].mimetype_name);
return image_format_mimetype_table[i].mimetype;
}
}
- image_util_error("imgp fmt: %d", format);
+ image_util_error("not supported image format: %d", format);
+ /* if format can't be changed to mimetype, return max */
return MEDIA_FORMAT_MAX;
}
{
unsigned int i = 0;
- for (i = 0; i < MM_UTIL_COLOR_NUM; i++) {
+ for (i = 0; i < image_format_mimetype_table_size; i++) {
if (image_format_mimetype_table[i].mimetype == mimetype) {
- image_util_debug("mimetype: %s imgp fmt: %d", image_format_mimetype_table[i].mimetype_name, image_format_mimetype_table[i].image_format);
+ image_util_debug("mimetype: %s imgp fmt: %d", image_format_mimetype_table[i].mimetype_name,
+ image_format_mimetype_table[i].image_format);
return image_format_mimetype_table[i].image_format;
}
}
- image_util_error("mimetype: %s", image_format_mimetype_table[i].mimetype_name);
+ image_util_error("not supported mimetype: %d", mimetype);
+ /* if mimetype can't be changed to image format, return max */
return MM_UTIL_COLOR_NUM;
}