Use mm_util_encode_to_jpeg_memory() instead of old deprecated mm_util_jpeg_encode_to_... 36/231336/1 accepted/tizen_6.0_unified accepted/tizen_6.0_unified_hotfix accepted/tizen_6.5_unified accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix accepted/tizen_unified tizen tizen_6.0 tizen_6.0_hotfix tizen_6.5 tizen_7.0 tizen_7.0_hotfix accepted/tizen/6.0/unified/20201030.123808 accepted/tizen/6.0/unified/hotfix/20201103.052345 accepted/tizen/6.5/unified/20211028.093603 accepted/tizen/7.0/unified/20221110.061441 accepted/tizen/7.0/unified/hotfix/20221116.104505 accepted/tizen/unified/20200424.141606 submit/tizen/20200422.053736 submit/tizen/20200423.093243 submit/tizen_6.0/20201029.205101 submit/tizen_6.0_hotfix/20201102.192501 submit/tizen_6.0_hotfix/20201103.114801 submit/tizen_6.5/20211028.161601 tizen_6.0.m2_release tizen_6.5.m2_release tizen_7.0_m2_release
authorhj kim <backto.kim@samsung.com>
Tue, 21 Apr 2020 08:16:22 +0000 (17:16 +0900)
committerhj kim <backto.kim@samsung.com>
Tue, 21 Apr 2020 08:16:37 +0000 (17:16 +0900)
Change-Id: I90bf45f3f995cf12281aa6a352f3f57fe1ded9a4

camerasrc/src/gstcamerasrc.c
packaging/gst-plugins-camera-n4.spec

index 8d4734e40b12e34ae9b0197450fa3cdadefc2a57..2af1721b6c873f23ef2293f739d9bebc2abcbd02 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <mm_error.h>
 #include <mm_types.h>
+#include <mm_util_image.h>
 #include <mm_util_jpeg.h>
 
 #include "gstcamerasrc.h"
@@ -1934,16 +1935,18 @@ static gboolean _gst_camerasrc_NV21_to_I420(GstCameraSrc *camerasrc, unsigned ch
 
 static gboolean gst_camerasrc_jpeg_capture(GstCameraSrc *camerasrc, gint buffer_index, GstCameraBuffer *buffer)
 {
-       int ret = 0;
+       int ret = MM_UTIL_ERROR_NONE;
        unsigned char *buffer_I420 = NULL;
-       unsigned char *jpeg_result = NULL;
-       unsigned int jpeg_size = 0;
+       void *jpeg_result = NULL;
+       size_t jpeg_size = 0;
 
        GstCaps *main_caps = NULL;
        GstBuffer *main_buffer = NULL;
        GstSample *main_sample = NULL;
 
        camerasrc_frame_data_t frame_data;
+       mm_util_image_h decoded = NULL;
+       size_t src_size = 0;
 
        GST_INFO_OBJECT(camerasrc, "Start to encode image");
 
@@ -1967,22 +1970,19 @@ static gboolean gst_camerasrc_jpeg_capture(GstCameraSrc *camerasrc, gint buffer_
                return FALSE;
        }
 
-       ret = mm_util_jpeg_encode_to_memory((void **)&jpeg_result, &jpeg_size,
-                                           buffer_I420, camerasrc->width, camerasrc->height,
-                                           MM_UTIL_COLOR_YUV420, camerasrc->cap_jpg_quality);
-
+       src_size = (camerasrc->width * camerasrc->height * 3) >> 1;
+       ret = mm_image_create_image(camerasrc->width, camerasrc->height, MM_UTIL_COLOR_YUV420, buffer_I420, src_size, &decoded);
        /* release converted src buffer */
        free(buffer_I420);
-       buffer_I420 = NULL;
-
-       if (ret != MM_ERROR_NONE || jpeg_result == NULL) {
-               GST_ERROR_OBJECT(camerasrc, "jpeg encoding failed %p, 0x%x", jpeg_result, ret);
-
-               if (jpeg_result) {
-                       free(jpeg_result);
-                       jpeg_result = NULL;
-               }
+       if (ret != MM_UTIL_ERROR_NONE) {
+               GST_ERROR_OBJECT(camerasrc, "mm_image_create_image failed [%d]", ret);
+               return FALSE;
+       }
 
+       ret = mm_util_encode_to_jpeg_memory(decoded, camerasrc->cap_jpg_quality, &jpeg_result, &jpeg_size);
+       mm_image_destroy_image(decoded);
+       if (ret != MM_UTIL_ERROR_NONE) {
+               GST_ERROR_OBJECT(camerasrc, "mm_util_encode_to_jpeg_memory failed [%d]", ret);
                return FALSE;
        }
 
index 61d49f89b997f3ce012b3acea8f4a80847d4c212..bd42c6084353662dcd10b28dc7c66f9c0a108860 100644 (file)
@@ -1,6 +1,6 @@
 Name:       gst-plugins-camera-n4
 Summary:    GStreamer codec plugins package for N4
-Version:    0.0.9
+Version:    0.0.10
 Release:    0
 Group:      Multimedia/Framework
 License:    LGPL-2.1