From: minje.ahn Date: Fri, 16 Feb 2024 02:05:13 +0000 (+0900) Subject: Use dlfnc instead of gmodule X-Git-Tag: accepted/tizen/unified/20240220.115633~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=192ba88c65e8f4d1af45e896846f331875efe034;p=platform%2Fcore%2Fmultimedia%2Flibmm-utility.git Use dlfnc instead of gmodule Change-Id: Iac10a0cb3459e673b4cc4d7a06b150ac31491273 Signed-off-by: minje.ahn --- diff --git a/imgp/CMakeLists.txt b/imgp/CMakeLists.txt index 2fb3f25..f8ad857 100644 --- a/imgp/CMakeLists.txt +++ b/imgp/CMakeLists.txt @@ -16,7 +16,7 @@ INCLUDE_DIRECTORIES(${INC_DIR} ../jpeg/include ) -SET(dependents "dlog glib-2.0 gmodule-2.0") +SET(dependents "dlog glib-2.0") INCLUDE(FindPkgConfig) pkg_check_modules(${fw_name} REQUIRED ${dependents}) @@ -39,7 +39,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}") aux_source_directory(. SOURCES) ADD_LIBRARY(${fw_name} SHARED ${SOURCES}) -TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS} mmutil_common) +TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS} mmutil_common -ldl) SET_TARGET_PROPERTIES(${fw_name} PROPERTIES VERSION ${VERSION} diff --git a/imgp/mm_util_imgp.c b/imgp/mm_util_imgp.c index 6970a38..af16cf9 100644 --- a/imgp/mm_util_imgp.c +++ b/imgp/mm_util_imgp.c @@ -19,8 +19,9 @@ * */ -#include #include +#include +#include #include "mm_util_private.h" #include "mm_util_imgp.h" #include "mm_util_imgp_internal.h" @@ -194,10 +195,10 @@ static int __mm_set_imgp_info_s(imgp_info_s *_imgp_info_s, mm_util_color_format_ return ret; } -static void __mm_util_imgp_finalize(GModule *module, imgp_info_s *_imgp_info_s) +static void __mm_util_imgp_finalize(void *module, imgp_info_s *_imgp_info_s) { if (module) - g_module_close(module); + dlclose(module); g_free(_imgp_info_s); } @@ -283,21 +284,18 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid } } -static IMGPInfoFunc __mm_util_initialize(GModule **module) +static IMGPInfoFunc __mm_util_initialize(void **module) { - GModule *_module = NULL; + void *_module = NULL; IMGPInfoFunc _func = NULL; - _module = g_module_open(PATH_GSTCS_LIB, G_MODULE_BIND_LAZY); + _module = dlopen(PATH_GSTCS_LIB, RTLD_LAZY); mm_util_retvm_if(!module, NULL, "%s module open failed", PATH_GSTCS_LIB); - mm_util_debug("module: %p, g_module_name: %s", _module, g_module_name(_module)); - - g_module_symbol(_module, IMGP_FUNC_NAME, (gpointer *)&_func); - + _func = dlsym(_module, IMGP_FUNC_NAME); if (!_func) { - mm_util_error("invalid function"); - g_module_close(_module); + mm_util_error("dlsym failed: %s", dlerror()); + dlclose(_module); return NULL; } @@ -318,7 +316,7 @@ int mm_util_convert_colorspace(mm_util_image_h src, mm_util_color_format_e color { int ret = MM_UTIL_ERROR_NONE; IMGPInfoFunc _mm_util_imgp_func = NULL; - GModule *_module = NULL; + void *_module = NULL; unsigned char *output_buffer = NULL; mm_image_info_s *_src = (mm_image_info_s *)src; mm_util_image_h _convert_image = NULL; @@ -389,7 +387,7 @@ int mm_util_resize_image(mm_util_image_h src, unsigned int width, unsigned int h { int ret = MM_UTIL_ERROR_NONE; IMGPInfoFunc _mm_util_imgp_func = NULL; - GModule *_module = NULL; + void *_module = NULL; unsigned char *output_buffer = NULL; mm_image_info_s *_src = (mm_image_info_s *)src; mm_util_image_h _resize_image = NULL; @@ -468,7 +466,7 @@ int mm_util_rotate_image(mm_util_image_h src, mm_util_rotate_type_e angle, mm_ut { int ret = MM_UTIL_ERROR_NONE; IMGPInfoFunc _mm_util_imgp_func = NULL; - GModule *_module = NULL; + void *_module = NULL; unsigned char *output_buffer = NULL; unsigned int uint_w = 0; unsigned int uint_h = 0; diff --git a/packaging/libmm-utility.spec b/packaging/libmm-utility.spec index acde0cb..811f551 100644 --- a/packaging/libmm-utility.spec +++ b/packaging/libmm-utility.spec @@ -14,7 +14,6 @@ BuildRequires: cmake BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gio-2.0) -BuildRequires: pkgconfig(gmodule-2.0) BuildRequires: pkgconfig(iniparser) BuildRequires: libjpeg-turbo-devel BuildRequires: pkgconfig(libtzplatform-config)