Define mm_util_imgp_h to replace MMHandle in mm-common 67/54567/2
authorHaejeong Kim <backto.kim@samsung.com>
Wed, 16 Dec 2015 07:28:06 +0000 (16:28 +0900)
committerHaejeong Kim <backto.kim@samsung.com>
Wed, 16 Dec 2015 07:30:41 +0000 (16:30 +0900)
Change-Id: Ic5f384c2c3bdf936b9d9634910f4893d900a6341

imgp/include/mm_util_imgp.h
imgp/mm_util_imgp.c
imgp/test/mm_util_imgp_testsuite.c
packaging/libmm-utility.spec

index 5e3558e..d303b46 100755 (executable)
 extern "C" {
 #endif
 
-#include <mm_types.h>
 #include <media_packet.h>
 
+typedef void *mm_util_imgp_h;
+
 typedef bool (*mm_util_completed_callback)(media_packet_h *dst, int error, void *user_param);
 /**
     @addtogroup UTILITY
@@ -109,57 +110,50 @@ typedef enum
  * @see         mm_util_img_format
  * @since       R1, 1.0
  */
-int
-mm_util_get_image_size(mm_util_img_format format, unsigned int width, unsigned int height, unsigned int *size);
-
+int mm_util_get_image_size(mm_util_img_format format, unsigned int width, unsigned int height, unsigned int *size);
 
 /**
  *
  * @remark     Transform Handle Creation
  *
- * @param      MMHandle                [in]                    MMHandleType pointer
-
+ * @param      imgp_handle             [in]                    image_util_imgp_h
  * @return     This function returns transform processor result value
  *             if the result is 0, then handle creation succeed
  *             else if the result is -1, then handle creation failed
  */
-int
-mm_util_create(MMHandleType* MMHandle);
+int mm_util_create(mm_util_imgp_h *imgp_handle);
 
 /**
  *
  * @remark     Transform Handle Creation
  *
- * @param      MMHandle                [in]                    MMHandleType pointer
+ * @param      imgp_handle             [in]                    image_util_imgp_h
  * @param      mode                    [in]                    User can use the accelerated image processing
 
  * @return     This function returns transform processor result value
  *             if the result is 0, then handle creation succeed
  *             else if the result is -1, then handle creation failed
  */
-int
-mm_util_set_hardware_acceleration(MMHandleType MMHandle, bool mode);
-
+int mm_util_set_hardware_acceleration(mm_util_imgp_h imgp_handle, bool mode);
 
 /**
  *
  * @remark     Transform Handle Creation
  *
- * @param      MMHandle                [in]            MMHandleType pointer
+ * @param      imgp_handle             [in]                    image_util_imgp_h
  * @param      colorspace      [in]                    colorspace The colorspace of the destination image buffer
 
  * @return     This function returns transform processor result value
  *             if the result is 0, then handle creation succeed
  *             else if the result is -1, then handle creation failed
  */
-int
-mm_util_set_colorspace_convert(MMHandleType MMHandle, mm_util_img_format colorspace);
+int mm_util_set_colorspace_convert(mm_util_imgp_h imgp_handle, mm_util_img_format colorspace);
 
 /**
  *
  * @remark     Transform Handle Creation
  *
- * @param      MMHandle                [in]            MMHandleType pointer
+ * @param      imgp_handle             [in]                    image_util_imgp_h
  * @param      width           [in]                    width The width of destination image buffer
  * @param      height          [in]                    height The height of destination image buffer
 
@@ -167,28 +161,26 @@ mm_util_set_colorspace_convert(MMHandleType MMHandle, mm_util_img_format colorsp
  *             if the result is 0, then handle creation succeed
  *             else if the result is -1, then handle creation failed
  */
-int
-mm_util_set_resolution(MMHandleType MMHandle, unsigned int width, unsigned int height);
+int mm_util_set_resolution(mm_util_imgp_h imgp_handle, unsigned int width, unsigned int height);
 
 /**
  *
  * @remark     Transform Handle Creation
  *
- * @param      MMHandle                [in]                    MMHandleType pointer
+ * @param      imgp_handle             [in]                    image_util_imgp_h
  * @param      rotation                [in]                    dest_rotation The rotation value of destination image buffer
 
  * @return     This function returns transform processor result value
  *             if the result is 0, then handle creation succeed
  *             else if the result is -1, then handle creation failed
  */
-int
-mm_util_set_rotation(MMHandleType MMHandle, mm_util_img_rotate_type rotation);
+int mm_util_set_rotation(mm_util_imgp_h imgp_handle, mm_util_img_rotate_type rotation);
 
 /**
  *
  * @remark     Transform Handle Creation
  *
- * @param      MMHandle                [in]                    MMHandleType pointer
+ * @param      imgp_handle             [in]                    image_util_imgp_h
  * @param      start_x                 [in]                    The start x position of cropped image buffer
  * @param      start_y                 [in]                    The start y position of cropped image buffer
  * @param      end_x                   [in]                    The start x position of cropped image buffer
@@ -198,14 +190,13 @@ mm_util_set_rotation(MMHandleType MMHandle, mm_util_img_rotate_type rotation);
  *             if the result is 0, then handle creation succeed
  *             else if the result is -1, then handle creation failed
  */
-int
-mm_util_set_crop_area(MMHandleType MMHandle, unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y);
+int mm_util_set_crop_area(mm_util_imgp_h imgp_handle, unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y);
 
 /**
  *
  * @remark     Transform Handle Creation
  *
- * @param      MMHandle                [in]                    MMHandleType pointer
+ * @param      imgp_handle             [in]                    image_util_imgp_h
  * @param      is_completed            [in/out]                Users can obtain the value of the conversion about whether to complete
 
  * @return     This function returns transform processor result value
@@ -213,14 +204,13 @@ mm_util_set_crop_area(MMHandleType MMHandle, unsigned int start_x, unsigned int
  *             else if the result is -1, then handle creation failed
  */
 
-int
-mm_util_transform_is_completed(MMHandleType MMHandle, bool *is_completed);
+int mm_util_transform_is_completed(mm_util_imgp_h imgp_handle, bool *is_completed);
 
 /**
  *
  * @remark     Image Transform Pipeline
  *
- * @param      MMHandle                                                [in]                    MMHandleType
+ * @param      imgp_handle             [in]                    image_util_imgp_h
  * @param      completed_callback                                      [in]                    Completed_callback
  * @param      user_param                                              [in]                    User parameter which is received from user when callback function was set
 
@@ -228,23 +218,18 @@ mm_util_transform_is_completed(MMHandleType MMHandle, bool *is_completed);
  *             if the result is 0, then you can use output_Filename pointer(char** value)
  *             else if the result is -1, then do not execute when the colopsapce converter is not supported
  */
-int
-mm_util_transform(MMHandleType MMHandle, media_packet_h src, mm_util_completed_callback completed_callback, void * user_data);
-
+int mm_util_transform(mm_util_imgp_h imgp_handle, media_packet_h src, mm_util_completed_callback completed_callback, void * user_data);
 
 /**
  *
  * @remark     Transform Handle Destory
  *
- * @param      MMHandle                [in]                    MMHandleType
-
+ * @param      imgp_handle             [in]                    image_util_imgp_h
  * @return     This function returns transform processor result value
  *             if the result is 0, then handle destory succeed
  *             else if the result is -1, then handle destory failed
  */
-int
-mm_util_destroy(MMHandleType MMHandle);
-
+int mm_util_destroy(mm_util_imgp_h imgp_handle);
 
 /**
  * This function convert the pixel format from source format to destination format.
@@ -261,11 +246,9 @@ mm_util_destroy(MMHandleType MMHandle);
  * @see         mm_util_img_format
  * @since       R1, 1.0
  */
-int
-mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
                            unsigned char *dst, mm_util_img_format dst_format);
 
