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-thumb-types.h"
23 #include "media-thumb-debug.h"
24 #include "media-util.h"
25 #include <tzplatform_config.h>
26 #include <gdk-pixbuf/gdk-pixbuf.h>
28 #ifndef _MEDIA_THUMB_UTIL_H_
29 #define _MEDIA_THUMB_UTIL_H_
31 #define SAFE_FREE(src) { if(src) {free(src); src = NULL;}}
33 #ifndef _USE_NEW_MEDIA_DB_
34 #define THUMB_NONE_TYPE 0x00000000 /* None */
35 #define THUMB_IMAGE_TYPE 0x00000001 /* Image */
36 #define THUMB_VIDEO_TYPE 0x00000002 /* Video */
38 #define THUMB_NONE_TYPE -1 /* None */
39 #define THUMB_IMAGE_TYPE 0 /* Image */
40 #define THUMB_VIDEO_TYPE 1 /* Video */
43 #define THUMB_PATH_PHONE MEDIA_ROOT_PATH_INTERNAL /**< File path prefix of files stored in phone */
44 #define THUMB_PATH_MMC MEDIA_ROOT_PATH_SDCARD /**< File path prefix of files stored in mmc card */
46 #define THUMB_PHONE_PATH tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb/phone")
47 #define THUMB_MMC_PATH tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb/mmc")
49 #define THUMB_DEFAULT_PATH tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb/thumb_default.png")
53 THUMB_PHONE, /**< Stored only in phone */
54 THUMB_MMC /**< Stored only in MMC */
55 } media_thumb_store_type;
57 int _media_thumb_get_length(media_thumb_type thumb_type);
59 int _media_thumb_get_store_type_by_path(const char *full_path);
61 int _media_thumb_get_file_ext(const char *file_path, char *file_ext, int max_len);
63 int _media_thumb_get_file_type(const char *file_full_path);
65 int _media_thumb_remove_file(const char *path);
67 char* _media_thumb_generate_hash_name(const char *file);
69 int _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path, size_t max_thumb_path, uid_t uid);
71 int _media_thumb_save_to_file_with_gdk(GdkPixbuf *data,
77 int _media_thumb_get_width(media_thumb_type thumb_type);
79 int _media_thumb_get_height(media_thumb_type thumb_type);
81 int _thumbnail_get_data(const char *origin_path,
82 media_thumb_type thumb_type,
83 media_thumb_format format,
93 int _thumbnail_get_raw_data(const char *origin_path,
94 media_thumb_format format,
101 #endif /*_MEDIA_THUMB_UTIL_H_*/