Add removed symbol for compatibility 03/209703/11
authorjiyong.min <jiyong.min@samsung.com>
Wed, 10 Jul 2019 05:42:28 +0000 (14:42 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Tue, 20 Aug 2019 23:01:12 +0000 (23:01 +0000)
 - ACR-1123 : [5.0][capi-media-image-util][Remove] Remove deprecated APIs

Change-Id: I692a15579f4fe851637eb54f14c0f0bf2fedc23a

CMakeLists.txt
packaging/capi-media-image-util.spec
src/image_util_decode.c [changed mode: 0755->0644]
src/image_util_encode.c

index 97543c6..da1a21d 100755 (executable)
@@ -29,6 +29,9 @@ ADD_DEFINITIONS("-DTIZEN_DEBUG")
 IF(FEATURE_ENABLE_HW_ACCELERATION)
 ADD_DEFINITIONS("-DENABLE_HW_ACCELERATION")
 ENDIF(FEATURE_ENABLE_HW_ACCELERATION)
+IF(TIZEN_FEATURE_COMPATIBILITY)
+ADD_DEFINITIONS("-DTIZEN_FEATURE_COMPATIBILITY")
+ENDIF(TIZEN_FEATURE_COMPATIBILITY)
 
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
 
index f4e619d..32e7424 100755 (executable)
@@ -68,10 +68,12 @@ export LDFLAGS+=" -lgcov"
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
 %if 0%{?model_build_feature_multimedia_image_hw_acceleration}
- -DFEATURE_ENABLE_HW_ACCELERATION:BOOL=ON
+ -DFEATURE_ENABLE_HW_ACCELERATION:BOOL=ON \
 %else
- -DFEATURE_ENABLE_HW_ACCELERATION:BOOL=OFF
+ -DFEATURE_ENABLE_HW_ACCELERATION:BOOL=OFF \
 %endif
+ -DTIZEN_FEATURE_COMPATIBILITY:BOOL=ON
+
 %__make %{?jobs:-j%jobs}
 
 %if 0%{?gcov:1}
old mode 100755 (executable)
new mode 100644 (file)
index c6290b3..f47c8fa
@@ -597,3 +597,125 @@ int image_util_decode_destroy(image_util_decode_h handle)
 
        return IMAGE_UTIL_ERROR_NONE;
 }