-
 /**
  * This function resizes the source image.
  *
@@ -282,11 +265,9 @@ mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, uns
  * @see         mm_util_img_format
  * @since       R1, 1.0
  */
-int
-mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
                      unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height);
 
-
 /**
  * This function rotates the source image.
  *
@@ -304,8 +285,7 @@ mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned
  * @see         mm_util_img_format, mm_util_img_rotate_type
  * @since       R1, 1.0
  */
-int
-mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
                      unsigned char *dst, unsigned int *dst_width, unsigned int *dst_height, mm_util_img_rotate_type angle);
 
 /**
@@ -327,8 +307,7 @@ mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned
  * @see         mm_util_img_format, mm_util_img_rotate_type
  * @since       R1, 1.0
  */
-int
-mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
+int mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_img_format src_format,
                      unsigned int crop_start_x, unsigned int crop_start_y, unsigned int *crop_dest_width, unsigned int *crop_dest_height, unsigned char *dst);
 
 #ifdef __cplusplus
index 60fb224..fe2f92c 100755 (executable)
@@ -1343,13 +1343,13 @@ _mm_util_handle_finalize(mm_util_s *handle)
        return ret;
 }
 
-int mm_util_create(MMHandleType* MMHandle)
+int mm_util_create(mm_util_imgp_h *imgp_handle)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
        TTRACE_BEGIN("MM_UTILITY:IMGP:CREATE");
 
