4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hyunjun Ko <zzoon.ko@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.
22 #include "media-util.h"
23 #include <tzplatform_config.h>
25 #ifndef _MEDIA_THUMB_UTIL_H_
26 #define _MEDIA_THUMB_UTIL_H_
28 #define SAFE_FREE(src) { if (src) {free(src); src = NULL; } }
29 #define THUMB_MALLOC(src, size) { if (size <= 0) {src = NULL; } \
30 else { src = malloc(size); if (src) memset(src, 0x0, size); } }
31 #define SAFE_STRLCPY(dst, src, n) g_strlcpy(dst, src, n);
34 MEDIA_THUMB_BGRA, /* BGRA, especially provided for evas users */
35 MEDIA_THUMB_RGB888, /* RGB888 */
38 #define THUMB_NONE_TYPE -1 /* None */
39 #define THUMB_IMAGE_TYPE 0 /* Image */
40 #define THUMB_VIDEO_TYPE 1 /* Video */
42 #define THUMB_PATH_PHONE MEDIA_ROOT_PATH_INTERNAL /**< File path prefix of files stored in phone */
43 #define THUMB_PATH_MMC MEDIA_ROOT_PATH_SDCARD /**< File path prefix of files stored in mmc card */
45 #define THUMB_PHONE_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/phone")
46 #define THUMB_MMC_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/mmc")
48 #define THUMB_DEFAULT_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/thumb_default.png")
51 THUMB_PHONE, /**< Stored only in phone */
52 THUMB_MMC /**< Stored only in MMC */
53 } media_thumb_store_type;
55 int _media_thumb_get_store_type_by_path(const char *full_path);
57 int _media_thumb_get_file_ext(const char *file_path, char *file_ext, int max_len);
59 int _media_thumb_get_file_type(const char *file_full_path);
61 char* _media_thumb_generate_hash_name(const char *file);
63 int _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path, size_t max_thumb_path, uid_t uid);
65 int _media_thumb_remove_file(const char *path);
67 #endif /*_MEDIA_THUMB_UTIL_H_*/