Remove capi-media-tool dependency & unused libraries 98/161198/3 submit/tizen/20171123.062739 submit/tizen/20171124.024723
authorJiyong Min <jiyong.min@samsung.com>
Wed, 22 Nov 2017 05:53:30 +0000 (14:53 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Wed, 22 Nov 2017 06:13:09 +0000 (15:13 +0900)
Change-Id: I4337e2dbc242fafc7e8683e833b403d8887e9689
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
17 files changed:
bmp/Makefile.am [changed mode: 0644->0755]
bmp/test/Makefile.am
configure.ac
gif/Makefile.am [changed mode: 0644->0755]
gif/test/Makefile.am
imgcv/Makefile.am
imgp/Makefile.am
imgp/include/mm_util_imgp.h
imgp/include/mm_util_imgp_internal.h
imgp/mm_util_imgp.c
imgp/test/Makefile.am
imgp/test/mm_util_imgp_testsuite.c
jpeg/Makefile.am
jpeg/test/Makefile.am
packaging/libmm-utility.spec
png/Makefile.am [changed mode: 0644->0755]
png/test/Makefile.am

old mode 100644 (file)
new mode 100755 (executable)
index a618fe8..ec8764b
@@ -10,14 +10,12 @@ libmmutil_bmp_la_SOURCES = mm_util_bmp.c
 
 libmmutil_bmp_la_CFLAGS = -I$(srcdir)/include \
                                -I$(srcdir)/../common/include \
-                               $(GLIB_CFLAGS) \
-                               $(MEDIA_CFLAGS) \
-                               -I/usr/include \
-                               $(srcdir)/../imgp/libmmutil_imgp.la
+                               $(DLOG_CFLAGS) \
+                               $(GLIB_CFLAGS)
 
 libmmutil_bmp_la_LIBADD = $(GLIB_LIBS) -lnsbmp -lbmp -ldl \
-                               $(GMODULE_LIBS) \
-                               $(MEDIA_LIBS)
+                               $(DLOG_LIBS) \
+                               $(GMODULE_LIBS)
 
 libmmutil_bmp_la_CFLAGS += -DLIBPREFIX=\"$(libdir)\"
 
index e2ab817..f2e6b90 100755 (executable)
@@ -4,9 +4,8 @@ mm_util_bmp_testsuite_SOURCES = mm_util_bmp_testsuite.c
 
 mm_util_bmp_testsuite_CFLAGS = -I$(srcdir)/../include \
                                -I$(srcdir)/../../common/include
-mm_util_bmp_testsuite_CFLAGS += $(MEDIA_CFLAGS) \
-                                -fPIE -pie \
-                                $(TZ_PLATFORM_CONFIG_FLAGS)
+mm_util_bmp_testsuite_CFLAGS += $(TZ_PLATFORM_CONFIG_FLAGS) \
+                                -fPIE -pie
 
 
 ############################################
@@ -14,6 +13,5 @@ mm_util_bmp_testsuite_CFLAGS += $(MEDIA_CFLAGS) \
 mm_util_bmp_testsuite_DEPENDENCIES = $(srcdir)/../libmmutil_bmp.la
 
 mm_util_bmp_testsuite_LDADD = $(srcdir)/../libmmutil_bmp.la
-mm_util_bmp_testsuite_LDADD += $(MEDIA_LIBS) \
-                               $(TZ_PLATFORM_CONFIG_LIBS)
+mm_util_bmp_testsuite_LDADD += $(TZ_PLATFORM_CONFIG_LIBS)
 
index 5fa4050..f381ad2 100755 (executable)
@@ -24,7 +24,7 @@ AM_PROG_CC_C_O
 
 # Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS([fcntl.h memory.h stdlib.h string.h unistd.h])
+AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_STRUCT_TM
@@ -49,10 +49,6 @@ PKG_CHECK_MODULES(GMODULE, gmodule-2.0)
 AC_SUBST(GMODULE_CFLAGS)
 AC_SUBST(GMODULE_LIBS)
 
-PKG_CHECK_MODULES(MEDIA, capi-media-tool)
-AC_SUBST(MEDIA_CFLAGS)
-AC_SUBST(MEDIA_LIBS)
-
 PKG_CHECK_MODULES(OPENCV, opencv)
 AC_SUBST(OPENCV_CFLAGS)
 AC_SUBST(OPENCV_LIBS)
old mode 100644 (file)
new mode 100755 (executable)
index 897249c..577cd74
@@ -10,16 +10,14 @@ libmmutil_gif_la_SOURCES = mm_util_gif.c
 
 libmmutil_gif_la_CFLAGS = -I$(srcdir)/include \
                                -I$(srcdir)/../common/include \
+                               $(DLOG_CFLAGS) \
                                $(GLIB_CFLAGS) \
-                               $(GIO_CFLAGS) \
-                               $(MEDIA_CFLAGS) \
-                               -I/usr/include \
-                               $(srcdir)/../imgp/libmmutil_imgp.la
+                               $(GIO_CFLAGS)
 
 libmmutil_gif_la_LIBADD = $(GLIB_LIBS) -lgif -ldl \
+                               $(DLOG_LIBS) \
                                $(GIO_LIBS) \
-                               $(GMODULE_LIBS) \
-                               $(MEDIA_LIBS)
+                               $(GMODULE_LIBS)
 
 libmmutil_gif_la_CFLAGS += -DLIBPREFIX=\"$(libdir)\"
 
index 8acca79..cad7d66 100755 (executable)
@@ -5,9 +5,8 @@ mm_util_gif_testsuite_SOURCES = mm_util_gif_testsuite.c
 mm_util_gif_testsuite_CFLAGS = -I$(srcdir)/../include \
                                -I$(srcdir)/../../common/include
 mm_util_gif_testsuite_CFLAGS += $(GLIB_CFLAGS) \
-                                $(MEDIA_CFLAGS) \
-                                -fPIE -pie \
-                                $(TZ_PLATFORM_CONFIG_FLAGS)
+                               $(TZ_PLATFORM_CONFIG_FLAGS) \
+                               -fPIE -pie
 
 
 ############################################
@@ -15,6 +14,5 @@ mm_util_gif_testsuite_CFLAGS += $(GLIB_CFLAGS) \
 mm_util_gif_testsuite_DEPENDENCIES = $(srcdir)/../libmmutil_gif.la
 
 mm_util_gif_testsuite_LDADD = $(srcdir)/../libmmutil_gif.la
-mm_util_gif_testsuite_LDADD += $(MEDIA_LIBS) \
-                               $(TZ_PLATFORM_CONFIG_LIBS)
+mm_util_gif_testsuite_LDADD += $(TZ_PLATFORM_CONFIG_LIBS)
 
index 598c9cc..29db355 100755 (executable)
@@ -13,13 +13,13 @@ libmmutil_imgcv_la_CFLAGS = -I$(srcdir)/include \
                                -I$(srcdir)/../common/include \
                                $(GLIB_CFLAGS) \
                                $(GMODULE_CFLAGS) \
-                               $(MEDIA_CFLAGS) \
+                               $(DLOG_CFLAGS) \
                                $(OPENCV_CFLAGS) \
                                $(srcdir)/../imgp/libmmutil_imgp.la
 
 libmmutil_imgcv_la_LIBADD = $(GLIB_LIBS) \
+                               $(DLOG_LIBS) \
                                $(GMODULE_LIBS) \
-                               $(MEDIA_LIBS) \
                                $(OPENCV_LIBS)
 
 libmmutil_imgcv_la_CFLAGS += -DLIBPREFIX=\"$(libdir)\"
index bc1c68e..55ffd73 100755 (executable)
@@ -11,28 +11,15 @@ libmmutil_imgp_la_SOURCES = mm_util_imgp.c
 
 libmmutil_imgp_la_CFLAGS = -I$(srcdir)/../common/include \
                            -I$(srcdir)/include \
-                          -I$(includedir)/drm \
                            $(GLIB_CFLAGS) \
                            $(GMODULE_CFLAGS) \
-                           $(DRM_CFLAGS) \
-                           $(DRM_DEVEL_CFLAGS) \
-                           $(MEDIA_CFLAGS) \
-                           $(XFIXES_CFLAGS) \
-                           $(DRI2PROTO_CFLAGS) \
-                           $(DRI2_CFLAGS) \
                            $(DLOG_CFLAGS)
 
 libmmutil_imgp_la_LIBADD = $(GLIB_LIBS) \
                            $(GMODULE_LIBS) \
-                           $(DRM_LIBS) \
-                           $(DRM_DEVEL_LIBS) \
-                           $(MEDIA_LIBS) \
-                           $(XFIXES_LIBS) \
-                           $(DRI2PROTO_LIBS) \
-                           $(DRI2_LIBS) \
                            $(DLOG_LIBS)
 
-libmmutil_imgp_la_CFLAGS += -lcapi-media-tool -DLIBPREFIX=\"$(libdir)\"
+libmmutil_imgp_la_CFLAGS += -DLIBPREFIX=\"$(libdir)\"
 
 pcfiles = mmutil-imgp.pc
 pkgconfigdir = $(libdir)/pkgconfig
index 33777f2..a8292fb 100755 (executable)
 extern "C" {
 #endif
 
-#include <media_packet.h>
+#include <stdbool.h>
+#include <stdlib.h>
 #include "mm_util_type.h"
 
 typedef void *mm_util_imgp_h;
+typedef void *mm_util_color_image_h;
 
-typedef bool (*mm_util_completed_callback)(media_packet_h *dst, int error, void *user_param);
+typedef bool (*mm_util_completed_callback)(mm_util_color_image_h image, int error, void *user_param);
 /**
     @addtogroup UTILITY
     @{
@@ -189,11 +191,61 @@ int mm_util_set_crop_area(mm_util_imgp_h imgp_handle, unsigned int start_x, unsi
  *             if the result is 0, then handle creation succeed
  *             else if the result is -1, then handle creation failed
  */
-
 int mm_util_transform_is_completed(mm_util_imgp_h imgp_handle, bool *is_completed);
 
 /**
  *
+ * @remark     Creates the handle of color image
+ *
+ * @param      image           [in/out]                The handle of the color image
+ * @return     This function returns created color image handle
+ *             if the result is 0, then handle creation succeed
+ *             else if the result is -1, then handle creation failed
+ */
+int mm_util_create_color_image(mm_util_color_image_h *image);
+
+/**
+ *
+ * @remark     Sets the data of color image to handle
+ *
+ * @param      image           [in]                    The handle of the color image
+ * @param      width           [in]                    The width of color image
+ * @param      height          [in]                    The height of color image
+ * @param      format          [in]                    The color format of color image
+ * @param      buffer          [in]                    The data of color image
+ * @param      buffer_size     [in]                    The data-size of color image
+ * @return     This function returns the result of setting the data in handle
+ *             if the result is 0, then setting the data has succeed
+ *             else if the result is -1, then setting the data has failed
+ */
+int mm_util_set_color_image(mm_util_color_image_h image, int width, int height, mm_util_img_format format, void *buffer, size_t buffer_size);
+
+/**
+ *
+ * @remark     Gets the data of color image from handle
+ *
+ * @param      image           [in]                    The handle of the color image
+ * @param      width           [in/out]                The width of color image
+ * @param      height          [in/out]                The height of color image
+ * @param      format          [in/out]                The color format of color image
+ * @param      buffer          [in/out]                The data of color image
+ * @param      buffer_size     [in/out]                The data-size of color image
+ * @return     This function returns the result of getting the data from handle
+ *             if the result is 0, then getting the data has succeed
+ *             else if the result is -1, then getting the data has failed
+ */
+int mm_util_get_color_image(mm_util_color_image_h image, int *width, int *height, mm_util_img_format *format, void **buffer, size_t *buffer_size);
+
+/**
+ *
+ * @remark     Destroys the handle of color image
+ *
+ * @param      image           [in]                    The handle of the color image
+ */
+void mm_util_destroy_color_image(mm_util_color_image_h image);
+
+/**
+ *
  * @remark     Image Transform Pipeline
  *
  * @param      imgp_handle             [in]                    image_util_imgp_h
@@ -204,7 +256,7 @@ int mm_util_transform_is_completed(mm_util_imgp_h imgp_handle, bool *is_complete
  *             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(mm_util_imgp_h imgp_handle, media_packet_h src, mm_util_completed_callback completed_callback, void * user_data);
+int mm_util_transform(mm_util_imgp_h imgp_handle, mm_util_color_image_h image, mm_util_completed_callback completed_callback, void * user_data);
 
 /**
  *
index 2f35ddb..9d06c06 100755 (executable)
@@ -82,34 +82,40 @@ typedef struct {
 } mm_util_cb_s;
 
 typedef struct {
-       void *src;
-       mm_util_img_format src_format;
-       unsigned int src_width;
-       unsigned int src_height;
-       media_packet_h dst_packet;
-       void *dst;
+       int width;
+       int height;
+       mm_util_img_format format;
+       void *buffer;
+       size_t buffer_size;
+} color_image_data_s;
+
+typedef struct {
+       color_image_data_s *src;
+       color_image_data_s *dst;
+
+       bool hardware_acceleration;
+
+       /* for converting colorspace */
        mm_util_img_format dst_format;
+       /* for image crop */
+       /* for resize */
        unsigned int start_x;
        unsigned int start_y;
        unsigned int dst_width;
        unsigned int dst_height;
-       mm_util_rotation_e dst_rotation;
-       bool hardware_acceleration;
-       mm_util_cb_s *_util_cb;
-       bool is_completed;
-       bool is_finish;
+
+       /* for rotation */
+       mm_util_rotation_e rotation;
 
        bool set_convert;
        bool set_crop;
        bool set_resize;
        bool set_rotate;
 
-       /* Src paramters */
-       guint src_buf_size; /**< for a standard colorspace format */
-       /* Dst paramters */
-       guint dst_buf_size;
-
        /* for multi instance */
+       mm_util_cb_s *_util_cb;
+       bool is_completed;
+       bool is_finish;
        GThread* thread;
        GAsyncQueue *queue;
 } mm_util_s;
index d847b47..fb1c466 100755 (executable)
@@ -21,7 +21,6 @@
 
 #include <gmodule.h>
 #include <limits.h>
-#include <inttypes.h>
 #include "mm_util_private.h"
 #include "mm_util_imgp.h"
 #include "mm_util_imgp_internal.h"
@@ -36,7 +35,7 @@
 #define GST "gstcs"
 
 typedef gboolean(*IMGPInfoFunc) (imgp_info_s *, const unsigned char *, unsigned char *, imgp_plugin_type_e);
-static int __mm_util_transform_exec(mm_util_s *handle, media_packet_h src_packet);
+static int __mm_util_transform_exec(mm_util_s *handle, color_image_data_s *source_image);
 
 static int check_valid_picture_size(int width, int height)
 {
@@ -661,12 +660,6 @@ static IMGPInfoFunc __mm_util_imgp_process(GModule *module)
        return mm_util_imgp_func;
 }
 
-static int _mm_util_transform_packet_finalize_callback(media_packet_h packet, int err, void *userdata)
-{
-       mm_util_debug("==> finalize callback func is called [%d]", err);
-       return MEDIA_PACKET_FINALIZE;
-}
-
 static int __mm_util_imgp_finalize(GModule *module, imgp_info_s *_imgp_info_s)
 {
        int ret = MM_UTIL_ERROR_NONE;
@@ -791,15 +784,12 @@ static int __mm_util_handle_init(mm_util_s *handle)
        }
 
        /* private values init */
-       handle->src = NULL;
        handle->dst = NULL;
        handle->dst_format = MM_UTIL_IMG_FMT_NUM;
-       handle->dst_rotation = MM_UTIL_ROTATION_NONE;
+       handle->rotation = MM_UTIL_ROTATION_NONE;
 
        handle->start_x = -1;
        handle->start_y = -1;
-       handle->src_width = 0;
-       handle->src_height = 0;
        handle->dst_width = 0;
        handle->dst_height = 0;
        handle->is_completed = FALSE;
@@ -822,147 +812,11 @@ static int __mm_util_handle_init(mm_util_s *handle)
        return ret;
 }
 
