summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhj kim <backto.kim@samsung.com>2020-04-21 17:16:22 +0900
committerhj kim <backto.kim@samsung.com>2020-04-21 17:16:37 +0900
commit6ada3d9b060113e9dd3871e247bbb920bad02966 (patch)
tree9e60092258f01126d4f0c13f04ec9fbd70f796d5
parentaf09f087f8f5120330609536be8aa251bfb9e56f (diff)
downloadgst-plugins-camera-n4-tizen_6.5.tar.gz
gst-plugins-camera-n4-tizen_6.5.tar.bz2
gst-plugins-camera-n4-tizen_6.5.zip
Change-Id: I90bf45f3f995cf12281aa6a352f3f57fe1ded9a4
-rw-r--r--camerasrc/src/gstcamerasrc.c32
-rw-r--r--packaging/gst-plugins-camera-n4.spec2
2 files changed, 17 insertions, 17 deletions
diff --git a/camerasrc/src/gstcamerasrc.c b/camerasrc/src/gstcamerasrc.c
index 8d4734e..2af1721 100644
--- a/camerasrc/src/gstcamerasrc.c
+++ b/camerasrc/src/gstcamerasrc.c
@@ -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;
}
diff --git a/packaging/gst-plugins-camera-n4.spec b/packaging/gst-plugins-camera-n4.spec
index 61d49f8..bd42c60 100644
--- a/packaging/gst-plugins-camera-n4.spec
+++ b/packaging/gst-plugins-camera-n4.spec
@@ -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