-       if (MMHandle == NULL) {
+       if (imgp_handle == NULL) {
                mm_util_error("Invalid arguments [tag null]");
                TTRACE_END();
                return MM_UTIL_ERROR_INVALID_PARAMETER;
@@ -1378,16 +1378,16 @@ int mm_util_create(MMHandleType* MMHandle)
                mm_util_debug("Success -__mm_util_create_thread");
        }
 
-       *MMHandle = (MMHandleType)handle;
+       *imgp_handle = (mm_util_imgp_h)handle;
 
        TTRACE_END();
        return ret;
 }
 
-int mm_util_set_hardware_acceleration(MMHandleType MMHandle, bool mode)
+int mm_util_set_hardware_acceleration(mm_util_imgp_h imgp_handle, bool mode)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       mm_util_s *handle = (mm_util_s *) MMHandle;
+       mm_util_s *handle = (mm_util_s *) imgp_handle;
 
        TTRACE_BEGIN("MM_UTILITY:IMGP:SET_HARDWARE_ACCELERATION");
 
@@ -1403,10 +1403,10 @@ int mm_util_set_hardware_acceleration(MMHandleType MMHandle, bool mode)
        return ret;
 }
 
-int mm_util_set_colorspace_convert(MMHandleType MMHandle, mm_util_img_format colorspace)
+int mm_util_set_colorspace_convert(mm_util_imgp_h imgp_handle, mm_util_img_format colorspace)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       mm_util_s *handle = (mm_util_s *) MMHandle;
+       mm_util_s *handle = (mm_util_s *) imgp_handle;
 
        TTRACE_BEGIN("MM_UTILITY:IMGP:SET_HARDWARE_ACCELERATION");
 
@@ -1424,10 +1424,10 @@ int mm_util_set_colorspace_convert(MMHandleType MMHandle, mm_util_img_format col
        return ret;
 }
 
-int mm_util_set_resolution(MMHandleType MMHandle, unsigned int width, unsigned int height)
+int mm_util_set_resolution(mm_util_imgp_h imgp_handle, unsigned int width, unsigned int height)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       mm_util_s *handle = (mm_util_s *) MMHandle;
+       mm_util_s *handle = (mm_util_s *) imgp_handle;
 
        TTRACE_BEGIN("MM_UTILITY:IMGP:SET_RESOLUTION");
 
@@ -1444,10 +1444,10 @@ int mm_util_set_resolution(MMHandleType MMHandle, unsigned int width, unsigned i
        return ret;
 }
 
-int mm_util_set_rotation(MMHandleType MMHandle, mm_util_img_rotate_type rotation)
+int mm_util_set_rotation(mm_util_imgp_h imgp_handle, mm_util_img_rotate_type rotation)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       mm_util_s *handle = (mm_util_s *) MMHandle;
+       mm_util_s *handle = (mm_util_s *) imgp_handle;
 
        TTRACE_BEGIN("MM_UTILITY:IMGP:SET_ROTATION");
 
@@ -1464,10 +1464,10 @@ int mm_util_set_rotation(MMHandleType MMHandle, mm_util_img_rotate_type rotation
        return ret;
 }
 
