Apply tizen coding rule
[platform/core/multimedia/libmedia-service.git] / src / include / common / media-svc-util.h
1 /*
2  * libmedia-service
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.kim@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21
22
23
24 #ifndef _MEDIA_SVC_UTIL_H_
25 #define _MEDIA_SVC_UTIL_H_
26
27 #include <string.h>
28 #include <stdbool.h>
29 #include <sqlite3.h>
30 #include <iniparser.h>
31 #include "media-svc-types.h"
32 #include "media-svc-env.h"
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #ifndef FALSE
39 #define FALSE   0
40 #endif
41 #ifndef TRUE
42 #define TRUE    1
43 #endif
44
45 #define SAFE_FREE(src)  { if (src) {free(src); src = NULL;}}
46 #define STRING_VALID(str)       \
47         ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
48
49 char *_media_info_generate_uuid(void);
50 void _strncpy_safe(char *x_dst, const char *x_src, int max_len);
51 int _media_svc_rename_file(const char *old_name, const char *new_name);
52 int _media_svc_remove_file(const char *path);
53 int _media_svc_remove_all_files_in_dir(const char *dir_path);
54 int _media_svc_get_thumbnail_path(media_svc_storage_type_e storage_type, char *thumb_path, const char *pathname, const char *img_format, uid_t uid);
55 int _media_svc_get_file_time(const char *full_path);
56 int _media_svc_set_default_value(media_svc_content_info_s *content_info, bool refresh);
57 int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, media_svc_storage_type_e storage_type,
58                 const char *path, media_svc_media_type_e *media_type, bool refresh);
59 int _media_svc_extract_image_metadata(sqlite3 *handle, media_svc_content_info_s *content_info);
60 int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s *content_info, uid_t uid);
61 int __media_svc_malloc_and_strncpy(char **dst, const char *src);
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_get_storage_type_by_path(const char *path, media_svc_storage_type_e *storage_type, uid_t uid);
65 char *_media_svc_replace_path(char *s, const char *olds, const char *news);
66 char *_media_svc_get_thumb_internal_path(uid_t uid);
67 char *_media_svc_get_thumb_external_path(uid_t uid);
68 bool _media_svc_is_drm_file(const char *path);
69 int _media_svc_request_thumbnail_with_origin_size(const char *path, char *thumb_path, int max_length, int *origin_width, int *origin_height, uid_t uid);
70 int _media_svc_get_pinyin_str(const char *src_str, char **pinyin_str);
71 bool _media_svc_check_pinyin_support(void);
72 int _media_svc_extract_music_metadata_for_update(sqlite3 *handle, media_svc_content_info_s *content_info, media_svc_media_type_e media_type);
73 int _media_svc_get_ini_value();
74 char *_media_svc_get_title_from_path(const char *path);
75 void _media_svc_print_stderror(void);
76
77
78 #ifdef __cplusplus
79 }
80 #endif
81
82 #endif /*_MEDIA_SVC_UTIL_H_*/