} \
} while (0)
-#define DEPRECATION_LOGW(deprecated, instead) do { \
- image_util_warning("DEPRECATION WARNING: %s is deprecated and will be removed from next release. Use %s instead.", deprecated, instead); \
- } while (0)
#define IMAGE_UTIL_STRING_VALID(str) \
((str != NULL && strlen(str) > 0) ? true : false)
Name: capi-media-image-util
Summary: A Image Utility library in Tizen Native API
-Version: 0.1.41
+Version: 0.1.42
Release: 2
Group: Multimedia/API
License: Apache-2.0
image_util_retvm_if((new_fmt == NULL) || (width == 0) || (height == 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter");
err = media_format_create(new_fmt);
- if (err != MEDIA_FORMAT_ERROR_NONE) {
- image_util_error("media_format_make_writable failed (%d)", err);
- return IMAGE_UTIL_ERROR_INVALID_OPERATION;
- }
+ image_util_retvm_if((err != MEDIA_FORMAT_ERROR_NONE), IMAGE_UTIL_ERROR_INVALID_OPERATION, "media_format_make_writable failed (%d)", err);
err = media_format_set_video_mime(*new_fmt, mimetype);
if (err != MEDIA_FORMAT_ERROR_NONE) {
image_util_retvm_if(((packet == NULL) || (color_image == NULL)), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter");
err = media_packet_get_format(packet, &fmt);
- if (err != MEDIA_PACKET_ERROR_NONE) {
- image_util_error("media_packet_get_format failed (%d)", err);
- return IMAGE_UTIL_ERROR_INVALID_PARAMETER;
- }
+ image_util_retvm_if((err != MEDIA_PACKET_ERROR_NONE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "media_packet_get_format failed (%d)", err);
err = media_format_get_video_info(fmt, &mimetype, &width, &height, NULL, NULL);
if (err != MEDIA_FORMAT_ERROR_NONE) {
media_format_unref(fmt);
err = media_packet_get_buffer_size(packet, &size);
- if (err != MEDIA_PACKET_ERROR_NONE) {
- image_util_error("media_packet_get_buffer_size failed (%d)", err);
- return IMAGE_UTIL_ERROR_INVALID_PARAMETER;
- }
+ image_util_retvm_if((err != MEDIA_PACKET_ERROR_NONE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "media_packet_get_buffer_size failed (%d)", err);
if (size) {
err = media_packet_get_buffer_data_ptr(packet, &ptr);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("media_packet_get_buffer_data_ptr failed (%d)", err);
- return IMAGE_UTIL_ERROR_INVALID_PARAMETER;
- }
+ image_util_retvm_if((err != MEDIA_PACKET_ERROR_NONE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "media_packet_get_buffer_data_ptr failed (%d)", err);
}
image_util_debug("[Fotmat: %u] W x H : %d x %d", mimetype, width, height);
- if ((width == 0) || (height == 0) || (size == 0) || (ptr == NULL)) {
- image_util_error("Invalid source packet");
- return IMAGE_UTIL_ERROR_INVALID_PARAMETER;
- }
+ image_util_retvm_if(((width == 0) || (height == 0) || (size == 0) || (ptr == NULL)), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid source packet");
err = mm_util_create_color_image(color_image, (unsigned long)width, (unsigned long)height, __mimetype_to_image_format(mimetype), ptr, (size_t)size);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("mm_util_create_color_image failed (%d)", err);
- return _image_error_capi(ERR_TYPE_TRANSFORM, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_TRANSFORM, err), "mm_util_create_color_image failed (%d)", err);
image_util_debug("_image_util_packet_to_image succeed");
size_t size = 0;
err = mm_util_get_color_image(image, &width, &height, &format, &buffer, &buffer_size);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("mm_util_get_color_image failed (%d)", err);
- return _image_error_capi(ERR_TYPE_TRANSFORM, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_TRANSFORM, err), "mm_util_get_color_image failed (%d)", err);
err = __create_media_format(__image_format_to_mimetype(format), (unsigned int)width, (unsigned int)height, &fmt);
- if (err != IMAGE_UTIL_ERROR_NONE) {
- image_util_error("mm_util_push_request_image failed (%d)", err);
- return err;
- }
+ image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "__create_media_format failed (%d)", err);
err = media_packet_create_alloc(fmt, NULL, NULL, packet);
if (err != MEDIA_PACKET_ERROR_NONE) {
mm_util_imgp_h image_h;
err = mm_util_create(&image_h);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("Error - mm_util_create");
- return _image_error_capi(ERR_TYPE_TRANSFORM, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_TRANSFORM, err), "Error - mm_util_create");
handle->image_h = image_h;
image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
err = mm_util_set_colorspace_convert(_handle->image_h, colorspace);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("Error - Set colorspace convert");
- return _image_error_capi(ERR_TYPE_TRANSFORM, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_TRANSFORM, err), "Error - Set colorspace convert");
_handle->colorspace = colorspace;
_handle->set_convert = true;
image_util_retvm_if((_image_util_check_resolution(width, height) == false), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution");
err = mm_util_set_resolution(_handle->image_h, width, height);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("Error - Set resolution");
- return _image_error_capi(ERR_TYPE_TRANSFORM, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_TRANSFORM, err), "Error - Set resolution");
+
_handle->width = width;
_handle->height = height;
_handle->set_resize = true;
image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
err = mm_util_set_rotation(_handle->image_h, rotation);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("Error - Set rotation");
- return _image_error_capi(ERR_TYPE_TRANSFORM, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_TRANSFORM, err), "Error - Set rotation");
+
_handle->rotation = rotation;
_handle->set_rotate = true;
image_util_retvm_if((_image_util_check_resolution(dest_width, dest_height) == false), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid dest resolution");
err = mm_util_set_crop_area(_handle->image_h, start_x, start_y, end_x, end_y);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("Error - Set crop area");
- return _image_error_capi(ERR_TYPE_TRANSFORM, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_TRANSFORM, err), "Error - Set crop area");
+
_handle->start_x = start_x;
_handle->start_y = start_y;
_handle->end_x = end_x;
image_util_retvm_if(buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid buffer");
fp = fopen(path, "r");
- if (fp == NULL) {
- image_util_error("File open failed %s", path);
- return IMAGE_UTIL_ERROR_NO_SUCH_FILE;
- }
+ image_util_retvm_if(fp == NULL, IMAGE_UTIL_ERROR_NO_SUCH_FILE, "File open failed %s", path);
read_buffer = (void *)calloc(1, IMG_HEADER_LENGTH + 1);
if (read_buffer == NULL) {
_handle->src_buffer = NULL;
err = _image_util_decode_read_header(path, &image_header);
- if (err != IMAGE_UTIL_ERROR_NONE) {
- image_util_error("_image_util_decode_read_header failed");
- return err;
- }
+ image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "_image_util_decode_read_header failed");
err = _image_util_decode_check_image_type(image_header, &_handle->image_type);
if (err != IMAGE_UTIL_ERROR_NONE) {
IMAGE_UTIL_SAFE_FREE(image_header);
err = _image_util_decode_create_image_handle(_handle);
- if (err != IMAGE_UTIL_ERROR_NONE) {
- image_util_error("_image_util_decode_create_image_handle failed");
- return err;
- }
+ image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "_image_util_decode_create_image_handle failed");
_handle->path = g_strndup(path, strlen(path));
image_util_retvm_if(_handle->path == NULL, IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
image_util_retvm_if(_handle->dst_buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output");
err = _image_util_decode_internal(_handle);
- image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "fail to _image_util_decode_internal");
+ image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "_image_util_decode_internal failed");
if (width)
*width = _handle->width;
image_util_retvm_if((frame == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
err = mm_util_gif_enocde_get_image_handle(gif_data, (int)index, frame);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("mm_util_gif_enocde_get_image_handle is failed %d", err);
- return _image_error_capi(ERR_TYPE_ENCODE, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_ENCODE, err), "mm_util_gif_enocde_get_image_handle failed %d", err);
+
if (*frame == NULL) {
err = mm_util_gif_image_create(gif_data, frame);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("mm_util_gif_image_create is failed %d", err);
- return _image_error_capi(ERR_TYPE_ENCODE, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_ENCODE, err), "mm_util_gif_image_create failed %d", err);
+
err = mm_util_gif_enocde_set_image_handle(gif_data, *frame);
if (err != MM_UTIL_ERROR_NONE) {
image_util_error("mm_util_gif_enocde_set_image_handle is failed %d", err);
}
mm_gif_image_h frame = NULL;
err = _image_util_encode_get_gif_frame(gif_data, _handle->current_resolution_count, &frame);
- if (err != IMAGE_UTIL_ERROR_NONE) {
- image_util_error("_image_util_encode_get_gif_frame is failed %d", err);
- return err;
- }
+ image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "_image_util_encode_get_gif_frame failed %d", err);
+
err = mm_util_gif_image_set_position(frame, 0, 0, (int)width, (int)height);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("mm_util_gif_image_set_position is failed %d", err);
- return _image_error_capi(ERR_TYPE_ENCODE, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_ENCODE, err), "mm_util_gif_image_set_position failed %d", err);
+
_handle->current_resolution_count++;
return err;
mm_gif_image_h frame = NULL;
err = _image_util_encode_get_gif_frame(gif_data, _handle->current_delay_count, &frame);
- if (err != IMAGE_UTIL_ERROR_NONE) {
- image_util_error("_image_util_encode_get_gif_frame is failed %d", err);
- return err;
- }
+ image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "_image_util_encode_get_gif_frame failed %d", err);
+
err = mm_util_gif_image_set_delay_time(frame, (int)delay_time);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("mm_util_gif_image_set_delay_time is failed %d", err);
- return _image_error_capi(ERR_TYPE_ENCODE, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_ENCODE, err), "mm_util_gif_image_set_delay_time failed %d", err);
+
_handle->current_delay_count++;
return err;
image_util_retvm_if(gif_data == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid gif data");
err = _image_util_encode_get_gif_frame(gif_data, _handle->current_buffer_count, &frame);
- if (err != IMAGE_UTIL_ERROR_NONE) {
- image_util_error("_image_util_encode_get_gif_frame is failed %d", err);
- return err;
- }
+ image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "_image_util_encode_get_gif_frame failed %d", err);
+
err = mm_util_gif_image_set_image(frame, src_buffer);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("mm_util_gif_image_set_image is failed %d", err);
- return _image_error_capi(ERR_TYPE_ENCODE, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_ENCODE, err), "mm_util_gif_image_set_image failed %d", err);
+
_handle->current_buffer_count++;
} else {
if (_handle->src_buffer == NULL)
err = mm_util_gif_encode_set_file(gif_data, _handle->path);
else
err = mm_util_gif_encode_set_mem(gif_data, _handle->dst_buffer, &encoded_buffer_size);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("mm_util_gif_encode_set_file | mm_util_gif_encode_set_mem is failed(%d)", err);
- return _image_error_capi(ERR_TYPE_ENCODE, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_ENCODE, err), "mm_util_gif_encode_set_file | mm_util_gif_encode_set_mem failed %d", err);
+
err = mm_util_gif_encode(gif_data);
- if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("mm_util_gif_encode is failed(%d)", err);
- return _image_error_capi(ERR_TYPE_ENCODE, err);
- }
+ image_util_retvm_if((err != MM_UTIL_ERROR_NONE), _image_error_capi(ERR_TYPE_ENCODE, err), "mm_util_gif_encode failed %d", err);
+
if (encoded_buffer_size != 0)
_handle->dst_size = (unsigned long long)encoded_buffer_size;
}
image_util_retvm_if((_image_util_check_resolution(_handle->width, _handle->height) == false), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution");
err = _image_util_encode_internal(_handle);
- if (err != IMAGE_UTIL_ERROR_NONE) {
- image_util_error("Error - encode run");
- return err;
- }
+ image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "_image_util_encode_internal failed");
if (size)
*size = _handle->dst_size;