4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
24 #ifndef _MEDIA_SVC_UTIL_H_
25 #define _MEDIA_SVC_UTIL_H_
31 #include "media-svc-env.h"
44 #define SAFE_FREE(src) { if (src) {free(src); src = NULL; } }
45 #define G_SAFE_FREE(src) { if (src) {g_free(src); src = NULL; } }
46 #define STRING_VALID(str) \
47 ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
49 #define SAFE_STRLCAT(dst, src, n) g_strlcat(dst, src, n);
50 #define SAFE_STRLCPY(dst, src, n) g_strlcpy(dst, src, n);
53 * Media meta data information
56 char *title; /**< track title*/
57 char *album; /**< album name*/
58 char *artist; /**< artist name*/
59 char *album_artist; /**< artist name*/
60 char *genre; /**< genre of track*/
61 char *composer; /**< composer name*/
62 char *year; /**< year*/
63 char *recorded_date; /**< recorded date*/
64 char *copyright; /**< copyright*/
65 char *track_num; /**< track number*/
66 char *description; /**< description*/
67 int bitrate; /**< bitrate*/
68 int samplerate; /**< samplerate*/
69 int channel; /**< channel*/
70 int duration; /**< duration*/
71 float longitude; /**< longitude*/
72 float latitude; /**< latitude*/
73 float altitude; /**< altitude*/
74 char *exposure_time; /**< exposure_time*/
75 float fnumber; /**< fnumber*/
77 char *model; /**< model*/
78 int width; /**< width*/
79 int height; /**< height*/
80 char *datetaken; /**< datetaken*/
81 int orientation; /**< orientation*/
82 int rating; /**< user defined rating */
83 int bitpersample; /**< bitrate*/
85 char *file_name_pinyin; /**< pinyin for file_name*/
86 char *title_pinyin; /**< pinyin for title*/
87 char *album_pinyin; /**< pinyin for album*/
88 char *artist_pinyin; /**< pinyin for artist*/
89 char *album_artist_pinyin; /**< pinyin for album_artist*/
90 char *genre_pinyin; /**< pinyin for genre*/
91 char *composer_pinyin; /**< pinyin for composer*/
92 char *copyright_pinyin; /**< pinyin for copyright*/
93 char *description_pinyin; /**< pinyin for description*/
95 } media_svc_content_meta_s;
98 * Media data information
101 char *media_uuid; /**< Unique ID of item */
102 char *path; /**< Full path of media file */
103 char *file_name; /**< File name of media file. Display name */
104 char *file_name_pinyin; /**< File name pinyin of media file. Display name */
105 int media_type; /**< Type of media file : internal/external */
106 char *mime_type; /**< Full path and file name of media file */
107 unsigned long long size; /**< size */
108 time_t added_time; /**< added time, time_t */
109 time_t modified_time; /**< modified time, time_t */
110 time_t timeline; /**< timeline of media, time_t */
111 char *folder_uuid; /**< Unique ID of folder */
112 int album_id; /**< Unique ID of album */
113 char *thumbnail_path; /**< Thumbnail image file path */
114 time_t favourate; /**< time favourate set */
115 int is_drm; /**< is_drm. o or 1 */
116 int sync_status; /**< sync_status */
117 int storage_type; /**< Storage of media file : internal/external */
118 char *storage_uuid; /**< Unique ID of storage */
119 media_svc_content_meta_s media_meta; /**< meta data structure for audio files */
120 } media_svc_content_info_s;
123 * Type definition for content type
126 MEDIA_SVC_MEDIA_TYPE_IMAGE = 0, /**< Image Content*/
127 MEDIA_SVC_MEDIA_TYPE_VIDEO = 1, /**< Video Content*/
128 MEDIA_SVC_MEDIA_TYPE_SOUND = 2, /**< Sound Content like Ringtone*/
129 MEDIA_SVC_MEDIA_TYPE_MUSIC = 3, /**< Music Content like mp3*/
130 MEDIA_SVC_MEDIA_TYPE_OTHER = 4, /**< Not media Content*/
131 MEDIA_SVC_MEDIA_TYPE_PVR = 5, /**< PVR Content*/
132 MEDIA_SVC_MEDIA_TYPE_UHD = 6, /**< UHD Content*/
133 MEDIA_SVC_MEDIA_TYPE_SCSA = 7, /**< SCSA Content*/
134 } media_svc_media_type_e;
136 char *_media_info_generate_uuid(void);
137 int _media_svc_remove_file(const char *path);
138 int _media_svc_get_thumbnail_path(media_svc_media_type_e media_type, char *thumb_path, const char *pathname, const char *img_format, uid_t uid);
139 int _media_svc_get_file_time(const char *full_path);
140 int _media_svc_set_default_value(media_svc_content_info_s *content_info, bool refresh);
141 int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, bool refresh);
142 int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info);
143 int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc_content_info_s *content_info, uid_t uid);
144 time_t __media_svc_get_timeline_from_str(const char *timstr);
145 void _media_svc_destroy_content_info(media_svc_content_info_s *content_info);
146 int _media_svc_create_thumbnail(const char *path, char *thumb_path, media_svc_media_type_e media_type, uid_t uid);
147 int _media_svc_get_pinyin_str(const char *src_str, char **pinyin_str);
148 bool _media_svc_check_pinyin_support(void);
149 int _media_svc_extract_music_metadata_for_update(media_svc_content_info_s *content_info, media_svc_media_type_e media_type);
150 int _media_svc_get_media_type(const char *path, int *mediatype);
151 bool _media_svc_check_storage_type(ms_user_storage_type_e storage_type);
157 #endif /*_MEDIA_SVC_UTIL_H_*/