4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: YoungHun Kim <yh8004.kim@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 #ifndef __MM_UTIL_PRIVATE_H__
23 #define __MM_UTIL_PRIVATE_H__
26 #include "mm_util_type.h"
27 #include "mm_util_debug.h"
28 #include "mm_util_image.h"
35 #define MMUTIL_STRING_VALID(str) (str != NULL && strlen(str) > 0)
38 #define MM_UTIL_ROUND_UP_2(num) (((num)+1)&~1)
39 #define MM_UTIL_ROUND_UP_4(num) (((num)+3)&~3)
40 #define MM_UTIL_ROUND_UP_8(num) (((num)+7)&~7)
41 #define MM_UTIL_ROUND_DOWN_2(num) ((num)&(~1))
42 #define MM_UTIL_ROUND_DOWN_4(num) ((num)&(~3))
43 #define MM_UTIL_ROUND_DOWN_16(num) ((num)&(~15))
45 #define IS_VALID_COLOR(color) ((color >= MM_UTIL_COLOR_YUV420) && (color < MM_UTIL_COLOR_NUM))
46 #define IS_VALID_IMAGE(image) mm_image_is_valid_image(image)
48 typedef int (*ANIM_ENC_CREATE)(void *);
49 typedef int (*ANIM_ENC_SET_BG_COLOR)(void *, unsigned char, unsigned char, unsigned char, unsigned char);
50 typedef int (*ANIM_ENC_SET_LOOP_COUNT)(void *, unsigned int);
51 typedef int (*ANIM_ENC_SET_LOSSLESS)(void *, bool);
52 typedef int (*ANIM_ENC_ADD_IMAGE)(void *, mm_util_image_h);
53 typedef int (*ANIM_ENC_SAVE_TO_FILE)(void *, const char *);
54 typedef int (*ANIM_ENC_SAVE_TO_BUFFER)(void *, void **, size_t *);
55 typedef void (*ANIM_ENC_DESTROY)(void *);
58 ANIM_ENC_CREATE create;
59 ANIM_ENC_SET_BG_COLOR set_bgcolor;
60 ANIM_ENC_SET_LOOP_COUNT set_loop_count;
61 ANIM_ENC_SET_LOSSLESS set_lossless;
62 ANIM_ENC_ADD_IMAGE add_image;
63 ANIM_ENC_SAVE_TO_FILE save_to_file;
64 ANIM_ENC_SAVE_TO_BUFFER save_to_buffer;
65 ANIM_ENC_DESTROY destroy;
69 mm_util_img_codec_type codec;
70 unsigned int compression;
74 // for using fp like jpeg
75 int mm_util_safe_fopen(const char *path, const char *mode, FILE **fp);
78 int mm_util_file_read(const char *path, void **data, size_t *size);
79 int mm_util_file_write(const char *path, void *data, size_t size);
82 int mm_util_ini_get_int(const char *category, const char *item, int default_value);
88 #endif /*__MM_UTIL_PRIVATE_H__*/