ret = __media_svc_malloc_and_strncpy(&content_info->path, path);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
- if (storage_type != MEDIA_SVC_STORAGE_CLOUD) {
- struct stat st;
- memset(&st, 0, sizeof(struct stat));
- if (stat(path, &st) == 0) {
- content_info->modified_time = st.st_mtime;
- content_info->timeline = content_info->modified_time;
- content_info->size = st.st_size;
- /* media_svc_debug("Modified time : [%d] Size : [%lld]", content_info->modified_time, content_info->size); */
- } else {
- media_svc_stderror("stat failed");
- }
+ struct stat st;
+ memset(&st, 0, sizeof(struct stat));
+ if (stat(path, &st) == 0) {
+ content_info->modified_time = st.st_mtime;
+ content_info->timeline = content_info->modified_time;
+ content_info->size = st.st_size;
+ } else {
+ media_svc_stderror("stat failed");
}
_media_svc_set_default_value(content_info, refresh);
SAFE_FREE(file_name);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
- if (storage_type != MEDIA_SVC_STORAGE_CLOUD) {
- /* if the file is DRM file, drm_type value is DRM_TRUE(1).
- if drm_contentinfo is not NULL, the file is OMA DRM.*/
- ret = __media_svc_get_mime_type(path, mime_type);
- media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
+ /* if the file is DRM file, drm_type value is DRM_TRUE(1).
+ if drm_contentinfo is not NULL, the file is OMA DRM.*/
+ ret = __media_svc_get_mime_type(path, mime_type);
+ media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
- media_svc_debug("mime [%s]", mime_type);
- content_info->is_drm = drm_type;
+ media_svc_debug("mime [%s]", mime_type);
+ content_info->is_drm = drm_type;
- ret = __media_svc_get_media_type(path, mime_type, media_type);
- media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
+ ret = __media_svc_get_media_type(path, mime_type, media_type);
+ media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
- if ((*media_type < MEDIA_SVC_MEDIA_TYPE_IMAGE) || (*media_type > MEDIA_SVC_MEDIA_TYPE_OTHER)) {
- media_svc_error("invalid media_type condition[%d]", *media_type);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
+ if ((*media_type < MEDIA_SVC_MEDIA_TYPE_IMAGE) || (*media_type > MEDIA_SVC_MEDIA_TYPE_OTHER)) {
+ media_svc_error("invalid media_type condition[%d]", *media_type);
+ return MS_MEDIA_ERR_INVALID_PARAMETER;
+ }
- ret = __media_svc_malloc_and_strncpy(&content_info->mime_type, mime_type);
- media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
+ ret = __media_svc_malloc_and_strncpy(&content_info->mime_type, mime_type);
+ media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
- media_svc_sec_debug("storage[%d], path[%s], media_type[%d]", storage_type, path, *media_type);
+ media_svc_sec_debug("storage[%d], path[%s], media_type[%d]", storage_type, path, *media_type);
- content_info->media_type = *media_type;
- }
+ content_info->media_type = *media_type;
return MS_MEDIA_ERR_NONE;
}
if (check_all == TRUE) {
if ((storage_type != MEDIA_SVC_STORAGE_INTERNAL)
&& (storage_type != MEDIA_SVC_STORAGE_EXTERNAL)
- && (storage_type != MEDIA_SVC_STORAGE_EXTERNAL_USB)
- && (storage_type != MEDIA_SVC_STORAGE_CLOUD)) {
+ && (storage_type != MEDIA_SVC_STORAGE_EXTERNAL_USB)) {
media_svc_error("storage type is incorrect[%d]", storage_type);
return FALSE;
}
media_svc_retvm_if(content_info == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
media_svc_retvm_if(new_content_info == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- if (content_info->storage_type == MEDIA_SVC_STORAGE_CLOUD) {
- new_content_info->size = content_info->size;
- new_content_info->modified_time = content_info->modified_time;
- new_content_info->is_drm = content_info->is_drm;
- new_content_info->media_type = content_info->media_type;
-
- if (STRING_VALID(content_info->mime_type)) {
- ret = __media_svc_malloc_and_strncpy(&new_content_info->mime_type, content_info->mime_type);
- if (ret != MS_MEDIA_ERR_NONE)
- media_svc_error("strcpy mime_type failed");
- }
-
- if (STRING_VALID(content_info->thumbnail_path)) {
- ret = __media_svc_malloc_and_strncpy(&new_content_info->thumbnail_path, content_info->thumbnail_path);
- if (ret != MS_MEDIA_ERR_NONE)
- media_svc_error("strcpy thumbnail_path failed");
- }
-
- new_content_info->media_meta.duration = content_info->media_meta.duration;
- new_content_info->media_meta.width = content_info->media_meta.width;
- new_content_info->media_meta.height = content_info->media_meta.height;
- }
-
if (content_info->added_time > 0)
new_content_info->added_time = content_info->added_time;
new_content_info->last_played_time = content_info->last_played_time;
media_svc_retvm_if(content_info == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "content_info is NULL");
media_svc_retvm_if(!STRING_VALID(content_info->path), MS_MEDIA_ERR_INVALID_PARAMETER, "file_path is NULL");
- if (content_info->storage_type == MEDIA_SVC_STORAGE_CLOUD) {
- media_svc_retvm_if(!STRING_VALID(content_info->mime_type), MS_MEDIA_ERR_INVALID_PARAMETER, "mime_type is NULL");
-
- if ((content_info->media_type < MEDIA_SVC_MEDIA_TYPE_IMAGE) || (content_info->media_type > MEDIA_SVC_MEDIA_TYPE_OTHER)) {
- media_svc_error("invalid media_type condition[%d]", content_info->media_type);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- if (content_info->size <= 0) {
- media_svc_error("invalid size condition[%d]", content_info->size);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- if (content_info->modified_time <= 0) {
- media_svc_error("invalid modified_time condition[%d]", content_info->modified_time);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
- }
-
media_svc_debug("storage[%d], path[%s], media_type[%d]", content_info->storage_type, content_info->path, content_info->media_type);
media_svc_content_info_s _new_content_info;
ret = _media_svc_set_media_info(&_new_content_info, content_info->storage_uuid, content_info->storage_type, content_info->path, &media_type, FALSE);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "fail _media_svc_set_media_info");
- if (content_info->storage_type != MEDIA_SVC_STORAGE_CLOUD) {
- if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER)
- media_svc_debug("Do nothing[%d]", media_type);
- else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE)
- ret = _media_svc_extract_image_metadata(db_handle, &_new_content_info);
- else
- ret = _media_svc_extract_media_metadata(db_handle, &_new_content_info, uid);
+ if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER)
+ media_svc_debug("Do nothing[%d]", media_type);
+ else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE)
+ ret = _media_svc_extract_image_metadata(db_handle, &_new_content_info);
+ else
+ ret = _media_svc_extract_media_metadata(db_handle, &_new_content_info, uid);
- media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
+ media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
- /* Extracting thumbnail */
- if (_new_content_info.thumbnail_path == NULL) {
- if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE || media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO) {
- char thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
- int width = 0;
- int height = 0;
+ /* Extracting thumbnail */
+ if (_new_content_info.thumbnail_path == NULL) {
+ if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE || media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO) {
+ char thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
+ int width = 0;
+ int height = 0;
- ret = _media_svc_request_thumbnail_with_origin_size(_new_content_info.path, thumb_path, sizeof(thumb_path), &width, &height, uid);
- if (ret == MS_MEDIA_ERR_NONE)
- ret = __media_svc_malloc_and_strncpy(&(_new_content_info.thumbnail_path), thumb_path);
+ ret = _media_svc_request_thumbnail_with_origin_size(_new_content_info.path, thumb_path, sizeof(thumb_path), &width, &height, uid);
+ if (ret == MS_MEDIA_ERR_NONE)
+ ret = __media_svc_malloc_and_strncpy(&(_new_content_info.thumbnail_path), thumb_path);
- if (_new_content_info.media_meta.width <= 0)
- _new_content_info.media_meta.width = width;
+ if (_new_content_info.media_meta.width <= 0)
+ _new_content_info.media_meta.width = width;
- if (_new_content_info.media_meta.height <= 0)
- _new_content_info.media_meta.height = height;
- }
+ if (_new_content_info.media_meta.height <= 0)
+ _new_content_info.media_meta.height = height;
}
}
if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("fail to _media_svc_delete_folder_by_storage_id. error : [%d]", ret);
- if ((storage_type == MEDIA_SVC_STORAGE_EXTERNAL_USB) || (storage_type == MEDIA_SVC_STORAGE_CLOUD)) {
+ if (storage_type == MEDIA_SVC_STORAGE_EXTERNAL_USB) {
ret = _media_svc_drop_media_table(storage_id, uid);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "drop table failed : %d", ret);