Merge branch 'tizen_3.0' into tizen
[platform/core/api/image-util.git] / include / image_util_private.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __TIZEN_MEDIA_IMAGE_UTIL_PRIVATE_H__
18 #define __TIZEN_MEDIA_IMAGE_UTIL_PRIVATE_H__
19
20 #include <image_util_type.h>
21 #include <dlog.h>
22 #include <stdlib.h>
23 #include <glib.h>
24 #include <gmodule.h>
25
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30
31 #ifdef LOG_TAG
32 #undef LOG_TAG
33 #endif
34
35 #define LOG_TAG "CAPI_MEDIA_IMAGE_UTIL"
36
37 #define FONT_COLOR_RESET    "\033[0m"
38 #define FONT_COLOR_RED      "\033[31m"
39
40 #define image_util_debug(fmt, arg...) do { \
41                 LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg);     \
42         } while (0)
43
44 #define image_util_error(fmt, arg...) do { \
45                 LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg);     \
46         } while (0)
47
48 #define image_util_warning(fmt, arg...) do { \
49                 LOGW(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg);     \
50         } while (0)
51
52 #define image_util_retm_if(expr, fmt, arg...) do { \
53                 if (expr) { \
54                         LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg);     \
55                         return; \
56                 } \
57         } while (0)
58
59 #define image_util_retvm_if(expr, val, fmt, arg...) do { \
60                 if (expr) { \
61                         LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg);     \
62                         return (val); \
63                 } \
64         } while (0)
65
66 #define DEPRECATION_LOGW(deprecated, instead) do { \
67                 image_util_warning("DEPRECATION WARNING: %s is deprecated and will be removed from next release. Use %s instead.", deprecated, instead);     \
68         } while (0)
69
70 #define IMGCV_FUNC_NAME "mm_util_cv_extract_representative_color"
71 #define PATH_MMUTIL_IMGCV_LIB PATH_LIBDIR"/libmmutil_imgcv.so"
72 typedef gboolean(*ModuleFunc)(void *, int, int, unsigned char *, unsigned char *, unsigned char *);
73
74 typedef struct {
75         void *user_data;
76         media_packet_h dst;
77         image_util_transform_completed_cb image_processing_completed_cb;
78 } image_util_cb_s;
79
80 typedef struct {
81         media_packet_h src;
82         media_packet_h dst;
83         image_util_colorspace_e colorspace;
84         image_util_rotation_e dest_rotation;
85         bool hardware_acceleration;
86         mm_util_imgp_h image_h;
87         image_util_cb_s *_util_cb;
88         unsigned int width;
89         unsigned int height;
90         image_util_rotation_e rotation;
91         unsigned int start_x;
92         unsigned int start_y;
93         unsigned int end_x;
94         unsigned int end_y;
95         bool set_convert;
96         bool set_resize;
97         bool set_rotate;
98         bool set_crop;
99 } transformation_s;
100
101 typedef struct {
102         void *user_data;
103         image_util_decode_completed_cb image_decode_completed_cb;
104 } decode_cb_s;
105
106 typedef struct {
107         void *user_data;
108         image_util_encode_completed_cb image_encode_completed_cb;
109 } encode_cb_s;
110
111 typedef struct {
112         image_util_type_e image_type;
113         void **src_buffer;
114         unsigned long long src_size;
115         void **dst_buffer;
116         unsigned long long dst_size;
117         const char *path;
118         mm_util_imgp_h image_h;
119         unsigned long width;
120         unsigned long height;
121         bool is_decode;
122         int quality;
123         unsigned int image_count;
124         unsigned int current_buffer_count;
125         unsigned int current_resolution_count;
126         unsigned int current_delay_count;
127         image_util_colorspace_e colorspace;
128         image_util_scale_e down_scale;
129         decode_cb_s *_decode_cb;
130         encode_cb_s *_encode_cb;
131
132         /* for async */
133         GThread *thread;
134         GAsyncQueue *async_queue;
135 } decode_encode_s;
136
137 /**
138 * @}
139 */
140
141 #ifdef __cplusplus
142 }
143 #endif
144
145 #endif /* __TIZEN_MEDIA_IMAGE_UTIL_PRIVATE_H__ */