float altitude; /**< altitude*/
char *exposure_time; /**< exposure_time*/
float fnumber; /**< fnumber*/
- int iso; /**< iso*/
+ int iso; /**< iso*/
char *model; /**< model*/
- int width; /**< width*/
- int height; /**< height*/
+ int width; /**< width*/
+ int height; /**< height*/
char *datetaken; /**< datetaken*/
int orientation; /**< orientation*/
int rating; /**< user defined rating */
/**
* Type definition for scanning status
*/
-typedef enum{
+typedef enum {
MEDIA_SVC_SCAN_PREPARE = 0, /**< Prepare scanning*/
MEDIA_SVC_SCAN_PROCESSING = 1, /**< Process scanning*/
MEDIA_SVC_SCAN_STOP = 2, /**< Stop scanning*/
MEDIA_SVC_SCAN_COMPLETE = 3, /**< Complete scanning*/
MEDIA_SVC_SCAN_MAX = 4, /**< Invalid status*/
-}media_svc_scan_status_type_e;
+} media_svc_scan_status_type_e;
#define MEDIA_SVC_DEFAULT_GPS_VALUE -200 /**< Default GPS Value*/
const unsigned char *c;
int length;
- if (!file) {
+ if (!file)
return NULL;
- }
length = 3 * strlen(file) + 9;
((c) >= 32 && (c) < 128 && (ACCEPTABLE_URI_CHARS[(c) - 32] & 0x08))
uri = alloca(length);
- if (uri == NULL) {
+ if (uri == NULL)
return NULL;
- }
strncpy(uri, "file://", length);
uri[length - 1] = '\0';
{
char *hash = NULL;
- if (max_length < ((2 * MD5_HASHBYTES) + 1)) {
+ if (max_length < ((2 * MD5_HASHBYTES) + 1))
return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
hash = _mb_svc_generate_hash_name(origin_path);
- if (hash == NULL) {
+ if (hash == NULL)
return MS_MEDIA_ERR_INTERNAL;
- }
strncpy(hash_code, hash, max_length);
hash_code[strlen(hash_code)] = '\0';
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
ret = thumbnail_request_extract_all_thumbs(uid);
- if (ret < 0) {
+ if (ret < 0)
return MEDIA_SVC_PLUGIN_ERROR;
- }
ret = dcm_svc_request_extract_all(uid);
- if (ret < 0) {
+ if (ret < 0)
return MEDIA_SVC_PLUGIN_ERROR;
- }
#endif
return MEDIA_SVC_PLUGIN_ERROR_NONE;
}
#if 0
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_pass2_get_extract_list(handle, storage_id, storage_type, scan_type, path, burst, uid, array);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
#if 0
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_one_item_pass2(handle, storage_id, storage_type, data, burst);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
#if 0
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_query_do_update_list(handle);
- if(ret < 0) {
+ if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
media_svc_retvm_if(album == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "album is NULL");
- if (artist != NULL) {
+ if (artist != NULL)
sql = sqlite3_mprintf("SELECT album_id FROM %s WHERE name = '%q' AND artist = '%q';", MEDIA_SVC_DB_TABLE_ALBUM, album, artist);
- } else {
+ else
sql = sqlite3_mprintf("SELECT album_id FROM %s WHERE name = '%q' AND artist IS NULL;", MEDIA_SVC_DB_TABLE_ALBUM, album, artist);
- }
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 album.");
- } else {
+ else
media_svc_error("error when _media_svc_get_album_id. err = [%d]", ret);
- }
+
return ret;
}
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 album_id.");
- } else {
+ else
media_svc_error("error when get album_art. err = [%d]", ret);
- }
+
return ret;
}
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 media in relted to this media's album.");
- } else {
+ else
media_svc_error("error when _media_svc_get_media_count_with_album_id_by_path. err = [%d]", ret);
- }
+
return ret;
}
tb = g_hash_table_lookup(table, MEDIA_SVC_DB_TABLE_UHD);
__media_svc_table_free(tb);
- g_hash_table_remove (table, MEDIA_SVC_DB_TABLE_UHD);
+ g_hash_table_remove(table, MEDIA_SVC_DB_TABLE_UHD);
tb = g_hash_table_lookup(table, MEDIA_SVC_DB_TABLE_PVR);
__media_svc_table_free(tb);
- g_hash_table_remove (table, MEDIA_SVC_DB_TABLE_PVR);
+ g_hash_table_remove(table, MEDIA_SVC_DB_TABLE_PVR);
g_hash_table_destroy(table);
{
if (g_log_fp == NULL) {
snprintf(_g_file_path, sizeof(_g_file_path), "/tmp/%s", "media-info");
- if (access(_g_file_path, R_OK == 0)) {
+ if (access(_g_file_path, R_OK == 0))
remove(_g_file_path);
- }
g_log_fp = fopen(_g_file_path, "a");
}
/*if(temp_name[j].pinyin_name[0]) */
/* name_len[j] += snprintf(temp_name[j].pinyin_name + name_len[j], pinyin_name_len - name_len[j], " "); */
- name_len[j] += snprintf(temp_name[j].pinyin_name + name_len[j], pinyin_name_len - name_len[j],
- "%s", spell[i][index]);
+ name_len[j] += snprintf(temp_name[j].pinyin_name + name_len[j], pinyin_name_len - name_len[j], "%s", spell[i][index]);
int char_len = _media_svc_check_utf8(spell[i][index][0]);
if (char_len > 0) {
if (char_len == 1)
- initial_len[j] += snprintf(temp_name[j].pinyin_initial + initial_len[j], pinyin_initial_len - initial_len[j],
- "%c", spell[i][index][0]);
+ initial_len[j] += snprintf(temp_name[j].pinyin_initial + initial_len[j], pinyin_initial_len - initial_len[j], "%c", spell[i][index][0]);
else {
char temp[10];
snprintf(temp, sizeof(temp), "%s", spell[i][index]);
temp[char_len] = '\0';
- initial_len[j] += snprintf(temp_name[j].pinyin_initial + initial_len[j], pinyin_initial_len - initial_len[j],
- "%s", temp);
+ initial_len[j] += snprintf(temp_name[j].pinyin_initial + initial_len[j], pinyin_initial_len - initial_len[j], "%s", temp);
}
} else {
media_svc_error("_media_svc_check_utf8 failed");
{ 0xA184, { 0x3127, 0x3122, 0x0, 0x0} }, /* I_AN */
{ 0xA185, { 0x3127, 0x3123, 0x0, 0x0} }, /* I_EN */
{ 0xA186, { 0x3127, 0x3124, 0x0, 0x0} }, /* I_ANG */
- { 0xA187, { 0x3127, 0x3125, 0x0, 0x0} }, /* I_ENG */
+ { 0xA187, { 0x3127, 0x3125, 0x0, 0x0} }, /* I_ENG */
{ 0xA188, { 0x3128, 0x0, 0x0, 0x0} }, /* U */
- { 0xA189, { 0x3128, 0x311A, 0x0, 0x0} }, /* U_A */
- { 0xA18A, { 0x3128, 0x311B, 0x0, 0x0} }, /* U_O */
- { 0xA18B, { 0x3128, 0x311E, 0x0, 0x0} }, /* U_AI */
- { 0xA18C, { 0x3128, 0x311F, 0x0, 0x0} }, /* U_EI */
- { 0xA18D, { 0x3128, 0x3122, 0x0, 0x0} }, /* U_AN */
- { 0xA18E, { 0x3128, 0x3123, 0x0, 0x0} }, /* U_EN */
- { 0xA18F, { 0x3128, 0x3124, 0x0, 0x0} }, /* U_ANG */
- { 0xA190, { 0x3128, 0x3125, 0x0, 0x0} }, /* U_ENG */
- { 0xA191, { 0x3129, 0x0, 0x0 } }, /* IU */
- { 0xA192, { 0x3129, 0x311D, 0x0, 0x0} }, /* IU_EH */
- { 0xA193, { 0x3129, 0x3122, 0x0, 0x0} }, /* IU_AN */
- { 0xA194, { 0x3129, 0x3123, 0x0, 0x0} }, /* IU_EN */
- { 0xA195, { 0x3129, 0x3125, 0x0, 0x0} }, /* IU_ENG */
+ { 0xA189, { 0x3128, 0x311A, 0x0, 0x0} }, /* U_A */
+ { 0xA18A, { 0x3128, 0x311B, 0x0, 0x0} }, /* U_O */
+ { 0xA18B, { 0x3128, 0x311E, 0x0, 0x0} }, /* U_AI */
+ { 0xA18C, { 0x3128, 0x311F, 0x0, 0x0} }, /* U_EI */
+ { 0xA18D, { 0x3128, 0x3122, 0x0, 0x0} }, /* U_AN */
+ { 0xA18E, { 0x3128, 0x3123, 0x0, 0x0} }, /* U_EN */
+ { 0xA18F, { 0x3128, 0x3124, 0x0, 0x0} }, /* U_ANG */
+ { 0xA190, { 0x3128, 0x3125, 0x0, 0x0} }, /* U_ENG */
+ { 0xA191, { 0x3129, 0x0, 0x0 } }, /* IU */
+ { 0xA192, { 0x3129, 0x311D, 0x0, 0x0} }, /* IU_EH */
+ { 0xA193, { 0x3129, 0x3122, 0x0, 0x0} }, /* IU_AN */
+ { 0xA194, { 0x3129, 0x3123, 0x0, 0x0} }, /* IU_EN */
+ { 0xA195, { 0x3129, 0x3125, 0x0, 0x0} }, /* IU_ENG */
{ 0xA196, { 0x311A, 0x0, 0x0, 0x0} }, /* A */
{ 0xA197, { 0x311B, 0x0, 0x0, 0x0} }, /* O */
{ 0xA198, { 0x311C, 0x0, 0x0, 0x0} }, /* E */
} else if (lowerBound > upperBound) {
return NULL;
} else {
- if (table[curIn].yi_syllable < src) {
+ if (table[curIn].yi_syllable < src)
lowerBound = curIn + 1;
- } else {
+ else
upperBound = curIn - 1;
- }
}
}
return NULL;
code = __media_svc_yi_syllable_find(HANZI_TO_BPMF_MAP_9, array_sizeof(HANZI_TO_BPMF_MAP_9), src);
else if (MAP_10_BEGIN <= src && src < MAP_END)
code = __media_svc_yi_syllable_find(HANZI_TO_BPMF_MAP_10, array_sizeof(HANZI_TO_BPMF_MAP_10), src);
- else {
+ else
return NULL;
- }
} else if (src >= 0x3105 && src <= 0x3129) {
code = __media_svc_yi_syllable_find(BPMF_TO_BPMF_MAP, array_sizeof(BPMF_TO_BPMF_MAP), src);
} else
{
char fuzzy_number = '*';
switch (src[2]) {
- case 0x85: /* \u3105 : u3105, e3 84 85 - 1 */
- case 0x86: /* \u3106 : u3106, e3 84 86 - 1 */
- case 0x87: /* \u3107 : u3107, e3 84 87 - 1 */
- case 0x88: /* \u3108 : u3108, e3 84 88 - 1 */
- fuzzy_number = '1';
- break;
- case 0x89: /* \u3109: u3109, e3 84 89 - 2 */
- case 0x8a: /* \u310a: u310a, e3 84 8a - 2 */
- case 0x8b: /* \u310b: u310b, e3 84 8b - 2 */
- case 0x8c: /* \u310c: u310c, e3 84 8c - 2 */
- fuzzy_number = '2';
- break;
- case 0x8d: /* \u310d: u310d, e3 84 8d - 3 */
- case 0x8e: /* \u310e: u310e, e3 84 8e - 3 */
- case 0x8f: /* \u310f: u310f, e3 84 8f - 3 */
- fuzzy_number = '3';
- break;
- case 0x90: /* \u3110: u3110, e3 84 90 - 4 */
- case 0x91: /* \u3111: u3111, e3 84 91 - 4 */
- case 0x92: /* \u3112: u3112, e3 84 92 - 4 */
- fuzzy_number = '4';
- break;
- case 0x93: /* \u3113: u3113, e3 84 93 - 5 */
- case 0x94: /* \u3114: u3114, e3 84 94 - 5 */
- case 0x95: /* \u3115: u3115, e3 84 95 - 5 */
- case 0x96: /* \u3116: u3116, e3 84 96 - 5 */
- fuzzy_number = '5';
- break;
- case 0x97: /* \u3117: u3117, e3 84 97 - 6 */
- case 0x98: /* \u3118: u3118, e3 84 98 - 6 */
- case 0x99: /* \u3119: u3119, e3 84 99 - 6 */
- fuzzy_number = '6';
- break;
- case 0x9a: /* \u311a: u311a, e3 84 9a - 7 */
- case 0x9b: /* \u311b: u311b, e3 84 9b - 7 */
- case 0x9c: /* \u311c: u311c, e3 84 9c - 7 */
- case 0x9d: /* \u311d: u311d, e3 84 9d - 7 */
- fuzzy_number = '7';
- break;
- case 0x9e: /* \u311e: u311e, e3 84 9e - 8 */
- case 0x9f: /* \u311f: u311f, e3 84 9f - 8 */
- case 0xa0: /* \u3120: u3120, e3 84 a0 - 8 */
- case 0xa1: /* \u3121: u3121, e3 84 a1 - 8 */
- fuzzy_number = '8';
- break;
- case 0xa2: /* \u3122: u3122, e3 84 a2 - 9 */
- case 0xa3: /* \u3123: u3123, e3 84 a3 - 9 */
- case 0xa4: /* \u3124: u3124, e3 84 a4 - 9 */
- case 0xa5: /* \u3125: u3125, e3 84 a5 - 9 */
- case 0xa6: /* \u3126: u3126, e3 84 a6 - 9 */
- fuzzy_number = '9';
- break;
- case 0xa7: /* \u3127: u3127, e3 84 a7 - 0 */
- case 0xa8: /* \u3128: u3128, e3 84 a8 - 0 */
- case 0xa9: /* \u3129: u3129, e3 84 a9 - 0 */
- fuzzy_number = '0';
- break;
- default:
- fuzzy_number = '*';
- break;
+ case 0x85: /* \u3105 : u3105, e3 84 85 - 1 */
+ case 0x86: /* \u3106 : u3106, e3 84 86 - 1 */
+ case 0x87: /* \u3107 : u3107, e3 84 87 - 1 */
+ case 0x88: /* \u3108 : u3108, e3 84 88 - 1 */
+ fuzzy_number = '1';
+ break;
+ case 0x89: /* \u3109: u3109, e3 84 89 - 2 */
+ case 0x8a: /* \u310a: u310a, e3 84 8a - 2 */
+ case 0x8b: /* \u310b: u310b, e3 84 8b - 2 */
+ case 0x8c: /* \u310c: u310c, e3 84 8c - 2 */
+ fuzzy_number = '2';
+ break;
+ case 0x8d: /* \u310d: u310d, e3 84 8d - 3 */
+ case 0x8e: /* \u310e: u310e, e3 84 8e - 3 */
+ case 0x8f: /* \u310f: u310f, e3 84 8f - 3 */
+ fuzzy_number = '3';
+ break;
+ case 0x90: /* \u3110: u3110, e3 84 90 - 4 */
+ case 0x91: /* \u3111: u3111, e3 84 91 - 4 */
+ case 0x92: /* \u3112: u3112, e3 84 92 - 4 */
+ fuzzy_number = '4';
+ break;
+ case 0x93: /* \u3113: u3113, e3 84 93 - 5 */
+ case 0x94: /* \u3114: u3114, e3 84 94 - 5 */
+ case 0x95: /* \u3115: u3115, e3 84 95 - 5 */
+ case 0x96: /* \u3116: u3116, e3 84 96 - 5 */
+ fuzzy_number = '5';
+ break;
+ case 0x97: /* \u3117: u3117, e3 84 97 - 6 */
+ case 0x98: /* \u3118: u3118, e3 84 98 - 6 */
+ case 0x99: /* \u3119: u3119, e3 84 99 - 6 */
+ fuzzy_number = '6';
+ break;
+ case 0x9a: /* \u311a: u311a, e3 84 9a - 7 */
+ case 0x9b: /* \u311b: u311b, e3 84 9b - 7 */
+ case 0x9c: /* \u311c: u311c, e3 84 9c - 7 */
+ case 0x9d: /* \u311d: u311d, e3 84 9d - 7 */
+ fuzzy_number = '7';
+ break;
+ case 0x9e: /* \u311e: u311e, e3 84 9e - 8 */
+ case 0x9f: /* \u311f: u311f, e3 84 9f - 8 */
+ case 0xa0: /* \u3120: u3120, e3 84 a0 - 8 */
+ case 0xa1: /* \u3121: u3121, e3 84 a1 - 8 */
+ fuzzy_number = '8';
+ break;
+ case 0xa2: /* \u3122: u3122, e3 84 a2 - 9 */
+ case 0xa3: /* \u3123: u3123, e3 84 a3 - 9 */
+ case 0xa4: /* \u3124: u3124, e3 84 a4 - 9 */
+ case 0xa5: /* \u3125: u3125, e3 84 a5 - 9 */
+ case 0xa6: /* \u3126: u3126, e3 84 a6 - 9 */
+ fuzzy_number = '9';
+ break;
+ case 0xa7: /* \u3127: u3127, e3 84 a7 - 0 */
+ case 0xa8: /* \u3128: u3128, e3 84 a8 - 0 */
+ case 0xa9: /* \u3129: u3129, e3 84 a9 - 0 */
+ fuzzy_number = '0';
+ break;
+ default:
+ fuzzy_number = '*';
+ break;
}
return fuzzy_number;
bool _media_svc_bpmf_is_bpmf(const char *src)
{
if (src[0] == 0xe3 && src[1] == 0x84) {
- if (src[2] >= 0x85 && src[2] <= 0xa9) {
+ if (src[2] >= 0x85 && src[2] <= 0xa9)
return true;
- }
}
return false;
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 folder.");
- } else {
+ else
media_svc_error("error when _media_svc_get_folder_id_by_foldername. err = [%d]", ret);
- }
+
return ret;
}
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);
- if (temp_parent_uuid != NULL) {
+ if (temp_parent_uuid != NULL)
_strncpy_safe(parent_folder_uuid, temp_parent_uuid, MEDIA_SVC_UUID_SIZE+1);
- }
SQLITE3_FINALIZE(sql_stmt);
}
}
ret = __media_svc_append_folder(storage_id, storage_type, folder_uuid, dir_path, parent_folder_uuid, FALSE, uid);
- if (ret != MS_MEDIA_ERR_NONE) {
+ if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("__media_svc_append_folder is failed");
- }
media_svc_error("[No-Error] New Appended folder path [%s], folder_uuid [%s], parent_folder_uuid [%s]", dir_path, folder_uuid, parent_folder_uuid);
_strncpy_safe(parent_folder_uuid, folder_uuid, MEDIA_SVC_UUID_SIZE + 1);
ret = _media_svc_get_folder_id_by_foldername(handle, storage_id, path, folder_id, uid);
- if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
+ if (ret == MS_MEDIA_ERR_DB_NO_RECORD)
ret = __media_svc_get_and_append_parent_folder(handle, storage_id, path, storage_type, folder_id, uid);
- }
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);
return ret;
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 folder.");
- } else {
+ else
media_svc_error("error when _media_svc_get_folder_id_by_foldername. err = [%d]", ret);
- }
+
return ret;
}
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- while (sqlite3_step(sql_stmt) == SQLITE_ROW) {
+ while (sqlite3_step(sql_stmt) == SQLITE_ROW)
*scan_status = sqlite3_column_int(sql_stmt, 0);
- }
SQLITE3_FINALIZE(sql_stmt);
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
- if (path) {
+ if (path)
sql = sqlite3_mprintf("UPDATE '%s' SET scan_status=%d WHERE path = '%q' AND storage_uuid = '%q'", MEDIA_SVC_DB_TABLE_FOLDER, scan_status, path, storage_id);
- } else {
+ else
sql = sqlite3_mprintf("UPDATE '%s' SET scan_status=%d WHERE storage_uuid = '%q'", MEDIA_SVC_DB_TABLE_FOLDER, scan_status, storage_id);
- }
ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
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 folder.");
- } else {
+ else
media_svc_error("error when _media_svc_get_folder_modified_time_by_path. err = [%d]", ret);
- }
+
return ret;
}
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 folder.");
- } else {
+ else
media_svc_error("error when get folder_id by path. err = [%d]", ret);
- }
*folder_list = NULL;
*count = 0;
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 folder.");
- } else {
+ else
media_svc_error("error when get folder_id by path [%s]. err = [%d]", path, ret);
- }
+
return ret;
}
} else {
/* free all data */
int i = 0;
- for (i = 0; i < idx; i++) {
+ for (i = 0; i < idx; i++)
SAFE_FREE((*folder_list)[i]);
- }
+
SAFE_FREE(*folder_list);
*count = 0;
ret = MS_MEDIA_ERR_INTERNAL;
fnumber=%.6f, iso=%d, model=%Q, rating=%d, weather=%Q, file_name_pinyin=%Q, title_pinyin=%Q, album_pinyin=%Q, \
artist_pinyin=%Q, album_artist_pinyin=%Q, genre_pinyin=%Q, composer_pinyin=%Q, copyright_pinyin=%Q, description_pinyin=%Q, is_360=%d WHERE path=%Q;",
storage_id,
- //content_info->folder_uuid,
+ /* content_info->folder_uuid, */
content_info->thumbnail_path,
content_info->media_meta.title,
content_info->album_id,
media_svc_noti_item *noti_list = g_inserted_noti_list;
if (noti_list) {
- for (idx = 0; idx < all_cnt; idx++) {
+ for (idx = 0; idx < all_cnt; idx++)
ret = __media_svc_publish_noti_by_item(&(noti_list[idx]));
- }
}
return ret;
ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- if (STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 0))) {
+ if (STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 0)))
_strncpy_safe(storage_id, (const char *)sqlite3_column_text(sql_stmt, 0), MEDIA_SVC_UUID_SIZE+1);
- }
SQLITE3_FINALIZE(sql_stmt);
SAFE_FREE(storage_path);
ExifEntry *entry;
ExifTag tag;
- if (ed == NULL) {
+ if (ed == NULL)
return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
tag = tagtype;
if (strptime(timstr, "%Y:%m:%d %H:%M:%S", &t) || strptime(timstr, "%Y-%m-%d %H:%M:%S", &t)) {
t.tm_isdst = timeinfo.tm_isdst;
- if (t.tm_isdst != 0) {
+ if (t.tm_isdst != 0)
media_svc_error("DST %d", t.tm_isdst);
- }
modified_t = mktime(&t);
- if (modified_t > 0) {
+ if (modified_t > 0)
return modified_t;
- } else {
+ else
media_svc_error("Failed to get timeline : [%s] [%d:%d:%d: %d:%d:%d]", timstr, t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
- }
} else {
media_svc_error("Failed to get timeline : [%s]", timstr);
}
media_svc_media_type_e type;
ret = __media_svc_get_content_type_from_mime(path, mime_type, &category);
- if (ret != MS_MEDIA_ERR_NONE) {
+ if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("__media_svc_get_content_type_from_mime failed : %d", ret);
- }
if (category & MEDIA_SVC_CATEGORY_SOUND) type = MEDIA_SVC_MEDIA_TYPE_SOUND;
else if (category & MEDIA_SVC_CATEGORY_MUSIC) type = MEDIA_SVC_MEDIA_TYPE_MUSIC;
return true;
}
- if (file_path[i] == '/') {
+ if (file_path[i] == '/')
return false;
- }
}
return false;
}
mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_LONGITUDE, &gps_value, NULL);
if (mmf_error == FILEINFO_ERROR_NONE) {
- if (longitude != NULL) {
+ if (longitude != NULL)
*longitude = (gps_value == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : gps_value;
- }
} else {
SAFE_FREE(err_attr_name);
}
mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_LATIDUE, &gps_value, NULL);
if (mmf_error == FILEINFO_ERROR_NONE) {
- if (latitude != NULL) {
+ if (latitude != NULL)
*latitude = (gps_value == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : gps_value;
- }
} else {
SAFE_FREE(err_attr_name);
}
mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_ALTIDUE, &gps_value, NULL);
if (mmf_error == FILEINFO_ERROR_NONE) {
- if (altitude != NULL) {
+ if (altitude != NULL)
*altitude = (gps_value == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : gps_value;
- }
} else {
SAFE_FREE(err_attr_name);
}
if (result == NULL)
break;
- if (strcmp(entry.d_name, ".") == 0 || strcmp(entry.d_name, "..") == 0) {
+ if (strcmp(entry.d_name, ".") == 0 || strcmp(entry.d_name, "..") == 0)
continue;
- }
+
snprintf(filename, sizeof(filename), "%s/%s", dir_path, entry.d_name);
- if (stat(filename, &st) != 0) {
+ if (stat(filename, &st) != 0)
continue;
- }
- if (S_ISDIR(st.st_mode)) {
+
+ if (S_ISDIR(st.st_mode))
continue;
- }
+
if (unlink(filename) != 0) {
media_svc_stderror("failed to remove");
closedir(dir);
}
ret = chmod(thumb_dir, 0777);
- if (ret != 0) {
+ if (ret != 0)
media_svc_stderror("chmod failed");
- }
+
ret = chown(thumb_dir, 5000, 5000);
- if (ret != 0) {
+ if (ret != 0)
media_svc_stderror("chown failed");
- }
}
return MS_MEDIA_ERR_NONE;
}
memset(file_ext, 0, sizeof(file_ext));
- if (!__media_svc_get_file_ext(pathname, file_ext)) {
+ if (!__media_svc_get_file_ext(pathname, file_ext))
media_svc_error("get file ext fail");
- }
ret = mb_svc_generate_hash_code(pathname, hash, sizeof(hash));
if (ret != MS_MEDIA_ERR_NONE) {
content_info->modified_time = st.st_mtime;
content_info->timeline = content_info->modified_time;
content_info->size = st.st_size;
- //media_svc_debug("Modified time : [%d] Size : [%lld]", content_info->modified_time, content_info->size);
+ /* media_svc_debug("Modified time : [%d] Size : [%lld]", content_info->modified_time, content_info->size); */
} else {
media_svc_stderror("stat failed");
}
if (fp == NULL)
goto ERROR;
- size = fread(exif_header, 1, sizeof (exif_header), fp);
+ size = fread(exif_header, 1, sizeof(exif_header), fp);
if (size <= 0)
goto ERROR;
if ((exif_header[0] == 0xff) && (exif_header[1] == 0xd8) && (exif_header[2] == 0xff) && (exif_header[3] == 0xe1)) {
- size = fread(exif_app1, 1, sizeof (exif_app1), fp);
+ size = fread(exif_app1, 1, sizeof(exif_app1), fp);
if (size <= 0)
goto ERROR;
if (fseek(fp, app1_size, SEEK_CUR) != 0)
goto ERROR;
- size = fread(exif_app1_xmp, 1, sizeof (exif_app1_xmp), fp);
+ size = fread(exif_app1_xmp, 1, sizeof(exif_app1_xmp), fp);
if (size <= 0)
goto ERROR;
if ((exif_app1_xmp[0] == 0xff) && (exif_app1_xmp[1] == 0xe1)) {
int result = 0;
char *ptr = NULL;
- size = fread(exif_app1_xmp_t, 1, sizeof (exif_app1_xmp_t), fp);
+ size = fread(exif_app1_xmp_t, 1, sizeof(exif_app1_xmp_t), fp);
if (size <= 0)
goto ERROR;
}
ptr = ptr - temp;
- if(strstr(ptr, "UsePanoramaViewer")
+ if (strstr(ptr, "UsePanoramaViewer")
&& strstr(ptr, "True")
&& strstr(ptr, "ProjectionType")
&& strstr(ptr, "equirectangular"))
if (__media_svc_get_exif_info(ed, NULL, NULL, &value, EXIF_TAG_GPS_LATITUDE) == MS_MEDIA_ERR_NONE) {
if (__media_svc_get_exif_info(ed, buf, NULL, NULL, EXIF_TAG_GPS_LATITUDE_REF) == MS_MEDIA_ERR_NONE) {
if (strlen(buf) > 0) {
- if (strcmp(buf, "S") == 0) {
+ if (strcmp(buf, "S") == 0)
value = -1 * value;
- }
}
content_info->media_meta.latitude = value;
} else {
if (__media_svc_get_exif_info(ed, NULL, NULL, &value, EXIF_TAG_GPS_LONGITUDE) == MS_MEDIA_ERR_NONE) {
if (__media_svc_get_exif_info(ed, buf, NULL, NULL, EXIF_TAG_GPS_LONGITUDE_REF) == MS_MEDIA_ERR_NONE) {
if (strlen(buf) > 0) {
- if (strcmp(buf, "W") == 0) {
+ if (strcmp(buf, "W") == 0)
value = -1 * value;
- }
}
content_info->media_meta.longitude = value;
} else {
if (has_datetaken) {
content_info->timeline = __media_svc_get_timeline_from_str(content_info->media_meta.datetaken);
- if (content_info->timeline == 0) {
+ if (content_info->timeline == 0)
content_info->timeline = content_info->modified_time;
- } else {
+ else
media_svc_debug("Timeline : %ld", content_info->timeline);
- }
}
/* Get exposure_time value from exif. */
if (__media_svc_get_exif_info(ed, exposure_time_buf, NULL, NULL, EXIF_TAG_EXPOSURE_TIME) == MS_MEDIA_ERR_NONE) {
if (strlen(exposure_time_buf) == 0) {
- //media_svc_debug("exposure_time_buf is NULL");
+ /* media_svc_debug("exposure_time_buf is NULL"); */
} else {
ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.exposure_time, exposure_time_buf);
if (ret != MS_MEDIA_ERR_NONE)
/* Get fnumber value from exif. */
if (__media_svc_get_exif_info(ed, NULL, NULL, &fnumber, EXIF_TAG_FNUMBER) == MS_MEDIA_ERR_NONE) {
- if (fnumber > 0.0) {
+ if (fnumber > 0.0)
content_info->media_meta.fnumber = fnumber;
- } else {
+ else
content_info->media_meta.fnumber = 0.0;
- }
} else {
content_info->media_meta.fnumber = 0.0;
}
/* Get iso value from exif. */
if (__media_svc_get_exif_info(ed, NULL, &iso, NULL, EXIF_TAG_ISO_SPEED_RATINGS) == MS_MEDIA_ERR_NONE) {
- if (iso > 0) {
+ if (iso > 0)
content_info->media_meta.iso = iso;
- } else {
+ else
content_info->media_meta.iso = 0;
- }
} else {
content_info->media_meta.iso = 0;
}
/* Get model value from exif. */
if (__media_svc_get_exif_info(ed, model_buf, NULL, NULL, EXIF_TAG_MODEL) == MS_MEDIA_ERR_NONE) {
if (strlen(model_buf) == 0) {
- //media_svc_debug("model_buf is NULL");
+ /* media_svc_debug("model_buf is NULL"); */
} else {
ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.model, model_buf);
if (ret != MS_MEDIA_ERR_NONE)
/* Get orientation value from exif. */
if (__media_svc_get_exif_info(ed, NULL, &orient_value, NULL, EXIF_TAG_ORIENTATION) == MS_MEDIA_ERR_NONE) {
- if (orient_value >= NOT_AVAILABLE && orient_value <= ROT_270) {
+ if (orient_value >= NOT_AVAILABLE && orient_value <= ROT_270)
content_info->media_meta.orientation = orient_value;
- } else {
+ else
content_info->media_meta.orientation = 0;
- }
} else {
content_info->media_meta.orientation = 0;
}
/* Get width value from exif. */
if (__media_svc_get_exif_info(ed, NULL, &exif_width, NULL, EXIF_TAG_PIXEL_X_DIMENSION) == MS_MEDIA_ERR_NONE) {
- if (exif_width > 0) {
+ if (exif_width > 0)
content_info->media_meta.width = exif_width;
- } else {
+ else
content_info->media_meta.width = 0;
- }
} else {
content_info->media_meta.width = 0;
}
/* Get height value from exif. */
if (__media_svc_get_exif_info(ed, NULL, &exif_height, NULL, EXIF_TAG_PIXEL_Y_DIMENSION) == MS_MEDIA_ERR_NONE) {
- if (exif_height > 0) {
+ if (exif_height > 0)
content_info->media_meta.height = exif_height;
- } else {
+ else
content_info->media_meta.height = 0;
- }
} else {
content_info->media_meta.height = 0;
}
}
mmf_error = mm_file_destroy_tag_attrs(tag);
- if (mmf_error != FILEINFO_ERROR_NONE) {
+ if (mmf_error != FILEINFO_ERROR_NONE)
media_svc_error("fail to free tag attr - err(%x)", mmf_error);
- }
} else {
/* in case of file size 0, MMFW Can't parsting tag info but add it to Music DB. */
char *no_tag_title = NULL;
mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_360, &content_info->media_meta.is_360, NULL);
- if (mmf_error != FILEINFO_ERROR_NONE) {
+ if (mmf_error != FILEINFO_ERROR_NONE)
SAFE_FREE(err_attr_name);
- }
mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_RECDATE, &p, &size, NULL);
if ((mmf_error == FILEINFO_ERROR_NONE) && (size > 0)) {
media_svc_error("strcpy error");
content_info->timeline = __media_svc_get_timeline_from_str(content_info->media_meta.recorded_date);
- if (content_info->timeline == 0) {
+ if (content_info->timeline == 0)
content_info->timeline = content_info->modified_time;
- } else {
+ else
media_svc_debug("Timeline : %ld", content_info->timeline);
- }
}
/*media_svc_debug("Recorded date : %s", content_info->media_meta.recorded_date); */
} else {
mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_ARTWORK_MIME, &p, &artwork_mime_size, NULL);
if ((mmf_error == FILEINFO_ERROR_NONE) && (artwork_mime_size > 0)) {
ret = _media_svc_get_thumbnail_path(content_info->storage_type, thumb_path, content_info->path, p, uid);
- if (ret != MS_MEDIA_ERR_NONE) {
+ if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("Fail to Get Thumbnail Path");
- }
/* albumart resizing */
__media_svc_resize_artwork(image, size, p, &resize_image, &resize_size);
} else {
}
mmf_error = mm_file_destroy_tag_attrs(tag);
- if (mmf_error != FILEINFO_ERROR_NONE) {
+ if (mmf_error != FILEINFO_ERROR_NONE)
media_svc_error("fail to free tag attr - err(%x)", mmf_error);
- }
} else {
/* in case of file size 0, MMFW Can't parsting tag info but add it to Music DB. */
char *no_tag_title = NULL;
}
/*Get Content attribute ===========*/
- if (cdis_value == 1) {
+ if (cdis_value == 1)
mmf_error = mm_file_create_content_attrs_safe(&content, content_info->path);
- } else {
+ else
mmf_error = mm_file_create_content_attrs_simple(&content, content_info->path);
- }
if (mmf_error == FILEINFO_ERROR_NONE) {
/*Common attribute*/
} else {
media_svc_error("Not support type");
mmf_error = mm_file_destroy_content_attrs(content);
- if (mmf_error != FILEINFO_ERROR_NONE) {
+ if (mmf_error != FILEINFO_ERROR_NONE)
media_svc_error("fail to free content attr - err(%x)", mmf_error);
- }
+
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
mmf_error = mm_file_destroy_content_attrs(content);
- if (mmf_error != FILEINFO_ERROR_NONE) {
+ if (mmf_error != FILEINFO_ERROR_NONE)
media_svc_error("fail to free content attr - err(%x)", mmf_error);
- }
} else {
media_svc_error("error in mm_file_create_content_attrs [%d]", mmf_error);
}
if (size > 0 && STRING_VALID(pinyinname[0].pinyin_name))
*pinyin_str = strdup(pinyinname[0].pinyin_name);
else
- *pinyin_str = strdup(src_str); //Return Original Non China Character
+ *pinyin_str = strdup(src_str); /* Return Original Non China Character */
}
_media_svc_pinyin_free(pinyinname, size);
return ret;
if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_PVR)
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_UHD)
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) {
- /*Do nothing.*/
- } else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) {
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_PVR)
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_UHD)
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_SCSA))
+ media_svc_debug("Do nothing[%d]", media_type);
+ else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE)
ret = _media_svc_extract_image_metadata(db_handle, &content_info);
- } else {
+ else
ret = _media_svc_extract_media_metadata(db_handle, &content_info, uid);
- }
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
/*Set or Get folder id*/
/*Set media info*/
ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, &media_type, FALSE);
- if (ret != MS_MEDIA_ERR_NONE) {
+ if (ret != MS_MEDIA_ERR_NONE)
return ret;
- }
if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_PVR)
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_UHD)
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) {
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_PVR)
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_UHD)
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) {
/*Do nothing.*/
} else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) {
ret = _media_svc_extract_image_metadata(db_handle, &content_info);
if (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)) {
+ if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO))
ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, FALSE, uid);
- } else {
+ else
ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, FALSE, uid);
- }
+
SAFE_FREE(file_name);
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)) {
/*update item*/
- if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) {
+ if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO))
ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid);
- } else {
+ else
ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid);
- }
+
SAFE_FREE(file_name);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
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)) {
-
/*update item*/
- if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) {
+ if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO))
ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid);
- } else {
+ else
ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid);
- }
+
SAFE_FREE(file_name);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
media_svc_debug_fenter();
- 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(MEDIA_SVC_QUERY_SET_ITEM_VALIDITY, uid);
- }
g_media_svc_item_validity_data_cnt = 1;
g_media_svc_item_validity_cur_data_cnt = 0;
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.");
- }
-// }
+/* } */
}
SAFE_FREE(default_thumbnail_path);
/*Set media info*/
ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, &media_type, TRUE);
- if (ret != MS_MEDIA_ERR_NONE) {
+ if (ret != MS_MEDIA_ERR_NONE)
return ret;
- }
/* Initialize thumbnail information to remake thumbnail. */
if (ini_val == 1) {
if (g_file_test(thumb_path, G_FILE_TEST_EXISTS) && (STRING_VALID(MEDIA_SVC_THUMB_DEFAULT_PATH)) && (strncmp(thumb_path, MEDIA_SVC_THUMB_DEFAULT_PATH, strlen(MEDIA_SVC_THUMB_DEFAULT_PATH)) != 0)) {
ret = _media_svc_remove_file(thumb_path);
- if (ret != MS_MEDIA_ERR_NONE) {
+ if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("_media_svc_remove_file failed : %s", thumb_path);
- }
}
ret = _media_svc_update_thumbnail_path(storage_id, path, NULL, uid);
content_info.media_type = media_type;
if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_PVR)
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_UHD)
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) {
- /*Do nothing.*/
- } else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) {
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_PVR)
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_UHD)
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_SCSA))
+ media_svc_debug("Do nothing [%d]", media_type);
+ else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE)
ret = _media_svc_extract_image_metadata(db_handle, &content_info);
- } else {
+ else
ret = _media_svc_extract_media_metadata(db_handle, &content_info, uid);
- }
if (ret != MS_MEDIA_ERR_NONE) {
_media_svc_destroy_noti_item(noti_item);
int height = 0;
ret = _media_svc_request_thumbnail_with_origin_size(content_info.path, thumb_path, sizeof(thumb_path), &width, &height, uid);
- 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 (content_info.media_meta.width <= 0)
content_info.media_meta.width = width;
update_item_sql = sqlite3_mprintf("UPDATE media SET path='%q' WHERE media_uuid='%q'", replaced_path, media_uuid);
} else {
#if 0
- if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE || media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO) {
+ if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE || media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)
update_item_sql = sqlite3_mprintf("UPDATE media SET path='%q', thumbnail_path='%q' WHERE media_uuid='%q'", replaced_path, media_new_thumb_path, media_uuid);
- } else {
+ else
update_item_sql = sqlite3_mprintf("UPDATE media SET path='%q', thumbnail_path='%q' WHERE media_uuid='%q'", replaced_path, media_thumb_path, media_uuid);
- }
#else
update_item_sql = sqlite3_mprintf("UPDATE media SET path='%q', thumbnail_path='%q' WHERE media_uuid='%q'", replaced_path, media_new_thumb_path, media_uuid);
#endif
char *default_thumbnail_path = _media_svc_get_thumb_default_path(uid);
if ((!no_thumb) && (default_thumbnail_path != NULL) && (strncmp(media_thumb_path, default_thumbnail_path, strlen(default_thumbnail_path)) != 0)) {
ret = _media_svc_rename_file(media_thumb_path, media_new_thumb_path);
- if (ret != MS_MEDIA_ERR_NONE) {
+ if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("_media_svc_rename_file failed : %d", ret);
- }
}
SAFE_FREE(default_thumbnail_path);
ret = _media_svc_get_folder_info_by_foldername(db_handle, storage_id, folder_path, folder_uuid, &sto_time);
if (ret == MS_MEDIA_ERR_NONE) {
- if (sto_time != cur_time) {
+ if (sto_time != cur_time)
ret = _media_svc_update_folder_modified_time_by_folder_uuid(folder_uuid, folder_path, FALSE, uid);
- }
}
return ret;
media_svc_debug_fenter();
- 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(MEDIA_SVC_QUERY_UPDATE_ITEM, uid);
- }
g_media_svc_update_item_data_cnt = 1;
g_media_svc_update_item_cur_data_cnt = 0;
/*Set media info*/
ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, file_path, &media_type, FALSE);
- if (ret != MS_MEDIA_ERR_NONE) {
+ if (ret != MS_MEDIA_ERR_NONE)
return ret;
- }
- if (media_type == MEDIA_SVC_MEDIA_TYPE_MUSIC) {
+ if (media_type == MEDIA_SVC_MEDIA_TYPE_MUSIC)
ret = _media_svc_extract_music_metadata_for_update(db_handle, &content_info, media_type);
- } else {
+ else
return MS_MEDIA_ERR_NONE;
- }
if (ret != MS_MEDIA_ERR_NONE) {
_media_svc_destroy_content_info(&content_info);
}
}
- new_content_info->media_meta.is_360= content_info->media_meta.is_360;
- //new_content_info->media_meta.bitrate = content_info->media_meta.bitrate;
- //new_content_info->media_meta.samplerate = content_info->media_meta.samplerate;
- //new_content_info->media_meta.channel = content_info->media_meta.channel;
- //new_content_info->media_meta.orientation = content_info->media_meta.orientation;
+ new_content_info->media_meta.is_360 = content_info->media_meta.is_360;
+ /* new_content_info->media_meta.bitrate = content_info->media_meta.bitrate; */
+ /* new_content_info->media_meta.samplerate = content_info->media_meta.samplerate; */
+ /* 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)
new_content_info->media_meta.longitude = content_info->media_meta.longitude;
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "fail _media_svc_set_media_info");
if (content_info->storage_type != MEDIA_SVC_STORAGE_CLOUD) {
- if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER) {
- /*Do nothing.*/
- } else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) {
+ if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER)
+ media_svc_debug("Do nothing[%d]", media_type);
+ else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE)
ret = _media_svc_extract_image_metadata(db_handle, &_new_content_info);
- } else {
+ else
ret = _media_svc_extract_media_metadata(db_handle, &_new_content_info, uid);
- }
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
int height = 0;
ret = _media_svc_request_thumbnail_with_origin_size(_new_content_info.path, thumb_path, sizeof(thumb_path), &width, &height, uid);
- if (ret == MS_MEDIA_ERR_NONE) {
+ if (ret == MS_MEDIA_ERR_NONE)
ret = __media_svc_malloc_and_strncpy(&(_new_content_info.thumbnail_path), thumb_path);
- }
if (_new_content_info.media_meta.width <= 0)
_new_content_info.media_meta.width = width;
/* Insert to db - calling _media_svc_insert_item_with_data */
ret = _media_svc_insert_item_with_data(db_handle, _new_content_info.storage_uuid, &_new_content_info, FALSE, FALSE, uid);
- if (ret == MS_MEDIA_ERR_NONE) {
+ if (ret == MS_MEDIA_ERR_NONE)
media_svc_debug("Insertion is successful.");
- }
- if (ret == MS_MEDIA_ERR_DB_CONSTRAINT_FAIL) {
+ if (ret == MS_MEDIA_ERR_DB_CONSTRAINT_FAIL)
media_svc_error("This item is already inserted. This may be normal operation because other process already did this");
- }
_media_svc_destroy_content_info(&_new_content_info);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "remove storage failed : %d", ret);
ret = _media_svc_delete_folder_by_storage_id(storage_id, storage_type, uid);
- if (ret != MS_MEDIA_ERR_NONE) {
+ if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("fail to _media_svc_delete_folder_by_storage_id. error : [%d]", ret);
- }
if ((storage_type == MEDIA_SVC_STORAGE_EXTERNAL_USB) || (storage_type == MEDIA_SVC_STORAGE_CLOUD)) {
ret = _media_svc_drop_media_table(storage_id, uid);
media_svc_debug_fenter();
- 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(MEDIA_SVC_QUERY_INSERT_FOLDER, uid);
- }
g_media_svc_insert_folder_data_cnt = 1;
g_media_svc_insert_folder_cur_data_cnt = 0;
return ret;
}
- //media_svc_debug("total %d, cur %d insert flag %d", g_media_svc_insert_item_data_cnt, g_media_svc_insert_item_cur_data_cnt, g_insert_with_noti);
-
/*Set or Get folder id*/
ret = _media_svc_get_and_append_folder_id_by_path(db_handle, storage_id, path, storage_type, folder_uuid, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
char *sql;
char folder_uuid[MEDIA_SVC_UUID_SIZE+1] = {0,};
- if (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) {
+ if (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE)
ret = _media_svc_get_folder_id_by_foldername(handle, storage_id, extract_path, folder_uuid, uid);
- }
if (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE && ret == MS_MEDIA_ERR_NONE) {
media_svc_error("folder no recursive extract");
- if (is_burst == 1) {
+ if (is_burst == 1)
sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 AND title IS NULL and folder_uuid = '%q' ", storage_id, folder_uuid);
- } else {
+ else
sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 AND title IS NULL and folder_uuid = '%q' LIMIT %d", storage_id, folder_uuid, BATCH_REQUEST_MAX);
- }
} else if (scan_type == MS_MSG_DIRECTORY_SCANNING) {
media_svc_error("folder recursive extract");
- if (is_burst == 1) {
+ if (is_burst == 1)
sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 and title IS NULL and path LIKE '%q%%' ", storage_id, extract_path);
- } else {
+ else
sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 and title IS NULL and path LIKE '%q%%' LIMIT %d", storage_id, extract_path, BATCH_REQUEST_MAX);
- }
} else {
- if (is_burst == 1) {
+ if (is_burst == 1)
sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 and title IS NULL", storage_id);
- } else {
+ else
sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 and title IS NULL LIMIT %d", storage_id, BATCH_REQUEST_MAX);
- }
}
ret = _media_svc_sql_prepare_to_step_simple(handle, sql, &sql_stmt);
}
media_type = db_data->media_type;
- //media_svc_debug("path is %s, media type %d", db_data->path, media_type);
+ /* media_svc_debug("path is %s, media type %d", db_data->path, media_type); */
memset(&content_info, 0, sizeof(media_svc_content_info_s));
__media_svc_malloc_and_strncpy(&content_info.path, db_data->path);
_media_svc_set_default_value(&content_info, FALSE);
if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_PVR)
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_UHD)
- ||(media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) {
- /*Do nothing.*/
- } else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) {
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_PVR)
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_UHD)
+ || (media_type == MEDIA_SVC_MEDIA_TYPE_SCSA))
+ media_svc_debug("Do nothing[%d]", media_type);
+ else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE)
ret = _media_svc_extract_image_metadata(db_handle, &content_info);
- } else {
+ else
ret = _media_svc_extract_media_metadata(db_handle, &content_info, uid);
- }
ret = _media_svc_insert_item_pass2(storage_id, &content_info, is_burst, TRUE, uid);
while (db_data_array->len != 0) {
db_data = NULL;
db_data = g_array_index(db_data_array, media_svc_item_info_s*, 0);
- g_array_remove_index (db_data_array, 0);
+ g_array_remove_index(db_data_array, 0);
- if(db_data) {
+ if (db_data) {
SAFE_FREE(db_data->path);
free(db_data);
db_data = NULL;
system_time = _media_svc_get_file_time(path);
media_svc_error("modified_time = [%d], system_time = [%d], path = [%s]", modified_time, system_time, path);
- if (system_time != modified_time && system_time != 0) {
+ if (system_time != modified_time && system_time != 0)
*modified = TRUE;
- } else {
+ else
*modified = FALSE;
- }
return ret;
}
#include <sqlite3.h>
#include <glib.h>
-#define SQLITE3_FINALIZE(x) if (x != NULL) {sqlite3_finalize(x);}
-#define SQLITE3_SAFE_FREE(x) {if(x != NULL) {sqlite3_free(x);x = NULL;}}
+#define SQLITE3_FINALIZE(x) if (x != NULL) sqlite3_finalize(x);
+#define SQLITE3_SAFE_FREE(x) {if (x != NULL) {sqlite3_free(x); x = NULL; } }
int _media_svc_make_table_query(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);
} while (0)
#define media_svc_retvm_if(expr, val, fmt, arg...) do { \
if (expr) { \
- LOGE(FONT_COLOR_RED" "fmt"", ##arg); \
+ LOGE(FONT_COLOR_RED" "fmt"", ##arg); \
return (val); \
} \
} while (0)
} while (0)
#define media_svc_sec_warn(fmt, arg...) do { \
- SECURE_LOGW(FONT_COLOR_GREEN" "fmt"", ##arg); \
+ SECURE_LOGW(FONT_COLOR_GREEN" "fmt"", ##arg); \
} while (0)
#define media_svct_sec_error(fmt, arg...) do { \
void mediainfo_init_file_debug();
void mediainfo_close_file_debug();
FILE* get_fp();
-#define mediainfo_file_dbg(fmt,arg...) fprintf( get_fp(), "[%s: %d] [%s]" fmt "\n", __FILE__, __LINE__, __FUNCTION__, ##arg)
+#define mediainfo_file_dbg(fmt, arg...) fprintf(get_fp(), "[%s: %d] [%s]" fmt "\n", __FILE__, __LINE__, __FUNCTION__, ##arg)
#endif
#define MEDIA_SVC_TAG_UNKNOWN "Unknown"
#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_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"
+#define THUMB_EXT "jpg"
enum Exif_Orientation {
NOT_AVAILABLE = 0,
} media_svc_query_type_e;
typedef enum {
- MEDIA_SVC_DB_LIST_MEDIA = 0,
+ MEDIA_SVC_DB_LIST_MEDIA = 0,
MEDIA_SVC_DB_LIST_FOLDER,
MEDIA_SVC_DB_LIST_PLAYLIST_MAP,
MEDIA_SVC_DB_LIST_PLAYLIST,
int _media_svc_collation_str(const char *src, char **dest);
-#endif /* __MEDIA_SVC_LOCALIZE_UTILS_H__ */
\ No newline at end of file
+#endif /* __MEDIA_SVC_LOCALIZE_UTILS_H__ */
bool _media_svc_has_chinese(const char *src);
-#endif /* __MEDIA_SERVICE_LOCALIZE_CH_H__ */
\ No newline at end of file
+#endif /* __MEDIA_SERVICE_LOCALIZE_CH_H__ */
bool _media_svc_bpmf_is_bpmf(const char *src);
char _media_svc_bpmf_get_fuzzy_number(const char *src);
-#endif /*__MEDIA_SERVICE_LOCALIZE_TW_H__ */
\ No newline at end of file
+#endif /*__MEDIA_SERVICE_LOCALIZE_TW_H__ */
#define TRUE 1
#endif
-#define SAFE_FREE(src) { if (src) {free(src); src = NULL;}}
-#define G_SAFE_FREE(src) { if (src) {g_free(src); src = NULL;}}
+#define SAFE_FREE(src) { if (src) {free(src); src = NULL; } }
+#define G_SAFE_FREE(src) { if (src) {g_free(src); src = NULL; } }
#define STRING_VALID(str) \
((str != NULL && strlen(str) > 0) ? TRUE : FALSE)