From 533170e65f4d982872dad4fee3e29648dddcac69 Mon Sep 17 00:00:00 2001 From: Ji Yong Min Date: Thu, 1 Oct 2015 14:01:30 +0900 Subject: [PATCH] Remove dependency of mm-log & mm-common in libmm-imgp-gstcs library Change-Id: I1cd81d13e5bb7654dd1e0ba64a8c47b0f79535dc --- configure.ac | 6 +--- gstcs/Makefile.am | 8 ++--- gstcs/include/mm_util_gstcs.h | 10 ++++++ gstcs/include/mm_util_gstcs_internal.h | 2 +- gstcs/mm_util_gstcs.c | 61 +++++++++++++++++----------------- packaging/libmm-imgp-gstcs.spec | 3 +- 6 files changed, 46 insertions(+), 44 deletions(-) diff --git a/configure.ac b/configure.ac index 7d5fcfa..b0dd5e9 100755 --- a/configure.ac +++ b/configure.ac @@ -31,11 +31,7 @@ AC_STRUCT_TM AC_FUNC_MALLOC AC_CHECK_FUNCS([memset strdup]) -PKG_CHECK_MODULES(MMCOMMON, mm-common) -AC_SUBST(MMCOMMON_CFLAGS) -AC_SUBST(MMCOMMON_LIBS) - -PKG_CHECK_MODULES(MMLOG, dlog) +PKG_CHECK_MODULES(DLOG, dlog) AC_SUBST(DLOG_CFLAGS) AC_SUBST(DLOG_LIBS) diff --git a/gstcs/Makefile.am b/gstcs/Makefile.am index 3c3ce01..11e613b 100755 --- a/gstcs/Makefile.am +++ b/gstcs/Makefile.am @@ -1,15 +1,14 @@ ACLOCAL_AMFLAGS='-I m4' lib_LTLIBRARIES = libmmutil_imgp_gstcs.la -#bin_PROGRAMS = mmutil_gstcs +#bin_PROGRAMS = mmutil_gstcs noinst_HEADERS = include/mm_util_gstcs.h \ include/mm_util_gstcs_internal.h libmmutil_imgp_gstcs_la_SOURCES = mm_util_gstcs.c - + libmmutil_imgp_gstcs_la_CFLAGS = -I$(srcdir)/include \ - $(MMCOMMON_CFLAGS) \ $(GLIB_CFLAGS) \ $(GST_CFLAGS) \ $(GSTAPP_CFLAGS) \ @@ -18,8 +17,7 @@ libmmutil_imgp_gstcs_la_CFLAGS = -I$(srcdir)/include \ $(GSTPBUTILS_CFLAGS) \ $(DLOG_CFLAGS) -libmmutil_imgp_gstcs_la_LIBADD = $(MMCOMMON_LIBS) \ - $(GLIB_LIBS) \ +libmmutil_imgp_gstcs_la_LIBADD = $(GLIB_LIBS) \ $(GST_LIBS) \ $(GSTAPP_LIBS) \ $(GST_VIDEO_LIBS) \ diff --git a/gstcs/include/mm_util_gstcs.h b/gstcs/include/mm_util_gstcs.h index efed447..7e8427f 100755 --- a/gstcs/include/mm_util_gstcs.h +++ b/gstcs/include/mm_util_gstcs.h @@ -77,6 +77,16 @@ typedef enum MM_UTIL_IMG_FMT_NUM, /**< Number of image formats */ } mm_util_img_format_e; +typedef enum +{ + GSTCS_ERROR_NONE = 0, /**< Successful */ + GSTCS_ERROR_INVALID_PARAMETER = -1, /**< Invalid parameter */ + GSTCS_ERROR_OUT_OF_MEMORY = -2, /**< Out of memory */ + GSTCS_ERROR_NO_SUCH_FILE = -3, /**< No such file */ + GSTCS_ERROR_INVALID_OPERATION = -4, /**< Internal error */ + GSTCS_ERROR_NOT_SUPPORTED_FORMAT = -5, /**< Not supported format */ +} gstcs_img_error_e; + /** * Image Process Info for dlopen */ diff --git a/gstcs/include/mm_util_gstcs_internal.h b/gstcs/include/mm_util_gstcs_internal.h index f6f8fc6..e32ad51 100755 --- a/gstcs/include/mm_util_gstcs_internal.h +++ b/gstcs/include/mm_util_gstcs_internal.h @@ -26,13 +26,13 @@ extern "C" { #endif +#include #include #include #include #include #include #include "mm_util_gstcs.h" -#include "mm_log.h" #ifdef LOG_TAG #undef LOG_TAG diff --git a/gstcs/mm_util_gstcs.c b/gstcs/mm_util_gstcs.c index a5df965..cc1ce87 100755 --- a/gstcs/mm_util_gstcs.c +++ b/gstcs/mm_util_gstcs.c @@ -19,10 +19,9 @@ * */ #include "mm_util_gstcs_internal.h" -#include #include #include -#include + #define MM_UTIL_ROUND_UP_2(num) (((num)+1)&~1) #define MM_UTIL_ROUND_UP_4(num) (((num)+3)&~3) #define MM_UTIL_ROUND_UP_8(num) (((num)+7)&~7) @@ -117,36 +116,36 @@ _mm_get_byte_per_pixcel(const char *__format_label) static int _mm_create_pipeline( gstreamer_s* pGstreamer_s) { - int ret = MM_ERROR_NONE; + int ret = GSTCS_ERROR_NONE; pGstreamer_s->pipeline= gst_pipeline_new ("videoconvert"); if (!pGstreamer_s->pipeline) { gstcs_error("pipeline could not be created. Exiting.\n"); - ret = MM_ERROR_IMAGE_INVALID_VALUE; + ret = GSTCS_ERROR_INVALID_PARAMETER; } pGstreamer_s->appsrc= gst_element_factory_make("appsrc","appsrc"); if (!pGstreamer_s->appsrc) { gstcs_error("appsrc could not be created. Exiting.\n"); - ret = MM_ERROR_IMAGE_INVALID_VALUE; + ret = GSTCS_ERROR_INVALID_PARAMETER; } pGstreamer_s->colorspace=gst_element_factory_make("videoconvert","colorspace"); if (!pGstreamer_s->colorspace) { gstcs_error("colorspace could not be created. Exiting.\n"); - ret = MM_ERROR_IMAGE_INVALID_VALUE; + ret = GSTCS_ERROR_INVALID_PARAMETER; } pGstreamer_s->videoscale=gst_element_factory_make("videoscale", "scale"); if (!pGstreamer_s->videoscale) { gstcs_error("videoscale could not be created. Exiting.\n"); - ret = MM_ERROR_IMAGE_INVALID_VALUE; + ret = GSTCS_ERROR_INVALID_PARAMETER; } pGstreamer_s->videoflip=gst_element_factory_make("videoflip", "flip"); if (!pGstreamer_s->videoflip) { gstcs_error("videoflip could not be created. Exiting.\n"); - ret = MM_ERROR_IMAGE_INVALID_VALUE; + ret = GSTCS_ERROR_INVALID_PARAMETER; } pGstreamer_s->appsink=gst_element_factory_make("appsink","appsink"); if (!pGstreamer_s->appsink) { gstcs_error("appsink could not be created. Exiting.\n"); - ret = MM_ERROR_IMAGE_INVALID_VALUE; + ret = GSTCS_ERROR_INVALID_PARAMETER; } return ret; } @@ -509,11 +508,11 @@ _mm_set_output_image_format_s_struct(imgp_info_s* pImgp_info, const image_format static int _mm_push_buffer_into_pipeline(imgp_info_s* pImgp_info, unsigned char *src, gstreamer_s * pGstreamer_s) { - int ret = MM_ERROR_NONE; + int ret = GSTCS_ERROR_NONE; if(pGstreamer_s->pipeline == NULL) { gstcs_error("pipeline is NULL\n"); - return MM_ERROR_IMAGE_INVALID_VALUE; + return GSTCS_ERROR_INVALID_PARAMETER; } gsize data_size = mm_setup_image_size(pImgp_info->input_format_label, pImgp_info->src_width, pImgp_info->src_height); @@ -521,7 +520,7 @@ _mm_push_buffer_into_pipeline(imgp_info_s* pImgp_info, unsigned char *src, gstre if(gst_buf==NULL) { gstcs_error("buffer is NULL\n"); - return MM_ERROR_IMAGE_INVALID_VALUE; + return GSTCS_ERROR_INVALID_PARAMETER; } gst_app_src_push_buffer (GST_APP_SRC (pGstreamer_s->appsrc), gst_buf); /* push buffer to pipeline */ @@ -531,7 +530,7 @@ _mm_push_buffer_into_pipeline(imgp_info_s* pImgp_info, unsigned char *src, gstre static int _mm_push_buffer_into_pipeline_new(image_format_s *input_format, image_format_s *output_format, unsigned char *src, gstreamer_s * pGstreamer_s) { - int ret = MM_ERROR_NONE; + int ret = GSTCS_ERROR_NONE; GstBuffer *gst_buf = NULL; unsigned int src_size = 0; unsigned char *data = NULL; @@ -540,7 +539,7 @@ _mm_push_buffer_into_pipeline_new(image_format_s *input_format, image_format_s * if(pGstreamer_s->pipeline == NULL) { gstcs_error("pipeline is NULL\n"); - return MM_ERROR_IMAGE_INVALID_VALUE; + return GSTCS_ERROR_INVALID_PARAMETER; } gstcs_debug("stride: %d, elevation: %d", stride, elevation); @@ -555,7 +554,7 @@ _mm_push_buffer_into_pipeline_new(image_format_s *input_format, image_format_s * data =(unsigned char *) g_malloc (src_size); if(data==NULL) { gstcs_error("app_buffer is NULL\n"); - return MM_ERROR_IMAGE_INVALID_VALUE; + return GSTCS_ERROR_INVALID_PARAMETER; } for (y = 0; y < (unsigned int)(input_format->height); y++) { guint8 *pLine = (guint8 *) &(src[src_row * y]); @@ -575,7 +574,7 @@ _mm_push_buffer_into_pipeline_new(image_format_s *input_format, image_format_s * if(gst_buf==NULL) { gstcs_error("buffer is NULL\n"); - return MM_ERROR_IMAGE_INVALID_VALUE; + return GSTCS_ERROR_INVALID_PARAMETER; } gst_app_src_push_buffer (GST_APP_SRC (pGstreamer_s->appsrc), gst_buf); /* push buffer to pipeline */ @@ -587,16 +586,16 @@ _mm_imgp_gstcs_processing( gstreamer_s* pGstreamer_s, unsigned char *src, unsign { GstBus *bus = NULL; GstStateChangeReturn ret_state; - int ret = MM_ERROR_NONE; + int ret = GSTCS_ERROR_NONE; if(src== NULL || dst == NULL) { gstcs_error("src || dst is NULL"); - return MM_ERROR_IMAGE_INVALID_VALUE; + return GSTCS_ERROR_INVALID_PARAMETER; } /*create pipeline*/ ret = _mm_create_pipeline(pGstreamer_s); - if(ret != MM_ERROR_NONE) { + if(ret != GSTCS_ERROR_NONE) { gstcs_error("ERROR - mm_create_pipeline "); } @@ -605,7 +604,7 @@ _mm_imgp_gstcs_processing( gstreamer_s* pGstreamer_s, unsigned char *src, unsign gstcs_error("ERROR - g_main_context_new "); gst_object_unref (pGstreamer_s->pipeline); g_free (pGstreamer_s); - return MM_ERROR_IMAGE_INTERNAL; + return GSTCS_ERROR_INVALID_OPERATION; } pGstreamer_s->loop = g_main_loop_new (pGstreamer_s->context, FALSE); if (pGstreamer_s->loop == NULL) { @@ -613,7 +612,7 @@ _mm_imgp_gstcs_processing( gstreamer_s* pGstreamer_s, unsigned char *src, unsign gst_object_unref (pGstreamer_s->pipeline); g_main_context_unref(pGstreamer_s->context); g_free (pGstreamer_s); - return MM_ERROR_IMAGE_INTERNAL; + return GSTCS_ERROR_INVALID_OPERATION; } g_main_context_push_thread_default(pGstreamer_s->context); @@ -633,7 +632,7 @@ _mm_imgp_gstcs_processing( gstreamer_s* pGstreamer_s, unsigned char *src, unsign gstcs_debug("Start mm_push_buffer_into_pipeline"); ret = _mm_push_buffer_into_pipeline(pImgp_info, src, pGstreamer_s); } - if(ret != MM_ERROR_NONE) { + if(ret != GSTCS_ERROR_NONE) { gstcs_error("ERROR - mm_push_buffer_into_pipeline "); gst_object_unref (pGstreamer_s->pipeline); g_main_context_unref(pGstreamer_s->context); @@ -705,7 +704,7 @@ _mm_imgp_gstcs_processing( gstreamer_s* pGstreamer_s, unsigned char *src, unsign g_main_context_unref(pGstreamer_s->context); g_main_loop_unref(pGstreamer_s->loop); g_free (pGstreamer_s); - return MM_ERROR_IMAGE_INTERNAL; + return GSTCS_ERROR_INVALID_OPERATION; } gstcs_debug("pGstreamer_s->output_buffer: 0x%2x\n", pGstreamer_s->output_buffer); memcpy(dst, mapinfo.data, buffer_size); @@ -778,7 +777,7 @@ _mm_imgp_gstcs(imgp_info_s* pImgp_info, unsigned char *src, unsigned char *dst) { image_format_s* input_format=NULL, *output_format=NULL; gstreamer_s* pGstreamer_s; - int ret = MM_ERROR_NONE; + int ret = GSTCS_ERROR_NONE; static const int max_argc = 50; gint* argc = NULL; gchar** argv = NULL; @@ -786,12 +785,12 @@ _mm_imgp_gstcs(imgp_info_s* pImgp_info, unsigned char *src, unsigned char *dst) if(pImgp_info == NULL) { gstcs_error("imgp_info_s is NULL"); - return MM_ERROR_IMAGE_INVALID_VALUE; + return GSTCS_ERROR_INVALID_PARAMETER; } if(src== NULL || dst == NULL) { gstcs_error("src || dst is NULL"); - return MM_ERROR_IMAGE_INVALID_VALUE; + return GSTCS_ERROR_INVALID_PARAMETER; } gstcs_debug("[src %p] [dst %p]", src, dst); @@ -808,7 +807,7 @@ _mm_imgp_gstcs(imgp_info_s* pImgp_info, unsigned char *src, unsigned char *dst) if (argv != NULL) { free(argv); } - return MM_ERROR_IMAGE_INVALID_VALUE; + return GSTCS_ERROR_INVALID_PARAMETER; } memset(argv, 0, sizeof(gchar*) * max_argc); gstcs_debug("memset argv"); @@ -837,7 +836,7 @@ _mm_imgp_gstcs(imgp_info_s* pImgp_info, unsigned char *src, unsigned char *dst) input_format= _mm_set_input_image_format_s_struct(pImgp_info); if (input_format == NULL) { gstcs_error("memory allocation failed"); - return MM_ERROR_IMAGE_NO_FREE_SPACE; + return GSTCS_ERROR_OUT_OF_MEMORY; } output_format= _mm_set_output_image_format_s_struct(pImgp_info, input_format); if (output_format == NULL) { @@ -845,16 +844,16 @@ _mm_imgp_gstcs(imgp_info_s* pImgp_info, unsigned char *src, unsigned char *dst) GSTCS_FREE(input_format->format_label); GSTCS_FREE(input_format->colorspace); GSTCS_FREE(input_format); - return MM_ERROR_IMAGE_NO_FREE_SPACE; + return GSTCS_ERROR_OUT_OF_MEMORY; } /* _format_label : I420, RGB888 etc*/ gstcs_debug("Start _mm_imgp_gstcs_processing "); ret =_mm_imgp_gstcs_processing(pGstreamer_s, src, dst, input_format, output_format, pImgp_info); /* input: buffer pointer for input image , input image format, input image width, input image height, output: buffer porinter for output image */ - if(ret == MM_ERROR_NONE) { + if(ret == GSTCS_ERROR_NONE) { gstcs_debug("End _mm_imgp_gstcs_processing [dst: %p]", dst); - }else if (ret != MM_ERROR_NONE) { + }else if (ret != GSTCS_ERROR_NONE) { gstcs_error("ERROR - _mm_imgp_gstcs_processing"); } diff --git a/packaging/libmm-imgp-gstcs.spec b/packaging/libmm-imgp-gstcs.spec index a4c7174..8169650 100755 --- a/packaging/libmm-imgp-gstcs.spec +++ b/packaging/libmm-imgp-gstcs.spec @@ -1,13 +1,12 @@ #sbs-git:slp/pkgs/l/libmm-imgp-gstcs libmm-imgp-gstcs 0.1 62b62e6d483557fc5750d1b4986e9a98323f1194 Name: libmm-imgp-gstcs Summary: Multimedia Framework Utility Library -Version: 0.6 +Version: 0.7 Release: 16 Group: System/Libraries License: Apache-2.0 Source0: %{name}-%{version}.tar.gz Source1001: libmm-imgp-gstcs.manifest -BuildRequires: pkgconfig(mm-common) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gstreamer-1.0) -- 2.7.4