#include <media_util_private.h>
#include <system_info.h>
-
-#define media_content_retv_free_info_if(expr, val, p_str) do { \
- if (expr) { \
- LOGE(FONT_COLOR_RED"Memory allocation failure"FONT_COLOR_RESET); \
- media_info_destroy(p_str); \
- return (val); \
- } \
- } while (0)
-
-
static void __media_info_insert_completed_cb(media_request_result_s *result, void *user_data);
static void __media_info_thumbnail_completed_cb(int error, const char *path, void *user_data);
static void __media_info_face_completed_cb(int error, const int face_count, void *user_data);
sqlite3_stmt *stmt = NULL;
char *select_query = NULL;
- media_content_retvm_if(!STRING_VALID(media_id), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid media_id");
+ content_retip_if_fail(STRING_VALID(media_id));
select_query = sqlite3_mprintf(SELECT_MEDIA_PATH_BY_ID, media_id);
ret = _content_get_result(select_query, &stmt);
SQLITE3_SAFE_FREE(select_query);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+ content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
if (sqlite3_step(stmt) == SQLITE_ROW) {
*path = g_strdup((const char *)sqlite3_column_text(stmt, 0));
} else {
- media_content_error("There's no media with this ID : %s", media_id);
+ content_error("There's no media with this ID : %s", media_id);
*path = NULL;
ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
ret = _content_error_capi(result->result);
if (_cb_data->insert_completed_cb) {
- media_content_debug("User callback is being called now");
+ content_debug("User callback is being called now");
_cb_data->insert_completed_cb(ret, _cb_data->user_data);
}
if (STRING_VALID(_cb_data->insert_list_path)) {
if (unlink(_cb_data->insert_list_path) < 0)
- media_content_stderror("failed to delete");
- SAFE_FREE(_cb_data->insert_list_path);
+ content_stderror("failed to delete");
+ g_free(_cb_data->insert_list_path);
}
}
- SAFE_FREE(_cb_data);
+ g_free(_cb_data);
return;
}
media = _thumb_cb->handle;
if (media != NULL) {
- if (media->thumbnail_path != NULL)
- SAFE_FREE(media->thumbnail_path);
+ g_free(media->thumbnail_path);
if (STRING_VALID(path))
media->thumbnail_path = g_strdup(path);
media->thumbnail_path = g_strdup(MEDIA_CONTENT_EMPTY_STRING);
}
- media_content_debug("error [%d], thumbnail_path [%s]", error, path);
+ content_debug("error [%d], thumbnail_path [%s]", error, path);
error_value = _content_error_capi(error);
if (_thumb_cb->thumbnail_completed_cb)
_thumb_cb->thumbnail_completed_cb(error_value, path, _thumb_cb->user_data);
}
- SAFE_FREE(_thumb_cb);
+ g_free(_thumb_cb);
return;
}
const int nRetVal = system_info_get_platform_bool("http://tizen.org/feature/vision.face_recognition", &isFaceRecognitionSupported);
if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
- media_content_debug("SYSTEM_INFO_ERROR: vision.face_recognition [%d]", nRetVal);
+ content_debug("SYSTEM_INFO_ERROR: vision.face_recognition [%d]", nRetVal);
return false;
}
media_face_cb_s *_face_cb = (media_face_cb_s *)user_data;
if (_face_cb != NULL) {
- media_content_debug("error [%d], face_count [%d]", error, face_count);
+ content_debug("error [%d], face_count [%d]", error, face_count);
error_value = _content_error_capi(error);
if (_face_cb->face_completed_cb)
_face_cb->face_completed_cb(error_value, face_count, _face_cb->user_data);
}
- SAFE_FREE(_face_cb);
+ g_free(_face_cb);
return;
}
memset(list_path, 0x00, sizeof(list_path));
continue;
} else {
- media_content_debug("The request file list path : %s", list_path);
+ content_sec_debug("The request file list path : %s", list_path);
break;
}
}
if (idx == BATCH_REQUEST_MAX) {
- media_content_error("Too many batch request for one thread");
+ content_error("Too many batch request for one thread");
return MEDIA_CONTENT_ERROR_DB_BUSY;
}
fp = fopen(list_path, "w");
if (fp == NULL) {
- media_content_error("failed to open file : [%s]", list_path);
- media_content_stderror("failed to open file");
+ content_sec_error("failed to open file : [%s]", list_path);
+ content_stderror("failed to open file");
return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
}
if (ret != MEDIA_CONTENT_ERROR_NONE) {
fclose(fp);
if (unlink(list_path) < 0)
- media_content_stderror("failed to delete");
+ content_stderror("failed to delete");
return ret;
}
if (!_media_util_check_support_media_type(path_array[idx])) {
fclose(fp);
if (unlink(list_path) < 0)
- media_content_stderror("failed to delete");
+ content_stderror("failed to delete");
return MEDIA_CONTENT_ERROR_NOT_SUPPORTED;
}
nwrites = fwrite(path_array[idx], 1, size, fp);
if (nwrites != size) {
- media_content_stderror("failed to write");
+ content_stderror("failed to write");
fclose(fp);
if (unlink(list_path) < 0)
- media_content_stderror("failed to delete");
+ content_stderror("failed to delete");
return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
}
nwrites = fwrite("\n", 1, 1, fp);
if (nwrites != 1) {
- media_content_stderror("failed to write");
+ content_stderror("failed to write");
fclose(fp);
if (unlink(list_path) < 0)
- media_content_stderror("failed to delete");
+ content_stderror("failed to delete");
return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
}
} else {
- media_content_error("path[%d] is invalid string", idx);
+ content_error("path[%d] is invalid string", idx);
}
}
fclose(fp);
- media_insert_cb_s *_cb_data = (media_insert_cb_s *)calloc(1, sizeof(media_insert_cb_s));
- media_content_retvm_if(_cb_data == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ media_insert_cb_s *_cb_data = g_new0(media_insert_cb_s, 1);
_cb_data->insert_completed_cb = completed_cb;
_cb_data->user_data = user_data;
ret = media_files_register(list_path, __media_info_insert_completed_cb, _cb_data, _content_get_uid());
if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("media_files_register failed : %d", ret);
+ content_error("media_files_register failed : %d", ret);
if (unlink(list_path) < 0)
- media_content_stderror("failed to delete");
+ content_stderror("failed to delete");
return _content_error_capi(ret);
}
static int __media_info_check_file_validity(const char *path)
{
- bool ignore = FALSE;
char *folder_path = NULL;
int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
+ content_retip_if_fail(path);
- ret = _media_util_check_ignore_file(path, &ignore);
- media_content_retvm_if(ignore == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid ignore path");
+ content_retvm_if(_media_util_is_ignorable_file(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid ignore path");
ret = _media_util_check_file_exist(path);
- media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "invalid path");
+ content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "invalid path");
folder_path = g_path_get_dirname(path);
- ret = _media_util_check_ignore_dir(folder_path, &ignore);
- SAFE_FREE(folder_path);
- media_content_retvm_if(ignore == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
+ if (_media_util_is_ignorable_dir(folder_path))
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- return MEDIA_CONTENT_ERROR_NONE;
+ g_free(folder_path);
+
+ return ret;
}
void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media)
{
media_info_s *_media = (media_info_s*)media;
+ if (!_media)
+ return;
+
_media->media_id = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_UUID));
_media->file_path = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_PATH));
_media->display_name = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_FILE_NAME));
_media->altitude = (double)sqlite3_column_double(stmt, MEDIA_INFO_ALTITUDE);
_media->title = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE));
_media->timeline = (double)sqlite3_column_double(stmt, MEDIA_INFO_TIMELINE);
- _media->sync_status = (int)sqlite3_column_int(stmt, MEDIA_INFO_SYNC_STATUS);
_media->storage_uuid = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_STORAGE_UUID));
_media->is_360 = (int)sqlite3_column_int(stmt, MEDIA_INFO_IS_360);
#ifdef _USE_TVPD_MODE
#endif
if (_media->media_type == MEDIA_CONTENT_TYPE_IMAGE) {
- _media->image_meta = (image_meta_s *)calloc(1, sizeof(image_meta_s));
- if (_media->image_meta) {
- _media->image_meta->media_id = g_strdup(_media->media_id);
- _media->image_meta->width = sqlite3_column_int(stmt, MEDIA_INFO_WIDTH);
- _media->image_meta->height = sqlite3_column_int(stmt, MEDIA_INFO_HEIGHT);
- _media->image_meta->fnumber = (double)sqlite3_column_double(stmt, MEDIA_INFO_FNUMBER);
- _media->image_meta->iso = sqlite3_column_int(stmt, MEDIA_INFO_ISO);
- _media->image_meta->date_taken = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_DATETAKEN));
- _media->image_meta->orientation = sqlite3_column_int(stmt, MEDIA_INFO_ORIENTATION);
- _media->image_meta->title = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE));
- _media->image_meta->exposure_time = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_EXPOSURE_TIME));
- _media->image_meta->model = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_MODEL));
- }
+ _media->image_meta = g_new0(image_meta_s, 1);
+
+ _media->image_meta->media_id = g_strdup(_media->media_id);
+ _media->image_meta->width = sqlite3_column_int(stmt, MEDIA_INFO_WIDTH);
+ _media->image_meta->height = sqlite3_column_int(stmt, MEDIA_INFO_HEIGHT);
+ _media->image_meta->fnumber = (double)sqlite3_column_double(stmt, MEDIA_INFO_FNUMBER);
+ _media->image_meta->iso = sqlite3_column_int(stmt, MEDIA_INFO_ISO);
+ _media->image_meta->date_taken = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_DATETAKEN));
+ _media->image_meta->orientation = sqlite3_column_int(stmt, MEDIA_INFO_ORIENTATION);
+ _media->image_meta->exposure_time = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_EXPOSURE_TIME));
+ _media->image_meta->model = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_MODEL));
+
} else if (_media->media_type == MEDIA_CONTENT_TYPE_VIDEO) {
- _media->video_meta = (video_meta_s *)calloc(1, sizeof(video_meta_s));
- if (_media->video_meta) {
- _media->video_meta->media_id = g_strdup(_media->media_id);
- _media->video_meta->width = sqlite3_column_int(stmt, MEDIA_INFO_WIDTH);
- _media->video_meta->height = sqlite3_column_int(stmt, MEDIA_INFO_HEIGHT);
- _media->video_meta->title = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE));
- _media->video_meta->album = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM));
- _media->video_meta->artist = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ARTIST));
- _media->video_meta->album_artist = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM_ARTIST));
- _media->video_meta->genre = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_GENRE));
- _media->video_meta->composer = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COMPOSER));
- _media->video_meta->year = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_YEAR));
- _media->video_meta->recorded_date = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_RECORDED_DATE));
- _media->video_meta->copyright = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COPYRIGHT));
- _media->video_meta->track_num = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TRACK_NUM));
- _media->video_meta->bitrate = sqlite3_column_int(stmt, MEDIA_INFO_BITRATE);
- _media->video_meta->duration = sqlite3_column_int(stmt, MEDIA_INFO_DURATION);
- _media->video_meta->rotation = sqlite3_column_int(stmt, MEDIA_INFO_ORIENTATION);
- }
+ _media->video_meta = g_new0(video_meta_s, 1);
+
+ _media->video_meta->media_id = g_strdup(_media->media_id);
+ _media->video_meta->width = sqlite3_column_int(stmt, MEDIA_INFO_WIDTH);
+ _media->video_meta->height = sqlite3_column_int(stmt, MEDIA_INFO_HEIGHT);
+ _media->video_meta->album = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM));
+ _media->video_meta->artist = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ARTIST));
+ _media->video_meta->album_artist = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM_ARTIST));
+ _media->video_meta->genre = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_GENRE));
+ _media->video_meta->composer = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COMPOSER));
+ _media->video_meta->year = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_YEAR));
+ _media->video_meta->recorded_date = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_RECORDED_DATE));
+ _media->video_meta->copyright = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COPYRIGHT));
+ _media->video_meta->track_num = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TRACK_NUM));
+ _media->video_meta->bitrate = sqlite3_column_int(stmt, MEDIA_INFO_BITRATE);
+ _media->video_meta->duration = sqlite3_column_int(stmt, MEDIA_INFO_DURATION);
+ _media->video_meta->rotation = sqlite3_column_int(stmt, MEDIA_INFO_ORIENTATION);
} else if ((_media->media_type == MEDIA_CONTENT_TYPE_MUSIC) || (_media->media_type == MEDIA_CONTENT_TYPE_SOUND)) {
- _media->audio_meta = (audio_meta_s *)calloc(1, sizeof(audio_meta_s));
- if (_media->audio_meta) {
- _media->audio_meta->media_id = g_strdup(_media->media_id);
- _media->audio_meta->title = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE));
- _media->audio_meta->album = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM));
- _media->audio_meta->artist = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ARTIST));
- _media->audio_meta->album_artist = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM_ARTIST));
- _media->audio_meta->genre = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_GENRE));
- _media->audio_meta->composer = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COMPOSER));
- _media->audio_meta->year = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_YEAR));
- _media->audio_meta->recorded_date = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_RECORDED_DATE));
- _media->audio_meta->copyright = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COPYRIGHT));
- _media->audio_meta->track_num = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TRACK_NUM));
- _media->audio_meta->bitrate = sqlite3_column_int(stmt, MEDIA_INFO_BITRATE);
- _media->audio_meta->bitpersample = sqlite3_column_int(stmt, MEDIA_INFO_BITPERSAMPLE);
- _media->audio_meta->duration = sqlite3_column_int(stmt, MEDIA_INFO_DURATION);
- _media->audio_meta->samplerate = sqlite3_column_int(stmt, MEDIA_INFO_SAMPLERATE);
- _media->audio_meta->channel = sqlite3_column_int(stmt, MEDIA_INFO_CHANNEL);
- }
+ _media->audio_meta = g_new0(audio_meta_s, 1);
+
+ _media->audio_meta->media_id = g_strdup(_media->media_id);
+ _media->audio_meta->album = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM));
+ _media->audio_meta->artist = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ARTIST));
+ _media->audio_meta->album_artist = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM_ARTIST));
+ _media->audio_meta->genre = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_GENRE));
+ _media->audio_meta->composer = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COMPOSER));
+ _media->audio_meta->year = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_YEAR));
+ _media->audio_meta->recorded_date = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_RECORDED_DATE));
+ _media->audio_meta->copyright = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COPYRIGHT));
+ _media->audio_meta->track_num = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TRACK_NUM));
+ _media->audio_meta->bitrate = sqlite3_column_int(stmt, MEDIA_INFO_BITRATE);
+ _media->audio_meta->bitpersample = sqlite3_column_int(stmt, MEDIA_INFO_BITPERSAMPLE);
+ _media->audio_meta->duration = sqlite3_column_int(stmt, MEDIA_INFO_DURATION);
+ _media->audio_meta->samplerate = sqlite3_column_int(stmt, MEDIA_INFO_SAMPLERATE);
+ _media->audio_meta->channel = sqlite3_column_int(stmt, MEDIA_INFO_CHANNEL);
+
}
}
-
+#ifdef _USE_TVPD_MODE
int _media_info_get_media_info_from_db(const char *path, const char *storage_id, media_info_h media)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
char *select_query = NULL;
media_info_s *_media = (media_info_s*)media;
- media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid media");
+ content_retip_if_fail(media);
select_query = sqlite3_mprintf(SELECT_MEDIA_BY_PATH, storage_id, path);
ret = _content_get_result(select_query, &stmt);
SQLITE3_SAFE_FREE(select_query);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+ content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+ if (sqlite3_step(stmt) == SQLITE_ROW) {
+ _media_info_item_get_detail(stmt, (media_info_h)_media);
+ } else {
+ content_sec_error("No media : path[%s] storage id[%s]", path, storage_id);
+ ret = MEDIA_CONTENT_ERROR_DB_FAILED;
+ }
+
+ SQLITE3_FINALIZE(stmt);
+
+ return ret;
+}
+#else
+int _media_info_get_media_info_from_db(const char *path, media_info_h media)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ sqlite3_stmt *stmt = NULL;
+ char *select_query = NULL;
+ media_info_s *_media = (media_info_s*)media;
+
+ content_retip_if_fail(path);
+ content_retip_if_fail(media);
+
+ select_query = sqlite3_mprintf(SELECT_MEDIA_BY_PATH, path);
+
+ ret = _content_get_result(select_query, &stmt);
+ SQLITE3_SAFE_FREE(select_query);
+ content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
if (sqlite3_step(stmt) == SQLITE_ROW) {
_media_info_item_get_detail(stmt, (media_info_h)_media);
} else {
- media_content_sec_error("No media : path[%s] storage id[%s]", path, storage_id);
+ content_sec_error("No media : path[%s]", path);
ret = MEDIA_CONTENT_ERROR_DB_FAILED;
}
return ret;
}
+#endif
int media_info_insert_to_db(const char *path, media_info_h *info)
{
ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
int modified_time = 0;
- media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
- media_content_retvm_if(info == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid info");
- memset(repl_path, 0, sizeof(repl_path));
+ content_retip_if_fail(STRING_VALID(path));
+ content_retip_if_fail(info);
+
ret = _media_content_replace_path(path, repl_path);
- media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
+ content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
ret = __media_info_check_file_validity(repl_path);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+ content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- memset(storage_id, 0x00, sizeof(storage_id));
ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid());
if (ret != MS_MEDIA_ERR_NONE) {
- media_content_error("media_svc_get_storage_id failed : %d", ret);
+ content_error("media_svc_get_storage_id failed : %d", ret);
return _content_error_capi(ret);
}
ret = ms_user_get_storage_type(_content_get_uid(), repl_path, &storage_type);
if (ret != MS_MEDIA_ERR_NONE) {
- media_content_sec_error("ms_user_get_storage_type failed : %d", ret);
+ content_sec_error("ms_user_get_storage_type failed : %d", ret);
return _content_error_capi(ret);
}
if (modified_time != _media_util_get_file_time(repl_path)) {
ret = media_svc_refresh_item(_content_get_db_handle(), false, storage_id, storage_type, repl_path, _content_get_uid());
if (ret != MS_MEDIA_ERR_NONE) {
- media_content_error("media_svc_refresh_item failed : %d", ret);
+ content_error("media_svc_refresh_item failed : %d", ret);
return _content_error_capi(ret);
}
}
} else if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
- media_content_sec_debug("media_svc_check_item_exist_by_path : no record : %s", repl_path);
- media_content_retvm_if(!_media_util_check_support_media_type(repl_path), MEDIA_CONTENT_ERROR_NOT_SUPPORTED, "Unsupported media type");
+ content_sec_debug("media_svc_check_item_exist_by_path : no record : %s", repl_path);
+ content_retvm_if(!_media_util_check_support_media_type(repl_path), MEDIA_CONTENT_ERROR_NOT_SUPPORTED, "Unsupported media type");
ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_id, storage_type, repl_path, _content_get_uid());
if (ret != MS_MEDIA_ERR_NONE) {
if (ret == MS_MEDIA_ERR_DB_CONSTRAINT_FAIL) {
- media_content_sec_error("This item is already inserted. This may be normal operation because other process already did this (%s)", repl_path);
+ content_sec_error("This item is already inserted. This may be normal operation because other process already did this (%s)", repl_path);
ret = MEDIA_CONTENT_ERROR_NONE;
} else {
- media_content_sec_error("media_svc_insert_item_immediately failed : %d (%s)", ret, repl_path);
+ content_sec_error("media_svc_insert_item_immediately failed : %d (%s)", ret, repl_path);
}
return _content_error_capi(ret);
}
} else {
- media_content_sec_error("media_svc_get_modified_time failed : %d (%s)", ret, repl_path);
+ content_sec_error("media_svc_get_modified_time failed : %d (%s)", ret, repl_path);
return _content_error_capi(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_info_s *_media = g_new0(media_info_s, 1);
+#ifdef _USE_TVPD_MODE
if (STRING_VALID(storage_id))
ret = _media_info_get_media_info_from_db(repl_path, storage_id, (media_info_h)_media);
else
ret = _media_info_get_media_info_from_db(repl_path, DB_TABLE_MEDIA, (media_info_h)_media);
*info = (media_info_h)_media;
+#else
+ ret = _media_info_get_media_info_from_db(repl_path, (media_info_h)_media);
+ *info = (media_info_h)_media;
+#endif
return ret;
}
int ret = MS_MEDIA_ERR_NONE;
char repl_path[MAX_PATH_LEN] = {0, };
- media_content_retvm_if(path_array == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path_array");
- media_content_retvm_if(array_length <= 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid array_length");
+ content_retip_if_fail(path_array);
+ content_retip_if_fail(array_length > 0);
+ content_retip_if_fail(completed_cb);
- repl_path_array = calloc(1, sizeof(char *) * array_length);
- media_content_retvm_if(repl_path_array == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ repl_path_array = g_malloc0(sizeof(char *) * array_length);
for (idx = 0; idx < array_length; idx++) {
if (STRING_VALID(path_array[idx])) {
memset(repl_path, 0, sizeof(repl_path));
_media_content_replace_path(path_array[idx], repl_path);
- repl_path_array[idx] = strndup(repl_path, strlen(repl_path));
+ repl_path_array[idx] = g_strndup(repl_path, strlen(repl_path));
} else {
- media_content_error("path[%d] is invalid string", idx);
+ content_error("path[%d] is invalid string", idx);
}
}
ret = __media_info_insert_batch((const char **)repl_path_array, array_length, completed_cb, user_data);
for (idx = 0; idx < array_length; idx++)
- SAFE_FREE(repl_path_array[idx]);
+ g_free(repl_path_array[idx]);
- SAFE_FREE(repl_path_array);
+ g_free(repl_path_array);
return ret;
}
#ifdef _USE_TVPD_MODE
int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* media)
{
- 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");
- media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid info");
+ char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
+
+ content_retip_if_fail(STRING_VALID(path));
+ content_retip_if_fail(media);
- memset(storage_id, 0x00, sizeof(storage_id));
ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id, tzplatform_getuid(TZ_USER_NAME));
if (ret != MS_MEDIA_ERR_NONE) {
- media_content_error("media_svc_get_storage_id failed : %d", ret);
+ content_error("media_svc_get_storage_id failed : %d", ret);
return _content_error_capi(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_info_s *_media = g_new0(media_info_s, 1);
ret = _media_info_get_media_info_from_db(path, storage_id, (media_info_h)_media);
*media = (media_info_h)_media;
int ret = MEDIA_CONTENT_ERROR_NONE;
char *path = NULL;
char *storage_id = NULL;
- media_content_warn("DEPRECATION WARNING: media_info_delete_from_db() is deprecated and will be removed from next release. Use media_content_scan_file() instead.");
+ content_warn("DEPRECATION WARNING: media_info_delete_from_db() is deprecated and will be removed from next release. Use media_content_scan_file() instead.");
- if (!STRING_VALID(media_id)) {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(STRING_VALID(media_id));
ret = __media_info_get_media_path_by_id_from_db(media_id, &path);
if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("__media_info_get_media_path_by_id_from_db failed : %d", ret);
- SAFE_FREE(path);
+ content_error("__media_info_get_media_path_by_id_from_db failed : %d", ret);
+ g_free(path);
return ret;
}
ret = _media_db_get_storage_id_by_media_id(media_id, &storage_id);
if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("_media_db_get_storage_id_by_media_id failed : %d", ret);
- SAFE_FREE(path);
+ content_error("_media_db_get_storage_id_by_media_id failed : %d", ret);
+ g_free(path);
return ret;
}
ret = media_svc_delete_item_by_path(_content_get_db_handle(), storage_id, path, _content_get_uid());
- SAFE_FREE(path);
- SAFE_FREE(storage_id);
+ g_free(path);
+ g_free(storage_id);
return _content_error_capi(ret);
}
int media_info_destroy(media_info_h media)
{
media_info_s *_media = (media_info_s*)media;
- media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Handle is null");
- SAFE_FREE(_media->media_id);
- SAFE_FREE(_media->file_path);
- SAFE_FREE(_media->display_name);
- SAFE_FREE(_media->mime_type);
- SAFE_FREE(_media->thumbnail_path);
- SAFE_FREE(_media->description);
- SAFE_FREE(_media->title);
+ content_retip_if_fail(media);
+
+ g_free(_media->media_id);
+ g_free(_media->file_path);
+ g_free(_media->display_name);
+ g_free(_media->mime_type);
+ g_free(_media->thumbnail_path);
+ g_free(_media->description);
+ g_free(_media->title);
#ifdef _USE_TVPD_MODE
- SAFE_FREE(_media->modified_month);
-#endif
- SAFE_FREE(_media->storage_uuid);
-#ifdef _USE_SENIOR_MODE
- SAFE_FREE(_media->contact);
- SAFE_FREE(_media->app_data);
+ g_free(_media->modified_month);
#endif
+ g_free(_media->storage_uuid);
if (_media->image_meta) {
- SAFE_FREE(_media->image_meta->media_id);
- SAFE_FREE(_media->image_meta->date_taken);
- SAFE_FREE(_media->image_meta->exposure_time);
- SAFE_FREE(_media->image_meta->model);
- SAFE_FREE(_media->image_meta->title);
+ g_free(_media->image_meta->media_id);
+ g_free(_media->image_meta->date_taken);
+ g_free(_media->image_meta->exposure_time);
+ g_free(_media->image_meta->model);
- SAFE_FREE(_media->image_meta);
+ g_free(_media->image_meta);
}
if (_media->video_meta) {
- SAFE_FREE(_media->video_meta->media_id);
- SAFE_FREE(_media->video_meta->title);
- SAFE_FREE(_media->video_meta->album);
- SAFE_FREE(_media->video_meta->artist);
- SAFE_FREE(_media->video_meta->album_artist);
- SAFE_FREE(_media->video_meta->genre);
- SAFE_FREE(_media->video_meta->composer);
- SAFE_FREE(_media->video_meta->year);
- SAFE_FREE(_media->video_meta->recorded_date);
- SAFE_FREE(_media->video_meta->copyright);
- SAFE_FREE(_media->video_meta->track_num);
-
- SAFE_FREE(_media->video_meta);
+ g_free(_media->video_meta->media_id);
+ g_free(_media->video_meta->album);
+ g_free(_media->video_meta->artist);
+ g_free(_media->video_meta->album_artist);
+ g_free(_media->video_meta->genre);
+ g_free(_media->video_meta->composer);
+ g_free(_media->video_meta->year);
+ g_free(_media->video_meta->recorded_date);
+ g_free(_media->video_meta->copyright);
+ g_free(_media->video_meta->track_num);
+
+ g_free(_media->video_meta);
}
if (_media->audio_meta) {
- SAFE_FREE(_media->audio_meta->media_id);
- SAFE_FREE(_media->audio_meta->title);
- SAFE_FREE(_media->audio_meta->album);
- SAFE_FREE(_media->audio_meta->artist);
- SAFE_FREE(_media->audio_meta->album_artist);
- SAFE_FREE(_media->audio_meta->genre);
- SAFE_FREE(_media->audio_meta->composer);
- SAFE_FREE(_media->audio_meta->year);
- SAFE_FREE(_media->audio_meta->recorded_date);
- SAFE_FREE(_media->audio_meta->copyright);
- SAFE_FREE(_media->audio_meta->track_num);
-
- SAFE_FREE(_media->audio_meta);
+ g_free(_media->audio_meta->media_id);
+ g_free(_media->audio_meta->album);
+ g_free(_media->audio_meta->artist);
+ g_free(_media->audio_meta->album_artist);
+ g_free(_media->audio_meta->genre);
+ g_free(_media->audio_meta->composer);
+ g_free(_media->audio_meta->year);
+ g_free(_media->audio_meta->recorded_date);
+ g_free(_media->audio_meta->copyright);
+ g_free(_media->audio_meta->track_num);
+
+ g_free(_media->audio_meta);
}
- SAFE_FREE(_media);
+ g_free(_media);
return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_clone(media_info_h *dst, media_info_h src)
{
media_info_s *_src = (media_info_s*)src;
- media_content_retvm_if(_src == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Source handle is null");
-
- media_info_s *_dst = (media_info_s*)calloc(1, sizeof(media_info_s));
- media_content_retvm_if(_dst == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- if (_src->media_id) {
- _dst->media_id = g_strdup(_src->media_id);
- media_content_retv_free_info_if(_dst->media_id == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->file_path) {
- _dst->file_path = g_strdup(_src->file_path);
- media_content_retv_free_info_if(_dst->file_path == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->display_name != NULL) {
- _dst->display_name = g_strdup(_src->display_name);
- media_content_retv_free_info_if(_dst->display_name == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->mime_type) {
- _dst->mime_type = g_strdup(_src->mime_type);
- media_content_retv_free_info_if(_dst->mime_type == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->thumbnail_path != NULL) {
- _dst->thumbnail_path = g_strdup(_src->thumbnail_path);
- media_content_retv_free_info_if(_dst->thumbnail_path == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->description != NULL) {
- _dst->description = g_strdup(_src->description);
- media_content_retv_free_info_if(_dst->description == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
+ content_retip_if_fail(dst);
+ content_retip_if_fail(src);
- if (_src->title != NULL) {
- _dst->title = g_strdup(_src->title);
- media_content_retv_free_info_if(_dst->title == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
+ media_info_s *_dst = g_new0(media_info_s, 1);
- if (_src->storage_uuid != NULL) {
- _dst->storage_uuid = g_strdup(_src->storage_uuid);
- media_content_retv_free_info_if(_dst->storage_uuid == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
+ _dst->media_id = g_strdup(_src->media_id);
+ _dst->file_path = g_strdup(_src->file_path);
+ _dst->display_name = g_strdup(_src->display_name);
+ _dst->mime_type = g_strdup(_src->mime_type);
+ _dst->thumbnail_path = g_strdup(_src->thumbnail_path);
+ _dst->description = g_strdup(_src->description);
+ _dst->title = g_strdup(_src->title);
+ _dst->storage_uuid = g_strdup(_src->storage_uuid);
#ifdef _USE_TVPD_MODE
- if (STRING_VALID(_src->modified_month)) {
- _dst->modified_month = strdup(_src->modified_month);
- media_content_retv_free_info_if(_dst->modified_month == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
-#endif
-#ifdef _USE_SENIOR_MODE
- if (STRING_VALID(_src->contact)) {
- _dst->contact = strdup(_src->contact);
- media_content_retv_free_info_if(_dst->contact == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
-
- if (STRING_VALID(_src->app_data)) {
- _dst->app_data = strdup(_src->app_data);
- media_content_retv_free_info_if(_dst->app_data == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
+ _dst->modified_month = g_strdup(_src->modified_month);
#endif
-
_dst->media_type = _src->media_type;
_dst->size = _src->size;
_dst->added_time = _src->added_time;
_dst->favourite = _src->favourite;
_dst->is_drm = _src->is_drm;
_dst->storage_type = _src->storage_type;
- _dst->sync_status = _src->sync_status;
_dst->request_id = _src->request_id;
_dst->face_request_id = _src->face_request_id;
_dst->is_360 = _src->is_360;
#endif
if (_src->media_type == MEDIA_CONTENT_TYPE_IMAGE && _src->image_meta) {
- _dst->image_meta = (image_meta_s *)calloc(1, sizeof(image_meta_s));
- media_content_retv_free_info_if(_dst->image_meta == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
-
- if (_src->image_meta->media_id != NULL) {
- _dst->image_meta->media_id = g_strdup(_src->image_meta->media_id);
- media_content_retv_free_info_if(_dst->image_meta->media_id == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
-
- if (_src->image_meta->date_taken != NULL) {
- _dst->image_meta->date_taken = g_strdup(_src->image_meta->date_taken);
- media_content_retv_free_info_if(_dst->image_meta->date_taken == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
-
- if (_src->image_meta->exposure_time != NULL) {
- _dst->image_meta->exposure_time = g_strdup(_src->image_meta->exposure_time);
- media_content_retv_free_info_if(_dst->image_meta->exposure_time == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
-
- if (_src->image_meta->model != NULL) {
- _dst->image_meta->model = g_strdup(_src->image_meta->model);
- media_content_retv_free_info_if(_dst->image_meta->model == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
+ _dst->image_meta = g_new0(image_meta_s, 1);
+ _dst->image_meta->media_id = g_strdup(_src->image_meta->media_id);
+ _dst->image_meta->date_taken = g_strdup(_src->image_meta->date_taken);
+ _dst->image_meta->exposure_time = g_strdup(_src->image_meta->exposure_time);
+ _dst->image_meta->model = g_strdup(_src->image_meta->model);
_dst->image_meta->fnumber = _src->image_meta->fnumber;
_dst->image_meta->iso = _src->image_meta->iso;
_dst->image_meta->width = _src->image_meta->width;
_dst->image_meta->orientation = _src->image_meta->orientation;
} else if (_src->media_type == MEDIA_CONTENT_TYPE_VIDEO && _src->video_meta) {
- _dst->video_meta = (video_meta_s *)calloc(1, sizeof(video_meta_s));
- media_content_retv_free_info_if(_dst->video_meta == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
-
- if (_src->video_meta->media_id != NULL) {
- _dst->video_meta->media_id = g_strdup(_src->video_meta->media_id);
- media_content_retv_free_info_if(_dst->video_meta->media_id == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->video_meta->title != NULL) {
- _dst->video_meta->title = g_strdup(_src->video_meta->title);
- media_content_retv_free_info_if(_dst->video_meta->title == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->video_meta->album != NULL) {
- _dst->video_meta->album = g_strdup(_src->video_meta->album);
- media_content_retv_free_info_if(_dst->video_meta->album == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->video_meta->artist != NULL) {
- _dst->video_meta->artist = g_strdup(_src->video_meta->artist);
- media_content_retv_free_info_if(_dst->video_meta->artist == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->video_meta->album_artist != NULL) {
- _dst->video_meta->album_artist = g_strdup(_src->video_meta->album_artist);
- media_content_retv_free_info_if(_dst->video_meta->album_artist == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->video_meta->genre != NULL) {
- _dst->video_meta->genre = g_strdup(_src->video_meta->genre);
- media_content_retv_free_info_if(_dst->video_meta->genre == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->video_meta->composer != NULL) {
- _dst->video_meta->composer = g_strdup(_src->video_meta->composer);
- media_content_retv_free_info_if(_dst->video_meta->composer == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->video_meta->year != NULL) {
- _dst->video_meta->year = g_strdup(_src->video_meta->year);
- media_content_retv_free_info_if(_dst->video_meta->year == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->video_meta->recorded_date != NULL) {
- _dst->video_meta->recorded_date = g_strdup(_src->video_meta->recorded_date);
- media_content_retv_free_info_if(_dst->video_meta->recorded_date == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->video_meta->copyright != NULL) {
- _dst->video_meta->copyright = g_strdup(_src->video_meta->copyright);
- media_content_retv_free_info_if(_dst->video_meta->copyright == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->video_meta->track_num != NULL) {
- _dst->video_meta->track_num = g_strdup(_src->video_meta->track_num);
- media_content_retv_free_info_if(_dst->video_meta->track_num == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
-
+ _dst->video_meta = g_new0(video_meta_s, 1);
+
+ _dst->video_meta->media_id = g_strdup(_src->video_meta->media_id);
+ _dst->video_meta->album = g_strdup(_src->video_meta->album);
+ _dst->video_meta->artist = g_strdup(_src->video_meta->artist);
+ _dst->video_meta->album_artist = g_strdup(_src->video_meta->album_artist);
+ _dst->video_meta->genre = g_strdup(_src->video_meta->genre);
+ _dst->video_meta->composer = g_strdup(_src->video_meta->composer);
+ _dst->video_meta->year = g_strdup(_src->video_meta->year);
+ _dst->video_meta->recorded_date = g_strdup(_src->video_meta->recorded_date);
+ _dst->video_meta->copyright = g_strdup(_src->video_meta->copyright);
+ _dst->video_meta->track_num = g_strdup(_src->video_meta->track_num);
_dst->video_meta->width = _src->video_meta->width;
_dst->video_meta->height = _src->video_meta->height;
_dst->video_meta->duration = _src->video_meta->duration;
_dst->video_meta->rotation = _src->video_meta->rotation;
} else if ((_src->media_type == MEDIA_CONTENT_TYPE_MUSIC || _src->media_type == MEDIA_CONTENT_TYPE_SOUND) && _src->audio_meta) {
- _dst->audio_meta = (audio_meta_s *)calloc(1, sizeof(audio_meta_s));
- media_content_retv_free_info_if(_dst->audio_meta == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
-
- if (_src->audio_meta->media_id != NULL) {
- _dst->audio_meta->media_id = g_strdup(_src->audio_meta->media_id);
- media_content_retv_free_info_if(_dst->audio_meta->media_id == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->audio_meta->title != NULL) {
- _dst->audio_meta->title = g_strdup(_src->audio_meta->title);
- media_content_retv_free_info_if(_dst->audio_meta->title == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->audio_meta->album != NULL) {
- _dst->audio_meta->album = g_strdup(_src->audio_meta->album);
- media_content_retv_free_info_if(_dst->audio_meta->album == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->audio_meta->artist != NULL) {
- _dst->audio_meta->artist = g_strdup(_src->audio_meta->artist);
- media_content_retv_free_info_if(_dst->audio_meta->artist == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->audio_meta->album_artist != NULL) {
- _dst->audio_meta->album_artist = g_strdup(_src->audio_meta->album_artist);
- media_content_retv_free_info_if(_dst->audio_meta->album_artist == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->audio_meta->genre != NULL) {
- _dst->audio_meta->genre = g_strdup(_src->audio_meta->genre);
- media_content_retv_free_info_if(_dst->audio_meta->genre == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->audio_meta->composer != NULL) {
- _dst->audio_meta->composer = g_strdup(_src->audio_meta->composer);
- media_content_retv_free_info_if(_dst->audio_meta->composer == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->audio_meta->year != NULL) {
- _dst->audio_meta->year = g_strdup(_src->audio_meta->year);
- media_content_retv_free_info_if(_dst->audio_meta->year == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->audio_meta->recorded_date != NULL) {
- _dst->audio_meta->recorded_date = g_strdup(_src->audio_meta->recorded_date);
- media_content_retv_free_info_if(_dst->audio_meta->recorded_date == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->audio_meta->copyright != NULL) {
- _dst->audio_meta->copyright = g_strdup(_src->audio_meta->copyright);
- media_content_retv_free_info_if(_dst->audio_meta->copyright == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
- if (_src->audio_meta->track_num != NULL) {
- _dst->audio_meta->track_num = g_strdup(_src->audio_meta->track_num);
- media_content_retv_free_info_if(_dst->audio_meta->track_num == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (media_info_h)_dst);
- }
-
+ _dst->audio_meta = g_new0(audio_meta_s, 1);
+
+ _dst->audio_meta->media_id = g_strdup(_src->audio_meta->media_id);
+ _dst->audio_meta->album = g_strdup(_src->audio_meta->album);
+ _dst->audio_meta->artist = g_strdup(_src->audio_meta->artist);
+ _dst->audio_meta->album_artist = g_strdup(_src->audio_meta->album_artist);
+ _dst->audio_meta->genre = g_strdup(_src->audio_meta->genre);
+ _dst->audio_meta->composer = g_strdup(_src->audio_meta->composer);
+ _dst->audio_meta->year = g_strdup(_src->audio_meta->year);
+ _dst->audio_meta->recorded_date = g_strdup(_src->audio_meta->recorded_date);
+ _dst->audio_meta->copyright = g_strdup(_src->audio_meta->copyright);
+ _dst->audio_meta->track_num = g_strdup(_src->audio_meta->track_num);
_dst->audio_meta->channel = _src->audio_meta->channel;
_dst->audio_meta->samplerate = _src->audio_meta->samplerate;
_dst->audio_meta->duration = _src->audio_meta->duration;
_dst->audio_meta->bitrate = _src->audio_meta->bitrate;
_dst->audio_meta->bitpersample = _src->audio_meta->bitpersample;
}
+
*dst = (media_info_h)_dst;
return MEDIA_CONTENT_ERROR_NONE;
int media_info_get_media_count_from_db(filter_h filter, int *media_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if (media_count == NULL) {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-
- return ret;
- }
-
- ret = _media_db_get_group_item_count(NULL, filter, MEDIA_GROUP_NONE, media_count);
+ content_retip_if_fail(media_count);
- return ret;
+ return _media_db_get_group_item_count(NULL, filter, MEDIA_GROUP_NONE, media_count);
}
int media_info_foreach_media_from_db(filter_h filter, media_info_cb callback, void *user_data)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- media_content_retvm_if(callback == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid callback");
-
- ret = _media_db_get_group_item(NULL, filter, callback, user_data, MEDIA_GROUP_NONE);
+ content_retip_if_fail(callback);
- return ret;
+ return _media_db_get_group_item(NULL, filter, callback, user_data, MEDIA_GROUP_NONE);
}
int media_info_get_tag_count_from_db(const char *media_id, filter_h filter, int *tag_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if (STRING_VALID(media_id) && tag_count) {
- ret = _media_db_get_group_item_count(media_id, filter, MEDIA_GROUP_TAG_BY_MEDIA_ID, tag_count);
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(STRING_VALID(media_id));
+ content_retip_if_fail(tag_count);
- return ret;
+ return _media_db_get_group_item_count(media_id, filter, MEDIA_GROUP_TAG_BY_MEDIA_ID, tag_count);
}
int media_info_foreach_tag_from_db(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if ((callback != NULL) && STRING_VALID(media_id)) {
- ret = _media_db_get_tag(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;
- }
+ content_retip_if_fail(STRING_VALID(media_id));
+ content_retip_if_fail(callback);
- return ret;
+ return _media_db_get_tag(media_id, filter, callback, user_data);
}
int media_info_get_bookmark_count_from_db(const char *media_id, filter_h filter, int *bookmark_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if (STRING_VALID(media_id) && bookmark_count) {
- ret = _media_db_get_group_item_count(media_id, filter, MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID, bookmark_count);
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(STRING_VALID(media_id));
+ content_retip_if_fail(bookmark_count);
- return ret;
+ return _media_db_get_group_item_count(media_id, filter, MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID, bookmark_count);
}
int media_info_foreach_bookmark_from_db(const char *media_id, filter_h filter, media_bookmark_cb callback, void *user_data)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
+ content_retip_if_fail(STRING_VALID(media_id));
+ content_retip_if_fail(callback);
- if ((callback != NULL) && STRING_VALID(media_id)) {
- ret = _media_db_get_bookmark(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;
+ return _media_db_get_bookmark(media_id, filter, callback, user_data);
}
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;
- }
+ content_retip_if_fail(STRING_VALID(media_id));
+ content_retip_if_fail(face_count);
- return ret;
+ return _media_db_get_group_item_count(media_id, filter, MEDIA_GROUP_FACE_BY_MEDIA_ID, face_count);
}
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;
- }
+ content_retip_if_fail(STRING_VALID(media_id));
+ content_retip_if_fail(callback);
- return ret;
+ return _media_db_get_face(media_id, filter, callback, user_data);
}
int media_info_get_image(media_info_h media, image_meta_h *image)
media_info_s *_media = (media_info_s*)media;
- media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
- media_content_retvm_if(_media->media_type != MEDIA_CONTENT_TYPE_IMAGE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media_type");
- media_content_retvm_if(_media->image_meta == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid image_meta");
+ content_retip_if_fail(media);
+ content_retip_if_fail(_media->media_type == MEDIA_CONTENT_TYPE_IMAGE);
+ content_retip_if_fail(_media->image_meta);
+ content_retip_if_fail(image);
- image_meta_s *_image = (image_meta_s*)calloc(1, sizeof(image_meta_s));
- media_content_retvm_if(_image == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ image_meta_s *_image = g_new0(image_meta_s, 1);
_image->media_id = g_strdup(_media->media_id);
_image->width = _media->image_meta->width;
_image->fnumber = _media->image_meta->fnumber;
_image->iso = _media->image_meta->iso;
_image->date_taken = g_strdup(_media->image_meta->date_taken);
- _image->title = g_strdup(_media->image_meta->title);
_image->exposure_time = g_strdup(_media->image_meta->exposure_time);
_image->model = g_strdup(_media->image_meta->model);
media_info_s *_media = (media_info_s*)media;
- media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
- media_content_retvm_if(_media->media_type != MEDIA_CONTENT_TYPE_VIDEO, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media_type");
- media_content_retvm_if(_media->video_meta == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid video_meta");
+ content_retip_if_fail(media);
+ content_retip_if_fail(_media->media_type == MEDIA_CONTENT_TYPE_VIDEO);
+ content_retip_if_fail(_media->video_meta);
+ content_retip_if_fail(video);
- video_meta_s *_video = (video_meta_s*)calloc(1, sizeof(video_meta_s));
- media_content_retvm_if(_video == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ video_meta_s *_video = g_new0(video_meta_s, 1);
_video->media_id = g_strdup(_media->media_id);
- _video->title = g_strdup(_media->video_meta->title);
_video->album = g_strdup(_media->video_meta->album);
_video->artist = g_strdup(_media->video_meta->artist);
_video->album_artist = g_strdup(_media->video_meta->album_artist);
media_info_s *_media = (media_info_s*)media;
- media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
- media_content_retvm_if(_media->media_type != MEDIA_CONTENT_TYPE_MUSIC && _media->media_type != MEDIA_CONTENT_TYPE_SOUND, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media_type");
- media_content_retvm_if(_media->audio_meta == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid audio_meta");
+ content_retip_if_fail(media);
+ content_retip_if_fail(_media->media_type == MEDIA_CONTENT_TYPE_MUSIC);
+ content_retip_if_fail(_media->audio_meta);
+ content_retip_if_fail(audio);
- audio_meta_s *_audio = (audio_meta_s*)calloc(1, sizeof(audio_meta_s));
- media_content_retvm_if(_audio == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ audio_meta_s *_audio = g_new0(audio_meta_s, 1);
_audio->media_id = g_strdup(_media->media_id);
- _audio->title = g_strdup(_media->audio_meta->title);
_audio->album = g_strdup(_media->audio_meta->album);
_audio->artist = g_strdup(_media->audio_meta->artist);
_audio->album_artist = g_strdup(_media->audio_meta->album_artist);
int media_info_get_media_id(media_info_h media, char **media_id)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && media_id) {
- if (STRING_VALID(_media->media_id)) {
- *media_id = strdup(_media->media_id);
- media_content_retvm_if(*media_id == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- *media_id = NULL;
- }
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(media_id);
- return ret;
+ *media_id = g_strdup(_media->media_id);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_file_path(media_info_h media, char **path)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && path) {
- if (STRING_VALID(_media->file_path)) {
- *path = strdup(_media->file_path);
- media_content_retvm_if(*path == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- *path = NULL;
- }
- ret = MEDIA_CONTENT_ERROR_NONE;
+ content_retip_if_fail(media);
+ content_retip_if_fail(path);
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ *path = g_strdup(_media->file_path);
- return ret;
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_display_name(media_info_h media, char **name)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && name) {
- if (_media->display_name != NULL) {
- *name = g_strdup(_media->display_name);
- media_content_retvm_if(*name == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- *name = NULL;
- }
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(name);
- return ret;
+ *name = g_strdup(_media->display_name);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_media_type(media_info_h media, media_content_type_e *type)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && type) {
- *type = _media->media_type;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
- return ret;
+ content_retip_if_fail(media);
+ content_retip_if_fail(type);
+
+ *type = _media->media_type;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_mime_type(media_info_h media, char **mime_type)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && mime_type) {
- if (STRING_VALID(_media->mime_type)) {
- *mime_type = strdup(_media->mime_type);
- media_content_retvm_if(*mime_type == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- *mime_type = NULL;
- }
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(mime_type);
- return ret;
+ *mime_type = g_strdup(_media->mime_type);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_size(media_info_h media, unsigned long long *size)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && size) {
- *size = _media->size;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(size);
- return ret;
+ *size = _media->size;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_added_time(media_info_h media, time_t *added_time)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && added_time) {
- *added_time = _media->added_time;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
- return ret;
+ content_retip_if_fail(media);
+ content_retip_if_fail(added_time);
+
+ *added_time = _media->added_time;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_modified_time(media_info_h media, time_t* time)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && time) {
- *time = _media->modified_time;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
- return ret;
+ content_retip_if_fail(media);
+ content_retip_if_fail(time);
+
+ *time = _media->modified_time;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_timeline(media_info_h media, time_t* time)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && time) {
- *time = _media->timeline;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
- return ret;
+ content_retip_if_fail(media);
+ content_retip_if_fail(time);
+
+ *time = _media->timeline;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_thumbnail_path(media_info_h media, char **path)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && path) {
- if (_media->thumbnail_path != NULL) {
- *path = g_strdup(_media->thumbnail_path);
- media_content_retvm_if(*path == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- *path = NULL;
- }
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(path);
- return ret;
+ *path = g_strdup(_media->thumbnail_path);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_title(media_info_h media, char **title)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && title) { /*title can be empty string*/
- if (_media->title != NULL) {
- *title = g_strdup(_media->title);
- media_content_retvm_if(*title == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- *title = NULL;
- }
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(title);
- return ret;
+ *title = g_strdup(_media->title);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_description(media_info_h media, char **description)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && description) {
- if (_media->description != NULL) { /*description can be empty string*/
- *description = g_strdup(_media->description);
- media_content_retvm_if(*description == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- *description = NULL;
- }
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(description);
- return ret;
+ *description = g_strdup(_media->description);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_longitude(media_info_h media, double* longitude)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && longitude) {
- *longitude = _media->longitude;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(longitude);
- return ret;
+ *longitude = _media->longitude;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_latitude(media_info_h media, double* latitude)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && latitude) {
- *latitude = _media->latitude;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(latitude);
- return ret;
+ *latitude = _media->latitude;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_altitude(media_info_h media, double *altitude)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && altitude) {
- *altitude = _media->altitude;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(altitude);
- return ret;
+ *altitude = _media->altitude;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_rating(media_info_h media, int *rating)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && rating) {
- *rating = _media->rating;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(rating);
- return ret;
+ *rating = _media->rating;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_favorite(media_info_h media, bool* favorite)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && favorite) {
- *favorite = _media->favourite;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(favorite);
- return ret;
+ *favorite = _media->favourite;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_storage_id(media_info_h media, char **storage_id)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_warn("DEPRECATION WARNING: media_info_get_storage_id() is deprecated and will be removed from next release.");
+ content_warn("DEPRECATION WARNING: media_info_get_storage_id() is deprecated and will be removed from next release.");
media_info_s *_media = (media_info_s*)media;
- if (_media && storage_id) {
- if (STRING_VALID(_media->storage_uuid)) {
- *storage_id = strdup(_media->storage_uuid);
- media_content_retvm_if(*storage_id == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- *storage_id = NULL;
- ret = MEDIA_CONTENT_ERROR_DB_FAILED;
- }
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(storage_id);
- return ret;
+ *storage_id = g_strdup(_media->storage_uuid);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_is_drm(media_info_h media, bool *is_drm)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media) {
- *is_drm = _media->is_drm;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(is_drm);
- return ret;
-}
+ *is_drm = _media->is_drm;
-int media_info_is_360_content(media_info_h media, bool *is_360)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_info_s *_media = (media_info_s*)media;
-
- if (_media) {
- *is_360 = _media->is_360;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
+ return MEDIA_CONTENT_ERROR_NONE;
}
-int media_info_get_storage_type(media_info_h media, media_content_storage_e *storage_type)
+int media_info_is_360_content(media_info_h media, bool *is_360)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_warn("DEPRECATION WARNING: media_info_get_storage_type() is deprecated and will be removed from next release. Use storage_get_type_dev() instead.");
media_info_s *_media = (media_info_s*)media;
- if (_media && storage_type) {
- *storage_type = _media->storage_type;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-#ifdef _USE_SENIOR_MODE
-int media_info_set_contact(media_info_h media, const char *contact)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_info_s *_media = (media_info_s*)media;
+ content_retip_if_fail(media);
+ content_retip_if_fail(is_360);
- if (_media != NULL) {
- SAFE_FREE(_media->contact);
- if (STRING_VALID(contact)) {
- _media->contact = strdup(contact);
- media_content_retvm_if(_media->contact == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- _media->contact = NULL;
- }
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ *is_360 = _media->is_360;
- return ret;
+ return MEDIA_CONTENT_ERROR_NONE;
}
-int media_info_set_app_data(media_info_h media, const char *app_data)
+int media_info_get_storage_type(media_info_h media, media_content_storage_e *storage_type)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
+ content_warn("DEPRECATION WARNING: media_info_get_storage_type() is deprecated and will be removed from next release. Use storage_get_type_dev() instead.");
media_info_s *_media = (media_info_s*)media;
- if (_media != NULL) {
- SAFE_FREE(_media->app_data);
- if (STRING_VALID(app_data)) {
- _media->app_data = strdup(app_data);
- media_content_retvm_if(_media->app_data == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- _media->app_data = NULL;
- }
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(storage_type);
- return ret;
-}
+ *storage_type = _media->storage_type;
-int media_info_insert_to_db_with_contact_data(const char *path, const char* contact, const char* app_data, media_info_h *info)
-{
- int ret = media_info_insert_to_db(path, info);
- media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "media_info_insert_to_db [%s] failed", path);
-
- ret = media_info_set_contact(*info, contact);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("media_info_set_contact [%s] failed", contact);
-
- media_info_s* _media_info = (media_info_s*)*info;
- ret = media_info_delete_from_db(_media_info->media_id);
- media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "media_info_delete_from_db [%s] failed", _media_info->media_id);
-
- media_info_destroy(*info);
- return ret;
- }
-
- ret = media_info_set_app_data(*info, app_data);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("media_info_set_app_data [%s] failed", app_data);
-
- media_info_s* _media_info = (media_info_s*)*info;
- ret = media_info_delete_from_db(_media_info->media_id);
- media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "media_info_delete_from_db [%s] failed", _media_info->media_id);
-
- media_info_destroy(*info);
- return ret;
- }
-
- ret = media_info_update_to_db(*info);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("media_info_update_to_db [] failed");
-
- media_info_s* _media_info = (media_info_s*)*info;
- ret = media_info_delete_from_db(_media_info->media_id);
- media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "media_info_delete_from_db [%s] failed", _media_info->media_id);
-
- media_info_destroy(*info);
- return ret;
- }
-
- return ret;
-}
-
-int media_info_delete_contact_from_db(const char* contact, const char* storage_id)
-{
- return -1;
-}
-
-int media_info_delete_item(const char *media_id)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- char *path = NULL;
- char *storage_id = NULL;
-
- if (!STRING_VALID(media_id)) {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- ret = __media_info_get_media_path_by_id_from_db(media_id, &path);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("__media_info_get_media_path_by_id_from_db failed : %d", ret);
- SAFE_FREE(path);
- return ret;
- }
-
- ret = _media_db_get_storage_id_by_media_id(media_id, &storage_id);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("_media_db_get_storage_id_by_media_id failed : %d", ret);
- SAFE_FREE(path);
- return ret;
- }
-
- ret = media_svc_delete_item_by_path(_content_get_db_handle(), storage_id, path, tzplatform_getuid(TZ_USER_NAME));
- SAFE_FREE(storage_id);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("remove from DB failed : %d", ret);
- SAFE_FREE(path);
- return ret;
- }
-
- ret = media_svc_remove_file(path);
- SAFE_FREE(path);
- return _content_error_capi(ret);
-}
-
-int media_info_get_contact(media_info_h media, char **contact)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_info_s *_media = (media_info_s*)media;
-
- if (_media && contact) {
- if (STRING_VALID(_media->contact)) {
- *contact = strdup(_media->contact);
- if (*contact == NULL) {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
- } else {
- *contact = NULL;
- }
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
+ return MEDIA_CONTENT_ERROR_NONE;
}
-int media_info_get_app_data(media_info_h media, char **app_data)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_info_s *_media = (media_info_s*)media;
-
- if (_media && app_data) {
- if (STRING_VALID(_media->app_data)) {
- *app_data = strdup(_media->app_data);
- if (*app_data == NULL) {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
- } else {
- *app_data = NULL;
- }
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-#endif
#ifdef _USE_TVPD_MODE
int media_info_get_played_count(media_info_h media, int *played_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media) {
- *played_count = _media->played_count;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(played_count);
- return ret;
+ *played_count = _media->played_count;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_set_played_count(media_info_h media, int played_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
media_info_s *_media = (media_info_s*)media;
- if (_media) {
- _media->played_count = played_count;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
- return ret;
+ _media->played_count = played_count;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_set_played_position(media_info_h media, int played_position)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if ((_media != NULL) && (played_position >= 0)) {
- _media->played_position = played_position;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(played_position >= 0);
- return ret;
+ _media->played_position = played_position;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_played_position(media_info_h media, int *played_position)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media) {
- *played_position = _media->played_position;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(played_position);
- return ret;
+ *played_position = _media->played_position;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_set_played_time(media_info_h media)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
time_t current_time;
media_info_s *_media = (media_info_s*)media;
- if (_media != NULL) {
- time(¤t_time);
- _media->played_time = current_time;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
- return ret;
+ time(¤t_time);
+ _media->played_time = current_time;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_played_time(media_info_h media, time_t* played_time)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media) {
- *played_time = _media->played_time;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(played_time);
- return ret;
+ *played_time = _media->played_time;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_extract_flag(media_info_h media, int *extract_flag)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s *)media;
- if (_media && extract_flag) {
- *extract_flag = _media->extract_flag;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(extract_flag);
- return ret;
+ *extract_flag = _media->extract_flag;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_stitched_state(media_info_h media, int *stitched_info)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media) {
- *stitched_info = (_media->stitched_info & 0xFFFF0000) >> 16;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(stitched_info);
- return ret;
+ *stitched_info = (_media->stitched_info & 0xFFFF0000) >> 16;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_stitched_engine(media_info_h media, int *stitched_info)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media) {
- *stitched_info = _media->stitched_info & 0x0000FFFF;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(stitched_info);
- return ret;
+ *stitched_info = _media->stitched_info & 0x0000FFFF;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_get_modified_month(media_info_h media, char **modified_month)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media && modified_month) {
- if (STRING_VALID(_media->modified_month)) {
- *modified_month = strdup(_media->modified_month);
- if (*modified_month == NULL) {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
- } else {
- *modified_month = NULL;
- }
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(modified_month);
- return ret;
+ *modified_month = g_strdup(_media->modified_month);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
#endif
{
int ret = MEDIA_CONTENT_ERROR_NONE;
char select_query[DEFAULT_QUERY_SIZE] = {0, };
- char *storage_id = NULL;
sqlite3_stmt *stmt = NULL;
- if (!STRING_VALID(media_id) || (media == NULL)) {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(STRING_VALID(media_id));
+ content_retip_if_fail(media);
- memset(select_query, 0x00, sizeof(select_query));
+#ifdef _USE_TVPD_MODE
+ char *storage_id = NULL;
ret = _media_db_get_storage_id_by_media_id(media_id, &storage_id);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
+ content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_MEDIA, storage_id, media_id);
+ g_free(storage_id);
+#else
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_MEDIA, media_id);
+#endif
ret = _content_get_result(select_query, &stmt);
- SAFE_FREE(storage_id);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+ content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
media_info_s *_media = NULL;
if (sqlite3_step(stmt) == SQLITE_ROW) {
- _media = (media_info_s*)calloc(1, sizeof(media_info_s));
-
- if (_media == NULL) {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- SQLITE3_FINALIZE(stmt);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
+ _media = g_new0(media_info_s, 1);
_media_info_item_get_detail(stmt, (media_info_h)_media);
return ret;
}
-int media_info_set_favorite(media_info_h media, bool favorite)
+int media_info_get_media_from_db_by_path(const char *path, media_info_h *media)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- media_info_s *_media = (media_info_s*)media;
+ media_info_s *_media = NULL;
- if (_media != NULL) {
- if (favorite == TRUE)
- time(&_media->favourite);
- else
- _media->favourite = 0;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ content_retip_if_fail(STRING_VALID(path));
+ content_retip_if_fail(media);
+ ret = _media_util_check_file_exist(path);
+ content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "_media_util_check_file_exist failed : %d", ret);
+
+#ifdef _USE_TVPD_MODE
+ char storage_id[MEDIA_CONTENT_UUID_SIZE + 1] = {0, };
+
+ ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id, _content_get_uid());
+ if (ret != MS_MEDIA_ERR_NONE) {
+ content_error("media_svc_get_storage_id failed : %d", ret);
+ return _content_error_capi(ret);
}
+#endif
+
+ _media = g_new0(media_info_s, 1);
+
+#ifdef _USE_TVPD_MODE
+ ret = _media_info_get_media_info_from_db(path, STRING_VALID(storage_id) ? storage_id : DB_TABLE_MEDIA, (media_info_h)_media);
+#else
+ ret = _media_info_get_media_info_from_db(path, (media_info_h)_media);
+#endif
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ g_free(_media);
+ _media = NULL;
+ }
+
+ *media = (media_info_h)_media;
return ret;
}
+int media_info_set_favorite(media_info_h media, bool favorite)
+{
+ media_info_s *_media = (media_info_s*)media;
+
+ content_retip_if_fail(media);
+
+ if (favorite == TRUE)
+ time(&_media->favourite);
+ else
+ _media->favourite = 0;
+
+ return MEDIA_CONTENT_ERROR_NONE;
+}
+
int media_info_update_to_db(media_info_h media)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
char *set_sql = NULL;
char *sql = NULL;
- if (_media != NULL && STRING_VALID(_media->media_id)) {
- /* This sql is due to sqlite3_mprintf's wrong operation when using floating point in the text format */
- /* This code will be removed when sqlite3_mprintf works clearly */
- char *test_sql = sqlite3_mprintf("%f, %f, %f", _media->longitude, _media->latitude, _media->altitude);
- SQLITE3_SAFE_FREE(test_sql);
-
- /*Update Pinyin If Support Pinyin*/
- char *file_name_pinyin = NULL;
- char *description_pinyin = NULL;
- bool pinyin_support = FALSE;
-
- /*Update Pinyin If Support Pinyin*/
- media_svc_check_pinyin_support(&pinyin_support);
- if (pinyin_support) {
- if (STRING_VALID(_media->display_name))
- media_svc_get_pinyin(_media->display_name, &file_name_pinyin);
- if (STRING_VALID(_media->description))
- media_svc_get_pinyin(_media->description, &description_pinyin);
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(STRING_VALID(_media->media_id));
+
+ /* This sql is due to sqlite3_mprintf's wrong operation when using floating point in the text format */
+ /* This code will be removed when sqlite3_mprintf works clearly */
+ char *test_sql = sqlite3_mprintf("%f, %f, %f", _media->longitude, _media->latitude, _media->altitude);
+ SQLITE3_SAFE_FREE(test_sql);
+
+ /*Update Pinyin If Support Pinyin*/
+ char *file_name_pinyin = NULL;
+ char *description_pinyin = NULL;
+ bool pinyin_support = FALSE;
+
+ /*Update Pinyin If Support Pinyin*/
+ media_svc_check_pinyin_support(&pinyin_support);
+ if (pinyin_support) {
+ if (STRING_VALID(_media->display_name))
+ media_svc_get_pinyin(_media->display_name, &file_name_pinyin);
+ if (STRING_VALID(_media->description))
+ media_svc_get_pinyin(_media->description, &description_pinyin);
+ }
#ifdef _USE_TVPD_MODE
-#ifdef _USE_SENIOR_MODE
- if (_media_content_is_support_senior_mode()) {
- set_sql = sqlite3_mprintf("media_display_name=%Q, media_description=%Q, media_longitude=%f, media_latitude=%f, media_file_name_pinyin=%Q, media_description_pinyin=%Q, played_count=%d, last_played_time=%d, last_played_position=%d, media_rating=%d, media_favourite=%d, contact=%Q, app_data=%Q",
- _media->display_name, _media->description, _media->longitude, _media->latitude, file_name_pinyin, description_pinyin, _media->played_count, _media->played_time, _media->played_position, _media->rating, _media->favourite, _media->contact, _media->app_data);
- } else
+ set_sql = sqlite3_mprintf("media_display_name=%Q, media_description=%Q, media_longitude=%f, media_latitude=%f, media_file_name_pinyin=%Q, media_description_pinyin=%Q, played_count=%d, last_played_time=%d, last_played_position=%d, media_rating=%d, media_favourite=%d",
+ _media->display_name, _media->description, _media->longitude, _media->latitude, file_name_pinyin, description_pinyin, _media->played_count, _media->played_time, _media->played_position, _media->rating, _media->favourite);
+#else
+ set_sql = sqlite3_mprintf("media_display_name=%Q, media_description=%Q, media_longitude=%f, media_latitude=%f, media_file_name_pinyin=%Q, media_description_pinyin=%Q, media_rating=%d, media_favourite=%d", _media->display_name, _media->description, _media->longitude, _media->latitude, file_name_pinyin, description_pinyin, _media->rating, _media->favourite);
#endif
- {
- set_sql = sqlite3_mprintf("media_display_name=%Q, media_description=%Q, media_longitude=%f, media_latitude=%f, media_file_name_pinyin=%Q, media_description_pinyin=%Q, played_count=%d, last_played_time=%d, last_played_position=%d, media_rating=%d, media_favourite=%d",
- _media->display_name, _media->description, _media->longitude, _media->latitude, file_name_pinyin, description_pinyin, _media->played_count, _media->played_time, _media->played_position, _media->rating, _media->favourite);
- }
+#ifdef _USE_TVPD_MODE
+ sql = sqlite3_mprintf("UPDATE %Q SET %s WHERE media_id=%Q", _media->storage_uuid, set_sql, _media->media_id);
#else
- set_sql = sqlite3_mprintf("media_display_name=%Q, media_description=%Q, media_longitude=%f, media_latitude=%f, media_file_name_pinyin=%Q, media_description_pinyin=%Q, media_rating=%d, media_favourite=%d", _media->display_name, _media->description, _media->longitude, _media->latitude, file_name_pinyin, description_pinyin, _media->rating, _media->favourite);
+ sql = sqlite3_mprintf("UPDATE %q SET %s WHERE media_id=%Q", DB_TABLE_MEDIA, set_sql, _media->media_id);
#endif
-
- sql = sqlite3_mprintf("UPDATE %Q SET %s WHERE media_id=%Q", _media->storage_uuid, set_sql, _media->media_id);
-
- ret = _content_query_sql(sql);
- SQLITE3_SAFE_FREE(set_sql);
- SQLITE3_SAFE_FREE(sql);
-
- SAFE_FREE(description_pinyin);
-
- if (ret == MEDIA_CONTENT_ERROR_NONE) {
- /* Send notification for this update */
- media_content_debug("Update is successfull. Send notification for this");
- if (_media->file_path && _media->mime_type)
- media_svc_publish_noti(MS_MEDIA_ITEM_UPDATE, _media->file_path, _media->media_type, _media->media_id, _media->mime_type);
- else
- media_content_error("Can't Send Noti : path or mime type is NULL");
- }
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ ret = _content_query_sql(sql);
+ SQLITE3_SAFE_FREE(set_sql);
+ SQLITE3_SAFE_FREE(sql);
+
+ SAFE_FREE(file_name_pinyin);
+ SAFE_FREE(description_pinyin);
+
+ if (ret == MEDIA_CONTENT_ERROR_NONE) {
+ /* Send notification for this update */
+ content_debug("Update is successfull. Send notification for this");
+ if (_media->file_path && _media->mime_type)
+ media_svc_publish_noti(MS_MEDIA_ITEM_UPDATE, _media->file_path, _media->media_type, _media->media_id, _media->mime_type);
+ else
+ content_error("Can't Send Noti : path or mime type is NULL");
}
return ret;
{
int ret = MEDIA_CONTENT_ERROR_NONE;
char repl_path[MAX_PATH_LEN] = {0, };
+ media_info_s *_info = NULL;
+#ifdef _USE_TVPD_MODE
+ char storage_id[MEDIA_CONTENT_UUID_SIZE + 1] = {0, };
+#endif
+
+ content_retip_if_fail(media);
+ content_retip_if_fail(STRING_VALID(dst_path));
- 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");
- memset(repl_path, 0, sizeof(repl_path));
ret = _media_content_replace_path(dst_path, repl_path);
- media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
+ content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
media_info_s *_media = (media_info_s*)media;
}
/* If the two paths are the same, do nothing */
- media_content_retvm_if(g_strcmp0(repl_path, _media->file_path) == 0, MEDIA_CONTENT_ERROR_NONE, "Same path");
+ content_retvm_if(g_strcmp0(repl_path, _media->file_path) == 0, MEDIA_CONTENT_ERROR_NONE, "Same path");
ret = __media_info_check_file_validity(repl_path);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+ content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
ret = media_svc_move_item(_content_get_db_handle(), _media->file_path, repl_path, _media->media_id, _media->media_type, _media->mime_type, _content_get_uid());
- return _content_error_capi(ret);
+ ret = _content_error_capi(ret);
+ content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+ /* Update media_info handle */
+ _info = g_new0(media_info_s, 1);
+
+#ifdef _USE_TVPD_MODE
+ ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid());
+ content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+ ret = _media_info_get_media_info_from_db(repl_path, storage_id, (media_info_h)_info);
+#else
+ ret = _media_info_get_media_info_from_db(repl_path, (media_info_h)_info);
+#endif
+
+ SAFE_FREE(_media->display_name);
+ _media->display_name = g_strdup(_info->display_name);
+ SAFE_FREE(_media->file_path);
+ _media->file_path = g_strdup(_info->file_path);
+ _media->storage_type = _info->storage_type;
+ SAFE_FREE(_media->storage_uuid);
+ _media->storage_uuid = g_strdup(_info->storage_uuid);
+ SAFE_FREE(_media->thumbnail_path);
+ _media->thumbnail_path = NULL;
+
+ media_info_destroy((media_info_h)_info);
+
+ return ret;
}
int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb callback, void *user_data)
{
+ content_warn("DEPRECATION WARNING: media_info_create_thumbnail() is deprecated and will be removed from next release. Use media_info_generate_thumbnail() instead.");
int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_warn("DEPRECATION WARNING: media_info_create_thumbnail() is deprecated and will be removed from next release. Use media_info_generate_thumbnail() instead.");
static unsigned int req_id = 0;
media_info_s *_media = (media_info_s*)media;
- if (_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path)) {
- media_thumbnail_cb_s *_thumb_cb = (media_thumbnail_cb_s*)calloc(1, sizeof(media_thumbnail_cb_s));
- media_content_retvm_if(_thumb_cb == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- req_id++;
- _media->request_id = req_id;
+ content_retip_if_fail(media);
+ content_retip_if_fail(callback);
+ content_retip_if_fail(STRING_VALID(_media->media_id));
+ content_retip_if_fail(_media->file_path);
- _thumb_cb->handle = _media;
- _thumb_cb->user_data = user_data;
- _thumb_cb->thumbnail_completed_cb = callback;
+ media_thumbnail_cb_s *_thumb_cb = g_new0(media_thumbnail_cb_s, 1);
- ret = thumbnail_request_from_db_async(_media->request_id, _media->file_path, (ThumbFunc)__media_info_thumbnail_completed_cb, (void *)_thumb_cb, _content_get_uid());
- ret = _content_error_capi(ret);
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ req_id++;
+ _media->request_id = req_id;
+
+ _thumb_cb->handle = _media;
+ _thumb_cb->user_data = user_data;
+ _thumb_cb->thumbnail_completed_cb = callback;
+
+ ret = thumbnail_request_from_db_async(_media->request_id, _media->file_path, (ThumbFunc)__media_info_thumbnail_completed_cb, (void *)_thumb_cb, _content_get_uid());
+ ret = _content_error_capi(ret);
return ret;
}
char *thumb_path = NULL;
media_info_s *_media = (media_info_s*)media;
- if (_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path)) {
- /* Already exists */
- if (STRING_VALID(_media->thumbnail_path))
- return MEDIA_CONTENT_ERROR_NONE;
+ content_retip_if_fail(media);
+ content_retip_if_fail(STRING_VALID(_media->media_id));
+ content_retip_if_fail(STRING_VALID(_media->file_path));
- ret = media_svc_create_thumbnail(_media->storage_uuid, _media->file_path, _media->media_type, _content_get_uid(), &thumb_path);
- ret = _content_error_capi(ret);
- if (ret == MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT) {
- SAFE_FREE(thumb_path);
- return ret;
- }
+ /* Already exists */
+ if (STRING_VALID(_media->thumbnail_path))
+ return MEDIA_CONTENT_ERROR_NONE;
- /* thumb_path is not NULL except #MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT */
- _media->thumbnail_path = g_strdup(thumb_path);
- SAFE_FREE(thumb_path);
- if (_media->thumbnail_path == NULL)
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ ret = media_svc_create_thumbnail(_media->file_path, _media->media_type, _content_get_uid(), &thumb_path);
+ ret = _content_error_capi(ret);
+ if (ret == MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT) {
+ g_free(thumb_path);
+ return ret;
}
+ /* thumb_path is not NULL except #MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT */
+ _media->thumbnail_path = g_strdup(thumb_path);
+ g_free(thumb_path);
+
return ret;
}
int media_info_cancel_thumbnail(media_info_h media)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_warn("DEPRECATION WARNING: media_info_cancel_thumbnail() is deprecated and will be removed from next release.");
+ content_warn("DEPRECATION WARNING: media_info_cancel_thumbnail() is deprecated and will be removed from next release.");
media_info_s *_media = (media_info_s*)media;
- if (_media != NULL && STRING_VALID(_media->media_id) && _media->request_id > 0) {
- ret = thumbnail_request_cancel_media(_media->request_id);
- ret = _content_error_capi(ret);
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(STRING_VALID(_media->media_id));
+ content_retip_if_fail(_media->request_id > 0);
- return ret;
+ ret = thumbnail_request_cancel_media(_media->request_id);
+ return _content_error_capi(ret);
}
int media_info_start_face_detection(media_info_h media, media_face_detection_completed_cb callback, void *user_data)
media_info_s *_media = (media_info_s*)media;
if (!__media_info_isFaceRecognition_feature_supported()) {
- media_content_error("NOT_SUPPORTED(0x%08x)", MEDIA_CONTENT_ERROR_NOT_SUPPORTED);
+ content_error("NOT_SUPPORTED(0x%08x)", MEDIA_CONTENT_ERROR_NOT_SUPPORTED);
return MEDIA_CONTENT_ERROR_NOT_SUPPORTED;
}
- if (_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path)) {
- if (g_strcmp0(_media->mime_type, "image/jpeg") != 0 && g_strcmp0(_media->mime_type, "image/png") != 0 && g_strcmp0(_media->mime_type, "image/bmp") != 0) {
- media_content_error("Unsupported mime type");
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(STRING_VALID(_media->media_id));
+ content_retip_if_fail(STRING_VALID(_media->file_path));
+ content_retip_if_fail(callback);
- media_face_cb_s *_face_cb = (media_face_cb_s*)calloc(1, sizeof(media_face_cb_s));
- media_content_retvm_if(_face_cb == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- req_id++;
- _media->face_request_id = req_id;
+ if (g_strcmp0(_media->mime_type, "image/jpeg") != 0 && g_strcmp0(_media->mime_type, "image/png") != 0 && g_strcmp0(_media->mime_type, "image/bmp") != 0) {
+ content_error("Unsupported mime type");
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
- _face_cb->user_data = user_data;
- _face_cb->face_completed_cb = callback;
+ media_face_cb_s *_face_cb = g_new0(media_face_cb_s, 1);
- ret = dcm_request_extract_face_async(_media->face_request_id, _media->file_path, (FaceFunc)__media_info_face_completed_cb, (void *)_face_cb, _content_get_uid());
- ret = _content_error_capi(ret);
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ req_id++;
+ _media->face_request_id = req_id;
+
+ _face_cb->user_data = user_data;
+ _face_cb->face_completed_cb = callback;
+
+ ret = dcm_request_extract_face_async(_media->face_request_id, _media->file_path, (FaceFunc)__media_info_face_completed_cb, (void *)_face_cb, _content_get_uid());
+ ret = _content_error_capi(ret);
return ret;
}
media_info_s *_media = (media_info_s*)media;
if (!__media_info_isFaceRecognition_feature_supported()) {
- media_content_error("NOT_SUPPORTED(0x%08x)", MEDIA_CONTENT_ERROR_NOT_SUPPORTED);
+ content_error("NOT_SUPPORTED(0x%08x)", MEDIA_CONTENT_ERROR_NOT_SUPPORTED);
return MEDIA_CONTENT_ERROR_NOT_SUPPORTED;
}
- if (_media != NULL && STRING_VALID(_media->media_id) && _media->face_request_id > 0) {
- ret = dcm_request_cancel_face(_media->face_request_id);
- ret = _content_error_capi(ret);
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
+ content_retip_if_fail(STRING_VALID(_media->media_id));
+ content_retip_if_fail(_media->face_request_id > 0);
- return ret;
+ ret = dcm_request_cancel_face(_media->face_request_id);
+ return _content_error_capi(ret);
}
int media_info_set_description(media_info_h media, const char *description)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_warn("DEPRECATION WARNING: media_info_set_description() is deprecated and will be removed from next release.");
+ content_warn("DEPRECATION WARNING: media_info_set_description() is deprecated and will be removed from next release.");
media_info_s *_media = (media_info_s*)media;
- if (_media != NULL) {
- SAFE_FREE(_media->description);
+ content_retip_if_fail(media);
- if (STRING_VALID(description)) {
- _media->description = strdup(description);
- media_content_retvm_if(_media->description == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- _media->description = NULL;
- }
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ g_free(_media->description);
+ _media->description = g_strdup(description);
- return ret;
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_set_longitude(media_info_h media, double longitude)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_warn("DEPRECATION WARNING: media_info_set_longitude() is deprecated and will be removed from next release.");
+ content_warn("DEPRECATION WARNING: media_info_set_longitude() is deprecated and will be removed from next release.");
media_info_s *_media = (media_info_s*)media;
- if (_media != NULL) {
- _media->longitude = longitude;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
- return ret;
+ _media->longitude = longitude;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_set_latitude(media_info_h media, double latitude)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_warn("DEPRECATION WARNING: media_info_set_latitude() is deprecated and will be removed from next release.");
+ content_warn("DEPRECATION WARNING: media_info_set_latitude() is deprecated and will be removed from next release.");
media_info_s *_media = (media_info_s*)media;
- if (_media != NULL) {
- _media->latitude = latitude;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
- return ret;
+ _media->latitude = latitude;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_info_set_rating(media_info_h media, int rating)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_warn("DEPRECATION WARNING: media_info_set_rating() is deprecated and will be removed from next release.");
+ content_warn("DEPRECATION WARNING: media_info_set_rating() is deprecated and will be removed from next release.");
media_info_s *_media = (media_info_s*)media;
- if (_media != NULL) {
- _media->rating = rating;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
- return ret;
+ _media->rating = rating;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
+#ifdef TIZEN_FEATURE_COMPATIBILITY
+int media_info_set_added_time(media_info_h media, time_t added_time)
+{
+ content_warn("DEPRECATION WARNING: media_info_set_added_time() is removed from 5.5.");
-int media_info_set_display_name(media_info_h media, const char *display_name)
+ return MEDIA_CONTENT_ERROR_NONE;
+}
+
+int media_info_delete_batch_from_db(filter_h filter)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_warn("DEPRECATION WARNING: media_info_set_display_name() is deprecated and will be removed from next release.");
- media_info_s *_media = (media_info_s*)media;
+ content_warn("DEPRECATION WARNING: media_info_delete_batch_from_db() is removed from 5.5.");
- if (_media != NULL && STRING_VALID(display_name)) {
- SAFE_FREE(_media->display_name);
+ return MEDIA_CONTENT_ERROR_NONE;
+}
- _media->display_name = strdup(display_name);
- media_content_retvm_if(_media->display_name == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+int media_info_create(const char *path, media_info_h *media)
+{
+ content_warn("DEPRECATION WARNING: media_info_create() is removed from 5.5.");
- return ret;
+ return MEDIA_CONTENT_ERROR_NONE;
}
+
+int media_info_refresh_metadata_to_db(const char *media_id)
+{
+ content_warn("DEPRECATION WARNING: media_info_refresh_metadata_to_db() is removed from 5.5.");
+
+ return MEDIA_CONTENT_ERROR_NONE;
+}
+
+int media_info_set_display_name(media_info_h media, const char *display_name)
+{
+ content_warn("DEPRECATION WARNING: media_info_set_display_name() is removed from 5.5.");
+
+ return MEDIA_CONTENT_ERROR_NONE;
+}
+#endif