Move some APIs to test_internal.h
[platform/core/multimedia/libmm-utility.git] / common / include / mm_util_private.h
1 /*
2  * libmm-utility
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: YoungHun Kim <yh8004.kim@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21
22 #ifndef __MM_UTIL_PRIVATE_H__
23 #define __MM_UTIL_PRIVATE_H__
24
25 #include <stdio.h>
26 #include "mm_util_type.h"
27 #include "mm_util_debug.h"
28 #include "mm_util_image.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34
35 #define MMUTIL_STRING_VALID(str)         (str != NULL && strlen(str) > 0)
36
37 /* for alignment */
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))
44
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)
47
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 *);
56
57 typedef struct {
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;
66 } anim_enc_module_t;
67
68 typedef struct {
69         mm_util_img_codec_type codec;
70         unsigned int compression;
71         bool lossless;
72 } mm_util_enc_opt_t;
73
74 // for using fp like jpeg
75 int mm_util_safe_fopen(const char *path, const char *mode, FILE **fp);
76
77 // for others
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);
80
81 // for reading ini
82 int mm_util_ini_get_int(const char *category, const char *item, int default_value);
83
84 #ifdef __cplusplus
85 }
86 #endif
87
88 #endif    /*__MM_UTIL_PRIVATE_H__*/