#include <media_content.h>
+#include <storage.h>
#include "mf-media-data.h"
#include "mf-media-content.h"
#include "mf-tray-item.h"
#include "mf-util.h"
#include "mf-file-util.h"
+typedef struct _mf_storage_media_t mf_storage_media_s;
+
+struct _mf_storage_media_t {
+ int storage_id;
+ char* file_url;
+};
+
static int __mf_media_data_sort_by_priority(const void *d1, const void *d2,
int sequence_type);
static int __mf_media_data_sort_by_name_cb_A2Z(const void *d1,
}
/**
+ * Called to get information once for each supported storage.
+ * @param storage_id : The unique storage ID
+ * @param type : The type of the storage
+ * @param state : The current state of the storage
+ * @param path : The absolute path to the root directory of the storage
+ * @param user_data : The user data passed from the foreach function
+ * @return
+ */
+static bool _storage_device_supported_cb(int storage_id, storage_type_e type,
+ storage_state_e state, const char *path, void *user_data ) {
+ mf_storage_media_s *storage_media = (mf_storage_media_s *)user_data;
+ if (!(storage_media && storage_media->file_url && path)) {
+ return true;
+ }
+
+ if (strncmp(path, storage_media->file_url, strlen(path)) == 0) {
+ storage_media->storage_id = storage_id;
+ return false;
+ }
+ return true;
+}
+
+/**
*
* @param media
* @return
}
//}
//mf_debug("thumb_url: %s", item_data->thumbnail_path);
+ mf_storage_media_s storage_media;
+ storage_media.storage_id = -1;
+ storage_media.file_url = item_data->fullpath;
+ storage_type_e storage_type = 0;
+
+ ret = storage_foreach_device_supported(_storage_device_supported_cb, &storage_media);
+ if (ret != STORAGE_ERROR_NONE || storage_media.storage_id == -1) {
+ mf_error("Get storage id failed");
+ goto MF_LOCAL_FAILED;
+ }
+
+ ret = storage_get_type(storage_media.storage_id, &storage_type);
- media_content_storage_e storage_type = 0;
- if (media_info_get_storage_type(media, &storage_type) !=
- MEDIA_CONTENT_ERROR_NONE) {
- mf_debug("Get storage type failed!");
+ if (ret != STORAGE_ERROR_NONE) {
+ mf_error("Get storage type failed");
goto MF_LOCAL_FAILED;
}
- if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) { /* The device's internal storage */
+
+ if (storage_type == STORAGE_TYPE_INTERNAL) { /* The device's internal storage */
item_data->storage_type = MYFILE_PHONE;
- } else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) { /* The device's external storage */
+ } else if (storage_type == STORAGE_TYPE_EXTERNAL) { /* The device's external storage */
item_data->storage_type = MYFILE_MMC;
} else {
mf_debug("Undefined mode[%d]!", storage_type);