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
* @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
* 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
* 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
* 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
* 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.
* @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.
*
* @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.
*
* @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);
/**
* @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
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;
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");
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");
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");
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");
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");
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");
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");
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");
#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)
{
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;
}
/* 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) {
}
/* 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 {
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 {
}
/* 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 {
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 {