Remove unnecessary executable permissions
[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  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __MM_UTIL_PRIVATE_H__
21 #define __MM_UTIL_PRIVATE_H__
22
23 #include <stdio.h>
24 #include "mm_util_type.h"
25 #include "mm_util_debug.h"
26 #include "mm_util_image.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32
33 #define MMUTIL_STRING_VALID(str)         (str != NULL && strlen(str) > 0)
34
35 /* for alignment */
36 #define MM_UTIL_ROUND_UP_2(num) (((num)+1)&~1)
37 #define MM_UTIL_ROUND_UP_4(num) (((num)+3)&~3)
38 #define MM_UTIL_ROUND_UP_8(num) (((num)+7)&~7)
39 #define MM_UTIL_ROUND_DOWN_2(num) ((num)&(~1))
40 #define MM_UTIL_ROUND_DOWN_4(num) ((num)&(~3))
41 #define MM_UTIL_ROUND_DOWN_16(num) ((num)&(~15))
42
43 #define IS_VALID_COLOR(color)   ((color >= MM_UTIL_COLOR_YUV420) && (color < MM_UTIL_COLOR_NUM))
44 #define IS_VALID_IMAGE(image)   mm_image_is_valid_image(image)
45
46 typedef int (*ANIM_ENC_CREATE)(void *);
47 typedef int (*ANIM_ENC_SET_BG_COLOR)(void *, unsigned char, unsigned char, unsigned char, unsigned char);
48 typedef int (*ANIM_ENC_SET_LOOP_COUNT)(void *, unsigned int);
49 typedef int (*ANIM_ENC_SET_LOSSLESS)(void *, bool);
50 typedef int (*ANIM_ENC_ADD_IMAGE)(void *, mm_util_image_h);
51 typedef int (*ANIM_ENC_SAVE_TO_FILE)(void *, const char *);
52 typedef int (*ANIM_ENC_SAVE_TO_BUFFER)(void *, void **, size_t *);
53 typedef void (*ANIM_ENC_DESTROY)(void *);
54
55 typedef struct {
56         ANIM_ENC_CREATE                 create;
57         ANIM_ENC_SET_BG_COLOR   set_bgcolor;
58         ANIM_ENC_SET_LOOP_COUNT set_loop_count;
59         ANIM_ENC_SET_LOSSLESS   set_lossless;
60         ANIM_ENC_ADD_IMAGE              add_image;
61         ANIM_ENC_SAVE_TO_FILE   save_to_file;
62         ANIM_ENC_SAVE_TO_BUFFER save_to_buffer;
63         ANIM_ENC_DESTROY                destroy;
64 } anim_enc_module_t;
65
66 typedef struct {
67         mm_util_img_codec_type codec;
68         unsigned int compression;
69         bool lossless;
70 } mm_util_enc_opt_t;
71
72 // for using fp like jpeg
73 int mm_util_safe_fopen(const char *path, const char *mode, FILE **fp);
74
75 // for others
76 int mm_util_file_read(const char *path, void **data, size_t *size);
77 int mm_util_file_write(const char *path, void *data, size_t size);
78
79 // for reading ini
80 int mm_util_ini_get_int(const char *category, const char *item, int default_value);
81
82 #ifdef __cplusplus
83 }
84 #endif
85
86 #endif    /*__MM_UTIL_PRIVATE_H__*/