int last_played_position; /**< last played position */
time_t favourate; /**< time favourate set */
int is_drm; /**< is_drm. o or 1 */
- int sync_status; /**< sync_status */
+ int sync_status; /**< sync_status */
int storage_type; /**< Storage of media file : internal/external */
char *storage_uuid; /**< Unique ID of storage */
media_svc_content_meta_s media_meta; /**< meta data structure for audio files */
MEDIA_SVC_SCAN_MAX = 4, /**< Invalid status*/
}media_svc_scan_status_type_e;
-#define MEDIA_SVC_DEFAULT_GPS_VALUE -200 /**< Default GPS Value*/
+#define MEDIA_SVC_DEFAULT_GPS_VALUE -200 /**< Default GPS Value*/
#endif /*_MEDIA_SVC_TYPES_H_*/
return MEDIA_SVC_PLUGIN_ERROR_NONE;
}
-int set_all_storage_items_validity(void *handle, const char *storage_id, int storage_type, int validity, uid_t uid, char **err_msg)
+int set_all_storage_items_validity(void *handle, const char *storage_id, int storage_type, int validity, uid_t uid, char **err_msg)
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_generate_uuid(uuid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_get_mmc_info(handle, storage_name, storage_path, validity, info_exist);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(MS_MEDIA_ERR_DB_NO_RECORD, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_check_storage(handle, storage_id, storage_name, storage_path, validity);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_insert_storage(handle, storage_id, storage_name, storage_path, NULL, storage_type, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_update_storage(handle, storage_id, storage_path, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_delete_storage(handle, storage_id, storage_name, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_set_storage_validity(handle, storage_id, validity, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_set_storage_validity(handle, NULL, validity, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_get_storage_id(handle, path, storage_id);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
media_svc_scan_status_type_e storage_status = 0;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_get_storage_scan_status(handle, storage_id, &storage_status);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
media_svc_scan_status_type_e storage_status = status;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_set_storage_scan_status(handle, storage_id, storage_status, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
- if(count == NULL) {
+ if (count == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_get_storage_list(handle, storage_list, storage_id_list, scan_status_list, count);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
return MEDIA_SVC_PLUGIN_ERROR;
}
- if(!STORAGE_VALID(storage_type)) {
+ if (!STORAGE_VALID(storage_type)) {
__set_error_message(ERR_STORAGE_TYPE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_insert_item_pass1(handle, storage_id, storage_type, file_path, FALSE, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
- if(!STORAGE_VALID(storage_type)) {
+ if (!STORAGE_VALID(storage_type)) {
__set_error_message(ERR_STORAGE_TYPE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_insert_item_pass2(handle, storage_id, storage_type, scan_type, path, FALSE, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_insert_folder_begin(handle, item_cnt);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_insert_folder_end(handle, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
return MEDIA_SVC_PLUGIN_ERROR;
}
- if(!STORAGE_VALID(storage_type)) {
+ if (!STORAGE_VALID(storage_type)) {
__set_error_message(ERR_STORAGE_TYPE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_insert_folder(handle, storage_id, storage_type, file_path, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_delete_invalid_folder(handle, storage_id, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_set_folder_validity(handle, storage_id, start_path, validity, is_recursive, uid);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_delete_invalid_folder_by_path(handle, storage_id, folder_path, uid, delete_count);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_check_folder_exist_by_path(handle, storage_id, folder_path);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
int cnt = 0;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_check_subfolder_by_path(handle, storage_id, folder_path, &cnt);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if(handle == NULL) {
+ if (handle == NULL) {
__set_error_message(ERR_HANDLE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
ret = media_svc_get_folder_id(handle, storage_id, path, folder_id);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
int ret = MS_MEDIA_ERR_NONE;
char *sql = sqlite3_mprintf("INSERT INTO %s (name, artist, album_art, album_art) values (%Q, %Q, %Q, %Q); ",
- MEDIA_SVC_DB_TABLE_ALBUM, album, artist, album_art, album_art);
+ MEDIA_SVC_DB_TABLE_ALBUM, album, artist, album_art, album_art);
ret = _media_svc_sql_query(handle, sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
if (STRING_VALID(triggerName)) {
tbl->triggerName = malloc(MEDIA_SVC_PATHNAME_SIZE);
- if(tbl->triggerName == NULL) {
+ if (tbl->triggerName == NULL) {
media_svc_error("MS_MEDIA_ERR_OUT_OF_MEMORY");
SAFE_FREE(tbl);
return MS_MEDIA_ERR_OUT_OF_MEMORY;
int i = 0;
tb = g_hash_table_lookup(table, table_name);
- if(tb == NULL) {
+ if (tb == NULL) {
media_svc_debug("lookup fail.. table name [%s] ", table_name);
tb = g_hash_table_lookup(table, MEDIA_SVC_DB_TABLE_MEDIA);
}
col_ptr = g_slist_nth_data(column_list[list], i);
/*create table */
if (col_ptr->hasOption) {
- if(sflag == true) {
+ if (sflag == true) {
snprintf(temp, sizeof(temp), ", %s %s %s", col_ptr->name, col_ptr->type, col_ptr->option);
strncat(table_query, temp, strlen(temp));
} else {
for (i = 1; i < len; i++) {
col_ptr = g_slist_nth_data(column_list[MEDIA_SVC_DB_LIST_TAG], i);
if (col_ptr->isView) {
- if(sflag == true) {
+ if (sflag == true) {
snprintf(temp, sizeof(temp), ", tag.%s", col_ptr->name);
strncat(table_query, temp, strlen(temp));
} else {
column_list[i] = g_slist_alloc();
}
- /*table specification.. (table_name, index, unique set, trigger, view, trigger name, event table, action table, view name) */
+ /*table specification.. (table_name, index, unique set, trigger, view, trigger name, event table, action table, view name) */
ret = __media_svc_add_table_info(MEDIA_SVC_DB_TABLE_MEDIA, NULL, NULL, NULL, MEDIA_SVC_DB_VIEW_MEDIA);
ret = __media_svc_add_table_info(MEDIA_SVC_DB_TABLE_FOLDER, MEDIA_SVC_DB_TRIGGER_FOLDER, event_table_name, MEDIA_SVC_DB_TABLE_FOLDER, NULL);
ret = __media_svc_add_table_info(MEDIA_SVC_DB_TABLE_PLAYLIST_MAP, MEDIA_SVC_DB_TRIGGER_PLAYLIST_MAP, event_table_name, MEDIA_SVC_DB_TABLE_PLAYLIST_MAP, NULL);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_FOLDER], "name_pinyin", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, false);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_FOLDER], "storage_type", MEDIA_SVC_DB_TYPE_INT, NULL, USER_V2, NULL, false, false, false);
/* storage_uuid column is added in DB v4. When doing DB upgrade to v4, if storage_uuid is NOT NULL, alter table failed. */
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_FOLDER], "storage_uuid", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V4, NULL, true, false, false);
+ ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_FOLDER], "storage_uuid", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V4, NULL, true, false, false);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_FOLDER], "folder_order", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 0", USER_V4, NULL, false, false, false);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_FOLDER], "parent_folder_uuid", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V4, NULL, false, false, false);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_FOLDER], "validity", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 1", USER_V4, NULL, false, false, false);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/* Upgrade issue in folder table */
- if(cur_version < USER_V4) {
+ if (cur_version < USER_V4) {
/* Create tmp table */
sql = sqlite3_mprintf("CREATE TABLE '%q' AS SELECT * FROM '%q';", MEDIA_SVC_DB_TABLE_TMP_TABLE, MEDIA_SVC_DB_TABLE_FOLDER);
media_svc_retv_if(sql == NULL, MS_MEDIA_ERR_OUT_OF_MEMORY);
ret = _media_svc_upgrade_table_query(db_handle, MEDIA_SVC_DB_TABLE_STORAGE, MEDIA_SVC_DB_LIST_STORAGE, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- if(cur_version < USER_V4) {
+ if (cur_version < USER_V4) {
/* Need to default value in storage_uuid */
- sql = sqlite3_mprintf("UPDATE %q SET storage_uuid = '%q';",MEDIA_SVC_DB_TABLE_MEDIA, "media");
+ sql = sqlite3_mprintf("UPDATE %q SET storage_uuid = '%q';",MEDIA_SVC_DB_TABLE_MEDIA, "media");
media_svc_retv_if(sql == NULL, MS_MEDIA_ERR_OUT_OF_MEMORY);
ret = _media_svc_sql_query(db_handle, sql, uid);
sqlite3_free(sql);
- sql = sqlite3_mprintf("UPDATE %q SET storage_uuid = '%q';",MEDIA_SVC_DB_TABLE_FOLDER, "media");
+ sql = sqlite3_mprintf("UPDATE %q SET storage_uuid = '%q';",MEDIA_SVC_DB_TABLE_FOLDER, "media");
media_svc_retv_if(sql == NULL, MS_MEDIA_ERR_OUT_OF_MEMORY);
ret = _media_svc_sql_query(db_handle, sql, uid);
SQLITE3_FINALIZE(sql_stmt);
if (cur_version < LATEST_VERSION_NUMBER) {
- if(cur_version < USER_V4) {
+ if (cur_version < USER_V4) {
*need_full_scan = true;
}
media_svc_error("Current DB is out of date(%d).. So start to upgrade DB(%d)", cur_version, LATEST_VERSION_NUMBER);
char view_query[4096] = {0, };
memset(view_query, 0x00, sizeof(view_query));
- snprintf(view_query, sizeof(view_query), "DROP VIEW IF EXISTS %s; CREATE VIEW IF NOT EXISTS %s AS SELECT * from %s ", MEDIA_SVC_DB_VIEW_MEDIA, MEDIA_SVC_DB_VIEW_MEDIA, MEDIA_SVC_DB_TABLE_MEDIA);
+ snprintf(view_query, sizeof(view_query), "DROP VIEW IF EXISTS %s; CREATE VIEW IF NOT EXISTS %s AS SELECT * from %s ", MEDIA_SVC_DB_VIEW_MEDIA, MEDIA_SVC_DB_VIEW_MEDIA, MEDIA_SVC_DB_TABLE_MEDIA);
/*Select list of storage*/
sql = sqlite3_mprintf("SELECT storage_uuid FROM '%s' WHERE validity=1 AND storage_uuid != '%s'", MEDIA_SVC_DB_TABLE_STORAGE, MEDIA_SVC_DB_TABLE_MEDIA);
void mediainfo_init_file_debug()
{
if (g_log_fp == NULL) {
- snprintf(_g_file_path, sizeof(_g_file_path), "/tmp/%s",
- "media-info");
+ snprintf(_g_file_path, sizeof(_g_file_path), "/tmp/%s", "media-info");
if (access(_g_file_path, R_OK == 0)) {
remove(_g_file_path);
}
double totaltime = 0.0;
gettimeofday(&time, NULL);
- totaltime =
- (double)(time.tv_sec * 1000000 + time.tv_usec -
- g_time_usec) / CLOCKS_PER_SEC;
+ totaltime = (double)(time.tv_sec * 1000000 + time.tv_usec - g_time_usec) / CLOCKS_PER_SEC;
media_svc_debug("time [%s] : %f", time_string, totaltime);
#endif
}
void
-mediainfo_print_debug_time_ex(long start, long end, const char *func_name,
- char *time_string)
+mediainfo_print_debug_time_ex(long start, long end, const char *func_name, char *time_string)
{
#ifdef _PERFORMANCE_CHECK_
double totaltime = 0.0;
totaltime = (double)(end - start) / CLOCKS_PER_SEC;
- media_svc_debug("time [%s: %s] : %f", func_name, time_string,
- totaltime);
+ media_svc_debug("time [%s: %s] : %f", func_name, time_string, totaltime);
#endif
}
parent_folder_path = g_path_get_dirname(folder_path);
- if(!STRING_VALID(parent_folder_path)) {
+ if (!STRING_VALID(parent_folder_path)) {
media_svc_error("error : g_path_get_dirname falied");
SAFE_FREE(parent_folder_path);
return MS_MEDIA_ERR_OUT_OF_MEMORY;
char *temp_parent_uuid = NULL;
char *parent_folder_path = NULL;
- sql = sqlite3_mprintf("SELECT folder_uuid, parent_folder_uuid FROM '%s' WHERE storage_uuid = '%q' AND path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, folder_name);
+ sql = sqlite3_mprintf("SELECT folder_uuid, parent_folder_uuid FROM '%s' WHERE storage_uuid = '%q' AND path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, folder_name);
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
SQLITE3_FINALIZE(sql_stmt);
/*root path can be null*/
- if(!STRING_VALID(parent_folder_uuid)) {
+ if (!STRING_VALID(parent_folder_uuid)) {
bool is_root = FALSE;
ret = __media_svc_is_root_path(folder_name, &is_root, uid);
return MS_MEDIA_ERR_NONE;
}
- /* Notice : Below code is the code only for inserting parent folder uuid when upgrade the media db version 3 to 4 */
+ /* Notice : Below code is the code only for inserting parent folder uuid when upgrade the media db version 3 to 4 */
/* Check parent folder uuid */
- if(!STRING_VALID(parent_folder_uuid)) {
+ if (!STRING_VALID(parent_folder_uuid)) {
/* update parent_uuid */
media_svc_error("[No-Error] there is no parent folder uuid. PLEASE CHECK IT");
parent_folder_path = g_path_get_dirname(folder_name);
- if(!STRING_VALID(parent_folder_path)) {
+ if (!STRING_VALID(parent_folder_path)) {
media_svc_error("error : g_path_get_dirname falied.");
return MS_MEDIA_ERR_OUT_OF_MEMORY;
}
- if(STRING_VALID(storage_id))
- sql = sqlite3_mprintf("SELECT folder_uuid FROM '%s' WHERE storage_uuid = '%q' AND path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, parent_folder_path);
+ if (STRING_VALID(storage_id))
+ sql = sqlite3_mprintf("SELECT folder_uuid FROM '%s' WHERE storage_uuid = '%q' AND path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, parent_folder_path);
else
- sql = sqlite3_mprintf("SELECT folder_uuid FROM '%s' WHERE path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, parent_folder_path);
+ sql = sqlite3_mprintf("SELECT folder_uuid FROM '%s' WHERE path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, parent_folder_path);
SAFE_FREE(parent_folder_path);
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
if (ret == MS_MEDIA_ERR_NONE) {
- temp_parent_uuid = (char *)sqlite3_column_text(sql_stmt, 0);
+ temp_parent_uuid = (char *)sqlite3_column_text(sql_stmt, 0);
if (temp_parent_uuid != NULL) {
_strncpy_safe(parent_folder_uuid, temp_parent_uuid, MEDIA_SVC_UUID_SIZE+1);
}
SQLITE3_FINALIZE(sql_stmt);
}
- if(STRING_VALID(parent_folder_uuid)) {
- if(STRING_VALID(storage_id))
- sql = sqlite3_mprintf("UPDATE %q SET parent_folder_uuid = '%q' WHERE storage_uuid = '%q' AND path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, parent_folder_uuid, storage_id, folder_name);
+ if (STRING_VALID(parent_folder_uuid)) {
+ if (STRING_VALID(storage_id))
+ sql = sqlite3_mprintf("UPDATE %q SET parent_folder_uuid = '%q' WHERE storage_uuid = '%q' AND path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, parent_folder_uuid, storage_id, folder_name);
else
- sql = sqlite3_mprintf("UPDATE %q SET parent_folder_uuid = '%q' WHERE path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, parent_folder_uuid, folder_name);
+ sql = sqlite3_mprintf("UPDATE %q SET parent_folder_uuid = '%q' WHERE path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, parent_folder_uuid, folder_name);
ret = _media_svc_sql_query(handle, sql, uid);
sqlite3_free(sql);
} else {
}
static int __media_svc_append_folder(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type,
- const char *folder_id, const char *folder_path, const char *parent_folder_uuid, bool stack_query, uid_t uid)
+ const char *folder_id, const char *folder_path, const char *parent_folder_uuid, bool stack_query, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *folder_name = NULL;
char *sql = sqlite3_mprintf("INSERT INTO %s (folder_uuid, path, name, storage_uuid, storage_type, modified_time, name_pinyin, parent_folder_uuid) \
values (%Q, %Q, %Q, %Q, '%d', '%d', %Q, %Q); ",
- MEDIA_SVC_DB_TABLE_FOLDER, folder_id, folder_path, folder_name, storage_id, storage_type, folder_modified_date, folder_name_pinyin, parent_folder_uuid);
+ MEDIA_SVC_DB_TABLE_FOLDER, folder_id, folder_path, folder_name, storage_id, storage_type, folder_modified_date, folder_name_pinyin, parent_folder_uuid);
- if(!stack_query)
+ if (!stack_query)
{
ret = _media_svc_sql_query(handle, sql, uid);
sqlite3_free(sql);
SAFE_FREE(dir_path);
}
- if(STRING_VALID(folder_uuid)) {
+ if (STRING_VALID(folder_uuid)) {
_strncpy_safe(folder_id, folder_uuid, MEDIA_SVC_UUID_SIZE + 1);
} else {
media_svc_error("Fail to get folder_uuid");
dir_path = g_path_get_dirname(path);
- ret = _media_svc_get_and_append_folder(handle, storage_id, dir_path, storage_type, folder_id, uid);
+ ret = _media_svc_get_and_append_folder(handle, storage_id, dir_path, storage_type, folder_id, uid);
SAFE_FREE(dir_path);
char *sql = NULL;
sql = sqlite3_mprintf("DELETE FROM '%s' WHERE folder_uuid IN (SELECT folder_uuid FROM '%s' WHERE folder_uuid NOT IN (SELECT folder_uuid FROM '%s'))",
- MEDIA_SVC_DB_TABLE_FOLDER, MEDIA_SVC_DB_TABLE_FOLDER, storage_id);
+ MEDIA_SVC_DB_TABLE_FOLDER, MEDIA_SVC_DB_TABLE_FOLDER, storage_id);
ret = _media_svc_sql_query(handle, sql, uid);
sqlite3_free(sql);
char **folder_uuid = NULL;
int i = 0;
- ret = __media_svc_count_all_folders(handle, start_path, &cnt);
+ ret = __media_svc_count_all_folders(handle, start_path, &cnt);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("error when __media_svc_count_all_folders. err = [%d]", ret);
return ret;
}
/* free all data */
- for (i = 0; i < idx; i++) {
+ for (i = 0; i < idx; i++) {
SAFE_FREE(folder_uuid[i]);
}
SAFE_FREE(folder_uuid);
ERROR:
/* free all data */
- for (i = 0; i < idx; i++) {
+ for (i = 0; i < idx; i++) {
SAFE_FREE((*folder_list)[i]);
SAFE_FREE(folder_uuid[i]);
}
} else {
sql = sqlite3_mprintf("UPDATE '%s' SET validity=1 WHERE storage_uuid = '%q' AND path = '%q'", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, path);
- if(!stack_query)
+ if (!stack_query)
{
ret = _media_svc_sql_query(handle, sql, uid);
sqlite3_free(sql);
return ret;
}
-int _media_svc_count_folder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count)
+int _media_svc_count_folder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count)
{
int ret = MS_MEDIA_ERR_NONE;
sqlite3_stmt *sql_stmt = NULL;
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_count_subfolder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count)
+int _media_svc_count_subfolder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count)
{
int ret = MS_MEDIA_ERR_NONE;
sqlite3_stmt *sql_stmt = NULL;
SQLITE3_FINALIZE(sql_stmt);
- if(!STRING_VALID(folder_id))
+ if (!STRING_VALID(folder_id))
{
media_svc_error("Not found valid storage id [%s]", path);
ret = MS_MEDIA_ERR_INVALID_PARAMETER;
static __thread GList *g_media_svc_update_item_query_list = NULL;
static int __media_svc_count_invalid_records_with_thumbnail(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, int *count);
-static int __media_svc_get_invalid_records_with_thumbnail(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type,
- int count, media_svc_thumbnailpath_s *thumb_path);
+static int __media_svc_get_invalid_records_with_thumbnail(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, int count, media_svc_thumbnailpath_s *thumb_path);
static int __media_svc_count_invalid_folder_records_with_thumbnail(sqlite3 *handle, const char *storage_id, const char *folder_path, const char *folder_uuid, bool is_recursive, int *count);
static int __media_svc_get_invalid_folder_records_with_thumbnail(sqlite3 *handle, const char *storage_id, const char *folder_path, const char *folder_uuid, bool is_recursive, int count, media_svc_thumbnailpath_s *thumb_path);
char *sql = NULL;
if (is_recursive) {
- sql = sqlite3_mprintf("SELECT thumbnail_path from (select thumbnail_path, validity from '%s' WHERE path LIKE '%q/%%' AND thumbnail_path IS NOT NULL GROUP BY thumbnail_path HAVING count() = 1) WHERE validity=0", storage_id, folder_path);
+ sql = sqlite3_mprintf("SELECT thumbnail_path from (select thumbnail_path, validity from '%s' WHERE path LIKE '%q/%%' AND thumbnail_path IS NOT NULL GROUP BY thumbnail_path HAVING count() = 1) WHERE validity=0", storage_id, folder_path);
} else {
- sql = sqlite3_mprintf("SELECT thumbnail_path from (select thumbnail_path, validity from '%s' WHERE folder_uuid = '%q' AND thumbnail_path IS NOT NULL GROUP BY thumbnail_path HAVING count() = 1) WHERE validity=0", storage_id, folder_uuid);
+ sql = sqlite3_mprintf("SELECT thumbnail_path from (select thumbnail_path, validity from '%s' WHERE folder_uuid = '%q' AND thumbnail_path IS NOT NULL GROUP BY thumbnail_path HAVING count() = 1) WHERE validity=0", storage_id, folder_uuid);
}
media_svc_debug("[SQL query] : %s", sql);
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_count_record_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count)
+int _media_svc_count_record_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count)
{
int ret = MS_MEDIA_ERR_NONE;
sqlite3_stmt *sql_stmt = NULL;
}
/* Get thumbnail for burst shot */
- if(ini_val == 1) {
+ if (ini_val == 1) {
char thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
int width = 0;
int height = 0;
content_info->media_meta.copyright_pinyin,
content_info->media_meta.description_pinyin,
content_info->storage_uuid
- );
+ );
if (burst_id) {
sqlite3_free(burst_id);
content_info->media_meta.copyright_pinyin,
content_info->media_meta.description_pinyin,
content_info->path
- );
+ );
if (sql != NULL) {
media_svc_debug("query : %s", sql);
content_info->media_meta.datetaken,
content_info->media_meta.orientation,
content_info->path
- );
+ );
ret = _media_svc_sql_query(handle, sql, uid);
sqlite3_free(sql);
else if (query_type == MEDIA_SVC_QUERY_UPDATE_ITEM)
ret = _media_svc_sql_query_list(handle, &g_media_svc_update_item_query_list, uid);
else if (query_type == MEDIA_SVC_QUERY_INSERT_FOLDER)
- ret = _media_svc_sql_query_list(handle, _media_svc_get_folder_list_ptr(), uid);
+ ret = _media_svc_sql_query_list(handle, _media_svc_get_folder_list_ptr(), uid);
else
ret = MS_MEDIA_ERR_INVALID_PARAMETER;
int height = 0;
ret = _media_svc_request_thumbnail_with_origin_size(content_info->path, thumb_path, sizeof(thumb_path), &width, &height);
- if(ret == MS_MEDIA_ERR_NONE) {
+ if (ret == MS_MEDIA_ERR_NONE) {
ret = __media_svc_malloc_and_strncpy(&(content_info->thumbnail_path), thumb_path);
if (ret != MS_MEDIA_ERR_NONE) {
content_info->thumbnail_path = NULL;
}
/* Update Pinyin If Support Pinyin */
- if(_media_svc_check_pinyin_support())
+ if (_media_svc_check_pinyin_support())
{
- if(STRING_VALID(content_info->file_name))
+ if (STRING_VALID(content_info->file_name))
_media_svc_get_pinyin_str(content_info->file_name, &content_info->file_name_pinyin);
}
#endif
#endif
media_svc_debug("MAKE PASS 1 QUERY END");
- if(!stack_query) {
+ if (!stack_query) {
ret = _media_svc_sql_query(handle, sql, uid);
sqlite3_free(sql);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_debug_fenter();
/*Update Pinyin If Support Pinyin*/
- if(_media_svc_check_pinyin_support())
+ if (_media_svc_check_pinyin_support())
{
- if(STRING_VALID(content_info->file_name))
+ if (STRING_VALID(content_info->file_name))
_media_svc_get_pinyin_str(content_info->file_name, &content_info->file_name_pinyin);
- if(STRING_VALID(content_info->media_meta.title))
+ if (STRING_VALID(content_info->media_meta.title))
_media_svc_get_pinyin_str(content_info->media_meta.title, &content_info->media_meta.title_pinyin);
- if(STRING_VALID(content_info->media_meta.album))
+ if (STRING_VALID(content_info->media_meta.album))
_media_svc_get_pinyin_str(content_info->media_meta.album, &content_info->media_meta.album_pinyin);
- if(STRING_VALID(content_info->media_meta.artist))
+ if (STRING_VALID(content_info->media_meta.artist))
_media_svc_get_pinyin_str(content_info->media_meta.artist, &content_info->media_meta.artist_pinyin);
- if(STRING_VALID(content_info->media_meta.album_artist))
+ if (STRING_VALID(content_info->media_meta.album_artist))
_media_svc_get_pinyin_str(content_info->media_meta.album_artist, &content_info->media_meta.album_artist_pinyin);
- if(STRING_VALID(content_info->media_meta.genre))
+ if (STRING_VALID(content_info->media_meta.genre))
_media_svc_get_pinyin_str(content_info->media_meta.genre, &content_info->media_meta.genre_pinyin);
- if(STRING_VALID(content_info->media_meta.composer))
+ if (STRING_VALID(content_info->media_meta.composer))
_media_svc_get_pinyin_str(content_info->media_meta.composer, &content_info->media_meta.composer_pinyin);
- if(STRING_VALID(content_info->media_meta.copyright))
+ if (STRING_VALID(content_info->media_meta.copyright))
_media_svc_get_pinyin_str(content_info->media_meta.copyright, &content_info->media_meta.copyright_pinyin);
- if(STRING_VALID(content_info->media_meta.description))
+ if (STRING_VALID(content_info->media_meta.description))
_media_svc_get_pinyin_str(content_info->media_meta.description, &content_info->media_meta.description_pinyin);
}
content_info->path
);
- if(!stack_query) {
+ if (!stack_query) {
ret = _media_svc_sql_query(handle, sql, uid);
sqlite3_free(sql);
if (ret != MS_MEDIA_ERR_NONE) {
}
int _media_svc_publish_noti(media_item_type_e update_item,
- media_item_update_type_e update_type,
- const char *path,
- media_type_e media_type,
- const char *uuid,
- const char *mime_type
- )
+ media_item_update_type_e update_type,
+ const char *path,
+ media_type_e media_type,
+ const char *uuid,
+ const char *mime_type
+ )
{
int ret = MS_MEDIA_ERR_NONE;
{
int ret = MS_MEDIA_ERR_NONE;
- if(STRING_VALID(path))
- {
+ if (STRING_VALID(path)) {
ret = media_db_update_send(pid, update_item, update_type, (char *)path, (char *)uuid, media_type, (char *)mime_type);
- if(ret != MS_MEDIA_ERR_NONE)
- {
+ if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("Send noti failed : %d [%s]", ret, path);
ret = MS_MEDIA_ERR_SEND_NOTI_FAIL;
- }
- else
- {
+ } else {
media_svc_debug("Send noti success [%d][%d]", update_item, update_type);
}
- }
- else
- {
+ } else {
media_svc_debug("invalid path");
ret = MS_MEDIA_ERR_INVALID_PARAMETER;
}
return ret;
}
-
int _media_svc_publish_dir_noti_v2(media_item_type_e update_item,
media_item_update_type_e update_type,
const char *path,
{
int ret = MS_MEDIA_ERR_NONE;
- if(STRING_VALID(path))
- {
+ if (STRING_VALID(path)) {
ret = media_db_update_send_internal(pid, update_item, update_type, (char *)path, (char *)uuid, media_type, (char *)mime_type);
- if(ret != MS_MEDIA_ERR_NONE)
- {
+ if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("Send noti failed : %d [%s]", ret, path);
ret = MS_MEDIA_ERR_SEND_NOTI_FAIL;
- }
- else
- {
+ } else {
media_svc_debug("Send noti success [%d][%d]", update_item, update_type);
}
- }
- else
- {
+ } else {
media_svc_debug("invalid path");
ret = MS_MEDIA_ERR_INVALID_PARAMETER;
}
if (storage_cnt == 0) {
char *internal_path = _media_svc_get_path(uid);
sql = sqlite3_mprintf("INSERT INTO %s (storage_uuid, storage_name, storage_path, storage_type) VALUES ('%s', '%s', '%s', 0);",
- MEDIA_SVC_DB_TABLE_STORAGE, MEDIA_SVC_DB_TABLE_MEDIA, MEDIA_SVC_DB_TABLE_MEDIA, internal_path);
+ MEDIA_SVC_DB_TABLE_STORAGE, MEDIA_SVC_DB_TABLE_MEDIA, MEDIA_SVC_DB_TABLE_MEDIA, internal_path);
ret = _media_svc_sql_query(handle, sql, uid);
sqlite3_free(sql);
*storage_path = NULL;
*validity = 0;
- if(storage_name != NULL)
+ if (storage_name != NULL)
sql = sqlite3_mprintf("SELECT * FROM '%s' WHERE storage_uuid=%Q AND storage_name=%Q", MEDIA_SVC_DB_TABLE_STORAGE, storage_id, storage_name);
else
sql = sqlite3_mprintf("SELECT * FROM '%s' WHERE storage_uuid=%Q", MEDIA_SVC_DB_TABLE_STORAGE, storage_id);
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = sqlite3_mprintf("INSERT INTO %s (storage_uuid, storage_name, storage_path, storage_account, storage_type) values (%Q, %Q, %Q, %Q, %d); ",
- MEDIA_SVC_DB_TABLE_STORAGE, storage_id, storage_name, storage_path, storage_account, storage_type);
+ MEDIA_SVC_DB_TABLE_STORAGE, storage_id, storage_name, storage_path, storage_account, storage_type);
ret = _media_svc_sql_query(handle, sql, uid);
sqlite3_free(sql);
char *remain_path = NULL;
int remain_len = 0;
- if(strncmp(path, MEDIA_ROOT_PATH_INTERNAL, strlen(MEDIA_ROOT_PATH_INTERNAL)) == 0)
+ if (strncmp(path, MEDIA_ROOT_PATH_INTERNAL, strlen(MEDIA_ROOT_PATH_INTERNAL)) == 0)
{
_strncpy_safe(storage_id, MEDIA_SVC_DB_TABLE_MEDIA, MEDIA_SVC_UUID_SIZE+1);
return MS_MEDIA_ERR_NONE;
while(sqlite3_step(sql_stmt) == SQLITE_ROW)
{
- if(STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 1)))
+ if (STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 1)))
{
- if (strlen(storage_path) == strlen((const char *)sqlite3_column_text(sql_stmt, 1)))
+ if (strlen(storage_path) == strlen((const char *)sqlite3_column_text(sql_stmt, 1)))
{
- if(strncmp(storage_path, (const char *)sqlite3_column_text(sql_stmt, 1), strlen(storage_path)) == 0)
+ if (strncmp(storage_path, (const char *)sqlite3_column_text(sql_stmt, 1), strlen(storage_path)) == 0)
{
_strncpy_safe(storage_id, (const char *)sqlite3_column_text(sql_stmt, 0), MEDIA_SVC_UUID_SIZE+1);
break;
SQLITE3_FINALIZE(sql_stmt);
SAFE_FREE(storage_path);
- if(!STRING_VALID(storage_id))
+ if (!STRING_VALID(storage_id))
{
media_svc_error("Not found valid storage id [%s]", path);
ret = MS_MEDIA_ERR_INVALID_PARAMETER;
sqlite3_stmt *sql_stmt = NULL;
char *sql = NULL;
- if(!STRING_VALID(storage_id))
+ if (!STRING_VALID(storage_id))
{
media_svc_error("Invalid storage_idid");
ret = MS_MEDIA_ERR_INVALID_PARAMETER;
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
if (ret != MS_MEDIA_ERR_NONE) {
- if(ret == MS_MEDIA_ERR_DB_NO_RECORD) {
+ if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
media_svc_debug("there is no storage.");
}
else {
sqlite3_stmt *sql_stmt = NULL;
char *sql = NULL;
- if(!STRING_VALID(storage_id))
+ if (!STRING_VALID(storage_id))
{
media_svc_error("Invalid storage_idid");
ret = MS_MEDIA_ERR_INVALID_PARAMETER;
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
if (ret != MS_MEDIA_ERR_NONE) {
- if(ret == MS_MEDIA_ERR_DB_NO_RECORD) {
+ if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
media_svc_debug("there is no storage.");
}
else {
sqlite3_stmt *sql_stmt = NULL;
char *sql = NULL;
- if(!STRING_VALID(storage_id))
+ if (!STRING_VALID(storage_id))
{
media_svc_error("Invalid storage_id");
return MS_MEDIA_ERR_INVALID_PARAMETER;
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
if (ret != MS_MEDIA_ERR_NONE) {
- if(ret == MS_MEDIA_ERR_DB_NO_RECORD) {
+ if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
media_svc_debug("there is no storage.");
}
else {
char *sql = NULL;
int cnt =0;
- ret = __media_svc_count_all_storage(handle, &cnt);
+ ret = __media_svc_count_all_storage(handle, &cnt);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("error when __media_svc_count_all_folders. err = [%d]", ret);
return ret;
(*storage_list)[idx] = g_strdup((char *)sqlite3_column_text(sql_stmt, 0));
(*storage_id_list)[idx] = g_strdup((char *)sqlite3_column_text(sql_stmt, 1));
(*scan_status_list)[idx] = (int)sqlite3_column_int(sql_stmt, 2);
- if(sqlite3_step(sql_stmt) != SQLITE_ROW)
+ if (sqlite3_step(sql_stmt) != SQLITE_ROW)
break;
idx++;
}
} else {
/* free all data */
int i =0;
- for (i = 0; i < idx; i ++) {
+ for (i = 0; i < idx; i ++) {
SAFE_FREE((*storage_list)[i]);
SAFE_FREE((*storage_id_list)[i]);
}
#include "media-svc-localize_ch.h"
#include "media-svc-localize_tw.h"
-#define MEDIA_SVC_FILE_EXT_LEN_MAX 6 /**< Maximum file ext lenth*/
+#define MEDIA_SVC_FILE_EXT_LEN_MAX 6 /**< Maximum file ext lenth*/
/* Define data structures for media type and mime type */
#define MEDIA_SVC_CATEGORY_UNKNOWN 0x00000000 /**< Default */
"x-mp3", /*alias of audio/mpeg*/
"x-mpeg", /*alias of audio/mpeg*/
"3gpp",
- "x-ogg", /*alias of audio/ogg*/
+ "x-ogg", /*alias of audio/ogg*/
"vnd.ms-playready.media.pya:*.pya", /*playready*/
"wma",
"aac",
return MS_MEDIA_ERR_NONE;
}
-static int __media_svc_get_exif_info(ExifData *ed,
- char *buf,
- int *i_value,
- double *d_value,
- int ifdtype,
- long tagtype)
+static int __media_svc_get_exif_info(ExifData *ed, char *buf, int *i_value, double *d_value, int ifdtype, long tagtype)
{
ExifEntry *entry;
ExifTag tag;
if (entry) {
/* Get the contents of the tag in human-readable form */
if (tag == EXIF_TAG_ORIENTATION ||
- tag == EXIF_TAG_PIXEL_X_DIMENSION ||
- tag == EXIF_TAG_PIXEL_Y_DIMENSION ||
- tag == EXIF_TAG_ISO_SPEED_RATINGS) {
+ tag == EXIF_TAG_PIXEL_X_DIMENSION ||
+ tag == EXIF_TAG_PIXEL_Y_DIMENSION ||
+ tag == EXIF_TAG_ISO_SPEED_RATINGS) {
if (i_value == NULL) {
media_svc_error("i_value is NULL");
*d_value = tmp_arr[0] + tmp_arr[1] / 60 + tmp_arr[2] / 3600;
/*media_svc_debug("GPS value is [%f], %f, %f, %f", *d_value, tmp_arr[0], tmp_arr[1], tmp_arr[2]); */
- } else if (tag == EXIF_TAG_EXPOSURE_TIME) {
+ } else if (tag == EXIF_TAG_EXPOSURE_TIME) {
if (buf == NULL) {
media_svc_error("buf is NULL");
struct statfs fs;
char *thumb_path = __media_svc_get_thumb_path(uid);
- if(!STRING_VALID(thumb_path)) {
+ if (!STRING_VALID(thumb_path)) {
media_svc_error("fail to get thumb_path");
return MS_MEDIA_ERR_INTERNAL;
}
ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.year, MEDIA_SVC_TAG_UNKNOWN);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
- if(refresh) {
+ if (refresh) {
media_svc_debug("refresh");
return MS_MEDIA_ERR_NONE;
}
}
int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, media_svc_storage_type_e storage_type,
- const char *path, media_svc_media_type_e *media_type, bool refresh)
+ const char *path, media_svc_media_type_e *media_type, bool refresh)
{
int ret = MS_MEDIA_ERR_NONE;
char * media_uuid = NULL;
ret = __media_svc_malloc_and_strncpy(&content_info->path, path);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
- if(storage_type != MEDIA_SVC_STORAGE_CLOUD) {
+ if (storage_type != MEDIA_SVC_STORAGE_CLOUD) {
struct stat st;
memset(&st, 0, sizeof(struct stat));
if (stat(path, &st) == 0) {
SAFE_FREE(file_name);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
- if(storage_type != MEDIA_SVC_STORAGE_CLOUD) {
+ if (storage_type != MEDIA_SVC_STORAGE_CLOUD) {
/* if the file is DRM file, drm_type value is DRM_TRUE(1).
if drm_contentinfo is not NULL, the file is OMA DRM.*/
ret = __media_svc_get_mime_type(path, mime_type);
if (!has_datetaken && __media_svc_get_exif_info(ed, buf, NULL, NULL, EXIF_IFD_0, EXIF_TAG_DATE_TIME_ORIGINAL) == MS_MEDIA_ERR_NONE) {
if (strlen(buf) == 0) {
- /*media_svc_debug("time is NULL"); */
+ /*media_svc_debug("time is NULL"); */
} else {
ret = __media_svc_malloc_and_strncpy_with_size(&content_info->media_meta.datetaken, buf, datetaken_size);
if (ret != MS_MEDIA_ERR_NONE) {
if (!has_datetaken && __media_svc_get_exif_info(ed, buf, NULL, NULL, EXIF_IFD_0, EXIF_TAG_DATE_TIME) == MS_MEDIA_ERR_NONE) {
if (strlen(buf) == 0) {
- /*media_svc_debug("time is NULL"); */
+ /*media_svc_debug("time is NULL"); */
} else {
ret = __media_svc_malloc_and_strncpy_with_size(&content_info->media_meta.datetaken, buf, datetaken_size);
if (ret != MS_MEDIA_ERR_NONE) {
GET_WIDTH_HEIGHT:
- if(content_info->media_meta.width == 0 ||
+ if (content_info->media_meta.width == 0 ||
content_info->media_meta.height == 0) {
/*Get image width, height*/
unsigned int img_width = 0;
ret = ImgGetImageInfo(path, &img_type, &img_width, &img_height);
- if(content_info->media_meta.width == 0)
+ if (content_info->media_meta.width == 0)
content_info->media_meta.width = img_width;
- if(content_info->media_meta.height == 0)
+ if (content_info->media_meta.height == 0)
content_info->media_meta.height = img_height;
}
no_tag_title = _media_svc_get_title_from_filepath(content_info->path);
if (no_tag_title) {
ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.title, no_tag_title);
- if(ret != MS_MEDIA_ERR_NONE)
+ if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("strcpy error");
SAFE_FREE(no_tag_title);
} else {
append_album = FALSE;
if ((!strncmp(content_info->media_meta.album, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN))) ||
- (!strncmp(content_info->media_meta.artist, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN)))) {
+ (!strncmp(content_info->media_meta.artist, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN)))) {
media_svc_debug("Unknown album or artist already exists. Extract thumbnail for Unknown.");
extract_thumbnail = TRUE;
if (append_album == TRUE) {
if ((strncmp(content_info->media_meta.album, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN))) &&
- (strncmp(content_info->media_meta.artist, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN))))
+ (strncmp(content_info->media_meta.artist, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN))))
ret = _media_svc_append_album(handle, content_info->media_meta.album, content_info->media_meta.artist, content_info->thumbnail_path, &album_id, uid);
else
ret = _media_svc_append_album(handle, content_info->media_meta.album, content_info->media_meta.artist, NULL, &album_id, uid);
no_tag_title = _media_svc_get_title_from_filepath(content_info->path);
if (no_tag_title) {
ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.title, no_tag_title);
- if(ret != MS_MEDIA_ERR_NONE)
+ if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("strcpy error");
SAFE_FREE(no_tag_title);
} else {
if (memcmp(s, olds, oldlen) == 0) {
memcpy(sr, news, newlen);
sr += newlen;
- s += oldlen;
+ s += oldlen;
} else *sr++ = *s++;
}
ret = _media_svc_convert_chinese_to_pinyin(src_str, &pinyinname, &size);
if (ret == MS_MEDIA_ERR_NONE) {
- if(STRING_VALID(pinyinname[0].pinyin_name))
+ if (STRING_VALID(pinyinname[0].pinyin_name))
*pinyin_str = strdup(pinyinname[0].pinyin_name);
else
*pinyin_str = strdup(src_str); //Return Original Non China Character
int _media_svc_get_ini_value()
{
- if(g_ini_value == -1) {
+ if (g_ini_value == -1) {
dictionary *dict = NULL;
dict = iniparser_load(MEDIA_SVC_INI_DEFAULT_PATH);
- if(!dict) {
+ if (!dict) {
media_svc_error("%s load failed", MEDIA_SVC_INI_DEFAULT_PATH);
return -1;
}
media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
media_svc_retvm_if(data_cnt < 1, MS_MEDIA_ERR_INVALID_PARAMETER, "data_cnt shuld be bigger than 1");
- g_media_svc_insert_item_data_cnt = data_cnt;
- g_media_svc_insert_item_cur_data_cnt = 0;
+ g_media_svc_insert_item_data_cnt = data_cnt;
+ g_media_svc_insert_item_cur_data_cnt = 0;
/* Prepare for making noti item list */
if (with_noti) {
media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- if (g_media_svc_insert_item_cur_data_cnt > 0) {
+ if (g_media_svc_insert_item_cur_data_cnt > 0) {
ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_INSERT_ITEM, uid);
if (g_insert_with_noti) {
}
}
- g_media_svc_insert_item_data_cnt = 1;
- g_media_svc_insert_item_cur_data_cnt = 0;
+ g_media_svc_insert_item_data_cnt = 1;
+ g_media_svc_insert_item_cur_data_cnt = 0;
return ret;
}
if (g_insert_with_noti)
_media_svc_insert_item_to_noti_list(&content_info, g_media_svc_insert_item_cur_data_cnt++);
- } else if (g_media_svc_insert_item_cur_data_cnt < (g_media_svc_insert_item_data_cnt - 1)) {
+ } else if (g_media_svc_insert_item_cur_data_cnt < (g_media_svc_insert_item_data_cnt - 1)) {
ret = _media_svc_insert_item_with_data(db_handle, storage_id, &content_info, is_burst, TRUE, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
g_media_svc_insert_item_cur_data_cnt++;
- } else if (g_media_svc_insert_item_cur_data_cnt == (g_media_svc_insert_item_data_cnt - 1)) {
+ } else if (g_media_svc_insert_item_cur_data_cnt == (g_media_svc_insert_item_data_cnt - 1)) {
ret = _media_svc_insert_item_with_data(db_handle, storage_id, &content_info, is_burst, TRUE, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
ret = _media_svc_update_folder_table(db_handle, storage_id, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- } else if (g_media_svc_move_item_cur_data_cnt < (g_media_svc_move_item_data_cnt - 1)) {
+ } else if (g_media_svc_move_item_cur_data_cnt < (g_media_svc_move_item_data_cnt - 1)) {
/*update item*/
if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) {
g_media_svc_move_item_cur_data_cnt++;
- } else if (g_media_svc_move_item_cur_data_cnt == (g_media_svc_move_item_data_cnt - 1)) {
+ } else if (g_media_svc_move_item_cur_data_cnt == (g_media_svc_move_item_data_cnt - 1)) {
/*update item*/
if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) {
media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
media_svc_retvm_if(data_cnt < 1, MS_MEDIA_ERR_INVALID_PARAMETER, "data_cnt shuld be bigger than 1");
- g_media_svc_item_validity_data_cnt = data_cnt;
- g_media_svc_item_validity_cur_data_cnt = 0;
+ g_media_svc_item_validity_data_cnt = data_cnt;
+ g_media_svc_item_validity_cur_data_cnt = 0;
return MS_MEDIA_ERR_NONE;
}
media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- if (g_media_svc_item_validity_cur_data_cnt > 0) {
+ if (g_media_svc_item_validity_cur_data_cnt > 0) {
ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_SET_ITEM_VALIDITY, uid);
}
- g_media_svc_item_validity_data_cnt = 1;
- g_media_svc_item_validity_cur_data_cnt = 0;
+ g_media_svc_item_validity_data_cnt = 1;
+ g_media_svc_item_validity_cur_data_cnt = 0;
return ret;
}
media_svc_debug("path=[%s], validity=[%d]", path, validity);
- if (g_media_svc_item_validity_data_cnt == 1) {
+ if (g_media_svc_item_validity_data_cnt == 1) {
return _media_svc_update_item_validity(db_handle, storage_id, path, validity, FALSE, uid);
- } else if (g_media_svc_item_validity_cur_data_cnt < (g_media_svc_item_validity_data_cnt - 1)) {
+ } else if (g_media_svc_item_validity_cur_data_cnt < (g_media_svc_item_validity_data_cnt - 1)) {
ret = _media_svc_update_item_validity(db_handle, storage_id, path, validity, TRUE, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
g_media_svc_item_validity_cur_data_cnt++;
- } else if (g_media_svc_item_validity_cur_data_cnt == (g_media_svc_item_validity_data_cnt - 1)) {
+ } else if (g_media_svc_item_validity_cur_data_cnt == (g_media_svc_item_validity_data_cnt - 1)) {
ret = _media_svc_update_item_validity(db_handle, storage_id, path, validity, TRUE, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_SET_ITEM_VALIDITY, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- g_media_svc_item_validity_cur_data_cnt = 0;
+ g_media_svc_item_validity_cur_data_cnt = 0;
} else {
if (thumb_count == 1) {
*/
ret = _media_svc_remove_file(thumb_path);
- if(ret != MS_MEDIA_ERR_NONE) {
+ if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("fail to remove thumbnail file.");
}
// }
}
/* Initialize thumbnail information to remake thumbnail. */
- if(ini_val == 1) {
+ if (ini_val == 1) {
char thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1];
ret = _media_svc_get_thumbnail_path_by_path(db_handle, storage_id, path, thumb_path);
if (ret != MS_MEDIA_ERR_NONE) {
}
}
- ret = _media_svc_update_thumbnail_path(db_handle, storage_id, path, NULL, uid);
+ ret = _media_svc_update_thumbnail_path(db_handle, storage_id, path, NULL, uid);
if (ret != MS_MEDIA_ERR_NONE) {
_media_svc_destroy_content_info(&content_info);
return ret;
}
#if 1
/* Extracting thumbnail */
- if(ini_val == 1) {
+ if (ini_val == 1) {
if (content_info.thumbnail_path == NULL) {
if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE || media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO) {
char thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
media_svc_retvm_if(src_path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "src_path is NULL");
media_svc_retvm_if(dst_path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "dst_path is NULL");
- media_svc_debug("Src path : %s, Dst Path : %s", src_path, dst_path);
+ media_svc_debug("Src path : %s, Dst Path : %s", src_path, dst_path);
ret = _media_svc_sql_begin_trans(db_handle, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
int ret = MS_MEDIA_ERR_NONE;
sqlite3 *db_handle = (sqlite3 *)handle;
time_t sto_time = 0;
- int cur_time = _media_svc_get_file_time(folder_path);
+ int cur_time = _media_svc_get_file_time(folder_path);
char folder_uuid[MEDIA_SVC_UUID_SIZE + 1] = {0, };
media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
media_svc_retvm_if(data_cnt < 1, MS_MEDIA_ERR_INVALID_PARAMETER, "data_cnt shuld be bigger than 1");
- g_media_svc_update_item_data_cnt = data_cnt;
- g_media_svc_update_item_cur_data_cnt = 0;
+ g_media_svc_update_item_data_cnt = data_cnt;
+ g_media_svc_update_item_cur_data_cnt = 0;
return MS_MEDIA_ERR_NONE;
}
media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- if (g_media_svc_update_item_cur_data_cnt > 0) {
+ if (g_media_svc_update_item_cur_data_cnt > 0) {
ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_UPDATE_ITEM, uid);
}
- g_media_svc_update_item_data_cnt = 1;
- g_media_svc_update_item_cur_data_cnt = 0;
+ g_media_svc_update_item_data_cnt = 1;
+ g_media_svc_update_item_cur_data_cnt = 0;
return ret;
}
ret = _media_svc_update_meta_with_data(db_handle, &content_info);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
- } else if (g_media_svc_update_item_cur_data_cnt < (g_media_svc_update_item_data_cnt - 1)) {
+ } else if (g_media_svc_update_item_cur_data_cnt < (g_media_svc_update_item_data_cnt - 1)) {
ret = _media_svc_update_meta_with_data(db_handle, &content_info);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
g_media_svc_update_item_cur_data_cnt++;
- } else if (g_media_svc_update_item_cur_data_cnt == (g_media_svc_update_item_data_cnt - 1)) {
+ } else if (g_media_svc_update_item_cur_data_cnt == (g_media_svc_update_item_data_cnt - 1)) {
ret = _media_svc_update_meta_with_data(db_handle, &content_info);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
//new_content_info->media_meta.channel = content_info->media_meta.channel;
//new_content_info->media_meta.orientation = content_info->media_meta.orientation;
- if(content_info->media_meta.longitude != MEDIA_SVC_DEFAULT_GPS_VALUE)
+ if (content_info->media_meta.longitude != MEDIA_SVC_DEFAULT_GPS_VALUE)
new_content_info->media_meta.longitude = content_info->media_meta.longitude;
- if(content_info->media_meta.latitude != MEDIA_SVC_DEFAULT_GPS_VALUE)
+ if (content_info->media_meta.latitude != MEDIA_SVC_DEFAULT_GPS_VALUE)
new_content_info->media_meta.latitude = content_info->media_meta.latitude;
- if(content_info->media_meta.altitude != MEDIA_SVC_DEFAULT_GPS_VALUE)
+ if (content_info->media_meta.altitude != MEDIA_SVC_DEFAULT_GPS_VALUE)
new_content_info->media_meta.altitude = content_info->media_meta.altitude;
new_content_info->media_meta.rating = content_info->media_meta.rating;
append_album = FALSE;
if ((!strncmp(_new_content_info.media_meta.album, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN))) ||
- (!strncmp(_new_content_info.media_meta.artist, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN)))) {
+ (!strncmp(_new_content_info.media_meta.artist, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN)))) {
media_svc_debug("Unknown album or artist already exists. Extract thumbnail for Unknown.");
} else {
if (append_album == TRUE) {
if ((strncmp(_new_content_info.media_meta.album, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN))) &&
- (strncmp(_new_content_info.media_meta.artist, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN))))
+ (strncmp(_new_content_info.media_meta.artist, MEDIA_SVC_TAG_UNKNOWN, strlen(MEDIA_SVC_TAG_UNKNOWN))))
ret = _media_svc_append_album(handle, _new_content_info.media_meta.album, _new_content_info.media_meta.artist, _new_content_info.thumbnail_path, &album_id, uid);
else
ret = _media_svc_append_album(handle, _new_content_info.media_meta.album, _new_content_info.media_meta.artist, NULL, &album_id, uid);
ret = _media_svc_append_storage(db_handle, storage_id, storage_name, storage_path, storage_account, storage_type, uid);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "append storage failed : %d", ret);
- if(strcmp(storage_id, MEDIA_SVC_DB_TABLE_MEDIA)) {
+ if (strcmp(storage_id, MEDIA_SVC_DB_TABLE_MEDIA)) {
ret = _media_svc_create_media_table_with_id(db_handle, storage_id, uid);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "create media table failed : %d", ret);
media_svc_retvm_if(data_cnt < 1, MS_MEDIA_ERR_INVALID_PARAMETER, "data_cnt shuld be bigger than 1");
g_media_svc_insert_folder_data_cnt = data_cnt;
- g_media_svc_insert_folder_cur_data_cnt = 0;
+ g_media_svc_insert_folder_cur_data_cnt = 0;
return MS_MEDIA_ERR_NONE;
}
media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- if (g_media_svc_insert_folder_cur_data_cnt > 0) {
+ if (g_media_svc_insert_folder_cur_data_cnt > 0) {
ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_INSERT_FOLDER, uid);
}
- g_media_svc_insert_folder_data_cnt = 1;
- g_media_svc_insert_folder_cur_data_cnt = 0;
+ g_media_svc_insert_folder_data_cnt = 1;
+ g_media_svc_insert_folder_cur_data_cnt = 0;
return ret;
}
media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
media_svc_retvm_if(__media_svc_check_storage(storage_type, FALSE) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
- if (g_media_svc_insert_folder_data_cnt == 1) {
+ if (g_media_svc_insert_folder_data_cnt == 1) {
ret = _media_svc_get_and_append_folder_id_by_folder_path(handle, storage_id, path, storage_type, folder_uuid, FALSE, uid);
- } else if (g_media_svc_insert_folder_cur_data_cnt < (g_media_svc_insert_folder_data_cnt - 1)) {
+ } else if (g_media_svc_insert_folder_cur_data_cnt < (g_media_svc_insert_folder_data_cnt - 1)) {
ret = _media_svc_get_and_append_folder_id_by_folder_path(handle, storage_id, path, storage_type, folder_uuid, TRUE, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
g_media_svc_insert_folder_cur_data_cnt ++;
- } else if (g_media_svc_insert_folder_cur_data_cnt == (g_media_svc_insert_folder_data_cnt - 1)) {
+ } else if (g_media_svc_insert_folder_cur_data_cnt == (g_media_svc_insert_folder_data_cnt - 1)) {
ret = _media_svc_get_and_append_folder_id_by_folder_path(handle, storage_id, path, storage_type, folder_uuid, TRUE, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_INSERT_FOLDER, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- g_media_svc_insert_folder_cur_data_cnt = 0;
+ g_media_svc_insert_folder_cur_data_cnt = 0;
} else {
media_svc_error("Error in media_svc_set_insert_folder");
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
if (g_insert_with_noti)
- {
_media_svc_insert_item_to_noti_list(&content_info, g_media_svc_insert_item_cur_data_cnt++);
- }
- } else if(g_media_svc_insert_item_cur_data_cnt < (g_media_svc_insert_item_data_cnt - 1)) {
+ } else if (g_media_svc_insert_item_cur_data_cnt < (g_media_svc_insert_item_data_cnt - 1)) {
ret = _media_svc_insert_item_pass1(db_handle, storage_id, &content_info, is_burst, TRUE, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
if (g_insert_with_noti)
- {
_media_svc_insert_item_to_noti_list(&content_info, g_media_svc_insert_item_cur_data_cnt);
- }
+
media_svc_debug("g_media_svc_insert_item_cur_data_cnt %d", g_media_svc_insert_item_cur_data_cnt);
g_media_svc_insert_item_cur_data_cnt ++;
- } else if (g_media_svc_insert_item_cur_data_cnt == (g_media_svc_insert_item_data_cnt - 1)) {
+ } else if (g_media_svc_insert_item_cur_data_cnt == (g_media_svc_insert_item_data_cnt - 1)) {
ret = _media_svc_insert_item_pass1(db_handle, storage_id, &content_info, is_burst, TRUE, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
while (sqlite3_step(sql_stmt) == SQLITE_ROW) {
db_data = NULL;
db_data = malloc(sizeof(media_svc_item_info_s));
- if(db_data == NULL) {
+ if (db_data == NULL) {
media_svc_error("Out of memory");
continue;
}
}
if (idx > 0)
- {
ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_UPDATE_ITEM, uid);
- }
g_array_free(db_data_array, FALSE);
db_data_array = NULL;
media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
media_svc_retvm_if(!STRING_VALID(folder_path), MS_MEDIA_ERR_INVALID_PARAMETER, "Path is NULL");
- ret = _media_svc_count_folder_with_path(db_handle, storage_id, folder_path, &count);
+ ret = _media_svc_count_folder_with_path(db_handle, storage_id, folder_path, &count);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- if(count > 0) {
+ if (count > 0) {
media_svc_debug("item is exist in database");
return MS_MEDIA_ERR_NONE;
} else {
media_svc_retvm_if(!STRING_VALID(folder_path), MS_MEDIA_ERR_INVALID_PARAMETER, "Path is NULL");
*count = 0;
- ret = _media_svc_count_subfolder_with_path(db_handle, storage_id, folder_path, &cnt);
+ ret = _media_svc_count_subfolder_with_path(db_handle, storage_id, folder_path, &cnt);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
*count = cnt;
- if(cnt > 0) {
+ if (cnt > 0) {
media_svc_debug("item is exist in database");
return MS_MEDIA_ERR_NONE;
} else {
#include <sqlite3.h>
#include <glib.h>
-#define SQLITE3_FINALIZE(x) if(x != NULL) {sqlite3_finalize(x);}
+#define SQLITE3_FINALIZE(x) if (x != NULL) {sqlite3_finalize(x);}
int _media_svc_make_table_query(sqlite3 *db_handle, const char *table_name, media_svc_table_slist_e list, uid_t uid);
int _media_svc_upgrade_table_query(sqlite3 *db_handle, const char *table_name, media_svc_table_slist_e list, uid_t uid);
#define LOG_TAG "MEDIA_SERVICE"
-#define FONT_COLOR_RESET "\033[0m"
-#define FONT_COLOR_RED "\033[31m"
-#define FONT_COLOR_GREEN "\033[32m"
-#define FONT_COLOR_YELLOW "\033[33m"
-#define FONT_COLOR_BLUE "\033[34m"
-#define FONT_COLOR_PURPLE "\033[35m"
-#define FONT_COLOR_CYAN "\033[36m"
-#define FONT_COLOR_GRAY "\033[37m"
+#define FONT_COLOR_RESET "\033[0m"
+#define FONT_COLOR_RED "\033[31m"
+#define FONT_COLOR_GREEN "\033[32m"
+#define FONT_COLOR_YELLOW "\033[33m"
+#define FONT_COLOR_BLUE "\033[34m"
+#define FONT_COLOR_PURPLE "\033[35m"
+#define FONT_COLOR_CYAN "\033[36m"
+#define FONT_COLOR_GRAY "\033[37m"
#define media_svc_debug(fmt, arg...) do { \
LOGD(FONT_COLOR_RESET" "fmt"", ##arg); \
} while (0)
#define media_svc_retm_if(expr, fmt, arg...) do { \
- if(expr) { \
+ if (expr) { \
LOGE(FONT_COLOR_RED" "fmt"", ##arg); \
return; \
} \
} while (0)
#define media_svc_retv_if(expr, val) do { \
- if(expr) { \
+ if (expr) { \
LOGE(FONT_COLOR_RED""); \
return (val); \
} \
} while (0)
#define media_svc_retvm_if(expr, val, fmt, arg...) do { \
- if(expr) { \
+ if (expr) { \
LOGE(FONT_COLOR_RED" "fmt"", ##arg); \
return (val); \
} \
} while (0)
#define media_svc_retv_del_if(expr, val, p_str) do { \
- if(expr) { \
+ if (expr) { \
LOGE(FONT_COLOR_RED""); \
_media_svc_destroy_content_info(p_str); \
return (val); \
/**
* Table Name
*/
-#define MEDIA_SVC_DB_TABLE_MEDIA "media" /**< media table*/
-#define MEDIA_SVC_DB_TABLE_FOLDER "folder" /**< media_folder table*/
-#define MEDIA_SVC_DB_TABLE_PLAYLIST "playlist" /**< playlist table*/
-#define MEDIA_SVC_DB_TABLE_PLAYLIST_MAP "playlist_map" /**< playlist_map table*/
-#define MEDIA_SVC_DB_TABLE_ALBUM "album" /**< album table*/
-#define MEDIA_SVC_DB_TABLE_TAG "tag" /**< tag table*/
-#define MEDIA_SVC_DB_TABLE_TAG_MAP "tag_map" /**< tag_map table*/
-#define MEDIA_SVC_DB_TABLE_BOOKMARK "bookmark" /**< bookmark table*/
-#define MEDIA_SVC_DB_TABLE_STORAGE "storage" /**< storage table*/
-#define MEDIA_SVC_DB_TABLE_TMP_TABLE "tmp" /**< tmp table for backup*/
-#define MEDIA_SVC_DB_TABLE_FACE "face" /**< face table*/
-#define MEDIA_SVC_DB_TABLE_FACE_SCAN_LIST "face_scan_list" /**< face_scan_list table*/
+#define MEDIA_SVC_DB_TABLE_MEDIA "media" /**< media table*/
+#define MEDIA_SVC_DB_TABLE_FOLDER "folder" /**< media_folder table*/
+#define MEDIA_SVC_DB_TABLE_PLAYLIST "playlist" /**< playlist table*/
+#define MEDIA_SVC_DB_TABLE_PLAYLIST_MAP "playlist_map" /**< playlist_map table*/
+#define MEDIA_SVC_DB_TABLE_ALBUM "album" /**< album table*/
+#define MEDIA_SVC_DB_TABLE_TAG "tag" /**< tag table*/
+#define MEDIA_SVC_DB_TABLE_TAG_MAP "tag_map" /**< tag_map table*/
+#define MEDIA_SVC_DB_TABLE_BOOKMARK "bookmark" /**< bookmark table*/
+#define MEDIA_SVC_DB_TABLE_STORAGE "storage" /**< storage table*/
+#define MEDIA_SVC_DB_TABLE_TMP_TABLE "tmp" /**< tmp table for backup*/
+#define MEDIA_SVC_DB_TABLE_FACE "face" /**< face table*/
+#define MEDIA_SVC_DB_TABLE_FACE_SCAN_LIST "face_scan_list" /**< face_scan_list table*/
/**
* View Name
*/
-#define MEDIA_SVC_DB_VIEW_MEDIA "media_view" /**< media_view*/
-#define MEDIA_SVC_DB_VIEW_PLAYLIST "playlist_view" /**< playlist_view*/
-#define MEDIA_SVC_DB_VIEW_TAG "tag_view" /**< tag_view*/
+#define MEDIA_SVC_DB_VIEW_MEDIA "media_view" /**< media_view*/
+#define MEDIA_SVC_DB_VIEW_PLAYLIST "playlist_view" /**< playlist_view*/
+#define MEDIA_SVC_DB_VIEW_TAG "tag_view" /**< tag_view*/
/**
* Trigger Name
*/
#define MEDIA_SVC_DB_TRIGGER_FOLDER "folder_cleanup"
-#define MEDIA_SVC_DB_TRIGGER_PLAYLIST_MAP "playlist_map_cleanup" /**< media to map*/
-#define MEDIA_SVC_DB_TRIGGER_PLAYLIST_MAP1 "playlist_map_cleanup_1" /**< playlist to map*/
+#define MEDIA_SVC_DB_TRIGGER_PLAYLIST_MAP "playlist_map_cleanup" /**< media to map*/
+#define MEDIA_SVC_DB_TRIGGER_PLAYLIST_MAP1 "playlist_map_cleanup_1" /**< playlist to map*/
#define MEDIA_SVC_DB_TRIGGER_ALBUM "album_cleanup"
-#define MEDIA_SVC_DB_TRIGGER_TAG_MAP "tag_map_cleanup" /**< media to map*/
-#define MEDIA_SVC_DB_TRIGGER_TAG_MAP1 "tag_map_cleanup_1" /**< tag to map*/
+#define MEDIA_SVC_DB_TRIGGER_TAG_MAP "tag_map_cleanup" /**< media to map*/
+#define MEDIA_SVC_DB_TRIGGER_TAG_MAP1 "tag_map_cleanup_1" /**< tag to map*/
#define MEDIA_SVC_DB_TRIGGER_BOOKMARK "bookmark_cleanup"
#define MEDIA_SVC_DB_TRIGGER_STORAGE "storage_folder_cleanup"
#define MEDIA_SVC_DB_TRIGGER_FACE_SCAN_LIST "face_scan_list_cleanup"
-#define MEDIA_SVC_METADATA_LEN_MAX 128 /**< Length of metadata*/
-#define MEDIA_SVC_METADATA_DESCRIPTION_MAX 512 /**< Length of description*/
-#define MEDIA_SVC_PATHNAME_SIZE 4096 /**< Length of Path name. */
-#define MEDIA_SVC_UUID_SIZE 36 /**< Length of UUID*/
+#define MEDIA_SVC_METADATA_LEN_MAX 128 /**< Length of metadata*/
+#define MEDIA_SVC_METADATA_DESCRIPTION_MAX 512 /**< Length of description*/
+#define MEDIA_SVC_PATHNAME_SIZE 4096 /**< Length of Path name. */
+#define MEDIA_SVC_UUID_SIZE 36 /**< Length of UUID*/
#define MEDIA_SVC_TAG_UNKNOWN "Unknown"
-#define MEDIA_SVC_MEDIA_PATH tzplatform_mkpath(TZ_USER_SHARE, "media") /**< Media path*/
+#define MEDIA_SVC_MEDIA_PATH tzplatform_mkpath(TZ_USER_SHARE, "media") /**< Media path*/
#define MEDIA_SVC_THUMB_PATH_PREFIX tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb") /**< Thumbnail path prefix*/
-#define MEDIA_SVC_THUMB_INTERNAL_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/phone") /**< Phone thumbnail path*/
-#define MEDIA_SVC_THUMB_EXTERNAL_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/mmc") /**< MMC thumbnail path*/
-#define MEDIA_SVC_THUMB_DEFAULT_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/thumb_default.png") /** default thumbnail */
+#define MEDIA_SVC_THUMB_INTERNAL_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/phone") /**< Phone thumbnail path*/
+#define MEDIA_SVC_THUMB_EXTERNAL_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/mmc") /**< MMC thumbnail path*/
+#define MEDIA_SVC_THUMB_DEFAULT_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/thumb_default.png") /**< default thumbnail */
#define THUMB_EXT "jpg"
enum Exif_Orientation {
NOT_AVAILABLE = 0,
- NORMAL = 1,
- HFLIP = 2,
+ NORMAL = 1,
+ HFLIP = 2,
ROT_180 = 3,
- VFLIP = 4,
- TRANSPOSE = 5,
- ROT_90 = 6,
- TRANSVERSE = 7,
+ VFLIP = 4,
+ TRANSPOSE = 5,
+ ROT_90 = 6,
+ TRANSVERSE = 7,
ROT_270 = 8
};
#endif
#ifndef FALSE
-#define FALSE 0
+#define FALSE 0
#endif
#ifndef TRUE
-#define TRUE 1
+#define TRUE 1
#endif
-#define SAFE_FREE(src) { if(src) {free(src); src = NULL;}}
+#define SAFE_FREE(src) { if (src) {free(src); src = NULL;}}
#define STRING_VALID(str) \
((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
int _media_svc_get_file_time(const char *full_path);
int _media_svc_set_default_value(media_svc_content_info_s *content_info, bool refresh);
int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, media_svc_storage_type_e storage_type,
- const char *path, media_svc_media_type_e *media_type, bool refresh);
+ const char *path, media_svc_media_type_e *media_type, bool refresh);
int _media_svc_extract_image_metadata(sqlite3 *handle, media_svc_content_info_s *content_info);
int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s *content_info, uid_t uid);
int __media_svc_malloc_and_strncpy(char **dst, const char *src);
#include <media-svc.h>
#include <media-svc-noti.h>
-#define SAFE_FREE(src) { if(src) { free(src); src = NULL; } }
+#define SAFE_FREE(src) { if (src) { free(src); src = NULL; } }
GMainLoop *g_loop = NULL;
MediaSvcHandle *g_db_handle = NULL;
void _noti_cb(int pid,
- media_item_type_e update_item,
- media_item_update_type_e update_type,
- char *path,
- char *uuid,
- media_type_e content_type,
- char *mime_type,
- void *user_data)
+ media_item_type_e update_item,
+ media_item_update_type_e update_type,
+ char *path,
+ char *uuid,
+ media_type_e content_type,
+ char *mime_type,
+ void *user_data)
{
media_svc_debug("Noti from PID(%d)", pid);
#include <tzplatform_config.h>
-#define PLUGIN_SO_FILE_NAME "/usr/lib/libmedia-content-plugin.so"
+#define PLUGIN_SO_FILE_NAME "/usr/lib/libmedia-content-plugin.so"
#define MEDIA_ROOT_PATH_SDCARD tzplatform_getenv(TZ_SYS_STORAGE)
void *funcHandle = NULL;
svc_set_folder_item_validity = dlsym(funcHandle, "set_folder_item_validity");
svc_delete_all_invalid_items_in_folder = dlsym(funcHandle, "delete_all_invalid_items_in_folder");
- if (!svc_connect ||
- !svc_disconnect ||
- !svc_insert_item_immediately ||
- !svc_set_folder_item_validity ||
- !svc_delete_all_invalid_items_in_folder ||
- !svc_check_item_exist) {
+ if (!svc_connect || !svc_disconnect ||!svc_insert_item_immediately ||!svc_set_folder_item_validity ||!svc_delete_all_invalid_items_in_folder ||!svc_check_item_exist) {
fprintf(stderr, "error: %s\n", dlerror());
return -1;
}
}
} /* End of While */
- ret = media_svc_insert_folder(db_handle, 0, path);
+ ret = media_svc_insert_folder(db_handle, 0, path);
if (ret < 0) {
msg_print(__LINE__, "media_svc_insert_folder error ");
} else {