daemon: Use capi-media-image-util for snapshot 31/305231/1
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 23 Jan 2024 08:26:17 +0000 (17:26 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 30 Jan 2024 07:23:38 +0000 (07:23 +0000)
[Version] 0.3.16

Change-Id: Ibf92fe58824b5580ece3219fbc9a457ef1870ab2
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
(cherry picked from commit 2f4396ef80e6acf226a26610a1ac8abbeb790b36)

packaging/espp-service.spec
project_def.prop
src/client/project_def.prop
src/daemon/espp_service_handler.c
src/daemon/meson.build
tizen-manifest.xml

index 5d9883d8cde098dc674e4f0e9203c67858fadc2c..fa38090282787b5431c40c967c0e9679c3ef6c9e 100644 (file)
@@ -1,6 +1,6 @@
 Name:       espp-service
 Summary:    ESPP service package which contains client lib. and daemon binary
-Version:    0.3.15
+Version:    0.3.16
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
@@ -18,9 +18,7 @@ BuildRequires: pkgconfig(json-glib-1.0)
 BuildRequires: pkgconfig(esplusplayer)
 %if "%{use_tizen_60}" != "1"
 BuildRequires: pkgconfig(libtbm)
-BuildRequires: pkgconfig(mm-common)
-BuildRequires: pkgconfig(mmutil-common)
-BuildRequires: pkgconfig(mmutil-imgp)
+BuildRequires: pkgconfig(capi-media-image-util)
 %endif
 %if "%{use_service_app}" == "1"
 BuildRequires: pkgconfig(capi-appfw-service-application)
index 3c93d8c043ab53f6a19de00cf1bd97817e019186..774c8d7302ccde1d504cd197e8b56d31dd063f1e 100644 (file)
@@ -11,7 +11,7 @@ profile = mobile-7.0
 USER_SRCS = ./src/daemon/*.c ./src/common/*.c
 
 # User Defines
-USER_DEFS = USE_DLOG USE_SERVICE_APP ESPP_SERVICE_VERSION="0.3.15"
+USER_DEFS = USE_DLOG USE_SERVICE_APP ESPP_SERVICE_VERSION="0.3.16"
 
 # User Includes
 USER_INC_DIRS = ./src/daemon ./src/common ./inc ./inc/esplusplayer_capi
index f7f3e726be017c43a12e58fd61d4ebc89c124ac0..e9b2a5d3e86dd19c25c794d0a0f517d6f739dd61 100644 (file)
@@ -11,7 +11,7 @@ profile = mobile-7.0
 USER_SRCS = ../common/*.c ./*.c
 
 # User Defines
-USER_DEFS = USE_DLOG USE_SERVICE_APP ESPP_SERVICE_VERSION="0.3.15"
+USER_DEFS = USE_DLOG USE_SERVICE_APP ESPP_SERVICE_VERSION="0.3.16"
 
 # User Includes
 USER_INC_DIRS = ../common ./
index 7e116191aecb7eb7ee17c87d6644bb01df03768e..7c3358de00c292c87d49324b2b10b26a8dcbf0a8 100644 (file)
@@ -20,9 +20,7 @@
 #include <inttypes.h>
 #ifndef USE_TIZEN_60
 #include <tbm_surface.h>
-#include <mm_util_image.h>
-#include <mm_util_imgp.h>
-#include <mm_error.h>
+#include <image_util.h>
 #endif
 
 #define USECONDS_TO_MSECONDS(usec) ((usec) / G_GINT64_CONSTANT (1000))
@@ -756,57 +754,80 @@ static void __handle_set_decoded_video_frame_buffer_type(handler_userdata_s *hda
 }
 
 #ifndef USE_TIZEN_60
-static int __convert_colorspace(unsigned char *src_data, size_t src_size, int src_w, int src_h, mm_util_color_format_e src_fmt, mm_util_color_format_e dst_fmt, snapshot_data_s *result)
+static int __convert_colorspace(unsigned char *src_data, size_t src_size, int src_w, int src_h, image_util_colorspace_e src_colorspace, image_util_colorspace_e dst_colorspace, snapshot_data_s *result)
 {
        int ret;
-       mm_util_image_h src_image;
-       mm_util_image_h dst_image;
+       image_util_image_h src_image = NULL;
+       image_util_image_h dst_image = NULL;
+       transformation_h transform = NULL;
        size_t size;
 
        RET_VAL_IF(src_data == NULL, -1, "src_data is NULL");
        RET_VAL_IF(result == NULL, -1, "result is NULL");
 
-       ret = mm_image_create_image(src_w, src_h, src_fmt, src_data, src_size, &src_image);
-       RET_VAL_IF(ret != MM_ERROR_NONE, -1, "failed to mm_image_create_image()");
+       ret = image_util_create_image(src_w, src_h, src_colorspace, src_data, src_size, &src_image);
+       RET_VAL_IF(ret != IMAGE_UTIL_ERROR_NONE, -1, "failed to image_util_create_image()");
 
-       ret = mm_util_convert_colorspace(src_image, dst_fmt, &dst_image);
-       mm_image_destroy_image(src_image);
-       RET_VAL_IF(ret != MM_ERROR_NONE, -1, "failed to mm_util_convert_colorspace()");
+       if ((ret = image_util_transform_create(&transform) != IMAGE_UTIL_ERROR_NONE)) {
+               LOG_ERROR("failed to image_util_transform_create(), ret[0x%x]", ret);
+               goto error;
+       }
+
+       if ((ret = image_util_transform_set_colorspace(transform, dst_colorspace) != IMAGE_UTIL_ERROR_NONE)) {
+               LOG_ERROR("failed to image_util_transform_set_colorspace(), ret[0x%x]", ret);
+               goto error;
+       }
 
-       mm_image_debug_image(dst_image, NULL);
+       if ((ret = image_util_transform_run2(transform, src_image, &dst_image) != IMAGE_UTIL_ERROR_NONE)) {
+               LOG_ERROR("failed to image_util_transform_run2(), ret[0x%x]", ret);
+               goto error;
+       }
+
+       if ((ret = image_util_get_image(dst_image, &result->width, &result->height, NULL, &result->data, &size) != IMAGE_UTIL_ERROR_NONE)) {
+               LOG_ERROR("failed to image_util_get_image(), ret[0x%x]", ret);
+               goto error;
+       }
 
-       ret = mm_image_get_image(dst_image, &result->width, &result->height, NULL, &result->data, &size);
-       mm_image_destroy_image(dst_image);
-       RET_VAL_IF(ret != MM_ERROR_NONE, -1, "failed to mm_image_get_image()");
+       image_util_transform_destroy(transform);
+       image_util_destroy_image(dst_image);
+       image_util_destroy_image(src_image);
 
        result->size = (uint32_t)size;
 
-       LOG_INFO("src[data:%p, size:%zu, %dx%d, fmt:%d] -> dst[data:%p, size:%u, %ux%u, fmt:%d]",
-               src_data, src_size, src_w, src_h, src_fmt, result->data, result->size, result->width, result->height, dst_fmt);
+       LOG_INFO("src[data:%p, size:%zu, %dx%d, colorspace:%d] -> dst[data:%p, size:%u, %ux%u, colorspace:%d]",
+               src_data, src_size, src_w, src_h, src_colorspace, result->data, result->size, result->width, result->height, dst_colorspace);
 
        return 0;
+error:
+       if (transform)
+               image_util_transform_destroy(transform);
+       if (dst_image)
+               image_util_destroy_image(dst_image);
+       if (src_image)
+               image_util_destroy_image(src_image);
+       return -1;
 }
 
-static int __get_mm_util_color_format(tbm_format in_format, mm_util_color_format_e *out_format)
+static int __get_image_util_colorspace(tbm_format in_format, image_util_colorspace_e *colorspace)
 {
        switch(in_format) {
                case TBM_FORMAT_NV12:
-                       *out_format = MM_UTIL_COLOR_NV12;
+                       *colorspace = IMAGE_UTIL_COLORSPACE_NV12;
                        break;
                case TBM_FORMAT_YUV420:
-                       *out_format = MM_UTIL_COLOR_YUV420;
+                       *colorspace = IMAGE_UTIL_COLORSPACE_I420;
                        break;
                case TBM_FORMAT_BGRA8888:
-                       *out_format = MM_UTIL_COLOR_BGRA;
+                       *colorspace = IMAGE_UTIL_COLORSPACE_BGRA8888;
                        break;
                case TBM_FORMAT_BGRX8888:
-                       *out_format = MM_UTIL_COLOR_BGRX;
+                       *colorspace = IMAGE_UTIL_COLORSPACE_BGRX8888;
                        break;
                case TBM_FORMAT_ARGB8888:
-                       *out_format = MM_UTIL_COLOR_ARGB;
+                       *colorspace = IMAGE_UTIL_COLORSPACE_ARGB8888;
                        break;
                default:
-                       LOG_ERROR("invalid format");
+                       LOG_ERROR("invalid tbm format");
                        return -1;
        }
        return 0;
@@ -820,7 +841,7 @@ static int __convert_colorspace_to_rgb24(tbm_surface_h tbm_surf, snapshot_data_s
        unsigned char *tmp_src = NULL;
        unsigned int i;
        tbm_surface_info_s info;
-       mm_util_color_format_e src_format;
+       image_util_colorspace_e src_colorspace;
 
        RET_VAL_IF(!tbm_surf, -1, "tbm_surf is NULL");
        RET_VAL_IF(!snapshot, -1, "snapshot is NULL");
@@ -833,13 +854,13 @@ static int __convert_colorspace_to_rgb24(tbm_surface_h tbm_surf, snapshot_data_s
        LOG_DEBUG("%c%c%c%c, %dx%d, size:%d, num of planes:%d",
                FOURCC_STR(info.format), info.width, info.height, info.size, info.num_planes);
 
-       if (__get_mm_util_color_format(info.format, &src_format) < 0) {
-               LOG_ERROR("failed to __get_mm_util_color_format()");
+       if (__get_image_util_colorspace(info.format, &src_colorspace) < 0) {
+               LOG_ERROR("failed to __get_image_util_color_space()");
                return -1;
        }
 
-       switch (src_format) {
-       case MM_UTIL_COLOR_NV12:
+       switch (src_colorspace) {
+       case IMAGE_UTIL_COLORSPACE_NV12:
                src_size = (info.width * info.height) + (info.width * (info.height >> 1));
 
                dst_buffer = (unsigned char *)g_malloc(src_size);
@@ -860,7 +881,7 @@ static int __convert_colorspace_to_rgb24(tbm_surface_h tbm_surf, snapshot_data_s
                        tmp_src += info.planes[1].stride;
                }
                break;
-       case MM_UTIL_COLOR_YUV420:
+       case IMAGE_UTIL_COLORSPACE_I420:
                src_size = (info.width * info.height) * 2;
 
                dst_buffer = (unsigned char *)g_malloc(src_size);
@@ -888,9 +909,9 @@ static int __convert_colorspace_to_rgb24(tbm_surface_h tbm_surf, snapshot_data_s
                        tmp_src += info.planes[2].stride;
                }
                break;
-       case MM_UTIL_COLOR_BGRX:
-       case MM_UTIL_COLOR_BGRA:
-       case MM_UTIL_COLOR_ARGB:
+       case IMAGE_UTIL_COLORSPACE_BGRA8888:
+       case IMAGE_UTIL_COLORSPACE_BGRX8888:
+       case IMAGE_UTIL_COLORSPACE_ARGB8888:
                src_size = (info.width * 4) * info.height;
 
                dst_buffer = (unsigned char *)g_malloc(src_size);
@@ -902,7 +923,7 @@ static int __convert_colorspace_to_rgb24(tbm_surface_h tbm_surf, snapshot_data_s
        }
 
        return __convert_colorspace(dst_buffer, src_size, info.width, info.height,
-               src_format, MM_UTIL_COLOR_RGB24, snapshot);
+               src_colorspace, IMAGE_UTIL_COLORSPACE_RGB888, snapshot);
 }
 
 static int __get_rgb24_frame(esplusplayer_handle espp, snapshot_data_s *snapshot)
index 409ddc36861290486eb0f582db6adc7377c69eb3..43e50dddf2a47f35f4c47053f082467a51732300 100644 (file)
@@ -14,10 +14,8 @@ if get_option('tizen-60')
   conf_data.set('USE_TIZEN_60', true)
 else
   tbm_dep = dependency('libtbm', required: true)
-  mm_common_dep = dependency('mm-common', required: true)
-  mm_util_dep = dependency('mmutil-common', required: true)
-  mmutil_imgp_dep = dependency('mmutil-imgp', required: true)
-  daemon_deps += [tbm_dep, mm_common_dep, mm_util_dep, mmutil_imgp_dep]
+  image_util_dep = dependency('capi-media-image-util', required: true)
+  daemon_deps += [tbm_dep, image_util_dep]
 endif
 message('bindir: '+ get_option('_bindir'))
 if get_option('service-app')
index 85c489f191b6e233ac00cf5084dea84416febbc1..f693d6e9596599e336daaad65a4a09e9c55bb465 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="7.0" package="com.samsung.tizen.espp-service" version="0.3.15">
+<manifest xmlns="http://tizen.org/ns/packages" api-version="7.0" package="com.samsung.tizen.espp-service" version="0.3.16">
     <profile name="mobile"/>
     <description>espp-service</description>
     <service-application appid="com.samsung.tizen.espp-service" auto-restart="false" exec="espp-service" multiple="false" nodisplay="false" on-boot="false" taskmanage="false" type="capp">