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_
30 #include "media-svc-types.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);
52 char *_media_info_generate_uuid(void);
53 int _media_svc_rename_file(const char *old_name, const char *new_name);
54 int _media_svc_remove_file(const char *path);
55 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);
56 int _media_svc_get_file_time(const char *full_path);
57 int _media_svc_set_default_value(media_svc_content_info_s *content_info, bool refresh);
58 int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, media_svc_storage_type_e storage_type,
59 const char *path, media_svc_media_type_e *media_type, bool refresh);
60 int _media_svc_extract_image_metadata(sqlite3 *handle, media_svc_content_info_s *content_info);
61 int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s *content_info, uid_t uid);
62 time_t __media_svc_get_timeline_from_str(const char *timstr);
63 void _media_svc_destroy_content_info(media_svc_content_info_s *content_info);
64 int _media_svc_create_thumbnail(const char *path, char *thumb_path, int max_length, media_svc_media_type_e media_type, uid_t uid);
65 int _media_svc_get_pinyin_str(const char *src_str, char **pinyin_str);
66 bool _media_svc_check_pinyin_support(void);
67 int _media_svc_extract_music_metadata_for_update(sqlite3 *handle, media_svc_content_info_s *content_info, media_svc_media_type_e media_type);
68 int _media_svc_get_media_type(const char *path, int *mediatype);
74 #endif /*_MEDIA_SVC_UTIL_H_*/