diff options
-rw-r--r-- | camerasrc/src/gstcamerasrc.c | 32 | ||||
-rw-r--r-- | packaging/gst-plugins-camera-n4.spec | 2 |
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 |