-static int __mm_util_handle_refresh(mm_util_s *handle)
-{
-       int ret = MM_UTIL_ERROR_NONE;
-
-       if (!handle) {
-               mm_util_error("[ERROR] - handle");
-               return MM_UTIL_ERROR_INVALID_OPERATION;
-       }
-
-       /* restore original settings */
-       if (handle->set_rotate && (handle->set_crop || handle->set_resize)) {
-               if ((handle->dst_rotation == MM_UTIL_ROTATION_90) || (handle->dst_rotation == MM_UTIL_ROTATION_270)) {
-                       unsigned int temp = 0;
-                       temp = handle->dst_width;
-                       handle->dst_width = handle->dst_height;
-                       handle->dst_height = temp;
-               }
-       }
-
-       handle->is_completed = FALSE;
-
-       handle->dst_packet = NULL;
-
-       return ret;
-}
-
-static media_format_mimetype_e __mm_util_mapping_imgp_format_to_mime(mm_util_img_format format)
-{
-       media_format_mimetype_e mimetype = -1;
-
-       switch (format) {
-       case MM_UTIL_IMG_FMT_NV12:
-               mimetype = MEDIA_FORMAT_NV12;
-               break;
-       case MM_UTIL_IMG_FMT_NV16:
-               mimetype = MEDIA_FORMAT_NV16;
-               break;
-       case MM_UTIL_IMG_FMT_YUYV:
-               mimetype = MEDIA_FORMAT_YUYV;
-               break;
-       case MM_UTIL_IMG_FMT_UYVY:
-               mimetype = MEDIA_FORMAT_UYVY;
-               break;
-       case MM_UTIL_IMG_FMT_YUV422:
-               mimetype = MEDIA_FORMAT_422P;
-               break;
-       case MM_UTIL_IMG_FMT_I420:
-               mimetype = MEDIA_FORMAT_I420;
-               break;
-       case MM_UTIL_IMG_FMT_YUV420:
-               mimetype = MEDIA_FORMAT_YV12;
-               break;
-       case MM_UTIL_IMG_FMT_RGB565:
-               mimetype = MEDIA_FORMAT_RGB565;
-               break;
-       case MM_UTIL_IMG_FMT_RGB888:
-               mimetype = MEDIA_FORMAT_RGB888;
-               break;
-       case MM_UTIL_IMG_FMT_RGBA8888:
-               mimetype = MEDIA_FORMAT_RGBA;
-               break;
-       case MM_UTIL_IMG_FMT_BGRA8888:
-               mimetype = MEDIA_FORMAT_BGRA;
-               break;
-       case MM_UTIL_IMG_FMT_ARGB8888:
-               mimetype = MEDIA_FORMAT_ARGB;
-               break;
-       case MM_UTIL_IMG_FMT_NV12_TILED:
-               mimetype = MEDIA_FORMAT_NV12T;
-               break;
-       default:
-               mimetype = -1;
-               mm_util_error("Not Supported Format [%d]", format);
-               break;
-       }
-
-       mm_util_debug("imgp fmt: %d mimetype fmt: %d", format, mimetype);
-
-       return mimetype;
-}
-
-static mm_util_img_format __mm_util_mapping_mime_format_to_imgp(media_format_mimetype_e mimetype)
-{
-       mm_util_img_format format = -1;
-
-       switch (mimetype) {
-       case MEDIA_FORMAT_NV12:
-               format = MM_UTIL_IMG_FMT_NV12;
-               break;
-       case MEDIA_FORMAT_NV16:
-               format = MM_UTIL_IMG_FMT_NV16;
-               break;
-       case MEDIA_FORMAT_YUYV:
-               format = MM_UTIL_IMG_FMT_YUYV;
-               break;
-       case MEDIA_FORMAT_UYVY:
-               format = MM_UTIL_IMG_FMT_UYVY;
-               break;
-       case MEDIA_FORMAT_422P:
-               format = MM_UTIL_IMG_FMT_YUV422;
-               break;
-       case MEDIA_FORMAT_I420:
-               format = MM_UTIL_IMG_FMT_I420;
-               break;
-       case MEDIA_FORMAT_YV12:
-               format = MM_UTIL_IMG_FMT_YUV420;
-               break;
-       case MEDIA_FORMAT_RGB565:
-               format = MM_UTIL_IMG_FMT_RGB565;
-               break;
-       case MEDIA_FORMAT_RGB888:
-               format = MM_UTIL_IMG_FMT_RGB888;
-               break;
-       case MEDIA_FORMAT_RGBA:
-               format = MM_UTIL_IMG_FMT_RGBA8888;
-               break;
-       case MEDIA_FORMAT_BGRA:
-               format = MM_UTIL_IMG_FMT_BGRA8888;
-               break;
-       case MEDIA_FORMAT_ARGB:
-               format = MM_UTIL_IMG_FMT_ARGB8888;
-               break;
-       case MEDIA_FORMAT_NV12T:
-               format = MM_UTIL_IMG_FMT_NV12_TILED;
-               break;
-       default:
-               format = -1;
-               mm_util_error("Not Supported Format [%d]", mimetype);
-               break;
-       }
-
-       mm_util_debug("mimetype: %d imgp fmt: %d", mimetype, format);
-
-       return format;
-}
-
 gpointer _mm_util_thread_repeate(gpointer data)
 {
        mm_util_s *handle = (mm_util_s *) data;
        int ret = MM_UTIL_ERROR_NONE;
-       media_packet_h pop_data = NULL;
+       mm_util_color_image_h pop_data = NULL;
 
        if (!handle) {
                mm_util_error("[ERROR] - handle");
@@ -971,7 +825,7 @@ gpointer _mm_util_thread_repeate(gpointer data)
 
        while (!handle->is_finish) {
                mm_util_debug("waiting...");
-               pop_data = (media_packet_h) g_async_queue_timeout_pop(handle->queue, 300 * G_TIME_SPAN_MILLISECOND);
+               pop_data = (mm_util_color_image_h)g_async_queue_timeout_pop(handle->queue, 300 * G_TIME_SPAN_MILLISECOND);
                mm_util_debug("get from data or timeout");
 
                if (pop_data == NULL) {
@@ -979,18 +833,19 @@ gpointer _mm_util_thread_repeate(gpointer data)
                        continue;
                }
 
-               ret = __mm_util_transform_exec(handle, pop_data); /* Need to block */
+               ret = __mm_util_transform_exec(handle, (color_image_data_s *)pop_data); /* Need to block */
                if (ret == MM_UTIL_ERROR_NONE)
                        mm_util_debug("Success - transform_exec");
                else
                        mm_util_error("Error - transform_exec");
 
                if (handle->_util_cb->completed_cb) {
-                       mm_util_debug("completed_cb");
-                       handle->_util_cb->completed_cb(&handle->dst_packet, ret, handle->_util_cb->user_data);
-                       mm_util_debug("completed_cb %p", &handle->dst);
+                       mm_util_debug("completed_cb is called");
+                       handle->_util_cb->completed_cb(handle->dst, ret, handle->_util_cb->user_data);
                }
-               __mm_util_handle_refresh(handle);
+               mm_util_destroy_color_image(pop_data);
+               mm_util_destroy_color_image(handle->dst);
+               handle->is_completed = FALSE;
        }
 
        mm_util_debug("exit thread");
@@ -1031,7 +886,7 @@ static int __mm_util_processing(mm_util_s *handle)
        unsigned char *dst_buf[4] = {NULL,};
        unsigned int dst_buf_size = 0;
        unsigned int src_width = 0, src_height = 0;
-       mm_util_img_format src_format;
+       mm_util_img_format src_format = -1;
        unsigned int src_index = 0, dst_index = 0;
 
        if (handle == NULL) {
@@ -1041,15 +896,15 @@ static int __mm_util_processing(mm_util_s *handle)
 
        mm_util_debug("src: %p, dst: %p", handle->src, handle->dst);
 
-       dst_buf[src_index] = calloc(1, handle->src_buf_size);
-       src_width = handle->src_width;
-       src_height = handle->src_height;
-       src_format = handle->src_format;
+       dst_buf[src_index] = calloc(1, handle->src->buffer_size);
+       src_width = handle->src->width;
+       src_height = handle->src->height;
+       src_format = handle->src->format;
        if (dst_buf[src_index] == NULL) {
                mm_util_error("[multi func] memory allocation error");
                return MM_UTIL_ERROR_INVALID_OPERATION;
        }
-       memcpy(dst_buf[src_index], handle->src, handle->src_buf_size);
+       memcpy(dst_buf[src_index], handle->src->buffer, handle->src->buffer_size);
        if (handle->set_crop) {
                dst_index++;
                __mm_util_get_crop_image_size(src_format, handle->dst_width, handle->dst_height, &dst_buf_size);
@@ -1106,13 +961,11 @@ static int __mm_util_processing(mm_util_s *handle)
                }
                src_index = dst_index;
                src_format = handle->dst_format;
-               handle->dst_width = src_width;
-               handle->dst_height = src_height;
        }
 
        if (handle->set_rotate) {
                dst_index++;
-               switch (handle->dst_rotation) {
+               switch (handle->rotation) {
                case  MM_UTIL_ROTATION_90:
                case MM_UTIL_ROTATION_270:
                        mm_util_get_image_size(src_format, src_height, src_width, &dst_buf_size);
@@ -1127,7 +980,7 @@ static int __mm_util_processing(mm_util_s *handle)
                        __mm_destroy_temp_buffer(dst_buf);
                        return MM_UTIL_ERROR_INVALID_OPERATION;
                }
-               ret = mm_util_rotate_image(dst_buf[src_index], src_width, src_height, src_format, dst_buf[dst_index], &handle->dst_width, &handle->dst_height, handle->dst_rotation);
+               ret = mm_util_rotate_image(dst_buf[src_index], src_width, src_height, src_format, dst_buf[dst_index], &handle->dst_width, &handle->dst_height, handle->rotation);
                if (ret != MM_UTIL_ERROR_NONE) {
                        __mm_destroy_temp_buffer(dst_buf);
                        mm_util_error("mm_util_rotate_image failed");
@@ -1139,14 +992,9 @@ static int __mm_util_processing(mm_util_s *handle)
        }
 
        if (dst_buf[dst_index] != NULL && dst_buf_size != 0) {
-               handle->dst = calloc(1, dst_buf_size);
-               if (handle->dst == NULL) {
-                       __mm_destroy_temp_buffer(dst_buf);
-                       mm_util_error("memory allocation failed");
-                       return MM_UTIL_ERROR_OUT_OF_MEMORY;
-               }
-               memcpy(handle->dst, dst_buf[dst_index], dst_buf_size);
-               handle->dst_buf_size = dst_buf_size;
+               ret = mm_util_set_color_image((mm_util_color_image_h)handle->dst, (int)src_width, (int)src_height, src_format, (void *)dst_buf[dst_index], (size_t)dst_buf_size);
+               if (ret != MM_UTIL_ERROR_NONE)
+                       mm_util_error("mm_util_set_color_image failed");
        }
        __mm_destroy_temp_buffer(dst_buf);
 
@@ -1155,206 +1003,33 @@ static int __mm_util_processing(mm_util_s *handle)
        return ret;
 }
 
-static int __mm_get_info_from_media_packet(media_packet_h pkt, mm_util_s *handle)
-{
-       int err = MEDIA_PACKET_ERROR_NONE;
-       media_format_mimetype_e mimetype = 0;
-       int width = 0, height = 0;
-       uint64_t size = 0;
-       void *ptr = NULL;
-       media_format_h fmt = NULL;
-
-       if ((pkt == NULL) || (handle == NULL)) {
-               mm_util_error("Invalid parameter");
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-
-       err = media_packet_get_format(pkt, &fmt);
-       if (err != MEDIA_PACKET_ERROR_NONE) {
-               mm_util_error("media_packet_get_format failed (%d)", err);
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-
-       err = media_format_get_video_info(fmt, &mimetype, &width, &height, NULL, NULL);
-       if (err != MEDIA_FORMAT_ERROR_NONE) {
-               mm_util_error("media_packet_get_format failed (%d)", err);
-               media_format_unref(fmt);
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-       media_format_unref(fmt);
-
-       err = media_packet_get_buffer_size(pkt, &size);
-       if (err != MEDIA_PACKET_ERROR_NONE) {
-               mm_util_error("media_packet_get_buffer_size failed (%d)", err);
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-
-       if (size) {
-               handle->src = NULL;
-               err = media_packet_get_buffer_data_ptr(pkt, &ptr);
-               if (err != MM_UTIL_ERROR_NONE) {
-                       mm_util_error("[src] media_packet_get_extra");
-                       return MM_UTIL_ERROR_INVALID_PARAMETER;
-               }
-               mm_util_debug("src buffer pointer: %p", ptr);
-       }
-
-       mm_util_debug("[Fotmat: %u] W x H : %d x %d", mimetype, width, height);
-       if ((width == 0) || (height == 0) || (size == 0) || (ptr == NULL)) {
-               mm_util_error("Invalid source packet");
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-
-       handle->src_format = __mm_util_mapping_mime_format_to_imgp(mimetype);
-       handle->src_width = width;
-       handle->src_height = height;
-       handle->src_buf_size = (guint)size;
-       handle->src = ptr;
-
-       if (handle->dst_format == MM_UTIL_IMG_FMT_NUM) {
-               mm_util_debug("dst format is equal to src format");
-               handle->dst_format = handle->src_format;
-       }
-
-       return MM_UTIL_ERROR_NONE;
-}
-
-static int __mm_create_media_format(mm_util_img_format format, unsigned int width, unsigned int height, media_format_h *new_fmt)
-{
-       int err = MEDIA_FORMAT_ERROR_NONE;
-
-       if ((new_fmt == NULL) || (width == 0) || (height == 0)) {
-               mm_util_error("Invalid parameter");
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-
-       err = media_format_create(new_fmt);
-       if (err != MEDIA_FORMAT_ERROR_NONE) {
-               mm_util_error("media_format_make_writable failed (%d)", err);
-               return MM_UTIL_ERROR_INVALID_OPERATION;
-       }
-
-       err = media_format_set_video_mime(*new_fmt, __mm_util_mapping_imgp_format_to_mime(format));
-       if (err != MEDIA_FORMAT_ERROR_NONE) {
-               media_format_unref(*new_fmt);
-               mm_util_error("media_format_set_video_mime failed (%d)", err);
-               return MM_UTIL_ERROR_INVALID_OPERATION;
-       }
-
-       err = media_format_set_video_width(*new_fmt, width);
-       if (err != MEDIA_FORMAT_ERROR_NONE) {
-               media_format_unref(*new_fmt);
-               mm_util_error("media_format_set_video_width failed (%d)", err);
-               return MM_UTIL_ERROR_INVALID_OPERATION;
-       }
-
-       err = media_format_set_video_height(*new_fmt, height);
-       if (err != MEDIA_FORMAT_ERROR_NONE) {
-               media_format_unref(*new_fmt);
-               mm_util_error("media_format_set_video_height failed (%d)", err);
-               return MM_UTIL_ERROR_INVALID_OPERATION;
-       }
-
-       return MM_UTIL_ERROR_NONE;
-}
-
-static int __mm_create_media_packet_with_buffer(media_format_h fmt, void *buffer, guint buffer_size, media_packet_h *pkt)
-{
-       int err = MEDIA_PACKET_ERROR_NONE;
-       uint64_t packet_buffer_size = 0;
-       size_t size = 0;
-       void *ptr = NULL;
-
-       if ((fmt == NULL) || (pkt == NULL) || (buffer == NULL) || (buffer_size == 0)) {
-               mm_util_error("Invalid parameter");
-               return MM_UTIL_ERROR_INVALID_PARAMETER;
-       }
-
-       err = media_packet_create_alloc(fmt, (media_packet_finalize_cb)_mm_util_transform_packet_finalize_callback, NULL, pkt);
-       if (err != MEDIA_PACKET_ERROR_NONE) {
-               mm_util_error("media_packet_create_alloc failed (%d)", err);
-               return MM_UTIL_ERROR_INVALID_OPERATION;
-       }
-
-       err = media_packet_get_buffer_size(*pkt, &packet_buffer_size);
-       if (err != MEDIA_PACKET_ERROR_NONE) {
-               mm_util_error("media_packet_get_buffer_size failed (%d)", err);
-               media_packet_destroy(*pkt);
-               return MM_UTIL_ERROR_INVALID_OPERATION;
-       }
-
-       err = media_packet_get_buffer_data_ptr(*pkt, &ptr);
-       if (err != MM_UTIL_ERROR_NONE) {
-               mm_util_error("media_packet_get_buffer_data_ptr failed (%d)", err);
-               media_packet_destroy(*pkt);
-               return MM_UTIL_ERROR_INVALID_OPERATION;
-       }
-
-       if (ptr == NULL || packet_buffer_size == 0) {
-               mm_util_error("The ptr(%p) and size(%" PRIu64 ") was wrong", ptr, packet_buffer_size);
-               media_packet_destroy(*pkt);
-               return MM_UTIL_ERROR_INVALID_OPERATION;
-       }
-
-       if ((uint64_t)buffer_size < packet_buffer_size) {
-               size = (size_t)buffer_size;
-       } else {
-               size = (size_t)packet_buffer_size;
-       }
-
-       mm_util_error("Size: result(%u) media_packet(%" PRIu64 ") use(%zu)", buffer_size, packet_buffer_size, size);
-       mm_util_debug("Success - media_packet is created (%p, %" PRIu64 ")", *pkt, packet_buffer_size);
-
-       memcpy(ptr, buffer, size);
-
-       return MM_UTIL_ERROR_NONE;
-}
-
-static int __mm_util_transform_exec(mm_util_s *handle, media_packet_h src_packet)
+static int __mm_util_transform_exec(mm_util_s *handle, color_image_data_s *source_image)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       media_format_h dst_fmt = NULL;
 
-       if ((handle == NULL) || (src_packet == NULL)) {
+       if ((handle == NULL) || (source_image == NULL)) {
                mm_util_error("Invalid parameter");
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-       ret = __mm_get_info_from_media_packet(src_packet, handle);
+       mm_util_debug("orig_image: %p [%zu] %d X %d (%d)", source_image->buffer, source_image->buffer_size,
+               source_image->width, source_image->height, source_image->format);
+
+       handle->src = source_image;
+       ret = mm_util_create_color_image((mm_util_color_image_h *)&handle->dst);
        if (ret != MM_UTIL_ERROR_NONE) {
-               mm_util_error("__mm_get_info_from_packet failed (%d)", ret);
+               mm_util_error("mm_util_create_color_image failed");
                return ret;
        }
-       mm_util_debug("src: %p (%u X %u)", src_packet, handle->src_width, handle->src_height);
 
        ret = __mm_util_processing(handle);
        if (ret != MM_UTIL_ERROR_NONE) {
                mm_util_error("__mm_util_processing failed (%d)", ret);
-               handle->dst_packet = NULL;
-               return ret;
-       }
-
-       mm_util_debug("handle->src: %p [%d] %d X %d (%d) => handle->dst: %p [%d] %d X %d (%d)",
-               handle->src, handle->src_format, handle->src_width, handle->src_height, handle->src_buf_size,
-               handle->dst, handle->dst_format, handle->dst_width, handle->dst_height, handle->dst_buf_size);
-
-       ret = __mm_create_media_format(handle->dst_format, handle->dst_width, handle->dst_height, &dst_fmt);
-       if (ret != MM_UTIL_ERROR_NONE) {
-               mm_util_error("__mm_create_media_format failed (%d)", ret);
-               MMUTIL_SAFE_FREE(handle->dst);
-               return ret;
-       }
-
-       ret = __mm_create_media_packet_with_buffer(dst_fmt, handle->dst, handle->dst_buf_size, &handle->dst_packet);
-       if (ret != MM_UTIL_ERROR_NONE) {
-               mm_util_error("__mm_create_media_packet failed (%d)", ret);
-               media_format_unref(dst_fmt);
-               MMUTIL_SAFE_FREE(handle->dst);
                return ret;
        }
 
-       media_format_unref(dst_fmt);
-       MMUTIL_SAFE_FREE(handle->dst);
+       mm_util_debug("result_image: %p [%zu] %d X %d (%u)", handle->dst->buffer, handle->dst->buffer_size,
+               handle->dst->width, handle->dst->height, handle->dst->format);
 
        return ret;
 }
@@ -1473,7 +1148,7 @@ int mm_util_set_rotation(mm_util_imgp_h imgp_handle, mm_util_img_rotate_type rot
        }
 
        handle->set_rotate = TRUE;
-       handle->dst_rotation = rotation;
+       handle->rotation = rotation;
 
        return ret;
 }
@@ -1500,7 +1175,103 @@ int mm_util_set_crop_area(mm_util_imgp_h imgp_handle, unsigned int start_x, unsi
        return ret;
 }
 
-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 mm_util_create_color_image(mm_util_color_image_h *image)
+{
+       int ret = MM_UTIL_ERROR_NONE;
+       color_image_data_s *color_image = NULL;
+
+       if (image == NULL) {
+               mm_util_error("[ERROR] - image");
+               return MM_UTIL_ERROR_INVALID_PARAMETER;
+       }
+
+       mm_util_error("Memory allocation s");
+
+       color_image = (color_image_data_s *)calloc(1, sizeof(color_image_data_s));
+       if (color_image == NULL) {
+               mm_util_error("Memory allocation failed");
+               return MM_UTIL_ERROR_OUT_OF_MEMORY;
+       }
+
+       mm_util_error("Memory allocation e");
+
+       *image = (mm_util_color_image_h)color_image;
+
+       return ret;
+}
+
+int mm_util_set_color_image(mm_util_color_image_h image, int width, int height, mm_util_img_format format, void *buffer, size_t buffer_size)
+{
+       int ret = MM_UTIL_ERROR_NONE;
+       color_image_data_s *color_image = (color_image_data_s *)image;
+
+       if (color_image == NULL) {
+               mm_util_error("[ERROR] - raw_image");
+               return MM_UTIL_ERROR_INVALID_PARAMETER;
+       }
+
+       if (buffer == NULL || buffer_size == 0) {
+               mm_util_error("[ERROR] - Invalid parameters");
+               return MM_UTIL_ERROR_INVALID_PARAMETER;
+       }
+
+       color_image->buffer = calloc(1, buffer_size);
+       if (color_image->buffer == NULL) {
+               mm_util_error("Memory allocation failed");
+               return MM_UTIL_ERROR_OUT_OF_MEMORY;
+       }
+       memcpy(color_image->buffer, buffer, buffer_size);
+       color_image->buffer_size = buffer_size;
+       color_image->width = width;
+       color_image->height = height;
+       color_image->format = format;
+
+       return ret;
+}
+
+int mm_util_get_color_image(mm_util_color_image_h image, int *width, int *height, mm_util_img_format *format, void **buffer, size_t *buffer_size)
+{
+       int ret = MM_UTIL_ERROR_NONE;
+       color_image_data_s *color_image = (color_image_data_s *)image;
+
+       if (color_image == NULL) {
+               mm_util_error("[ERROR] - raw_image");
+               return MM_UTIL_ERROR_INVALID_PARAMETER;
+       }
+
+       if (width != NULL)
+               *width = color_image->width;
+
+       if (height != NULL)
+               *height = color_image->height;
+
+       if (format != NULL)
+               *format = color_image->format;
+
+       if (buffer != NULL)
+               *buffer = color_image->buffer;
+
+       if (buffer_size != NULL)
+               *buffer_size = color_image->buffer_size;
+
+       return ret;
+}
+
+
+void mm_util_destroy_color_image(mm_util_color_image_h image)
+{
+       color_image_data_s *color_image = (color_image_data_s *)image;
+
+       if (color_image == NULL) {
+               mm_util_error("[ERROR] - image");
+               return;
+       }
+
+       MMUTIL_SAFE_FREE(color_image->buffer);
+       MMUTIL_SAFE_FREE(color_image);
+}
+
+int mm_util_transform(mm_util_imgp_h imgp_handle, mm_util_color_image_h image, mm_util_completed_callback completed_callback, void *user_data)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_s *handle = (mm_util_s *) imgp_handle;
@@ -1512,11 +1283,11 @@ int mm_util_transform(mm_util_imgp_h imgp_handle, media_packet_h src_packet, mm_
                return MM_UTIL_ERROR_INVALID_OPERATION;
        }
 
-       if (!src_packet) {
-               mm_util_error("[ERROR] - src_packet");
+       if (!image) {
+               mm_util_error("[ERROR] - image");
                return MM_UTIL_ERROR_INVALID_PARAMETER;
        } else {
-               mm_util_debug("src: %p", src_packet);
+               mm_util_debug("image: %p", image);
        }
 
        if (!completed_callback) {
@@ -1535,7 +1306,7 @@ int mm_util_transform(mm_util_imgp_h imgp_handle, media_packet_h src_packet, mm_
 
        if (handle->queue) {
                mm_util_debug("g_async_queue_push");
-               g_async_queue_push(handle->queue, GINT_TO_POINTER(src_packet));
+               g_async_queue_push(handle->queue, GINT_TO_POINTER(image));
                ret = __mm_util_create_thread(handle);
                if (ret != MM_UTIL_ERROR_NONE) {
                        mm_util_error("ERROR - Create thread");
index fceabac..e167c56 100755 (executable)
@@ -4,15 +4,7 @@ mm_util_imgp_testsuite_SOURCES = mm_util_imgp_testsuite.c
 
 mm_util_imgp_testsuite_CFLAGS = -I$(srcdir)/../include \
                                 -I$(srcdir)/../../common/include \
-                                -I$(includedir)/drm \
                                  $(GMODULE_CFLAGS) \
-                                 $(MMCAMCORDER_CFLAGS) \
-                                 $(DRM_CFLAGS) \
-                                 $(DRM_DEVEL_CFLAGS) \
-                                 $(MEDIA_CFLAGS) \
-                                 $(XFIXES_CFLAGS) \
-                                 $(DRI2PROTO_CFLAGS) \
-                                 $(DRI2_CFLAGS) \
                                  -fPIE -pie
 
 ############################################
@@ -20,13 +12,5 @@ mm_util_imgp_testsuite_CFLAGS = -I$(srcdir)/../include \
 mm_util_imgp_testsuite_DEPENDENCIES = $(srcdir)/../libmmutil_imgp.la
 
 mm_util_imgp_testsuite_LDADD = $(srcdir)/../libmmutil_imgp.la \
-                              $(GMODULE_LIBS) \
-                              $(MMCAMCORDER_LIBS) \
-                              $(DRM_LIBS) \
-                              $(DRM_DEVEL_LIBS) \
-                              $(MEDIA_LIBS) \
-                              $(XFIXES_LIBS) \
-                              $(DRI2PROTO_LIBS) \
-                              $(DRI2_LIBS) \
-                              $(MMLOG_LIBS)
+                              $(GMODULE_LIBS)
 
index af76ddc..2f251e9 100755 (executable)
 #include <stdlib.h>
 #include <string.h>
 #include <inttypes.h>
-
-#include <media_packet.h>
-#include "mm_util_imgp.h"
+#include <errno.h>
+#include <mm_util_imgp.h>
 
 #define MAX_STRING_LEN 128
 #define IMAGE_FORMAT_LABEL_BUFFER_SIZE 4
 #define IMGP_FREE(src) { if (src != NULL) {g_free(src); src = NULL; } }
 
-mm_util_imgp_h imgp_handle = 0;
+mm_util_imgp_h imgp_handle = NULL;
 bool completed = false;
 
 GCond g_thread_cond;
@@ -55,63 +54,10 @@ void _signal()
        g_mutex_unlock(&g_thread_mutex);
 }
 
-media_format_mimetype_e _format_to_mime(mm_util_img_format colorspace)
-{
-       media_format_mimetype_e mimetype = -1;
-
-       switch (colorspace) {
-       case MM_UTIL_IMG_FMT_NV12:
-               mimetype = MEDIA_FORMAT_NV12;
-               break;
-       case MM_UTIL_IMG_FMT_NV16:
-               mimetype = MEDIA_FORMAT_NV16;
-               break;
-       case MM_UTIL_IMG_FMT_YUYV:
-               mimetype = MEDIA_FORMAT_YUYV;
-               break;
-       case MM_UTIL_IMG_FMT_UYVY:
-               mimetype = MEDIA_FORMAT_UYVY;
-               break;
-       case MM_UTIL_IMG_FMT_YUV422:
-               mimetype = MEDIA_FORMAT_422P;
-               break;
-       case MM_UTIL_IMG_FMT_I420:
-               mimetype = MEDIA_FORMAT_I420;
-               break;
-       case MM_UTIL_IMG_FMT_RGB565:
-               mimetype = MEDIA_FORMAT_RGB565;
-               break;
-       case MM_UTIL_IMG_FMT_RGB888:
-               mimetype = MEDIA_FORMAT_RGB888;
-               break;
-       case MM_UTIL_IMG_FMT_RGBA8888:
-               mimetype = MEDIA_FORMAT_RGBA;
-               break;
-       case MM_UTIL_IMG_FMT_ARGB8888:
-               mimetype = MEDIA_FORMAT_ARGB;
-               break;
-       case MM_UTIL_IMG_FMT_BGRA8888:
-       case MM_UTIL_IMG_FMT_BGRX8888:
-       case MM_UTIL_IMG_FMT_NV61:
-       default:
-               mimetype = -1;
-               fprintf(stderr, "Not Supported Format\n");
-               break;
-       }
-
-       fprintf(stderr, "imgp fmt: %d mimetype fmt: %d\n", colorspace, mimetype);
-       return mimetype;
-}
-
-int _packet_finalize_callback(media_packet_h packet, int err, void *user_data)
-{
-       fprintf(stderr, "==> finalize callback func is called [%d] \n", err);
-       return MEDIA_PACKET_FINALIZE;
-}
-
-bool _transform_completed_cb(media_packet_h *packet, int error, void *user_data)
+bool _transform_completed_cb(mm_util_color_image_h image, int error, void *user_data)
 {
-       uint64_t size = 0;
+       int err = MM_UTIL_ERROR_NONE;
+       size_t size = 0;
        char* output_file = (char *)user_data;
        fprintf(stderr, "imgp_handle: %p\n", imgp_handle);
 
@@ -121,17 +67,16 @@ bool _transform_completed_cb(media_packet_h *packet, int error, void *user_data)
                fprintf(stderr, "completed\n");
                FILE *fp = fopen(output_file, "w");
                if (fp) {
-                       media_packet_get_buffer_size(*packet, &size);
                        void *dst = NULL;
-                       int err = media_packet_get_buffer_data_ptr(*packet, &dst);
-                       if (err != MEDIA_PACKET_ERROR_NONE) {
+                       err = mm_util_get_color_image(image, NULL, NULL, NULL, &dst, &size);
+                       if (err != MM_UTIL_ERROR_NONE) {
                                IMGP_FREE(dst);
                                fclose(fp);
                                fprintf(stderr, "Error media_packet_get_buffer_data_ptr (%d)\n", err);
                                _signal();
                                return FALSE;
                        }
-                       fprintf(stderr, "dst: %p [%" PRIu64 "]\n", dst, size);
+                       fprintf(stderr, "dst: %p [%zu]\n", dst, size);
                        fwrite(dst, 1, size, fp);
                        fprintf(stderr, "FREE\n");
                        fclose(fp);
@@ -143,8 +88,7 @@ bool _transform_completed_cb(media_packet_h *packet, int error, void *user_data)
        }
 
        completed = true;
-       fprintf(stderr, "Destory - dst packet\n");
-       media_packet_destroy(*packet);
+       fprintf(stderr, "Destory - destroy image\n");
 
        _signal();
 
@@ -158,14 +102,14 @@ int main(int argc, char *argv[])
        unsigned char *dst = NULL;
 
        if (argc < 12) {
-               fprintf(stderr, "Usage: mm_util_imgp_testsuite sync {filename} {command} src_width src_height src_foramt dst_width dst_height dst_format roation crop_start_x crop_start_y \n");
-               fprintf(stderr, "Usage: mm_util_imgp_testsuite async {filename} {command} src_width src_height src_foramt dst_width dst_height dst_format roation crop_start_x crop_start_y \n");
-               fprintf(stderr, "ex: mm_util_imgp_testsuite sync test.rgb resize 1920 1080 7 1280 720 7 0 0 0 \n");
+               fprintf(stderr, "Usage: %s sync {filename} {command} src_width src_height src_foramt dst_width dst_height dst_format roation crop_start_x crop_start_y \n", argv[0]);
+               fprintf(stderr, "Usage: %s async {filename} {command} src_width src_height src_foramt dst_width dst_height dst_format roation crop_start_x crop_start_y \n", argv[0]);
+               fprintf(stderr, "ex: %s sync test.rgb resize 1920 1080 7 1280 720 7 0 0 0 \n", argv[0]);
                return ret;
        }
 
-       uint64_t src_size = 0;
-       uint64_t dst_size = 0;
+       size_t src_size = 0;
+       size_t dst_size = 0;
        bool sync_mode = (strcmp(argv[1], "sync") == 0) ? TRUE : FALSE;
        char *filename = strdup(argv[2]);
        char *command = strdup(argv[3]);
@@ -181,9 +125,7 @@ int main(int argc, char *argv[])
        char output_file[40] = {};
 
        /* async mode */
-       media_packet_h src_packet;
-       void *ptr = NULL;
-       media_format_h fmt;
+       mm_util_color_image_h orig_image = NULL;
 
        unsigned int size = 0;
 
@@ -191,9 +133,9 @@ int main(int argc, char *argv[])
 
        /* mem allocation for src dst buffer */
        mm_util_get_image_size(src_format, src_width, src_height, &size);
-       src_size = (uint64_t)size;
+       src_size = (size_t)size;
        mm_util_get_image_size(dst_format, dst_width, dst_height, &size);
-       dst_size = (uint64_t)size;
+       dst_size = (size_t)size;
        src = calloc(1, src_size);
        dst = calloc(1, dst_size);
 
@@ -209,7 +151,7 @@ int main(int argc, char *argv[])
                        goto TEST_FAIL;
                }
 
-               if (fread(src, 1, (int)src_size, fp) == src_size)
+               if (fread(src, 1, src_size, fp) == src_size)
                        fprintf(stderr, "#Success# fread\n");
                else
                        fprintf(stderr, "#Error# fread\n");
@@ -255,7 +197,7 @@ int main(int argc, char *argv[])
                {  /* write output file */
                        FILE *fpout = fopen(output_file, "w");
                        if (fpout) {
-                               fprintf(stderr, "dst: %p [%" PRIu64 "]\n", dst, dst_size);
+                               fprintf(stderr, "dst: %p [%zu]\n", dst, dst_size);
                                fwrite(dst, 1, dst_size, fpout);
                                fprintf(stderr, "FREE\n");
                                fclose(fpout);
@@ -272,63 +214,21 @@ int main(int argc, char *argv[])
                        fprintf(stderr, "ERROR - Create Transcode Handle\n");
                        goto TEST_FAIL;
                }
-               if (media_format_create(&fmt) == MEDIA_FORMAT_ERROR_NONE) {
-                       if (media_format_set_video_mime(fmt, _format_to_mime(src_format)) != MEDIA_FORMAT_ERROR_NONE) {
-                               media_format_unref(fmt);
-                               fprintf(stderr, "[Error] Set - video mime\n");
-                               goto TEST_FAIL;
-                       }
-
-                       if (media_format_set_video_width(fmt, src_width) != MEDIA_FORMAT_ERROR_NONE) {
-                               media_format_unref(fmt);
-                               fprintf(stderr, "[Error] Set - video width\n");
-                               goto TEST_FAIL;
-                       }
 
-                       if (media_format_set_video_height(fmt, src_height) != MEDIA_FORMAT_ERROR_NONE) {
-                               media_format_unref(fmt);
-                               fprintf(stderr, "[Error] Set - video height\n");
-                               goto TEST_FAIL;
-                       }
-
-                       if (media_format_set_video_avg_bps(fmt, 15000000) != MEDIA_FORMAT_ERROR_NONE) {
-                               media_format_unref(fmt);
-                               fprintf(stderr, "[Error] Set - video avg bps\n");
-                               goto TEST_FAIL;
-                       }
-
-                       if (media_format_set_video_max_bps(fmt, 20000000) != MEDIA_FORMAT_ERROR_NONE) {
-                               media_format_unref(fmt);
-                               fprintf(stderr, "[Error] Set - video max bps\n");
-                               goto TEST_FAIL;
-                       }
-
-                       fprintf(stderr, "media_format_set_video_info success! w:%d, h:%d, format:%d\n", src_width, src_height, src_format);
+               ret = mm_util_create_color_image(&orig_image);
+               if (ret == MM_UTIL_ERROR_NONE) {
+                       fprintf(stderr, "Success - mm_util_create_color_image\n");
                } else {
-                       fprintf(stderr, "media_format_create failed...\n");
+                       fprintf(stderr, "ERROR - mm_util_create_color_image\n");
+                       goto TEST_FAIL;
                }
 
-               /* Set Source */
-               ret = media_packet_create_alloc(fmt, (media_packet_finalize_cb)_packet_finalize_callback, NULL, &src_packet);
+               ret = mm_util_set_color_image(orig_image, src_width, src_height, src_format, src, src_size);
                if (ret == MM_UTIL_ERROR_NONE) {
-                       fprintf(stderr, "Success - Create Media Packet(%p)\n", src_packet);
-                       uint64_t buffer_size = (uint64_t)size;
-                       if (media_packet_get_buffer_size(src_packet, &buffer_size) == MEDIA_PACKET_ERROR_NONE) {
-                               ptr = calloc(1, buffer_size);
-                               if (ptr == NULL) {
-                                       fprintf(stderr, "\tmemory allocation failed\n");
-                                       goto TEST_FAIL;
-                               }
-                               if (media_packet_get_buffer_data_ptr(src_packet, &ptr) == MEDIA_PACKET_ERROR_NONE) {
-                                       if (src != NULL && src_size > 0) {
-                                               memcpy(ptr, src, buffer_size);
-                                               fprintf(stderr, "memcpy\n");
-                                       }
-                               }
-                       }
+                       fprintf(stderr, "Success - mm_util_create_color_image\n");
                } else {
-                       fprintf(stderr, "ERROR - Create Media Packet\n");
-                       return ret;
+                       fprintf(stderr, "ERROR - mm_util_create_color_image\n");
+                       goto TEST_FAIL;
                }
 
                ret = mm_util_set_hardware_acceleration(imgp_handle, FALSE);
@@ -380,7 +280,7 @@ int main(int argc, char *argv[])
                }
 
                /* Transform */
-               ret = mm_util_transform(imgp_handle, src_packet, (mm_util_completed_callback) _transform_completed_cb, output_file);
+               ret = mm_util_transform(imgp_handle, orig_image, (mm_util_completed_callback) _transform_completed_cb, output_file);
                if (ret == MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "Success - Transform\n");
                } else {
@@ -411,9 +311,7 @@ TEST_FAIL:
        IMGP_FREE(command);
        IMGP_FREE(filename);
        if (!sync_mode) {
-               media_format_unref(fmt);
-               fprintf(stderr, "Destory - src packet\n");
-               media_packet_destroy(src_packet);
+               mm_util_destroy_color_image(orig_image);
                fprintf(stderr, "destroy\n");
        }
 
index e2fc256..42db1d4 100755 (executable)
@@ -11,13 +11,12 @@ libmmutil_jpeg_la_CFLAGS = -I$(srcdir)/include \
                                -I$(srcdir)/../common/include \
                                -I$(srcdir)/../imgp/include \
                                $(GLIB_CFLAGS) \
-                               $(MEDIA_CFLAGS) \
-                               -I/usr/include \
+                               $(DLOG_CFLAGS) \
                                $(srcdir)/../imgp/libmmutil_imgp.la
 
 libmmutil_jpeg_la_LIBADD = $(GLIB_LIBS) -ljpeg -ldl -lturbojpeg\
                                $(GMODULE_LIBS) \
-                               $(MEDIA_LIBS)
+                               $(DLOG_LIBS)
 
 libmmutil_jpeg_la_CFLAGS += -DLIBPREFIX=\"$(libdir)\"
 
index 60c7fd9..766795f 100755 (executable)
@@ -4,9 +4,8 @@ mm_util_jpeg_testsuite_SOURCES = mm_util_jpeg_testsuite.c
 
 mm_util_jpeg_testsuite_CFLAGS = -I$(srcdir)/../include \
                                -I$(srcdir)/../../common/include
-mm_util_jpeg_testsuite_CFLAGS += $(MEDIA_CFLAGS) \
-                                -fPIE -pie \
-                                $(TZ_PLATFORM_CONFIG_FLAGS)
+mm_util_jpeg_testsuite_CFLAGS += $(TZ_PLATFORM_CONFIG_FLAGS) \
+                                -fPIE -pie
 
 
 ############################################
@@ -14,6 +13,5 @@ mm_util_jpeg_testsuite_CFLAGS += $(MEDIA_CFLAGS) \
 mm_util_jpeg_testsuite_DEPENDENCIES = $(srcdir)/../libmmutil_jpeg.la
 
 mm_util_jpeg_testsuite_LDADD = $(srcdir)/../libmmutil_jpeg.la
-mm_util_jpeg_testsuite_LDADD += $(MEDIA_LIBS) \
-                               $(TZ_PLATFORM_CONFIG_LIBS)
+mm_util_jpeg_testsuite_LDADD += $(TZ_PLATFORM_CONFIG_LIBS)
 
index 9e878f1..f589667 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-utility
 Summary:    Multimedia Framework Utility Library
-Version:    0.47
+Version:    0.1.0
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
@@ -15,7 +15,6 @@ BuildRequires:  pkgconfig(gio-2.0)
 BuildRequires:  pkgconfig(gmodule-2.0)
 BuildRequires:  libjpeg-turbo-devel
 BuildRequires:  pkgconfig(libtzplatform-config)
-BuildRequires:  pkgconfig(capi-media-tool)
 BuildRequires:  pkgconfig(opencv)
 BuildRequires:  libpng-devel
 BuildRequires:  giflib-devel
old mode 100644 (file)
new mode 100755 (executable)
index c39bf87..710783e
@@ -11,13 +11,11 @@ libmmutil_png_la_SOURCES = mm_util_png.c
 libmmutil_png_la_CFLAGS = -I$(srcdir)/include \
                                -I$(srcdir)/../common/include \
                                $(GLIB_CFLAGS) \
-                               $(MEDIA_CFLAGS) \
-                               -I/usr/include \
-                               $(srcdir)/../imgp/libmmutil_imgp.la
+                               $(DLOG_CFLAGS)
 
 libmmutil_png_la_LIBADD = $(GLIB_LIBS) -lpng -ldl \
                                $(GMODULE_LIBS) \
-                               $(MEDIA_LIBS)
+                               $(DLOG_LIBS)
 
 libmmutil_png_la_CFLAGS += -DLIBPREFIX=\"$(libdir)\"
 
index 947982b..561cf49 100755 (executable)
@@ -4,9 +4,8 @@ mm_util_png_testsuite_SOURCES = mm_util_png_testsuite.c
 
 mm_util_png_testsuite_CFLAGS = -I$(srcdir)/../include \
                                -I$(srcdir)/../../common/include
-mm_util_png_testsuite_CFLAGS += $(MEDIA_CFLAGS) \
-                                -fPIE -pie \
-                                $(TZ_PLATFORM_CONFIG_FLAGS)
+mm_util_png_testsuite_CFLAGS += $(TZ_PLATFORM_CONFIG_FLAGS) \
+                                -fPIE -pie
 
 
 ############################################
@@ -14,6 +13,4 @@ mm_util_png_testsuite_CFLAGS += $(MEDIA_CFLAGS) \
 mm_util_png_testsuite_DEPENDENCIES = $(srcdir)/../libmmutil_png.la
 
 mm_util_png_testsuite_LDADD = $(srcdir)/../libmmutil_png.la
-mm_util_png_testsuite_LDADD += $(MEDIA_LIBS) \
-                               $(TZ_PLATFORM_CONFIG_LIBS)
-
+mm_util_png_testsuite_LDADD += $(TZ_PLATFORM_CONFIG_LIBS)