Use glib() APIs and Remove unnecesarry codes 42/231942/4
authorhj kim <backto.kim@samsung.com>
Mon, 27 Apr 2020 03:14:23 +0000 (12:14 +0900)
committerhj kim <backto.kim@samsung.com>
Tue, 28 Apr 2020 05:35:53 +0000 (14:35 +0900)
Change-Id: I0c01a9bd23c325a2081731ece555daf13eae29f3

gstcs/mm_util_gstcs.c
packaging/libmm-imgp-gstcs.spec

index a1cecf0..4c9a479 100644 (file)
@@ -289,10 +289,7 @@ static GstCaps* _mm_get_capabilities(mm_util_color_format_e color_format, unsign
                        "framerate", GST_TYPE_FRACTION, 1, 1,
                        NULL);
 
-       if (caps)
-               _mm_check_caps_format(caps);
-       else
-               gstcs_error("caps is NULL");
+       _mm_check_caps_format(caps);
 
        return caps;
 }
@@ -418,8 +415,7 @@ static int _mm_push_buffer_into_pipeline_new(unsigned char *src, gstreamer_s * p
        unsigned int stride_row = stride * byte_per_pixcel;
        unsigned int i = 0, y = 0;
 
-       data = (unsigned char *) malloc(src_size);
-       gstcs_retvm_if(data == NULL, GSTCS_ERROR_OUT_OF_MEMORY, "data is NULL");
+       data = (unsigned char *) g_malloc0(src_size);
 
        for (y = 0; y < height; y++) {
                guint8 *pLine = (guint8 *) &(src[src_row * y]);
@@ -562,16 +558,8 @@ static int _mm_imgp_gstcs_processing(gstreamer_s* pGstreamer_s, unsigned char *s
                                return GSTCS_ERROR_INVALID_OPERATION;
                        }
                        gstcs_debug("pGstreamer_s->output_buffer: %p\n", pGstreamer_s->output_buffer);
-                       *dst = calloc(1, buffer_size);
-                       if (*dst == NULL) {
-                               gstcs_error("ERROR - calloc ");
-                               gst_buffer_unref(pGstreamer_s->output_buffer);
-                               gst_object_unref(pGstreamer_s->pipeline);
-                               pGstreamer_s->output_buffer = NULL;
-                               return GSTCS_ERROR_INVALID_OPERATION;
-                       }
 
-                       memcpy(*dst, mapinfo.data, buffer_size);
+                       *dst = g_memdup(mapinfo.data, buffer_size);
                        pImgp_info->buffer_size = buffer_size;
                        gst_buffer_unmap(pGstreamer_s->output_buffer, &mapinfo);
                } else {
index 6e5098b..5016840 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-imgp-gstcs
 Summary:    Multimedia Framework Utility Library
-Version:    0.21
+Version:    0.22
 Release:    16
 Group:      System/Libraries
 License:    Apache-2.0
@@ -66,4 +66,4 @@ rm -rf %{buildroot}
 %{_libdir}/*.so*
 %if 0%{?gtests:1}
 %{_bindir}/gtest*
-%endif
\ No newline at end of file
+%endif