int audio_meta_destroy(audio_meta_h audio)
{
audio_meta_s *_audio = (audio_meta_s*)audio;
- content_retvm_if(_audio == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Audio handle is null");
+
+ content_retip_if_fail(audio);
g_free(_audio->media_id);
g_free(_audio->album);
int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate)
{
audio_meta_s *_audio = (audio_meta_s*)audio;
- content_retvm_if(!_audio || !bit_rate, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(audio);
+ content_retip_if_fail(bit_rate);
*bit_rate = _audio->bitrate;
int audio_meta_get_bitpersample(audio_meta_h audio, int *bitpersample)
{
audio_meta_s *_audio = (audio_meta_s*)audio;
- content_retvm_if(!_audio || !bitpersample, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(audio);
+ content_retip_if_fail(bitpersample);
*bitpersample = _audio->bitpersample;
int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate)
{
audio_meta_s *_audio = (audio_meta_s*)audio;
- content_retvm_if(!_audio || !sample_rate, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(audio);
+ content_retip_if_fail(sample_rate);
*sample_rate = _audio->samplerate;
int audio_meta_get_channel(audio_meta_h audio, int *channel)
{
audio_meta_s *_audio = (audio_meta_s*)audio;
- content_retvm_if(!_audio || !channel, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(audio);
+ content_retip_if_fail(channel);
*channel = _audio->channel;
int audio_meta_get_duration(audio_meta_h audio, int *duration)
{
audio_meta_s *_audio = (audio_meta_s*)audio;
- content_retvm_if(!_audio || !duration, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(audio);
+ content_retip_if_fail(duration);
*duration = _audio->duration;
sqlite3_stmt *stmt = NULL;
int item_count = 0;
- content_retvm_if(!STRING_VALID(media_id), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid media_id");
+ content_retip_if_fail(STRING_VALID(media_id));
query_str = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_MEDIA_BY_ID, media_id);
ret = _content_get_result(query_str, &stmt);
{
int ret = MEDIA_CONTENT_ERROR_NONE;
char *sql = NULL;
- content_retvm_if(!STRING_VALID(media_id), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(STRING_VALID(media_id));
sql = sqlite3_mprintf(INSERT_BOOKMARK_TO_BOOKMARK, media_id, time, thumbnail_path, MEDIA_CONTENT_EMPTY_STRING);
ret = _content_query_sql(sql);
{
int ret = MEDIA_CONTENT_ERROR_NONE;
char *query_str = NULL;
- content_retvm_if(bookmark_id < 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(bookmark_id >= 0);
query_str = sqlite3_mprintf(DELETE_BOOKMARK_FROM_BOOKMARK, bookmark_id);
ret = _content_query_sql(query_str);
int media_bookmark_get_bookmark_count_from_db(filter_h filter, int *bookmark_count)
{
- content_retvm_if(!bookmark_count, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ content_retip_if_fail(bookmark_count);
return _media_db_get_group_count(filter, MEDIA_GROUP_BOOKMARK, bookmark_count);
}
int media_bookmark_foreach_bookmark_from_db(filter_h filter, media_bookmark_cb callback, void *user_data)
{
- content_retvm_if(!callback, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid paramter");
+ content_retip_if_fail(callback);
return _media_db_get_bookmark(NULL, filter, callback, user_data);
}
int media_bookmark_destroy(media_bookmark_h bookmark)
{
media_bookmark_s *_bookmark = (media_bookmark_s *)bookmark;
- content_retvm_if(!_bookmark, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid paramter");
+
+ content_retip_if_fail(bookmark);
g_free(_bookmark->media_id);
g_free(_bookmark->thumbnail_path);
int media_bookmark_get_bookmark_id(media_bookmark_h bookmark, int *bookmark_id)
{
media_bookmark_s *_bookmark = (media_bookmark_s *)bookmark;
- content_retvm_if(!_bookmark || !bookmark_id, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(bookmark);
+ content_retip_if_fail(bookmark_id);
*bookmark_id = _bookmark->bookmark_id;
int media_bookmark_get_marked_time(media_bookmark_h bookmark, time_t* marked_time)
{
media_bookmark_s *_bookmark = (media_bookmark_s *)bookmark;
- content_retvm_if(!_bookmark || !marked_time, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(bookmark);
+ content_retip_if_fail(marked_time);
*marked_time = _bookmark->marked_time;
int ret = MEDIA_CONTENT_ERROR_NONE;
media_bookmark_s *_bookmark = (media_bookmark_s *)bookmark;
char *sql = NULL;
- content_retvm_if(!_bookmark, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(bookmark);
sql = sqlite3_mprintf(UPDATE_BOOKMARK_FROM_BOOKMARK, _bookmark->name, _bookmark->bookmark_id);
ret = _content_query_sql(sql);
sqlite3_stmt *stmt = NULL;
int bookmark_id = -1;
- content_retvm_if(!_bookmark, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid bookmark");
- content_retvm_if(_bookmark->bookmark_id != -1, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid bookmark");
+ content_retip_if_fail(bookmark);
+ content_retip_if_fail(_bookmark->bookmark_id == -1);
sql = sqlite3_mprintf(INSERT_BOOKMARK_TO_BOOKMARK,
_bookmark->media_id, _bookmark->marked_time, _bookmark->thumbnail_path, _bookmark->name);
int ret = MEDIA_CONTENT_ERROR_NONE;
char *query = NULL;
- content_retvm_if(!STRING_VALID(select_query), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid select_query");
+ content_retip_if_fail(select_query);
/* If 'option_query' is NULL, 'condition_query' is also NULL. */
if (option_query) {
{
int err = MEDIA_CONTENT_ERROR_NONE;
- content_retvm_if(_content_get_db_handle() == NULL, MEDIA_CONTENT_ERROR_DB_FAILED, "database is not connected");
- content_retvm_if(!STRING_VALID(query), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid query");
+ content_retip_if_fail(_content_get_db_handle());
+ content_retip_if_fail(query);
content_sec_debug("Query[%s]", query);
int err = MEDIA_CONTENT_ERROR_NONE;
char query[MAX_QUERY_SIZE] = {0, };
- content_retvm_if(_content_get_db_handle() == NULL, MEDIA_CONTENT_ERROR_DB_FAILED, "database is not connected");
- content_retvm_if(!STRING_VALID(select_query1), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid select_query1");
- content_retvm_if(!STRING_VALID(select_query2), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid select_query2");
+ content_retip_if_fail(_content_get_db_handle());
+ content_retip_if_fail(select_query1);
+ content_retip_if_fail(select_query2);
if (!STRING_VALID(condition_query1))
condition_query1 = (char *)" ";
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
char repl_path[MAX_PATH_LEN] = {0,};
- content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
+ content_retip_if_fail(STRING_VALID(path));
content_sec_debug("Path : %s", path);
int ret = MEDIA_CONTENT_ERROR_NONE;
char repl_path[MAX_PATH_LEN] = {0, };
- content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
+ content_retip_if_fail(STRING_VALID(path));
ret = _media_content_replace_path(path, repl_path);
content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
filter_s *_filter = (filter_s *)filter;
const char* group_name = __media_db_get_group_name(group);
- if (!STRING_VALID(group_name)) {
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- }
+ content_retip_if_fail(STRING_VALID(group_name));
if (group < MEDIA_PVR_GROUP_DURATION) { /*media content*/
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
sqlite3_stmt *stmt = NULL;
int item_count = 0;
- content_retvm_if(!STRING_VALID(media_id), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid media_id");
+ content_retip_if_fail(STRING_VALID(media_id));
/* Get image count */
query_str = sqlite3_mprintf(SELECT_IMAGE_COUNT_FROM_MEDIA_BY_ID, media_id);
{
media_face_s *_face = (media_face_s*)face;
- content_retvm_if(face == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
+ content_retip_if_fail(face);
g_free(_face->media_id);
g_free(_face->face_tag);
{
media_face_s* _face = (media_face_s*)face;
- content_retvm_if(face == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
- content_retvm_if(!(rect_x && rect_y && rect_w && rect_h), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid rect");
+ content_retip_if_fail(face);
+ content_retip_if_fail(rect_x);
+ content_retip_if_fail(rect_y);
+ content_retip_if_fail(rect_w);
+ content_retip_if_fail(rect_h);
*rect_x = _face->face_rect_x;
*rect_y = _face->face_rect_y;
{
media_face_s* _face = (media_face_s*)face;
- content_retvm_if(face == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
- content_retvm_if(orientation == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid orientation");
+ content_retip_if_fail(face);
+ content_retip_if_fail(orientation);
*orientation = _face->orientation;
{
media_face_s* _face = (media_face_s*)face;
- content_retvm_if(face == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
- content_retvm_if(rect_w == 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid rect_w");
- content_retvm_if(rect_h == 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid rect_h");
+ content_retip_if_fail(face);
+ content_retip_if_fail(rect_w > 0);
+ content_retip_if_fail(rect_h > 0);
_face->face_rect_x = rect_x;
_face->face_rect_y = rect_y;
{
media_face_s* _face = (media_face_s*)face;
- content_retvm_if(face == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
+ content_retip_if_fail(face);
_face->orientation = orientation;
media_face_s* _face = (media_face_s*)face;
- content_retvm_if(face == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
- content_retvm_if(_face->media_id == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media_id");
- content_retvm_if(_face->face_rect_w == 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid rect_w");
- content_retvm_if(_face->face_rect_h == 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid rect_h");
+ content_retip_if_fail(face);
+ content_retip_if_fail(_face->media_id);
+ content_retip_if_fail(_face->face_rect_w > 0);
+ content_retip_if_fail(_face->face_rect_h > 0);
query_str = sqlite3_mprintf(INSERT_FACE_TO_FACE, _face->media_id, _face->face_rect_x, _face->face_rect_y, _face->face_rect_w, _face->face_rect_h, _face->orientation, _face->face_tag);
media_face_s* _face = (media_face_s*)face;
- content_retvm_if(face == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
- content_retvm_if(_face->face_id == 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid face_id");
- content_retvm_if(_face->media_id == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media_id");
- content_retvm_if(_face->face_rect_w == 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid rect_w");
- content_retvm_if(_face->face_rect_h == 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid rect_h");
+ content_retip_if_fail(face);
+ content_retip_if_fail(_face->media_id);
+ content_retip_if_fail(_face->face_id > 0);
+ content_retip_if_fail(_face->face_rect_w > 0);
+ content_retip_if_fail(_face->face_rect_h > 0);
query_str = sqlite3_mprintf(UPDATE_FACE_TO_FACE, _face->face_rect_x, _face->face_rect_y, _face->face_rect_w, _face->face_rect_h, _face->orientation, _face->face_tag, _face->face_id);
{
char *end = NULL;
errno = 0;
- content_retvm_if(buffer == NULL || si == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid parameter");
+
+ content_retip_if_fail(buffer);
+ content_retip_if_fail(si);
const long sl = strtol(buffer, &end, 10);
int ret = MEDIA_CONTENT_ERROR_NONE;
char *query_str = NULL;
int query_face_id = 0;
- content_retvm_if(!STRING_VALID(face_id), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid face_id");
ret = __media_face_safe_atoi(face_id, &query_face_id);
content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid face_id");
int media_face_get_face_count_from_db(filter_h filter, int *face_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if (face_count == NULL) {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(face_count);
- ret = _media_db_get_group_count(filter, MEDIA_GROUP_FACE, face_count);
-
- return ret;
+ return _media_db_get_group_count(filter, MEDIA_GROUP_FACE, face_count);
}
int media_face_foreach_face_from_db(filter_h filter, media_face_cb callback, void *user_data)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- content_retvm_if(callback == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid paramter");
+ content_retip_if_fail(callback);
- ret = _media_db_get_face(NULL, filter, callback, user_data);
-
- return ret;
+ return _media_db_get_face(NULL, filter, callback, user_data);
}
int _media_filter_build_condition(bool is_full, const char *condition, media_content_collation_e collate_type, char **result)
{
- content_retvm_if(!result, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid result");
- content_retvm_if(!STRING_VALID(condition), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid condition");
- content_retvm_if(!__check_collate_type(collate_type), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid collate_type");
+ content_retip_if_fail(condition);
+ content_retip_if_fail(__check_collate_type(collate_type));
+ content_retip_if_fail(result);
if (is_full)
*result = g_strdup_printf("(%s)", condition);
{
filter_s *_filter = (filter_s *)filter;
- content_retvm_if(!_filter, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid filter");
- content_retvm_if(!result, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid result");
+ content_retip_if_fail(filter);
+ content_retip_if_fail(result);
if (!STRING_VALID(_filter->order_keyword)) {
*result = g_strdup_printf(" LIMIT %d, %d", _filter->offset, _filter->count);
int media_filter_destroy(filter_h filter)
{
filter_s *_filter = (filter_s *)filter;
- content_retvm_if(!_filter, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid filter");
+
+ content_retip_if_fail(filter);
g_free(_filter->storage_id);
g_free(_filter->condition);
int media_filter_set_offset(filter_h filter, int offset, int count)
{
filter_s *_filter = (filter_s *)filter;
- content_retvm_if(!_filter, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid filter");
+
+ content_retip_if_fail(filter);
_filter->offset = offset;
_filter->count = count;
{
int ret = MEDIA_CONTENT_ERROR_NONE;
filter_s *_filter = (filter_s *)filter;
- content_retvm_if(!_filter, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid filter");
- content_retvm_if(!STRING_VALID(condition), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid condition");
- content_retvm_if(!__check_collate_type(collate_type), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid collate_type");
+
+ content_retip_if_fail(filter);
+ content_retip_if_fail(STRING_VALID(condition));
+ content_retip_if_fail(__check_collate_type(collate_type));
_filter->is_full_condition = false;
g_free(_filter->condition);
int media_filter_get_offset(filter_h filter, int *offset, int *count)
{
filter_s *_filter = (filter_s *)filter;
- content_retvm_if(!_filter || !offset || !count, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(filter);
+ content_retip_if_fail(offset);
+ content_retip_if_fail(count);
*offset = _filter->offset;
*count = _filter->count;
int media_filter_set_condition_v2(filter_h filter, const char *condition)
{
filter_s *_filter = (filter_s *)filter;
- content_retvm_if(!_filter || !STRING_VALID(condition), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(filter);
+ content_retip_if_fail(STRING_VALID(condition));
_filter->is_full_condition = true;
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- if (!folder_count) {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(folder_count);
+
#ifdef _USE_TVPD_MODE
g_mutex_lock(_content_get_db_mutex());
#endif
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- if (callback == NULL) {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(callback);
#ifdef _USE_TVPD_MODE
g_mutex_lock(_content_get_db_mutex());
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- if (STRING_VALID(folder_id) && media_count) {
+ content_retip_if_fail(STRING_VALID(folder_id));
+ content_retip_if_fail(media_count);
+
#ifdef _USE_TVPD_MODE
- g_mutex_lock(_content_get_db_mutex());
+ g_mutex_lock(_content_get_db_mutex());
#endif
- ret = _media_db_get_group_item_count(folder_id, filter, MEDIA_GROUP_FOLDER, media_count);
+ ret = _media_db_get_group_item_count(folder_id, filter, MEDIA_GROUP_FOLDER, media_count);
#ifdef _USE_TVPD_MODE
- g_mutex_unlock(_content_get_db_mutex());
+ g_mutex_unlock(_content_get_db_mutex());
#endif
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
return ret;
}
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- if ((callback != NULL) && STRING_VALID(folder_id)) {
+ content_retip_if_fail(STRING_VALID(folder_id));
+ content_retip_if_fail(callback);
+
#ifdef _USE_TVPD_MODE
- g_mutex_lock(_content_get_db_mutex());
+ g_mutex_lock(_content_get_db_mutex());
#endif
- ret = _media_db_get_group_item(folder_id, filter, callback, user_data, MEDIA_GROUP_FOLDER);
+ ret = _media_db_get_group_item(folder_id, filter, callback, user_data, MEDIA_GROUP_FOLDER);
#ifdef _USE_TVPD_MODE
- g_mutex_unlock(_content_get_db_mutex());
+ g_mutex_unlock(_content_get_db_mutex());
#endif
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
return ret;
}
#ifdef _USE_SENIOR_MODE
int media_folder_foreach_media_from_db_by_union_select(const char* folder_id, filter_h filter1, filter_h filter2, media_info_cb callback, void* user_data)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if ((callback != NULL) && STRING_VALID(folder_id)) {
- ret = _media_db_get_group_item_by_union_select(folder_id, filter1, filter2, callback, user_data);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(STRING_VALID(folder_id));
+ content_retip_if_fail(callback);
- return ret;
+ return _media_db_get_group_item_by_union_select(folder_id, filter1, filter2, callback, user_data);
}
#endif
int media_folder_destroy(media_folder_h folder)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_folder_s *_folder = (media_folder_s*)folder;
- if (_folder) {
- g_free(_folder->path);
- g_free(_folder->name);
- g_free(_folder->folder_id);
- g_free(_folder->storage_uuid);
- g_free(_folder);
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(folder);
- return ret;
+ g_free(_folder->path);
+ g_free(_folder->name);
+ g_free(_folder->folder_id);
+ g_free(_folder->storage_uuid);
+ g_free(_folder);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_folder_clone(media_folder_h *dst, media_folder_h src)
{
int media_folder_get_storage_type(media_folder_h folder, media_content_storage_e* storage_type)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
content_warn("DEPRECATION WARNING: media_folder_get_storage_type() is deprecated and will be removed from next release. Use storage_get_type_dev() instead.");
media_folder_s *_folder = (media_folder_s*)folder;
- if (_folder) {
- *storage_type = _folder->storage_type;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(folder);
+ content_retip_if_fail(storage_type);
- return ret;
+ *storage_type = _folder->storage_type;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_folder_get_storage_id(media_folder_h folder, char **storage_id)
media_folder_s *_folder = (media_folder_s*)folder;
char repl_path[MAX_PATH_LEN] = {0, };
- if ((_folder == NULL) || (_folder->folder_id == NULL)) {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(folder);
+ content_retip_if_fail(STRING_VALID(_folder->folder_id));
- if (STRING_VALID(_folder->folder_id) && g_src_path) {
- ret = _media_content_replace_path(_folder->path, repl_path);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- SAFE_FREE(g_src_path);
- return ret;
- }
- ret = media_svc_rename_folder(_content_get_db_handle(), _folder->storage_uuid, g_src_path, repl_path, _content_get_uid());
- SAFE_FREE(g_src_path);
+ if (!g_src_path)
+ return ret;
- return _content_error_capi(ret);
+
+ ret = _media_content_replace_path(_folder->path, repl_path);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SAFE_FREE(g_src_path);
+ return ret;
}
+ ret = media_svc_rename_folder(_content_get_db_handle(), _folder->storage_uuid, g_src_path, repl_path, _content_get_uid());
+ SAFE_FREE(g_src_path);
- return ret;
+ return _content_error_capi(ret);
}
int media_folder_set_name(media_folder_h folder, const char *name)
content_warn("DEPRECATION WARNING: media_folder_set_name() is deprecated and will be removed from next release.");
media_folder_s *_folder = (media_folder_s*)folder;
- if (_folder != NULL && STRING_VALID(name) && name[0] != '.') {
- if (STRING_VALID(_folder->path) && STRING_VALID(_folder->name)) {
- char *folder_path = NULL;
- char new_folder_path[MAX_PATH_LEN] = {0,};
- char repl_path[MAX_PATH_LEN] = {0, };
+ char *folder_path = NULL;
+ char new_folder_path[MAX_PATH_LEN] = {0,};
+ char repl_path[MAX_PATH_LEN] = {0, };
- ret = _media_content_replace_path(_folder->path, repl_path);
- content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
+ content_retip_if_fail(folder);
+ content_retip_if_fail(STRING_VALID(name));
+ content_retip_if_fail(name[0] != '.');
+ content_retip_if_fail(STRING_VALID(_folder->path));
+ content_retip_if_fail(STRING_VALID(_folder->name));
- folder_path = g_path_get_dirname(repl_path);
- content_sec_debug("Existed Folder Path : %s", repl_path);
- snprintf(new_folder_path, sizeof(new_folder_path), "%s/%s", folder_path, name);
- content_sec_debug("New Path : %s", new_folder_path);
+ ret = _media_content_replace_path(_folder->path, repl_path);
+ content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
- g_free(g_src_path);
- g_src_path = g_strdup(repl_path);
+ folder_path = g_path_get_dirname(repl_path);
+ content_sec_debug("Existed Folder Path : %s", repl_path);
+ snprintf(new_folder_path, sizeof(new_folder_path), "%s/%s", folder_path, name);
+ content_sec_debug("New Path : %s", new_folder_path);
- g_free(_folder->path);
- g_free(_folder->name);
- g_free(folder_path);
+ g_free(g_src_path);
+ g_src_path = g_strdup(repl_path);
- _folder->path = g_strdup(new_folder_path);
- _folder->name = g_strdup(name);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ g_free(_folder->path);
+ g_free(_folder->name);
+ g_free(folder_path);
+
+ _folder->path = g_strdup(new_folder_path);
+ _folder->name = g_strdup(name);
return ret;
}
char repl_path[MAX_PATH_LEN] = {0, };
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
- content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
+ content_retip_if_fail(STRING_VALID(path));
ret = _media_content_replace_path(path, repl_path);
content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
int ret = MEDIA_CONTENT_ERROR_NONE;
int status = MEDIA_DIR_SCAN_NONE;
- if (STRING_VALID(storage_uuid) && STRING_VALID(path)) {
- ret = media_svc_get_folder_scan_status(_content_get_db_handle(), storage_uuid, path, &status);
- if (ret != MS_MEDIA_ERR_NONE) {
- content_error("media_svc_get_folder_scan_status failed");
- ret = _content_error_capi(ret);
- } else {
- *scan_status = status;
- }
+ content_retip_if_fail(STRING_VALID(storage_uuid));
+ content_retip_if_fail(STRING_VALID(path));
+ content_retip_if_fail(scan_status);
+
+ ret = media_svc_get_folder_scan_status(_content_get_db_handle(), storage_uuid, path, &status);
+ if (ret != MS_MEDIA_ERR_NONE) {
+ content_error("media_svc_get_folder_scan_status failed");
+ ret = _content_error_capi(ret);
} else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ *scan_status = status;
}
return ret;
int media_folder_reset_scan_status(const char *storage_uuid, const char* path)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- if (STRING_VALID(path)) {
- ret = media_svc_set_folder_validity(FALSE, storage_uuid, path, 0, TRUE, _content_get_uid());
- if (ret != MS_MEDIA_ERR_NONE) {
- content_error("set folder validity failed");
- ret = _content_error_capi(ret);
- return ret;
- }
- ret = media_svc_set_folder_scan_status(storage_uuid, path, MEDIA_DIR_SCAN_NONE, _content_get_uid());
- if (ret != MS_MEDIA_ERR_NONE) {
- content_error("media_folder_reset_scan_status failed");
- ret = _content_error_capi(ret);
- }
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ content_retip_if_fail(STRING_VALID(path));
+
+ ret = media_svc_set_folder_validity(FALSE, storage_uuid, path, 0, TRUE, _content_get_uid());
+ if (ret != MS_MEDIA_ERR_NONE) {
+ content_error("set folder validity failed");
+ return _content_error_capi(ret);
+ }
+
+ ret = media_svc_set_folder_scan_status(storage_uuid, path, MEDIA_DIR_SCAN_NONE, _content_get_uid());
+ if (ret != MS_MEDIA_ERR_NONE) {
+ content_error("media_folder_reset_scan_status failed");
+ return _content_error_capi(ret);
}
return ret;
int media_album_get_album_count_from_db(filter_h filter, int *album_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
+ content_retip_if_fail(album_count);
- if (album_count != NULL)
- ret = _media_db_get_group_count(filter, MEDIA_GROUP_ALBUM, album_count);
- else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ return _media_db_get_group_count(filter, MEDIA_GROUP_ALBUM, album_count);
- return ret;
}
int media_album_foreach_album_from_db(filter_h filter, media_album_cb callback, void *user_data)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if (callback == NULL) {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- ret = _media_db_get_album(filter, callback, user_data);
+ content_retip_if_fail(callback);
- return ret;
+ return _media_db_get_album(filter, callback, user_data);
}
int media_album_get_media_count_from_db(int album_id, filter_h filter, int *media_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if ((album_id > 0) && (media_count != NULL))
- ret = _media_db_get_group_item_count_by_id(album_id, filter, MEDIA_GROUP_ALBUM, media_count);
- else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(album_id > 0);
+ content_retip_if_fail(media_count);
- return ret;
+ return _media_db_get_group_item_count_by_id(album_id, filter, MEDIA_GROUP_ALBUM, media_count);
}
int media_album_foreach_media_from_db(int album_id, filter_h filter, media_info_cb callback, void *user_data)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
+ content_retip_if_fail(album_id > 0);
+ content_retip_if_fail(callback);
- if ((album_id > 0) && (callback != NULL))
- ret = _media_db_get_group_item_by_id(album_id, filter, callback, user_data, MEDIA_GROUP_ALBUM);
- else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
+ return _media_db_get_group_item_by_id(album_id, filter, callback, user_data, MEDIA_GROUP_ALBUM);
}
int media_album_get_album_from_db(int album_id, media_album_h *album)
int media_album_destroy(media_album_h album)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_album_s *_album = (media_album_s*)album;
- if (_album) {
- g_free(_album->name);
- g_free(_album->artist);
- g_free(_album->album_art_path);
- g_free(_album);
+ content_retip_if_fail(album);
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ g_free(_album->name);
+ g_free(_album->artist);
+ g_free(_album->album_art_path);
+ g_free(_album);
- return ret;
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_album_clone(media_album_h *dst, media_album_h src)
int media_album_get_album_id(media_album_h album, int *album_id)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_album_s *_album = (media_album_s*)album;
- if (_album && album_id) {
- *album_id = _album->album_id;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(album);
+ content_retip_if_fail(album_id);
- return ret;
+ *album_id = _album->album_id;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_album_get_name(media_album_h album, char **name)
int image_meta_destroy(image_meta_h image)
{
image_meta_s *_image = (image_meta_s*)image;
- content_retvm_if(_image == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Image handle is null");
+
+ content_retip_if_fail(image);
g_free(_image->media_id);
g_free(_image->date_taken);
int image_meta_get_width(image_meta_h image, int *width)
{
image_meta_s *_image = (image_meta_s*)image;
- content_retvm_if(!_image || !width, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(image);
+ content_retip_if_fail(width);
*width = _image->width;
int image_meta_get_height(image_meta_h image, int *height)
{
image_meta_s *_image = (image_meta_s*)image;
- content_retvm_if(!_image || !height, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(image);
+ content_retip_if_fail(height);
*height = _image->height;
int image_meta_get_orientation(image_meta_h image, media_content_orientation_e* orientation)
{
image_meta_s *_image = (image_meta_s*)image;
- content_retvm_if(!_image || !orientation, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(image);
+ content_retip_if_fail(orientation);
*orientation = _image->orientation;
int image_meta_get_fnumber(image_meta_h image, double *fnumber)
{
image_meta_s *_image = (image_meta_s*)image;
- content_retvm_if(!_image || !fnumber, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(image);
+ content_retip_if_fail(fnumber);
*fnumber = _image->fnumber;
int image_meta_get_iso(image_meta_h image, int *iso)
{
image_meta_s *_image = (image_meta_s*)image;
- content_retvm_if(!_image || !iso, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(image);
+ content_retip_if_fail(iso);
*iso = _image->iso;
{
content_warn("DEPRECATION WARNING: image_meta_set_orientation() is deprecated and will be removed from next release.");
image_meta_s *_image = (image_meta_s*)image;
- content_retvm_if(!_image, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(image);
content_retvm_if(orientation < MEDIA_CONTENT_ORIENTATION_NOT_AVAILABLE || orientation > MEDIA_CONTENT_ORIENTATION_ROT_270, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid orientation");
_image->orientation = orientation;
image_meta_s *_image = (image_meta_s*)image;
char *sql = NULL;
- content_retvm_if(!_image || !STRING_VALID(_image->media_id), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ content_retip_if_fail(image);
+ content_retip_if_fail(STRING_VALID(_image->media_id));
#ifdef _USE_TVPD_MODE
char *storage_id = NULL;
sqlite3_stmt *stmt = NULL;
char *select_query = NULL;
- 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);
char *folder_path = NULL;
int ret = MEDIA_CONTENT_ERROR_NONE;
- content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
+ content_retip_if_fail(path);
content_retvm_if(_media_util_is_ignorable_file(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid ignore path");
char *select_query = NULL;
media_info_s *_media = (media_info_s*)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);
char *select_query = NULL;
media_info_s *_media = (media_info_s*)media;
- content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid media");
+ content_retip_if_fail(path);
+ content_retip_if_fail(media);
select_query = sqlite3_mprintf(SELECT_MEDIA_BY_PATH, path);
int ret = MEDIA_CONTENT_ERROR_NONE;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
- content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
- content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid info");
+ content_retip_if_fail(STRING_VALID(path));
+ content_retip_if_fail(media);
ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id, tzplatform_getuid(TZ_USER_NAME));
if (ret != MS_MEDIA_ERR_NONE) {
char *storage_id = NULL;
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)) {
- 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) {
int media_info_destroy(media_info_h media)
{
media_info_s *_media = (media_info_s*)media;
- content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Handle is null");
+
+ content_retip_if_fail(media);
g_free(_media->media_id);
g_free(_media->file_path);
int media_info_get_media_count_from_db(filter_h filter, int *media_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if (media_count == NULL) {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ content_retip_if_fail(media_count);
- return ret;
- }
-
- ret = _media_db_get_group_item_count(NULL, filter, MEDIA_GROUP_NONE, 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;
-
- 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 {
- 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 {
- 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 {
- 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;
-
- if ((callback != NULL) && STRING_VALID(media_id)) {
- ret = _media_db_get_bookmark(media_id, filter, callback, user_data);
- } else {
- 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_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 {
- 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 {
- 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)
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 {
- 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 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 {
- 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 {
- 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 {
- 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 {
- 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 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 {
- 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 {
- 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 {
- 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 {
- 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 {
- 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 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 {
- 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;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
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 {
- 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_360);
- return ret;
+ *is_360 = _media->is_360;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
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 && storage_type) {
- *storage_type = _media->storage_type;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- 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;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
#ifdef _USE_SENIOR_MODE
char *path = NULL;
char *storage_id = NULL;
- if (!STRING_VALID(media_id)) {
- 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) {
#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 {
- 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 {
- 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 {
- 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 {
- 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 {
- 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 {
- 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 {
- 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 {
- 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;
+ 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 {
- 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 media_info_set_favorite(media_info_h media, bool favorite)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- if (_media != NULL) {
- if (favorite == TRUE)
- time(&_media->favourite);
- else
- _media->favourite = 0;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media);
- return ret;
+ 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)
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
+ 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
#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);
- }
+ {
+ 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);
+ 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
#ifdef _USE_TVPD_MODE
- sql = sqlite3_mprintf("UPDATE %Q SET %s WHERE media_id=%Q", _media->storage_uuid, set_sql, _media->media_id);
+ sql = sqlite3_mprintf("UPDATE %Q SET %s WHERE media_id=%Q", _media->storage_uuid, set_sql, _media->media_id);
#else
- sql = sqlite3_mprintf("UPDATE %q SET %s WHERE media_id=%Q", DB_TABLE_MEDIA, set_sql, _media->media_id);
+ sql = sqlite3_mprintf("UPDATE %q SET %s WHERE media_id=%Q", DB_TABLE_MEDIA, set_sql, _media->media_id);
#endif
- 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");
- }
- } else {
- 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, };
- content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid media");
- content_retvm_if(!STRING_VALID(dst_path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid dst_path");
+ content_retip_if_fail(media);
+ content_retip_if_fail(STRING_VALID(dst_path));
ret = _media_content_replace_path(dst_path, repl_path);
content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
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 {
- 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)
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 {
- 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 media_info_set_longitude(media_info_h media, double longitude)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
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 {
- 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;
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 {
- 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;
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 {
- 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_pvr_get_media_count_from_db(filter_h filter, int *media_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if (media_count) {
- ret = _media_db_get_group_item_count(NULL, filter, MEDIA_GROUP_PVR, media_count);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media_count);
- return ret;
+ return _media_db_get_group_item_count(NULL, filter, MEDIA_GROUP_PVR, media_count);
}
int media_pvr_foreach_media_from_db(filter_h filter, media_pvr_cb callback, void *user_data)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
+ content_retip_if_fail(callback);
- if (callback != NULL) {
- ret = _media_db_get_pvr(filter, callback, user_data);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
+ return _media_db_get_pvr(filter, callback, user_data);
}
int media_pvr_destroy(media_pvr_h pvr)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr) {
- g_free(_pvr->media_id);
- g_free(_pvr->storage_id);
- g_free(_pvr->channel_name);
- g_free(_pvr->channel_num);
- g_free(_pvr->program_title);
- g_free(_pvr->program_crid);
- g_free(_pvr->guidance);
- g_free(_pvr->synopsis);
- g_free(_pvr->genre);
- g_free(_pvr->language);
- g_free(_pvr->path);
- g_free(_pvr->modified_month);
- g_free(_pvr->private_data);
- g_free(_pvr);
-
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
- return ret;
+ content_retip_if_fail(pvr);
+
+ g_free(_pvr->media_id);
+ g_free(_pvr->storage_id);
+ g_free(_pvr->channel_name);
+ g_free(_pvr->channel_num);
+ g_free(_pvr->program_title);
+ g_free(_pvr->program_crid);
+ g_free(_pvr->guidance);
+ g_free(_pvr->synopsis);
+ g_free(_pvr->genre);
+ g_free(_pvr->language);
+ g_free(_pvr->path);
+ g_free(_pvr->modified_month);
+ g_free(_pvr->private_data);
+ g_free(_pvr);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_clone(media_pvr_h *dst, media_pvr_h src)
char *select_query = NULL;
sqlite3_stmt *stmt = NULL;
- if (!STRING_VALID(media_id) || (pvr == NULL)) {
- 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(pvr);
select_query = sqlite3_mprintf(SELECT_PVR_FROM_PVR, media_id);
int media_pvr_get_size(media_pvr_h pvr, unsigned long long *size)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && size) {
- *size = _pvr->size;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(size);
- return ret;
+ *size = _pvr->size;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_timezone(media_pvr_h pvr, int *timezone)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && timezone) {
- *timezone = _pvr->timezone;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(timezone);
- return ret;
+ *timezone = _pvr->timezone;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_ptc(media_pvr_h pvr, int *ptc)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && ptc) {
- *ptc = _pvr->ptc;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(ptc);
- return ret;
+ *ptc = _pvr->ptc;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_major(media_pvr_h pvr, int *major)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && major) {
- *major = _pvr->major;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(major);
- return ret;
+ *major = _pvr->major;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_minor(media_pvr_h pvr, int *minor)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && minor) {
- *minor = _pvr->minor;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(minor);
- return ret;
+ *minor = _pvr->minor;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_channel_type(media_pvr_h pvr, int *channel_type)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && channel_type) {
- *channel_type = _pvr->channel_type;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(channel_type);
- return ret;
+ *channel_type = _pvr->channel_type;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_program_num(media_pvr_h pvr, int *program_num)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && program_num) {
- *program_num = _pvr->program_num;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(program_num);
- return ret;
+ *program_num = _pvr->program_num;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_service_profile(media_pvr_h pvr, unsigned int *service_profile)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && service_profile) {
- *service_profile = _pvr->service_profile;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(service_profile);
- return ret;
+ *service_profile = _pvr->service_profile;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_duration(media_pvr_h pvr, int *duration)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && duration) {
- *duration = _pvr->duration;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(duration);
- return ret;
+ *duration = _pvr->duration;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_embargo_time(media_pvr_h pvr, int *embargo_time)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && embargo_time) {
- *embargo_time = _pvr->embargo_time;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(embargo_time);
- return ret;
+ *embargo_time = _pvr->embargo_time;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_expiry_time(media_pvr_h pvr, int *expiry_time)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && expiry_time) {
- *expiry_time = _pvr->expiry_time;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(expiry_time);
- return ret;
+ *expiry_time = _pvr->expiry_time;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_parental_rating(media_pvr_h pvr, int *parental_rating)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && parental_rating) {
- *parental_rating = _pvr->parental_rating;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(parental_rating);
- return ret;
+ *parental_rating = _pvr->parental_rating;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_start_time(media_pvr_h pvr, int *start_time)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && start_time) {
- *start_time = _pvr->start_time;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(start_time);
- return ret;
+ *start_time = _pvr->start_time;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_program_start_time(media_pvr_h pvr, int *program_start_time)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && program_start_time) {
- *program_start_time = _pvr->program_start_time;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(program_start_time);
- return ret;
+ *program_start_time = _pvr->program_start_time;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_program_end_time(media_pvr_h pvr, int *end_time)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && end_time) {
- *end_time = _pvr->program_end_time;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(end_time);
- return ret;
+ *end_time = _pvr->program_end_time;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_program_date(media_pvr_h pvr, int *program_date)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && program_date) {
- *program_date = _pvr->program_date;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(program_date);
- return ret;
+ *program_date = _pvr->program_date;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_timer_record(media_pvr_h pvr, bool* timer_record)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && timer_record) {
- *timer_record = _pvr->timer_record;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(timer_record);
- return ret;
+ *timer_record = _pvr->timer_record;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_series_record(media_pvr_h pvr, bool* series_record)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && series_record) {
- *series_record = _pvr->series_record;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(series_record);
- return ret;
+ *series_record = _pvr->series_record;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_hd(media_pvr_h pvr, int* hd)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && hd) {
- *hd = _pvr->hd;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(hd);
- return ret;
+ *hd = _pvr->hd;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_subtitle(media_pvr_h pvr, bool* subtitle)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && subtitle) {
- *subtitle = _pvr->subtitle;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(subtitle);
- return ret;
+ *subtitle = _pvr->subtitle;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_ttx(media_pvr_h pvr, bool* ttx)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && ttx) {
- *ttx = _pvr->ttx;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(ttx);
- return ret;
+ *ttx = _pvr->ttx;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_ad(media_pvr_h pvr, bool* ad)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && ad) {
- *ad = _pvr->ad;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(ad);
- return ret;
+ *ad = _pvr->ad;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_hard_of_hearing_radio(media_pvr_h pvr, bool* hard_of_hearing_radio)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && hard_of_hearing_radio) {
- *hard_of_hearing_radio = _pvr->hard_of_hearing_radio;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(hard_of_hearing_radio);
- return ret;
+ *hard_of_hearing_radio = _pvr->hard_of_hearing_radio;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_data_service(media_pvr_h pvr, bool* data_service)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && data_service) {
- *data_service = _pvr->data_service;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(data_service);
- return ret;
+ *data_service = _pvr->data_service;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_content_lock(media_pvr_h pvr, bool* content_lock)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && content_lock) {
- *content_lock = _pvr->content_lock;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(content_lock);
- return ret;
+ *content_lock = _pvr->content_lock;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_content_watch(media_pvr_h pvr, bool* content_watch)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && content_watch) {
- *content_watch = _pvr->content_watch;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(content_watch);
- return ret;
+ *content_watch = _pvr->content_watch;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_has_audio_only(media_pvr_h pvr, bool* has_audio_only)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && has_audio_only) {
- *has_audio_only = _pvr->has_audio_only;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(has_audio_only);
- return ret;
+ *has_audio_only = _pvr->has_audio_only;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_is_local_record(media_pvr_h pvr, bool* is_local_record)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && is_local_record) {
- *is_local_record = _pvr->is_local_record;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(is_local_record);
- return ret;
+ *is_local_record = _pvr->is_local_record;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_resolution(media_pvr_h pvr, media_pvr_resolution_e* resolution)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && resolution) {
- *resolution = _pvr->resolution;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(resolution);
- return ret;
+ *resolution = _pvr->resolution;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_aspectratio(media_pvr_h pvr, media_pvr_aspectratio_e* aspectratio)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && aspectratio) {
- *aspectratio = _pvr->aspectratio;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(aspectratio);
- return ret;
+ *aspectratio = _pvr->aspectratio;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_modified_month(media_pvr_h pvr, char **modified_month)
int media_pvr_get_sports_type(media_pvr_h pvr, int* sports_type)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && sports_type) {
- *sports_type = _pvr->sports_type;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(sports_type);
- return ret;
+ *sports_type = _pvr->sports_type;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_guidance_length(media_pvr_h pvr, int* guidance_length)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && guidance_length) {
- *guidance_length = _pvr->guidance_length;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(guidance_length);
- return ret;
+ *guidance_length = _pvr->guidance_length;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_tvmode(media_pvr_h pvr, int* tvmode)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && tvmode) {
- *tvmode = _pvr->tvmode;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(tvmode);
- return ret;
+ *tvmode = _pvr->tvmode;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_play_count(media_pvr_h pvr, int* play_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && play_count) {
- *play_count = _pvr->play_count;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(play_count);
- return ret;
+ *play_count = _pvr->play_count;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_get_private_data(media_pvr_h pvr, char **private_data)
int media_pvr_get_highlight(media_pvr_h pvr, bool *highlight)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr && highlight) {
- *highlight = _pvr->highlight;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(highlight);
- return ret;
+ *highlight = _pvr->highlight;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_set_play_count(media_pvr_h pvr, int play_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr != NULL) {
- _pvr->play_count = play_count;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
- return ret;
+ _pvr->play_count = play_count;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_set_program_title(media_pvr_h pvr, const char *program_title)
int media_pvr_set_content_lock(media_pvr_h pvr, bool content_lock)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr != NULL) {
- _pvr->content_lock = content_lock;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
- return ret;
+ _pvr->content_lock = content_lock;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_set_content_watch(media_pvr_h pvr, bool content_watch)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr != NULL) {
- _pvr->content_watch = content_watch;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
- return ret;
+ _pvr->content_watch = content_watch;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_set_highlight(media_pvr_h pvr, bool highlight)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_pvr_s *_pvr = (media_pvr_s*)pvr;
- if (_pvr != NULL) {
- _pvr->highlight = highlight;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(pvr);
- return ret;
+ _pvr->highlight = highlight;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_pvr_update_to_db(media_pvr_h pvr)
media_pvr_s *_pvr = (media_pvr_s*)pvr;
char *update_query = NULL;
- if (_pvr != NULL && STRING_VALID(_pvr->media_id) && STRING_VALID(_pvr->path)) {
- update_query = sqlite3_mprintf(UPDATE_PVR_META_FROM_PVR, _pvr->program_title, _pvr->content_lock, _pvr->content_watch, _pvr->play_count, _pvr->highlight, _pvr->media_id);
+ content_retip_if_fail(pvr);
+ content_retip_if_fail(STRING_VALID(_pvr->media_id));
+ content_retip_if_fail(STRING_VALID(_pvr->path));
- ret = _content_query_sql(update_query);
- sqlite3_free(update_query);
+ update_query = sqlite3_mprintf(UPDATE_PVR_META_FROM_PVR, _pvr->program_title, _pvr->content_lock, _pvr->content_watch, _pvr->play_count, _pvr->highlight, _pvr->media_id);
+
+ ret = _content_query_sql(update_query);
+ sqlite3_free(update_query);
+
+ if (ret == MEDIA_CONTENT_ERROR_NONE)
+ media_svc_update_pvr_info(_content_get_db_handle(), _pvr->path, _pvr->program_title, _pvr->content_lock);
- if (ret == MEDIA_CONTENT_ERROR_NONE)
- media_svc_update_pvr_info(_content_get_db_handle(), _pvr->path, _pvr->program_title, _pvr->content_lock);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
return ret;
}
int media_pvr_group_foreach_media_from_db(const char *group_name, media_group_e group, filter_h filter, media_pvr_cb callback, void *user_data)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
+ content_retip_if_fail(callback);
+ content_retvm_if((group < MEDIA_PVR_GROUP_DURATION) || (group >= MEDIA_GROUP_MAX), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid group");
- if ((callback == NULL) || (group < MEDIA_PVR_GROUP_DURATION) || (group >= MEDIA_GROUP_MAX)) {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- } else {
- ret = _media_db_get_pvr_group_item(group_name, filter, group, callback, user_data);
- }
-
- return ret;
+ return _media_db_get_pvr_group_item(group_name, filter, group, callback, user_data);
}
int media_pvr_set_is_local_record(const char *pvr_path, bool is_local_record)
char *update_query = NULL;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
- if (pvr_path == NULL) {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- } else {
+ content_retip_if_fail(pvr_path);
- /*get the storage uuid*/
- ret = media_svc_get_storage_id(_content_get_db_handle(), pvr_path, storage_id, tzplatform_getuid(TZ_USER_NAME));
- if (ret == MS_MEDIA_ERR_NONE) {
- content_error("storage uuid [%s]", storage_id);
- update_query = sqlite3_mprintf(UPDATE_PVR_LOCAL_RECORD_PVR, is_local_record, pvr_path, storage_id);
-
- ret = _content_query_sql(update_query);
- sqlite3_free(update_query);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- content_error("pvr path[%s] error[%d]", pvr_path, ret);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
- }
+ /*get the storage uuid*/
+ ret = media_svc_get_storage_id(_content_get_db_handle(), pvr_path, storage_id, tzplatform_getuid(TZ_USER_NAME));
+ content_retvm_if(ret != MS_MEDIA_ERR_NONE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid pvr path[%s] error[%d]", pvr_path, ret);
+
+ content_error("storage uuid [%s]", storage_id);
+ update_query = sqlite3_mprintf(UPDATE_PVR_LOCAL_RECORD_PVR, is_local_record, pvr_path, storage_id);
+
+ ret = _content_query_sql(update_query);
+ sqlite3_free(update_query);
return ret;
}
int media_storage_get_storage_count_from_db(filter_h filter, int *storage_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
content_warn("DEPRECATION WARNING: media_storage_get_storage_count_from_db() is deprecated and will be removed from next release.");
- if (storage_count) {
- ret = _media_db_get_group_count(filter, MEDIA_GROUP_STORAGE, storage_count);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(storage_count);
- return ret;
+ return _media_db_get_group_count(filter, MEDIA_GROUP_STORAGE, storage_count);
}
int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb callback, void *user_data)
int ret = MEDIA_CONTENT_ERROR_NONE;
content_warn("DEPRECATION WARNING: media_storage_foreach_storage_from_db() is deprecated and will be removed from next release.");
- if (callback != NULL) {
+ content_retip_if_fail(callback);
+
#ifdef _USE_TVPD_MODE
g_mutex_lock(_content_get_db_mutex());
#endif
-
- ret = _media_db_get_storage(filter, callback, user_data);
+ ret = _media_db_get_storage(filter, callback, user_data);
#ifdef _USE_TVPD_MODE
g_mutex_unlock(_content_get_db_mutex());
#endif
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
return ret;
}
int media_storage_get_media_count_from_db(const char *storage_id, filter_h filter, int *media_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
content_warn("DEPRECATION WARNING: media_storage_get_media_count_from_db() is deprecated and will be removed from next release.");
- if (STRING_VALID(storage_id) && media_count) {
- ret = _media_db_get_group_item_count(storage_id, filter, MEDIA_GROUP_STORAGE, media_count);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(STRING_VALID(storage_id));
+ content_retip_if_fail(media_count);
- return ret;
+ return _media_db_get_group_item_count(storage_id, filter, MEDIA_GROUP_STORAGE, media_count);
}
int media_storage_foreach_media_from_db(const char *storage_id, filter_h filter, media_info_cb callback, void *user_data)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
content_warn("DEPRECATION WARNING: media_storage_foreach_media_from_db() is deprecated and will be removed from next release.");
- if ((callback != NULL) && STRING_VALID(storage_id)) {
- ret = _media_db_get_group_item(storage_id, filter, callback, user_data, MEDIA_GROUP_STORAGE);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(STRING_VALID(storage_id));
+ content_retip_if_fail(callback);
- return ret;
+ return _media_db_get_group_item(storage_id, filter, callback, user_data, MEDIA_GROUP_STORAGE);
}
int media_storage_destroy(media_storage_h storage)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
content_warn("DEPRECATION WARNING: media_storage_destroy() is deprecated and will be removed from next release.");
media_storage_s *_storage = (media_storage_s*)storage;
- if (_storage) {
- g_free(_storage->storage_id);
- g_free(_storage->storage_path);
- g_free(_storage);
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(storage);
- return ret;
+ g_free(_storage->storage_id);
+ g_free(_storage->storage_path);
+ g_free(_storage);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_storage_clone(media_storage_h *dst, media_storage_h src)
int media_storage_get_type(media_storage_h storage, media_content_storage_e *storage_type)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
content_warn("DEPRECATION WARNING: media_storage_get_type() is deprecated and will be removed from next release. Use storage_get_type_dev() instead.");
media_storage_s *_storage = (media_storage_s*)storage;
- if (_storage && storage_type) {
- *storage_type = _storage->storage_type;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(storage);
+ content_retip_if_fail(storage_type);
- return ret;
+ *storage_type = _storage->storage_type;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
#ifdef _USE_TVPD_MODE
int ret = MEDIA_CONTENT_ERROR_NONE;
media_svc_scan_status_type_e status = MEDIA_STORAGE_SCAN_NONE;
- if (STRING_VALID(storage_uuid)) {
- ret = media_svc_get_storage_scan_status(_content_get_db_handle(), storage_uuid, &status);
- if (ret != MS_MEDIA_ERR_NONE) {
- content_error("media_svc_get_storage_scan_status failed");
- ret = _content_error_capi(ret);
- } else {
- *scan_status = status;
- }
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ content_retip_if_fail(STRING_VALID(storage_uuid));
+ content_retip_if_fail(scan_status);
+
+ ret = media_svc_get_storage_scan_status(_content_get_db_handle(), storage_uuid, &status);
+ if (ret != MS_MEDIA_ERR_NONE) {
+ content_error("media_svc_get_storage_scan_status failed");
+ return _content_error_capi(ret);
}
+ *scan_status = status;
+
return ret;
}
#endif
int media_tag_get_tag_id(media_tag_h tag, int *tag_id)
{
media_tag_s *_tag = (media_tag_s *)tag;
+
content_retip_if_fail(tag);
content_retip_if_fail(tag_id);
int media_tag_get_name(media_tag_h tag, char **name)
{
media_tag_s *_tag = (media_tag_s *)tag;
+
content_retip_if_fail(tag);
content_retip_if_fail(name);
int media_uhd_get_media_count_from_db(filter_h filter, int *media_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if (media_count) {
- ret = _media_db_get_group_item_count(NULL, filter, MEDIA_GROUP_UHD, media_count);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(media_count);
- return ret;
+ return _media_db_get_group_item_count(NULL, filter, MEDIA_GROUP_UHD, media_count);
}
int media_uhd_foreach_media_from_db(filter_h filter, media_uhd_cb callback, void *user_data)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
+ content_retip_if_fail(callback);
- if (callback != NULL) {
- ret = _media_db_get_uhd(filter, callback, user_data);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
+ return _media_db_get_uhd(filter, callback, user_data);
}
int media_uhd_destroy(media_uhd_h uhd)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_uhd_s *_uhd = (media_uhd_s*)uhd;
- if (_uhd) {
- g_free(_uhd->media_id);
- g_free(_uhd->storage_id);
- g_free(_uhd->path);
- g_free(_uhd->content_id);
- g_free(_uhd->content_title);
- g_free(_uhd->file_name);
- g_free(_uhd->release_date);
- g_free(_uhd);
-
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
- return ret;
+ content_retip_if_fail(uhd);
+
+ g_free(_uhd->media_id);
+ g_free(_uhd->storage_id);
+ g_free(_uhd->path);
+ g_free(_uhd->content_id);
+ g_free(_uhd->content_title);
+ g_free(_uhd->file_name);
+ g_free(_uhd->release_date);
+ g_free(_uhd);
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_uhd_clone(media_uhd_h *dst, media_uhd_h src)
char *select_query = NULL;
sqlite3_stmt *stmt = NULL;
- if (!STRING_VALID(media_id) || (uhd == NULL)) {
- 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(uhd);
select_query = sqlite3_mprintf(SELECT_UHD_FROM_UHD, media_id);
int media_uhd_get_size(media_uhd_h uhd, unsigned long long *size)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_uhd_s *_uhd = (media_uhd_s*)uhd;
- if (_uhd && size) {
- *size = _uhd->size;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(uhd);
+ content_retip_if_fail(size);
- return ret;
+ *size = _uhd->size;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_uhd_get_content_id(media_uhd_h uhd, char **content_id)
int media_uhd_get_modified_time(media_uhd_h uhd, time_t *modified_time)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_uhd_s *_uhd = (media_uhd_s*)uhd;
- if (_uhd && modified_time) {
- *modified_time = _uhd->modified_time;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(uhd);
+ content_retip_if_fail(modified_time);
- return ret;
+ *modified_time = _uhd->modified_time;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_uhd_get_played_position(media_uhd_h uhd, int *played_position)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_uhd_s *_uhd = (media_uhd_s*)uhd;
- if (_uhd) {
- *played_position = _uhd->played_position;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(uhd);
+ content_retip_if_fail(played_position);
- return ret;
+ *played_position = _uhd->played_position;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_uhd_get_sub_type(media_uhd_h uhd, int *sub_type)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_uhd_s *_uhd = (media_uhd_s*)uhd;
- if (_uhd) {
- *sub_type = _uhd->sub_type;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(uhd);
+ content_retip_if_fail(sub_type);
- return ret;
+ *sub_type = _uhd->sub_type;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_uhd_get_played_count(media_uhd_h uhd, int *played_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_uhd_s *_uhd = (media_uhd_s*)uhd;
- if (_uhd) {
- *played_count = _uhd->played_count;
- ret = MEDIA_CONTENT_ERROR_NONE;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(uhd);
+ content_retip_if_fail(played_count);
- return ret;
+ *played_count = _uhd->played_count;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_uhd_set_played_position(media_uhd_h uhd, int played_position)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_uhd_s *_uhd = (media_uhd_s*)uhd;
- if ((_uhd != NULL) && (played_position >= 0)) {
- _uhd->played_position = played_position;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(uhd);
+ content_retip_if_fail(played_position);
- return ret;
+ _uhd->played_position = played_position;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_uhd_set_content_title(media_uhd_h uhd, const char *content_title)
int media_uhd_set_sub_type(media_uhd_h uhd, int sub_type)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_uhd_s *_uhd = (media_uhd_s*)uhd;
- if ((_uhd != NULL) && (sub_type >= 0)) {
- _uhd->sub_type = sub_type;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(uhd);
+ content_retip_if_fail(sub_type >= 0);
- return ret;
+ _uhd->sub_type = sub_type;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_uhd_set_played_count(media_uhd_h uhd, int played_count)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
media_uhd_s *_uhd = (media_uhd_s*)uhd;
- if (_uhd != NULL) {
- _uhd->played_count = played_count;
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ content_retip_if_fail(uhd);
- return ret;
+ _uhd->played_count = played_count;
+
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_uhd_update_to_db(media_uhd_h uhd)
media_uhd_s *_uhd = (media_uhd_s*)uhd;
char *update_query = NULL;
- if (_uhd != NULL && STRING_VALID(_uhd->media_id) && STRING_VALID(_uhd->path)) {
- update_query = sqlite3_mprintf(UPDATE_UHD_META_FROM_UHD, _uhd->content_title, _uhd->release_date, _uhd->played_position, _uhd->sub_type, _uhd->played_count, _uhd->media_id);
+ content_retip_if_fail(uhd);
+ content_retip_if_fail(STRING_VALID(_uhd->media_id));
+ content_retip_if_fail(STRING_VALID(_uhd->path));
- ret = _content_query_sql(update_query);
- sqlite3_free(update_query);
- } else {
- content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ update_query = sqlite3_mprintf(UPDATE_UHD_META_FROM_UHD, _uhd->content_title, _uhd->release_date, _uhd->played_position, _uhd->sub_type, _uhd->played_count, _uhd->media_id);
+
+ ret = _content_query_sql(update_query);
+ sqlite3_free(update_query);
return ret;
}
bool _media_util_is_ignorable_file(const char *path)
{
- content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
-
char *tmp_path = NULL;
char *org_path = NULL;
char replace[MAX_PATH_LEN] = {0, };
#endif
+ content_retip_if_fail(STRING_VALID(path));
+
/* Check is exist (It may be the path to the deleted file) */
if (!g_file_test(path, G_FILE_TEST_EXISTS)) {
content_sec_debug("removed path[%s]", path);
int ret = MEDIA_CONTENT_ERROR_NONE;
ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
- content_retvm_if(!STRING_VALID(dir_path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid dir_path");
+ content_retip_if_fail(STRING_VALID(dir_path));
+
content_sec_debug("dir_path : %s", dir_path);
/*1. Check Hidden Directory*/
/* FIXME : If there are no issue reports related to this, it will be deleted in Tizen 6.5 or after. */
int _media_content_replace_path(const char *path, char *replace_path)
{
- content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
+ content_retip_if_fail(STRING_VALID(path));
snprintf(replace_path, MAX_PATH_LEN, "%s", path);
#if 0
int video_meta_destroy(video_meta_h video)
{
video_meta_s *_video = (video_meta_s*)video;
- content_retvm_if(!_video, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Video handle is null");
+
+ content_retip_if_fail(video);
g_free(_video->media_id);
g_free(_video->album);
int video_meta_get_bit_rate(video_meta_h video, int *bit_rate)
{
video_meta_s *_video = (video_meta_s*)video;
- content_retvm_if(!_video || !bit_rate, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(video);
+ content_retip_if_fail(bit_rate);
*bit_rate = _video->bitrate;
int video_meta_get_duration(video_meta_h video, int *duration)
{
video_meta_s *_video = (video_meta_s*)video;
- content_retvm_if(!_video || !duration, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(video);
+ content_retip_if_fail(duration);
*duration = _video->duration;
int video_meta_get_width(video_meta_h video, int *width)
{
video_meta_s *_video = (video_meta_s*)video;
- content_retvm_if(!_video || !width, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(video);
+ content_retip_if_fail(width);
*width = _video->width;
int video_meta_get_height(video_meta_h video, int *height)
{
video_meta_s *_video = (video_meta_s*)video;
- content_retvm_if(!_video || !height, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(video);
+ content_retip_if_fail(height);
*height = _video->height;
int video_meta_get_rotation(video_meta_h video, int *rotation)
{
video_meta_s *_video = (video_meta_s*)video;
- content_retvm_if(!_video || !rotation, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
+
+ content_retip_if_fail(video);
+ content_retip_if_fail(rotation);
*rotation = _video->rotation;