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); } }
33 MEDIA_THUMB_BGRA, /* BGRA, especially provided for evas users */
34 MEDIA_THUMB_RGB888, /* RGB888 */
37 #define THUMB_NONE_TYPE -1 /* None */
38 #define THUMB_IMAGE_TYPE 0 /* Image */
39 #define THUMB_VIDEO_TYPE 1 /* Video */
41 #define THUMB_PATH_PHONE MEDIA_ROOT_PATH_INTERNAL /**< File path prefix of files stored in phone */
42 #define THUMB_PATH_MMC MEDIA_ROOT_PATH_SDCARD /**< File path prefix of files stored in mmc card */
44 #define THUMB_PHONE_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/phone")
45 #define THUMB_MMC_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/mmc")
47 #define THUMB_DEFAULT_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/thumb_default.png")
50 THUMB_PHONE, /**< Stored only in phone */
51 THUMB_MMC /**< Stored only in MMC */
52 } media_thumb_store_type;
54 int _media_thumb_get_store_type_by_path(const char *full_path);
56 int _media_thumb_get_file_ext(const char *file_path, char *file_ext, int max_len);
58 int _media_thumb_get_file_type(const char *file_full_path);
60 char* _media_thumb_generate_hash_name(const char *file);
62 int _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path, size_t max_thumb_path, uid_t uid);
64 int _media_thumb_remove_file(const char *path);
66 #endif /*_MEDIA_THUMB_UTIL_H_*/