4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
22 #ifndef _MEDIA_SVC_UTIL_H_
23 #define _MEDIA_SVC_UTIL_H_
27 #include <sys/types.h>
31 #include <media-util-err.h>
37 #define STRING_VALID(str) (str && strlen(str) > 0)
40 * Media meta data information
43 char *title; /**< track title*/
44 char *album; /**< album name*/
45 char *artist; /**< artist name*/
46 char *album_artist; /**< artist name*/
47 char *genre; /**< genre of track*/
48 char *year; /**< year*/
49 char *track_num; /**< track number*/
50 unsigned int width; /**< width*/
51 unsigned int height; /**< height*/
52 char *datetaken; /**< datetaken*/
53 unsigned short orientation; /**< orientation*/
54 } media_svc_content_meta_s;
57 * Media data information
60 char *media_uuid; /**< Unique ID of item */
61 char *path; /**< Full path of media file */
62 char *file_name; /**< File name of media file. Display name */
63 int media_type; /**< Type of media file : internal/external */
64 char *mime_type; /**< Full path and file name of media file */
65 unsigned long long size; /**< size */
66 time_t modified_time; /**< modified time, time_t */
67 long long int folder_id; /**< Unique ID of folder */
68 int album_id; /**< Unique ID of album */
69 char *thumbnail_path; /**< Thumbnail image file path */
70 char *storage_uuid; /**< Unique ID of storage */
71 media_svc_content_meta_s media_meta; /**< meta data structure */
72 } media_svc_content_info_s;
75 * Type definition for content type
78 MEDIA_SVC_MEDIA_TYPE_IMAGE = 0, /**< Image Content*/
79 MEDIA_SVC_MEDIA_TYPE_VIDEO = 1, /**< Video Content*/
80 MEDIA_SVC_MEDIA_TYPE_SOUND = 2, /**< Sound Content like Ringtone*/
81 MEDIA_SVC_MEDIA_TYPE_MUSIC = 3, /**< Music Content like mp3*/
82 MEDIA_SVC_MEDIA_TYPE_OTHER = 4, /**< Not media Content*/
83 MEDIA_SVC_MEDIA_TYPE_BOOK = 5, /**< Book Content like epub*/
84 } media_svc_media_type_e;
87 MEDIA_SVC_SEARCH_TYPE_DIRECT = 0,
88 MEDIA_SVC_SEARCH_TYPE_DB,
89 } media_svc_search_type_e;
91 void _media_svc_remove_file(const char *path);
92 int _media_svc_get_file_time(const char *full_path);
93 char * _media_svc_get_title_from_filename(const char *filename);
94 int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, const char *path, bool refresh);
95 int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info);
96 void _media_svc_extract_audio_metadata(sqlite3 *handle, bool is_direct, media_svc_content_info_s *content_info, uid_t uid);
97 void _media_svc_extract_video_metadata(media_svc_content_info_s *content_info);
98 int _media_svc_extract_book_metadata(media_svc_content_info_s *content_info);
99 void _media_svc_destroy_content_info(media_svc_content_info_s *content_info);
100 int _media_svc_create_thumbnail(const char *path, char *thumb_path, media_svc_media_type_e media_type, uid_t uid);
101 int _media_svc_get_media_type(const char *path, int *mediatype);
102 bool _media_svc_is_keyword_included(const char *path, const char *keyword);
103 void _media_svc_update_wordbook(const char *path, uid_t uid);
104 void _media_svc_clean_wordbook(uid_t uid);
105 bool _media_svc_get_matched_list(const char *keyword, uid_t uid, GList **list);
111 #endif /*_MEDIA_SVC_UTIL_H_*/