the external storage can be multiple.
- one sdcard and several usb.
Change-Id: Ib6731e336d9a2d0f504858dfc7eaba020acf044c
Name: libmm-player
Summary: Multimedia Framework Player Library
-Version: 0.6.78
+Version: 0.6.79
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
/**
* This function is to manage the playback according to the external storage state
*/
-int mm_player_manage_external_storage_state(MMHandleType player, int state);
+int mm_player_manage_external_storage_state(MMHandleType player, int id, int state);
/**
* These functions are to set/get the max variant of HAS
storage_type_e type;
storage_state_e state;
int id;
+ char path[MM_MAX_URL_LEN];
} MMPlayerStorageInfo;
typedef struct {
int _mmplayer_set_pcm_spec(MMHandleType hplayer, int samplerate, int channel);
int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout);
int _mmplayer_get_num_of_video_out_buffers(MMHandleType hplayer, int *num, int *extra_num);
-int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int state);
+int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int id, int state);
int __mmplayer_gst_set_state(mm_player_t* player, GstElement * pipeline, GstState state, gboolean async, gint timeout);
int __mmplayer_set_state(mm_player_t* player, int state);
int __mmplayer_check_state(mm_player_t* player, enum PlayerCommandState command);
return result;
}
-int mm_player_manage_external_storage_state(MMHandleType player, int state)
+int mm_player_manage_external_storage_state(MMHandleType player, int id, int state)
{
int result = MM_ERROR_NONE;
MMPLAYER_CMD_LOCK(player);
- result = _mmplayer_manage_external_storage_state(player, state);
+ result = _mmplayer_manage_external_storage_state(player, id, state);
MMPLAYER_CMD_UNLOCK(player);
/* check storage state */
storage_get_state(player->storage_info[path_type].id, &storage_state);
player->storage_info[path_type].state = storage_state;
- LOGW("path %d, storage state %d", path_type, storage_state);
+ LOGW("path %d, storage state %d:%d", path_type, player->storage_info[path_type].id, storage_state);
}
} /* fall through */
case GST_RESOURCE_ERROR_WRITE:
if (path_type == MMPLAYER_PATH_MAX || path_type == i) {
player->storage_info[i].type = STORAGE_TYPE_INTERNAL;
- player->storage_info[i].state = STORAGE_STATE_MOUNTED;
+ player->storage_info[i].state = STORAGE_STATE_UNMOUNTABLE;
player->storage_info[i].id = -1;
+ memset(player->storage_info[i].path, 0x00, MM_MAX_URL_LEN);
if (path_type != MMPLAYER_PATH_MAX)
break;
MMPLAYER_FLEAVE();
}
-int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int state)
+int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int id, int state)
{
int ret = MM_ERROR_NONE;
mm_player_t* player = (mm_player_t*)hplayer;
MMPLAYER_FENTER();
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- LOGD("storage state : %d", state);
+ LOGW("state changed storage %d:%d", id, state);
if (state != STORAGE_STATE_UNMOUNTABLE && state != STORAGE_STATE_REMOVED)
return MM_ERROR_NONE;
- if ((player->storage_info[MMPLAYER_PATH_VOD].type == STORAGE_TYPE_EXTERNAL) ||
- (player->storage_info[MMPLAYER_PATH_TEXT].type == STORAGE_TYPE_EXTERNAL)) {
- LOGW("external storage is removed.");
+ /* FIXME: text path should be handled seperately. */
+ if (((player->storage_info[MMPLAYER_PATH_VOD].type == STORAGE_TYPE_EXTERNAL) && (player->storage_info[MMPLAYER_PATH_VOD].id == id)) ||
+ ((player->storage_info[MMPLAYER_PATH_TEXT].type == STORAGE_TYPE_EXTERNAL) && (player->storage_info[MMPLAYER_PATH_TEXT].id == id))) {
+ LOGW("external storage is removed");
if (player->msg_posted == FALSE) {
memset(&msg_param, 0, sizeof(MMMessageParamType));
#include <tzplatform_config.h>
#include "mm_player_utils.h"
-#define MEDIA_PATH_EXTERNAL tzplatform_getenv(TZ_SYS_STORAGE) /* external storage */
+#define MEDIA_PATH_EXTERNAL tzplatform_getenv(TZ_SYS_STORAGE) /* external storage, sd card, usb */
int util_exist_file_path(const char *file_path)
{
MMPLAYER_RETURN_VAL_IF_FAIL(storage_info, FALSE);
- if (type == storage_info->type) {
+ if (type == storage_info->type && strstr(storage_info->path, path)) {
storage_info->id = storage_id;
storage_info->state = state;
return FALSE;
else
storage_info->type = STORAGE_TYPE_INTERNAL;
+ 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)_util_storage_supported_cb, storage_info);
if (ret != STORAGE_ERROR_NONE) {
- LOGE("storage_foreach_device_supported failed 0x%x", ret);
+ LOGE("failed to check supported storage 0x%x", ret);
return false;
}
if ((storage_info->type == STORAGE_TYPE_EXTERNAL) &&
(storage_info->state <= STORAGE_STATE_REMOVED)) {
- LOGE("need to check the storage state : %d", storage_info->state);
+ LOGE("need to check the external storage state %d:%d", storage_info->id, storage_info->state);
return false;
}
- LOGD("storage info: type %d, id %d", storage_info->type, storage_info->id);
+ LOGD("storage info %d:%d:%d", storage_info->type, storage_info->id, storage_info->state);
return true;
}