{
int ret = MEDIA_CONTENT_ERROR_NONE;
FILE *fp = NULL;
- char list_path[255] = {0,};
+ char list_path[255] = {0, };
unsigned int idx = 0;
int nwrites = 0;
bool ignore_file = FALSE;
bool ignore_dir = FALSE;
char *folder_path = NULL;
- char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
+ char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
int ret = MEDIA_CONTENT_ERROR_NONE;
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
{
int ret = MEDIA_CONTENT_ERROR_NONE;
char *path = NULL;
- char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
+ char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
if(!STRING_VALID(media_id))
{
return ret;
}
+int media_info_get_face_count_from_db(const char *media_id, filter_h filter, int *face_count)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ if(STRING_VALID(media_id) && face_count)
+ {
+ ret = _media_db_get_group_item_count(media_id, filter, MEDIA_GROUP_FACE_BY_MEDIA_ID, face_count);
+ }
+ else
+ {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+
+int media_info_foreach_face_from_db (const char *media_id, filter_h filter, media_face_cb callback, void *user_data)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ if((callback != NULL) && STRING_VALID(media_id))
+ {
+ ret = _media_db_get_face(media_id, filter, callback, user_data);
+ }
+ else
+ {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+
int media_info_get_image(media_info_h media, image_meta_h *image)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
{
int ret = MEDIA_CONTENT_ERROR_NONE;
char select_query[DEFAULT_QUERY_SIZE];
- char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
+ char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
sqlite3_stmt *stmt = NULL;
if(!STRING_VALID(media_id) || (media == NULL))
media_info_h media = NULL;
char *file_path = NULL;
media_content_storage_e storage_type = 0;
- char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
+ char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
if(!STRING_VALID(media_id))
{
char *folder_path = NULL;
media_svc_storage_type_e src_storage_type = 0;
media_svc_storage_type_e dst_storage_type = 0;
- char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
+ char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid media");
media_content_retvm_if(!STRING_VALID(dst_path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid dst_path");
if(_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path))
{
- ret = thumbnail_request_cancel_media(_media->file_path, tzplatform_getuid(TZ_USER_NAME));
+ ret = thumbnail_request_cancel_media(_media->file_path);
ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret);
}
else
static int __media_info_map_data_usr_to_svc(media_info_s *media, media_svc_content_info_s **service_content, media_content_storage_e storage_type)
{
- if(media == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
media_svc_content_info_s *svc_content_info = calloc(1, sizeof(media_svc_content_info_s));
media_content_retvm_if(svc_content_info == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
}
*service_content = svc_content_info;
+
return MEDIA_CONTENT_ERROR_NONE;
}
{
media_info_s *_media = (media_info_s*)media;
- if(_media == NULL)
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
switch(data_type)
{
ret = __media_info_map_data_usr_to_svc(_media, &svc_content_info, _media->storage_type);
media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "__media_info_map_data_usr_to_svc fail");
- if(svc_content_info == NULL)
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
ret = media_svc_insert_item_immediately_with_data(_content_get_db_handle(), svc_content_info, tzplatform_getuid(TZ_USER_NAME));
if(ret != MS_MEDIA_ERR_NONE) {
media_content_sec_error("media_svc_insert_item_immediately_with_data failed : %d (%s)", ret, _media->file_path);
return ret;
}
-int media_info_create_handle(media_info_h *media)
+int media_info_create(const char *path, media_info_h *media)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
+ char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
+ media_svc_storage_type_e storage_type = 0;
- if(media == NULL)
+ media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
+ media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
+
+ memset(storage_id, 0x00, sizeof(storage_id));
+
+ if (strstr(MEDIA_ROOT_PATH_CLOUD, path) == NULL) {
+ bool ignore_file = FALSE;
+ bool ignore_dir = FALSE;
+ char *folder_path = NULL;
+
+ ret = _media_util_check_ignore_file(path, &ignore_file);
+ media_content_retvm_if(ignore_file == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
+
+ ret = _media_util_check_file_exist(path);
+ media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+ folder_path = g_path_get_dirname(path);
+ ret = _media_util_check_ignore_dir(folder_path, &ignore_dir);
+ SAFE_FREE(folder_path);
+ media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
+
+ ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id);
+ if(ret != MS_MEDIA_ERR_NONE)
+ {
+ media_content_error("media_svc_get_storage_id failed : %d", ret);
+ return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ }
+
+ ret = media_svc_get_storage_type(path, &storage_type, tzplatform_getuid(TZ_USER_NAME));
+ if(ret != MS_MEDIA_ERR_NONE) {
+ media_content_sec_error("media_svc_get_storage_type failed : %d", ret);
+ return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ }
+ }
+
+ media_info_s *_media = (media_info_s*)calloc(1,sizeof(media_info_s));
+ media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+
+ _media->audio_meta = (audio_meta_s *)calloc(1, sizeof(audio_meta_s));
+ if(_media->audio_meta == NULL)
{
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ SAFE_FREE(_media);
+ media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+
+ _media->video_meta = (video_meta_s *)calloc(1, sizeof(video_meta_s));
+ if(_media->video_meta == NULL)
+ {
+ SAFE_FREE(_media->audio_meta);
+ SAFE_FREE(_media);
+ media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+
+ _media->image_meta = (image_meta_s *)calloc(1, sizeof(image_meta_s));
+ if(_media->image_meta == NULL)
+ {
+ SAFE_FREE(_media->audio_meta);
+ SAFE_FREE(_media->video_meta);
+ SAFE_FREE(_media);
+ media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+
+ _media->file_path = g_strdup(path);
+ _media->storage_type = -1;
+ _media->media_type = -1;
+ _media->modified_time = -1;
+ _media->size = -1;
+
+ if(STRING_VALID(storage_id)) {
+ _media->storage_uuid = g_strdup(storage_id);
+ _media->storage_type = storage_type;
}
+ *media = (media_info_h)_media;
+
+ return ret;
+}
+
+int media_info_create_handle(media_info_h *media)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
+
media_info_s *_media = (media_info_s*)calloc(1,sizeof(media_info_s));
media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
{
media_info_s *_media = (media_info_s*)media;
- if(_media == NULL)
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
_media->size = size;
{
media_info_s *_media = (media_info_s*)media;
- if(_media == NULL)
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
_media->modified_time = modified_time;
{
media_info_s *_media = (media_info_s*)media;
- if(_media == NULL)
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
_media->media_type = type;
{
media_info_s *_media = (media_info_s*)media;
- if(_media == NULL)
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
if(_media->media_type == MEDIA_CONTENT_TYPE_VIDEO)
_media->video_meta->duration = duration;
{
media_info_s *_media = (media_info_s*)media;
- if(_media == NULL)
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
if(_media->media_type == MEDIA_CONTENT_TYPE_VIDEO)
_media->video_meta->width = width;
{
media_info_s *_media = (media_info_s*)media;
- if(_media == NULL)
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
if(_media->media_type == MEDIA_CONTENT_TYPE_VIDEO)
_media->video_meta->height = height;
{
media_info_s *_media = (media_info_s*)media;
- if(_media == NULL)
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
_media->storage_type = storage_type;