-int mm_util_set_crop_area(MMHandleType MMHandle, unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y)
+int mm_util_set_crop_area(mm_util_imgp_h imgp_handle, unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       mm_util_s *handle = (mm_util_s *) MMHandle;
+       mm_util_s *handle = (mm_util_s *) imgp_handle;
 
        TTRACE_BEGIN("MM_UTILITY:IMGP:SET_CROP_AREA");
 
@@ -1490,10 +1490,10 @@ int mm_util_set_crop_area(MMHandleType MMHandle, unsigned int start_x, unsigned
        return ret;
 }
 
-int mm_util_transform(MMHandleType MMHandle, media_packet_h src_packet, mm_util_completed_callback completed_callback, void * user_data)
+int mm_util_transform(mm_util_imgp_h imgp_handle, media_packet_h src_packet, mm_util_completed_callback completed_callback, void * user_data)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       mm_util_s *handle = (mm_util_s *) MMHandle;
+       mm_util_s *handle = (mm_util_s *) imgp_handle;
 
        TTRACE_BEGIN("MM_UTILITY:IMGP:TRANSFORM");
 
@@ -1539,11 +1539,11 @@ int mm_util_transform(MMHandleType MMHandle, media_packet_h src_packet, mm_util_
        return ret;
 }
 
-int mm_util_transform_is_completed(MMHandleType MMHandle, bool *is_completed)
+int mm_util_transform_is_completed(mm_util_imgp_h imgp_handle, bool *is_completed)
 {
        int ret = MM_UTIL_ERROR_NONE;
 
-       mm_util_s *handle = (mm_util_s *) MMHandle;
+       mm_util_s *handle = (mm_util_s *) imgp_handle;
 
        TTRACE_BEGIN("MM_UTILITY:IMGP:TRANSFORM_IS_COMPLETED");
 
@@ -1566,10 +1566,10 @@ int mm_util_transform_is_completed(MMHandleType MMHandle, bool *is_completed)
        return ret;
 }
 
-int mm_util_destroy(MMHandleType MMHandle)
+int mm_util_destroy(mm_util_imgp_h imgp_handle)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       mm_util_s *handle = (mm_util_s*) MMHandle;
+       mm_util_s *handle = (mm_util_s*) imgp_handle;
 
        TTRACE_BEGIN("MM_UTILITY:IMGP:DESTROY");
 
index e5d781f..6bf6693 100755 (executable)
@@ -24,7 +24,7 @@
 
 #define ONE_ALL 0
 #define IMAGE_FORMAT_LABEL_BUFFER_SIZE 4
-MMHandleType MMHandle = 0;
+mm_util_imgp_h imgp_handle = 0;
 bool completed = false;
 
 int packet_finalize_callback(media_packet_h packet, int err, void* userdata)
@@ -38,7 +38,7 @@ transform_completed_cb(media_packet_h *packet, int error, void *user_param)
 {
        uint64_t size = 0;
        char output_file[25] = {};
-       mm_util_debug("MMHandle: 0x%2x", MMHandle);
+       mm_util_debug("imgp_handle: 0x%2x", imgp_handle);
 
        media_format_h dst_fmt;
        media_format_mimetype_e dst_mimetype;
@@ -113,15 +113,15 @@ int main(int argc, char *argv[])
        }
 
        /* Create Transform */
-       ret = mm_util_create(&MMHandle);
+       ret = mm_util_create(&imgp_handle);
        if (ret == MM_UTIL_ERROR_NONE) {
-               mm_util_debug("Success - Create Transcode Handle [MMHandle: 0x%2x]", MMHandle);
+               mm_util_debug("Success - Create Transcode Handle [imgp_handle: 0x%2x]", imgp_handle);
        } else {
                mm_util_debug("ERROR - Create Transcode Handle");
                return ret;
        }
 
-       handle = (mm_util_s*) MMHandle;
+       handle = (mm_util_s*) imgp_handle;
 
        media_format_h fmt;
        if (media_format_create(&fmt) == MEDIA_FORMAT_ERROR_NONE) {
@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
        }
 
        /* Set Source */
-       ret = mm_util_set_hardware_acceleration(MMHandle, atoi(argv[2]));
+       ret = mm_util_set_hardware_acceleration(imgp_handle, atoi(argv[2]));
        if (ret == MM_UTIL_ERROR_NONE) {
                mm_util_debug("Success - Set hardware_acceleration");
        } else {
@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
                return ret;
        }
 
-       ret = mm_util_set_resolution(MMHandle, 176, 144);
+       ret = mm_util_set_resolution(imgp_handle, 176, 144);
        if (ret == MM_UTIL_ERROR_NONE) {
                mm_util_debug("Success - Set Convert Info");
        } else {
@@ -214,7 +214,7 @@ int main(int argc, char *argv[])
        }
 
        /* Transform */
-       ret = mm_util_transform(MMHandle, src_packet, (mm_util_completed_callback) transform_completed_cb, handle);
+       ret = mm_util_transform(imgp_handle, src_packet, (mm_util_completed_callback) transform_completed_cb, handle);
        if (ret == MM_UTIL_ERROR_NONE) {
                mm_util_debug("Success - Transform");
        } else {
@@ -226,7 +226,7 @@ int main(int argc, char *argv[])
        mm_util_debug("Wait...");
        while (false == completed) {} // polling
 
-       ret = mm_util_destroy(MMHandle);
+       ret = mm_util_destroy(imgp_handle);
        if (ret == MM_UTIL_ERROR_NONE) {
                mm_util_debug("Success - Destroy");
        } else {
index 715043a..2f0b0de 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-utility
 Summary:    Multimedia Framework Utility Library
-Version:    0.18
+Version:    0.19
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0