+
+#ifdef TIZEN_FEATURE_COMPATIBILITY
+int image_util_decode_jpeg(const char *path, image_util_colorspace_e colorspace, unsigned char **image_buffer, int *width, int *height, unsigned int *size)
+{
+       int err = MM_UTIL_ERROR_NONE;
+       mm_util_image_h image = NULL;
+       unsigned int image_width = 0;
+       unsigned int image_height = 0;
+       size_t image_size = 0;
+
+       image_util_warning("DEPRECATION WARNING: image_util_decode_jpeg() is removed from 5.0. Use image_util_decode_create() instead.");
+
+       image_util_retvm_if(!IMAGE_UTIL_STRING_VALID(path), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid path");
+       image_util_retvm_if(!image_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid image_buffer");
+       image_util_retvm_if(!size, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "!invalid size");
+       image_util_retvm_if(!is_valid_colorspace(colorspace), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
+       image_util_retvm_if(!is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "Not supported format");
+
+       err = mm_util_decode_from_jpeg_file(path, TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG), MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1, &image);
+       image_util_retvm_if(err != MM_UTIL_ERROR_NONE, _image_error_capi(err), "mm_util_decode_from_jpeg_file failed. (%d)", err);
+
+       err = mm_image_get_image(image, &image_width, &image_height, NULL, image_buffer, &image_size);
+       if (width)
+               *width = image_width;
+       if (height)
+               *height = image_height;
+       *size = image_size;
+
+       return _image_error_capi(err);
+}
+
+int image_util_decode_jpeg_from_memory(const unsigned char *jpeg_buffer, int jpeg_size, image_util_colorspace_e colorspace, unsigned char **image_buffer, int *width, int *height, unsigned int *size)
+{
+       int err = MM_UTIL_ERROR_NONE;
+       mm_util_image_h image = NULL;
+       unsigned int image_width = 0;
+       unsigned int image_height = 0;
+       size_t image_size = 0;
+
+       image_util_warning("DEPRECATION WARNING: image_util_decode_jpeg_from_memory() is removed from 5.0. Use image_util_decode_create() instead.");
+
+       image_util_retvm_if(!jpeg_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid jpeg_buffer");
+       image_util_retvm_if(jpeg_size <= 0, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid jpeg_size");
+       image_util_retvm_if(!image_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid image_buffer");
+       image_util_retvm_if(!size, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "!invalid size");
+       image_util_retvm_if(!is_valid_colorspace(colorspace), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
+       image_util_retvm_if(!is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "Not supported format");
+
+       err = mm_util_decode_from_jpeg_memory((void  *)jpeg_buffer, (size_t)jpeg_size,
+                                       TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG), MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1, &image);
+       image_util_retvm_if(err != MM_UTIL_ERROR_NONE, _image_error_capi(err), "mm_util_decode_from_jpeg_file failed. (%d)", err);
+
+       err = mm_image_get_image(image, &image_width, &image_height, NULL, image_buffer, &image_size);
+       if (width)
+               *width = image_width;
+       if (height)
+               *height = image_height;
+       *size = image_size;
+
+       return _image_error_capi(err);
+}
+
+int image_util_decode_jpeg_with_downscale(const char *path, image_util_colorspace_e colorspace, image_util_scale_e downscale, unsigned char **image_buffer, int *width, int *height, unsigned int *size)
+{
+       int err = MM_UTIL_ERROR_NONE;
+       mm_util_image_h image = NULL;
+       unsigned int image_width = 0;
+       unsigned int image_height = 0;
+       size_t image_size = 0;
+
+       image_util_warning("DEPRECATION WARNING: image_util_decode_jpeg_with_downscale() is removed from 5.0. Use image_util_decode_create() instead.");
+
+       image_util_retvm_if(!IMAGE_UTIL_STRING_VALID(path), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid path");
+       image_util_retvm_if(!image_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid image_buffer");
+       image_util_retvm_if(!size, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "!invalid size");
+       image_util_retvm_if(!is_valid_colorspace(colorspace), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
+       image_util_retvm_if(!is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "Not supported format");
+
+       err = mm_util_decode_from_jpeg_file(path, TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG), _convert_decode_scale_tbl[downscale], &image);
+       image_util_retvm_if(err != MM_UTIL_ERROR_NONE, _image_error_capi(err), "mm_util_decode_from_jpeg_file failed. (%d)", err);
+
+       err = mm_image_get_image(image, &image_width, &image_height, NULL, image_buffer, &image_size);
+       if (width)
+               *width = image_width;
+       if (height)
+               *height = image_height;
+       *size = image_size;
+
+       return _image_error_capi(err);
+}
+
+int image_util_decode_jpeg_from_memory_with_downscale(const unsigned char *jpeg_buffer, int jpeg_size, image_util_colorspace_e colorspace, image_util_scale_e downscale, unsigned char **image_buffer, int *width, int *height, unsigned int *size)
+{
+       int err = MM_UTIL_ERROR_NONE;
+       mm_util_image_h image = NULL;
+       unsigned int image_width = 0;
+       unsigned int image_height = 0;
+       size_t image_size = 0;
+
+       image_util_warning("DEPRECATION WARNING: image_util_decode_jpeg_from_memory_with_downscale() is removed from 5.0. Use image_util_decode_create() instead.");
+
+       image_util_retvm_if(!jpeg_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid jpeg_buffer");
+       image_util_retvm_if(jpeg_size <= 0, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid jpeg_size");
+       image_util_retvm_if(!image_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid image_buffer");
+       image_util_retvm_if(!size, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "!invalid size");
+       image_util_retvm_if(!is_valid_colorspace(colorspace), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
+       image_util_retvm_if(!is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "Not supported format");
+
+       err = mm_util_decode_from_jpeg_memory((void  *)jpeg_buffer, (size_t)jpeg_size,
+                                       TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG), _convert_decode_scale_tbl[downscale], &image);
+       image_util_retvm_if(err != MM_UTIL_ERROR_NONE, _image_error_capi(err), "mm_util_decode_from_jpeg_file failed. (%d)", err);
+
+       err = mm_image_get_image(image, &image_width, &image_height, NULL, image_buffer, &image_size);
+       if (width)
+               *width = image_width;
+       if (height)
+               *height = image_height;
+       *size = image_size;
+
+       return _image_error_capi(err);
+}
+#endif
index 1a885a1..53463d4 100644 (file)
@@ -752,3 +752,51 @@ int image_util_agif_encode_destroy(image_util_agif_encode_h handle)
 
        return IMAGE_UTIL_ERROR_NONE;
 }
+
+#ifdef TIZEN_FEATURE_COMPATIBILITY
+int image_util_encode_jpeg(const unsigned char *buffer, int width, int height, image_util_colorspace_e colorspace, int quality, const char *path)
+{
+       int err = MM_UTIL_ERROR_NONE;
+       mm_util_image_h image = NULL;
+
+       image_util_warning("DEPRECATION WARNING: image_util_encode_jpeg() is removed from 5.0. Use image_util_encode_create() instead.");
+
+       image_util_retvm_if((path == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "path is null");
+       image_util_retvm_if((buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "buffer is null");
+       image_util_retvm_if((strlen(path) == 0), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path");
+       image_util_retvm_if((is_valid_colorspace(colorspace) == FALSE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
+       image_util_retvm_if((is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG) == FALSE), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported format");
+
+       err = mm_image_create_image((unsigned int)width, (unsigned int)height, TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG), buffer, TEMP_DATA_SIZE, &image);
+       image_util_retvm_if(err != MM_UTIL_ERROR_NONE, _image_error_capi(err), "mm_image_create_image is failed (%d)", err);
+
+       err = mm_util_jpeg_encode_to_file(image, quality, path);
+
+       mm_image_destroy_image(image);
+
+       return _image_error_capi(err);
+}
+
+int image_util_encode_jpeg_to_memory(const unsigned char *image_buffer, int width, int height, image_util_colorspace_e colorspace, int quality, unsigned char **jpeg_buffer, unsigned int *jpeg_size)
+{
+       int err = MM_UTIL_ERROR_NONE;
+       mm_util_image_h image = NULL;
+
+       image_util_warning("DEPRECATION WARNING: image_util_encode_jpeg_to_memory() is removed from 5.0. Use image_util_encode_create() instead.");
+
+       image_util_retvm_if((jpeg_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "jpeg_buffer is null");
+       image_util_retvm_if((image_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "image_buffer is null");
+       image_util_retvm_if((jpeg_size == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "jpeg_size is null");
+       image_util_retvm_if((is_valid_colorspace(colorspace) == FALSE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
+       image_util_retvm_if((is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG) == FALSE), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported format");
+
+       err = mm_image_create_image((unsigned int)width, (unsigned int)height, TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG), image_buffer, TEMP_DATA_SIZE, &image);
+       image_util_retvm_if(err != MM_UTIL_ERROR_NONE, _image_error_capi(err), "mm_image_create_image is failed (%d)", err);
+
+       err = mm_util_encode_to_jpeg_memory(image, quality, (void **)jpeg_buffer, jpeg_size);
+
+       mm_image_destroy_image(image);
+
+       return _image_error_capi(err);
+}
+#endif