+int
+_mmplayer_get_pixtype(unsigned int fourcc)
+{
+ int pixtype = MM_PIXEL_FORMAT_INVALID;
+
+#ifdef __DEBUG__
+ char *pfourcc = (char *)&fourcc;
+
+ LOGD("fourcc(%c%c%c%c)",
+ pfourcc[0], pfourcc[1], pfourcc[2], pfourcc[3]);
+#endif
+
+ switch (fourcc) {
+ case GST_MAKE_FOURCC('S', 'N', '1', '2'):
+ case GST_MAKE_FOURCC('N', 'V', '1', '2'):
+ pixtype = MM_PIXEL_FORMAT_NV12;
+ break;
+ case GST_MAKE_FOURCC('S', 'T', '1', '2'):
+ pixtype = MM_PIXEL_FORMAT_NV12T;
+ break;
+ case GST_MAKE_FOURCC('S', 'N', '2', '1'):
+ case GST_MAKE_FOURCC('N', 'V', '2', '1'):
+ pixtype = MM_PIXEL_FORMAT_NV21;
+ break;
+ case GST_MAKE_FOURCC('S', 'U', 'Y', 'V'):
+ case GST_MAKE_FOURCC('Y', 'U', 'Y', 'V'):
+ case GST_MAKE_FOURCC('Y', 'U', 'Y', '2'):
+ pixtype = MM_PIXEL_FORMAT_YUYV;
+ break;
+ case GST_MAKE_FOURCC('S', 'Y', 'V', 'Y'):
+ case GST_MAKE_FOURCC('U', 'Y', 'V', 'Y'):
+ pixtype = MM_PIXEL_FORMAT_UYVY;
+ break;
+ case GST_MAKE_FOURCC('S', '4', '2', '0'):
+ case GST_MAKE_FOURCC('I', '4', '2', '0'):
+ pixtype = MM_PIXEL_FORMAT_I420;
+ break;
+ case GST_MAKE_FOURCC('Y', 'V', '1', '2'):
+ pixtype = MM_PIXEL_FORMAT_YV12;
+ break;
+ case GST_MAKE_FOURCC('4', '2', '2', 'P'):
+ pixtype = MM_PIXEL_FORMAT_422P;
+ break;
+ case GST_MAKE_FOURCC('R', 'G', 'B', 'P'):
+ pixtype = MM_PIXEL_FORMAT_RGB565;
+ break;
+ case GST_MAKE_FOURCC('R', 'G', 'B', '3'):
+ pixtype = MM_PIXEL_FORMAT_RGB888;
+ break;
+ case GST_MAKE_FOURCC('A', 'R', 'G', 'B'):
+ case GST_MAKE_FOURCC('x', 'R', 'G', 'B'):
+ pixtype = MM_PIXEL_FORMAT_ARGB;
+ break;
+ case GST_MAKE_FOURCC('B', 'G', 'R', 'A'):
+ case GST_MAKE_FOURCC('B', 'G', 'R', 'x'):
+ case GST_MAKE_FOURCC('S', 'R', '3', '2'):
+ pixtype = MM_PIXEL_FORMAT_RGBA;
+ break;
+ case GST_MAKE_FOURCC('J', 'P', 'E', 'G'):
+ case GST_MAKE_FOURCC('P', 'N', 'G', ' '):
+ pixtype = MM_PIXEL_FORMAT_ENCODED;
+ break;
+ case GST_MAKE_FOURCC('I', 'T', 'L', 'V'):
+ pixtype = MM_PIXEL_FORMAT_ITLV_JPEG_UYVY;
+ break;
+ default:
+ LOGE("Not supported fourcc type(%c%c%c%c)",
+ fourcc, fourcc>>8, fourcc>>16, fourcc>>24);
+ pixtype = MM_PIXEL_FORMAT_INVALID;
+ break;
+ }
+
+ return pixtype;
+}
+
+static int
+__mmplayer_storage_supported_cb(int storage_id, storage_type_e type,
+ storage_state_e state, const char *path, void *user_data)
+{
+ mmplayer_storage_info_t *storage_info = (mmplayer_storage_info_t *)user_data;
+
+ MMPLAYER_RETURN_VAL_IF_FAIL(storage_info, FALSE);
+
+ if (type == storage_info->type && strstr(storage_info->path, path)) {
+ storage_info->id = storage_id;
+ storage_info->state = state;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+bool
+_mmplayer_get_storage_info(const char *path, mmplayer_storage_info_t *storage_info)
+{
+ int ret = 0;
+ const char *file_path = path;
+
+ MMPLAYER_RETURN_VAL_IF_FAIL(file_path && storage_info, false);
+
+ if (strncmp(file_path, "file://", strlen("file://")) == 0)
+ file_path = path + 7; /* remove file prefix */
+
+ if (strncmp(file_path, MEDIA_PATH_EXTERNAL, strlen(MEDIA_PATH_EXTERNAL)) == 0) {
+ storage_info->type = STORAGE_TYPE_EXTERNAL;
+
+ memset(storage_info->path, 0x00, MM_MAX_URL_LEN);
+ g_snprintf(storage_info->path, MM_MAX_URL_LEN, "%s", file_path);
+
+ ret = storage_foreach_device_supported((storage_device_supported_cb)__mmplayer_storage_supported_cb, storage_info);
+ if (ret != STORAGE_ERROR_NONE) {
+ LOGE("failed to check supported storage 0x%x", ret);
+ return false;
+ }
+
+ if (storage_info->state <= STORAGE_STATE_REMOVED) {
+ LOGE("need to check the external storage state %d:%d", storage_info->id, storage_info->state);
+ return false;
+ }
+ } else {
+ storage_info->type = STORAGE_TYPE_INTERNAL;
+ storage_info->state = STORAGE_STATE_MOUNTED;
+ }
+
+ LOGD("storage info %d:%d:%d", storage_info->type, storage_info->id, storage_info->state);
+ return true;
+}
+
+media_format_mimetype_e _mmplayer_convert_audio_pcm_str_to_media_format_mime(const gchar *audio_pcm_str)
+{
+ if (!audio_pcm_str) {
+ LOGW("audio pcm str is NULL");
+ return MEDIA_FORMAT_MAX;
+ }
+
+ if (strstr(audio_pcm_str, "S16LE"))
+ return MEDIA_FORMAT_PCM_S16LE;
+ else if (strstr(audio_pcm_str, "S24LE"))
+ return MEDIA_FORMAT_PCM_S24LE;
+ else if (strstr(audio_pcm_str, "S32LE"))
+ return MEDIA_FORMAT_PCM_S32LE;
+ else if (strstr(audio_pcm_str, "S16BE"))
+ return MEDIA_FORMAT_PCM_S16BE;
+ else if (strstr(audio_pcm_str, "S24BE"))
+ return MEDIA_FORMAT_PCM_S24BE;
+ else if (strstr(audio_pcm_str, "S32BE"))
+ return MEDIA_FORMAT_PCM_S32BE;
+ else if (strstr(audio_pcm_str, "F32LE"))
+ return MEDIA_FORMAT_PCM_F32LE;
+ else if (strstr(audio_pcm_str, "F32BE"))
+ return MEDIA_FORMAT_PCM_F32BE;
+ else if (strstr(audio_pcm_str, "U16LE"))
+ return MEDIA_FORMAT_PCM_U16LE;
+ else if (strstr(audio_pcm_str, "U24LE"))
+ return MEDIA_FORMAT_PCM_U24LE;
+ else if (strstr(audio_pcm_str, "U32LE"))
+ return MEDIA_FORMAT_PCM_U32LE;
+ else if (strstr(audio_pcm_str, "U16BE"))
+ return MEDIA_FORMAT_PCM_U16BE;
+ else if (strstr(audio_pcm_str, "U24BE"))
+ return MEDIA_FORMAT_PCM_U24BE;
+ else if (strstr(audio_pcm_str, "U32BE"))
+ return MEDIA_FORMAT_PCM_U32BE;
+ else {
+ LOGW("Not supported audio pcm format str : %s", audio_pcm_str);
+ return MEDIA_FORMAT_MAX;
+ }
+}
+
+gboolean _mmplayer_use_uridecodebin3(mmplayer_t *player) /* MMPLAYER_USE_URIDECODEBIN3(player) */
+{
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+
+ if (MMPLAYER_IS_RTSP_STREAMING(player) ||
+ MMPLAYER_IS_MS_BUFF_SRC(player))
+ return FALSE;
+
+ if (!player->ini.use_uridecodebin3)
+ return FALSE;
+
+ return TRUE;
+}