#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;
}