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"
37 #define SAFE_FREE(src) { if (src) {free(src); src = NULL; } }
38 #define STRING_VALID(str) \
39 ((str != NULL && strlen(str) > 0) ? true : false)
41 #define SAFE_STRLCAT(dst, src, n) g_strlcat(dst, src, n);
42 #define SAFE_STRLCPY(dst, src, n) g_strlcpy(dst, src, n);
45 * Media meta data information
48 char *title; /**< track title*/
49 char *album; /**< album name*/
50 char *artist; /**< artist name*/
51 char *album_artist; /**< artist name*/
52 char *genre; /**< genre of track*/
53 char *composer; /**< composer name*/
54 char *year; /**< year*/
55 char *recorded_date; /**< recorded date*/
56 char *copyright; /**< copyright*/
57 char *track_num; /**< track number*/
58 char *description; /**< description*/
59 int bitrate; /**< bitrate*/
60 int samplerate; /**< samplerate*/
61 int channel; /**< channel*/
62 int duration; /**< duration*/
63 float longitude; /**< longitude*/
64 float latitude; /**< latitude*/
65 float altitude; /**< altitude*/
66 char *exposure_time; /**< exposure_time*/
67 float fnumber; /**< fnumber*/
69 char *model; /**< model*/
70 int width; /**< width*/
71 int height; /**< height*/
72 char *datetaken; /**< datetaken*/
73 int orientation; /**< orientation*/
74 int rating; /**< user defined rating */
75 int bitpersample; /**< bitrate*/
77 char *file_name_pinyin; /**< pinyin for file_name*/
78 char *title_pinyin; /**< pinyin for title*/
79 char *album_pinyin; /**< pinyin for album*/
80 char *artist_pinyin; /**< pinyin for artist*/
81 char *album_artist_pinyin; /**< pinyin for album_artist*/
82 char *genre_pinyin; /**< pinyin for genre*/
83 char *composer_pinyin; /**< pinyin for composer*/
84 char *copyright_pinyin; /**< pinyin for copyright*/
85 char *description_pinyin; /**< pinyin for description*/
87 } media_svc_content_meta_s;
90 * Media data information
93 char *media_uuid; /**< Unique ID of item */
94 char *path; /**< Full path of media file */
95 char *file_name; /**< File name of media file. Display name */
96 char *file_name_pinyin; /**< File name pinyin of media file. Display name */
97 int media_type; /**< Type of media file : internal/external */
98 char *mime_type; /**< Full path and file name of media file */
99 unsigned long long size; /**< size */
100 time_t added_time; /**< added time, time_t */
101 time_t modified_time; /**< modified time, time_t */
102 time_t timeline; /**< timeline of media, time_t */
103 char *folder_uuid; /**< Unique ID of folder */
104 int album_id; /**< Unique ID of album */
105 char *thumbnail_path; /**< Thumbnail image file path */
106 time_t favourate; /**< time favourate set */
107 int is_drm; /**< is_drm. o or 1 */
108 int sync_status; /**< sync_status */
109 int storage_type; /**< Storage of media file : internal/external */
110 char *storage_uuid; /**< Unique ID of storage */
111 media_svc_content_meta_s media_meta; /**< meta data structure for audio files */
112 } media_svc_content_info_s;
115 * Type definition for content type
118 MEDIA_SVC_MEDIA_TYPE_IMAGE = 0, /**< Image Content*/
119 MEDIA_SVC_MEDIA_TYPE_VIDEO = 1, /**< Video Content*/
120 MEDIA_SVC_MEDIA_TYPE_SOUND = 2, /**< Sound Content like Ringtone*/
121 MEDIA_SVC_MEDIA_TYPE_MUSIC = 3, /**< Music Content like mp3*/
122 MEDIA_SVC_MEDIA_TYPE_OTHER = 4, /**< Not media Content*/
123 MEDIA_SVC_MEDIA_TYPE_PVR = 5, /**< PVR Content*/
124 MEDIA_SVC_MEDIA_TYPE_UHD = 6, /**< UHD Content*/
125 MEDIA_SVC_MEDIA_TYPE_SCSA = 7, /**< SCSA Content*/
126 } media_svc_media_type_e;
128 char *_media_info_generate_uuid(void);
129 int _media_svc_remove_file(const char *path);
130 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);
131 int _media_svc_get_file_time(const char *full_path);
132 int _media_svc_set_default_value(media_svc_content_info_s *content_info, bool refresh);
133 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);
134 int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info);
135 int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc_content_info_s *content_info, uid_t uid);
136 time_t __media_svc_get_timeline_from_str(const char *timstr);
137 void _media_svc_destroy_content_info(media_svc_content_info_s *content_info);
138 int _media_svc_create_thumbnail(const char *path, char *thumb_path, media_svc_media_type_e media_type, uid_t uid);
139 int _media_svc_get_pinyin_str(const char *src_str, char **pinyin_str);
140 bool _media_svc_check_pinyin_support(void);
141 int _media_svc_extract_music_metadata_for_update(media_svc_content_info_s *content_info, media_svc_media_type_e media_type);
142 int _media_svc_get_media_type(const char *path, int *mediatype);
143 bool _media_svc_is_valid_storage_type(ms_user_storage_type_e storage_type);
149 #endif /*_MEDIA_SVC_UTIL_H_*/