Add 'free_on_destroy' variables for memory release
[platform/core/multimedia/libmm-utility.git] / common / include / mm_util_type.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_TYPE_H__
23 #define __MM_UTIL_TYPE_H__
24
25 #include <stdbool.h>
26 #include <stddef.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 typedef void *mm_util_image_h;
33
34 /**
35  * error type
36  */
37 typedef enum {
38         MM_UTIL_ERROR_NONE                 =  0, /**< Successful */
39         MM_UTIL_ERROR_INVALID_PARAMETER    = -1, /**< Invalid parameter */
40         MM_UTIL_ERROR_OUT_OF_MEMORY        = -2, /**< Out of memory */
41         MM_UTIL_ERROR_NO_SUCH_FILE         = -3, /**< No such file */
42         MM_UTIL_ERROR_INVALID_OPERATION    = -4, /**< Internal error */
43         MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT = -5, /**< Not supported format */
44 } mm_util_error_e;
45
46 /**
47  * color formats
48  */
49 typedef enum {
50         /* YUV planar format */
51         MM_UTIL_COLOR_YUV420,     /**< YUV420 format - planer YV12*/
52         MM_UTIL_COLOR_YUV422,     /**< YUV422 format - planer */
53         MM_UTIL_COLOR_I420,       /**< YUV420 format - planar */
54         MM_UTIL_COLOR_NV12,       /**< NV12 format - planer */
55
56         /* YUV packed format */
57         MM_UTIL_COLOR_UYVY,       /**< UYVY format - YUV packed format */
58         MM_UTIL_COLOR_YUYV,       /**< YUYV format - YUV packed format */
59
60         /* RGB color */
61         MM_UTIL_COLOR_RGB16,      /**< RGB565 pixel format */
62         MM_UTIL_COLOR_RGB24,      /**< RGB888 pixel format */
63         MM_UTIL_COLOR_ARGB,       /**< ARGB8888 pixel format */
64
65         MM_UTIL_COLOR_BGRA,       /**< BGRA8888 pixel format */
66         MM_UTIL_COLOR_RGBA,       /**< RGBA8888 pixel format */
67         MM_UTIL_COLOR_BGRX,       /**< BGRX8888 pixel format */
68
69         /* non-standard format */
70         MM_UTIL_COLOR_NV12_TILED, /**< Customized color format in s5pc110 */
71         MM_UTIL_COLOR_NV16,       /**< NV16 pixel format */
72         MM_UTIL_COLOR_NV61,       /**< NV61 pixel format */
73         MM_UTIL_COLOR_NV21,       /**< NV21 format - planer */
74
75         /* GrayScale */
76         MM_UTIL_COLOR_GRAYSCALE,  /**< Grayscale pixel format */
77         MM_UTIL_COLOR_NUM,        /**< Number of image formats */
78 } mm_util_color_format_e;
79
80 /**
81  * Image rotation types
82  */
83 typedef enum {
84         MM_UTIL_ROTATE_0,         /**< Rotation 0 degree - no effect */
85         MM_UTIL_ROTATE_90,        /**< Rotation 90 degree */
86         MM_UTIL_ROTATE_180,       /**< Rotation 180 degree */
87         MM_UTIL_ROTATE_270,       /**< Rotation 270 degree */
88         MM_UTIL_ROTATE_FLIP_HORZ, /**< Flip horizontal */
89         MM_UTIL_ROTATE_FLIP_VERT, /**< Flip vertial */
90         MM_UTIL_ROTATE_NUM        /**< Number of rotation types */
91 } mm_util_rotate_type_e;
92
93 typedef enum {
94         IMG_CODEC_JPEG = 0,
95         IMG_CODEC_PNG,
96         IMG_CODEC_GIF,
97         IMG_CODEC_BMP,
98         IMG_CODEC_WEBP,
99         IMG_CODEC_HEIF,
100         IMG_CODEC_JPEGXL,
101         IMG_CODEC_WBMP, /* Note: used by only media-content */
102         IMG_CODEC_UNKNOWN_TYPE,
103 } mm_util_img_codec_type;
104
105 typedef enum {
106         ANIM_CODEC_GIF = 0,
107         ANIM_CODEC_WEBP,
108         ANIM_CODEC_UNKNOWN_TYPE,
109 } mm_util_anim_codec_type;
110
111 typedef struct {
112         unsigned int width;
113         unsigned int height;
114         mm_util_color_format_e color;
115         bool free_on_destroy;
116         void *data;
117         size_t size;
118         unsigned int delay_time;
119 } mm_image_info_s;
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif /*__MM_UTIL_TYPE_H__*/