Add 'free_on_destroy' variables for memory release
[platform/core/multimedia/libmm-utility.git] / common / include / mm_util_type.h
index e7b0cad..714ff91 100755 (executable)
 #ifndef __MM_UTIL_TYPE_H__
 #define __MM_UTIL_TYPE_H__
 
+#include <stdbool.h>
+#include <stddef.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+typedef void *mm_util_image_h;
+
 /**
  * error type
  */
 typedef enum {
-       MM_UTIL_ERROR_NONE =              0,       /**< Successful */
-       MM_UTIL_ERROR_INVALID_PARAMETER = -1,      /**< Invalid parameter */
-       MM_UTIL_ERROR_OUT_OF_MEMORY = -2,          /**< Out of memory */
-       MM_UTIL_ERROR_NO_SUCH_FILE  = -3,                  /**< No such file */
-       MM_UTIL_ERROR_INVALID_OPERATION = -4,      /**< Internal error */
-       MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT = -5,   /**< Not supported format */
+       MM_UTIL_ERROR_NONE                 =  0, /**< Successful */
+       MM_UTIL_ERROR_INVALID_PARAMETER    = -1, /**< Invalid parameter */
+       MM_UTIL_ERROR_OUT_OF_MEMORY        = -2, /**< Out of memory */
+       MM_UTIL_ERROR_NO_SUCH_FILE         = -3, /**< No such file */
+       MM_UTIL_ERROR_INVALID_OPERATION    = -4, /**< Internal error */
+       MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT = -5, /**< Not supported format */
 } mm_util_error_e;
 
 /**
@@ -43,39 +48,71 @@ typedef enum {
  */
 typedef enum {
        /* YUV planar format */
-       MM_UTIL_COLOR_YUV420,                   /**< YUV420 format - planer YV12*/
-       MM_UTIL_COLOR_YUV422,                   /**< YUV422 format - planer */
-       MM_UTIL_COLOR_I420,                             /**< YUV420 format - planar */
-       MM_UTIL_COLOR_NV12,                             /**< NV12 format - planer */
+       MM_UTIL_COLOR_YUV420,     /**< YUV420 format - planer YV12*/
+       MM_UTIL_COLOR_YUV422,     /**< YUV422 format - planer */
+       MM_UTIL_COLOR_I420,       /**< YUV420 format - planar */
+       MM_UTIL_COLOR_NV12,       /**< NV12 format - planer */
 
        /* YUV packed format */
-       MM_UTIL_COLOR_UYVY,                             /**< UYVY format - YUV packed format */
-       MM_UTIL_COLOR_YUYV,                             /**< YUYV format - YUV packed format */
+       MM_UTIL_COLOR_UYVY,       /**< UYVY format - YUV packed format */
+       MM_UTIL_COLOR_YUYV,       /**< YUYV format - YUV packed format */
 
        /* RGB color */
-       MM_UTIL_COLOR_RGB16,            /**< RGB565 pixel format */
-       MM_UTIL_COLOR_RGB24,                    /**< RGB888 pixel format */
-       MM_UTIL_COLOR_ARGB,                             /**< ARGB8888 pixel format */
+       MM_UTIL_COLOR_RGB16,      /**< RGB565 pixel format */
+       MM_UTIL_COLOR_RGB24,      /**< RGB888 pixel format */
+       MM_UTIL_COLOR_ARGB,       /**< ARGB8888 pixel format */
 
-       MM_UTIL_COLOR_BGRA,                             /**< BGRA8888 pixel format */
-       MM_UTIL_COLOR_RGBA,                             /**< RGBA8888 pixel format */
-       MM_UTIL_COLOR_BGRX,                             /**< BGRX8888 pixel format */
+       MM_UTIL_COLOR_BGRA,       /**< BGRA8888 pixel format */
+       MM_UTIL_COLOR_RGBA,       /**< RGBA8888 pixel format */
+       MM_UTIL_COLOR_BGRX,       /**< BGRX8888 pixel format */
 
        /* non-standard format */
-       MM_UTIL_COLOR_NV12_TILED,               /**< Customized color format in s5pc110 */
-       MM_UTIL_COLOR_NV16,                             /**< NV16 pixel format */
-       MM_UTIL_COLOR_NV61,                             /**< NV61 pixel format */
-       MM_UTIL_COLOR_NV21,                     /**< NV21 format - planer */
+       MM_UTIL_COLOR_NV12_TILED, /**< Customized color format in s5pc110 */
+       MM_UTIL_COLOR_NV16,       /**< NV16 pixel format */
+       MM_UTIL_COLOR_NV61,       /**< NV61 pixel format */
+       MM_UTIL_COLOR_NV21,       /**< NV21 format - planer */
 
        /* GrayScale */
-       MM_UTIL_COLOR_GRAYSCALE,                /**< Grayscale pixel format */
-       MM_UTIL_COLOR_NUM,                              /**< Number of image formats */
+       MM_UTIL_COLOR_GRAYSCALE,  /**< Grayscale pixel format */
+       MM_UTIL_COLOR_NUM,        /**< Number of image formats */
 } mm_util_color_format_e;
 
+/**
+ * Image rotation types
+ */
+typedef enum {
+       MM_UTIL_ROTATE_0,         /**< Rotation 0 degree - no effect */
+       MM_UTIL_ROTATE_90,        /**< Rotation 90 degree */
+       MM_UTIL_ROTATE_180,       /**< Rotation 180 degree */
+       MM_UTIL_ROTATE_270,       /**< Rotation 270 degree */
+       MM_UTIL_ROTATE_FLIP_HORZ, /**< Flip horizontal */
+       MM_UTIL_ROTATE_FLIP_VERT, /**< Flip vertial */
+       MM_UTIL_ROTATE_NUM        /**< Number of rotation types */
+} mm_util_rotate_type_e;
+
+typedef enum {
+       IMG_CODEC_JPEG = 0,
+       IMG_CODEC_PNG,
+       IMG_CODEC_GIF,
+       IMG_CODEC_BMP,
+       IMG_CODEC_WEBP,
+       IMG_CODEC_HEIF,
+       IMG_CODEC_JPEGXL,
+       IMG_CODEC_WBMP, /* Note: used by only media-content */
+       IMG_CODEC_UNKNOWN_TYPE,
+} mm_util_img_codec_type;
+
+typedef enum {
+       ANIM_CODEC_GIF = 0,
+       ANIM_CODEC_WEBP,
+       ANIM_CODEC_UNKNOWN_TYPE,
+} mm_util_anim_codec_type;
+
 typedef struct {
        unsigned int width;
        unsigned int height;
        mm_util_color_format_e color;
+       bool free_on_destroy;
        void *data;
        size_t size;
        unsigned int delay_time;
@@ -85,4 +122,4 @@ typedef struct {
 }
 #endif
 
-#endif   /*__MM_UTIL_TYPE_H__*/
+#endif /*__MM_UTIL_TYPE_H__*/