mmutil-bmp was just a wrapper of mmutil-magick.
and modules which used mmutil-bmp has been mofied to use mmutil-magick.
So remove it.
Change-Id: Ie3819fa4890308d7fbe9d4de94a33662b1bbc0ad
)
ADD_SUBDIRECTORY(common)
-ADD_SUBDIRECTORY(bmp)
ADD_SUBDIRECTORY(gif)
ADD_SUBDIRECTORY(imgcv)
ADD_SUBDIRECTORY(imgp)
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-SET(fw_name "mmutil_bmp")
-
-PROJECT(${fw_name})
-
-SET(VERSION_MAJOR 0)
-SET(VERSION "${VERSION_MAJOR}.0.0")
-SET(CMAKE_INSTALL_PREFIX /usr)
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-
-SET(INC_DIR
- include
- )
-INCLUDE_DIRECTORIES(${INC_DIR}
- ../common/include
- ../magick/include
- )
-
-SET(dependents "dlog glib-2.0")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${dependents})
-FOREACH(flag ${${fw_name}_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-
-IF("${ARCH}" STREQUAL "arm")
- ADD_DEFINITIONS("-DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DLIBPREFIX=\"${LIB_INSTALL_DIR}\"")
-ADD_DEFINITIONS("-DTIZEN_DEBUG")
-
-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 mmutil_magick)
-SET_TARGET_PROPERTIES(${fw_name}
- PROPERTIES
- VERSION ${VERSION}
- SOVERSION ${VERSION_MAJOR}
- CLEAN_DIRECT_OUTPUT 1
-)
-
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(
- DIRECTORY ${INC_DIR}/ DESTINATION include/mmf
- FILES_MATCHING
- PATTERN "*_internal.h" EXCLUDE
- PATTERN "*_private.h" EXCLUDE
- PATTERN "${INC_DIR}/*.h"
- )
-
-SET(PC_NAME mmutil-bmp)
-SET(PC_LDFLAGS -l${fw_name})
-SET(PC_FILE_NAME ${PC_NAME}.pc.in)
-
-CONFIGURE_FILE(
- ${PC_FILE_NAME}
- ${CMAKE_CURRENT_SOURCE_DIR}/${PC_NAME}.pc
- @ONLY
-)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PC_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-ADD_SUBDIRECTORY(test)
-IF(BUILD_GTESTS)
- ADD_SUBDIRECTORY(unittest)
-ENDIF(BUILD_GTESTS)
+++ /dev/null
-/*
- * libmm-utility
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Vineeth T M <vineeth.tm@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef __MM_UTIL_BMP_H__
-#define __MM_UTIL_BMP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include "mm_util_type.h"
-
-int mm_util_decode_from_bmp_file(const char *file_path, mm_util_image_h *decoded);
-int mm_util_decode_from_bmp_memory(void *memory, const size_t src_size, mm_util_image_h *decoded);
-int mm_util_encode_bmp_to_file(mm_util_image_h decoded, const char *file_path);
-int mm_util_encode_bmp_to_memory(mm_util_image_h decoded, void **buffer, size_t *size);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /*__MM_UTIL_BMP_H__*/
+++ /dev/null
-/*
- * libmm-utility
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Vineeth T M <vineeth.tm@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <stdlib.h>
-
-#include "mm_util_bmp.h"
-#include "mm_util_magick.h"
-
-
-int mm_util_decode_from_bmp_file(const char *file_path, mm_util_image_h *decoded)
-{
- return mm_util_decode_image_from_file(file_path, MM_UTIL_COLOR_RGBA, decoded);
-}
-
-int mm_util_decode_from_bmp_memory(void *memory, const size_t src_size, mm_util_image_h *decoded)
-{
- return mm_util_decode_image_from_buffer(memory, src_size, MM_UTIL_COLOR_RGBA, decoded);
-}
-
-int mm_util_encode_bmp_to_file(mm_util_image_h decoded, const char *file_path)
-{
- return mm_util_encode_image_to_file(decoded, file_path);
-}
-
-int mm_util_encode_bmp_to_memory(mm_util_image_h decoded, void **buffer, size_t *size)
-{
- return mm_util_encode_image_to_buffer(decoded, IMG_CODEC_BMP, buffer, size);
-}
+++ /dev/null
-prefix=@PREFIX@
-exec_prefix=/usr
-libdir=@LIB_INSTALL_DIR@
-includedir=/usr/include/mmf
-
-Name : @PC_NAME@
-Description : Multimedia Framework Utility Library
-Requires :
-Version : @VERSION@
-Libs : -L${libdir} @PC_LDFLAGS@
-Cflags : -I${includedir}
+++ /dev/null
-SET(fw_name "mmutil_bmp")
-SET(fw_test "${fw_name}-test")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED glib-2.0 dlog libtzplatform-config)
-FOREACH(flag ${${fw_test}_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE")
-
-aux_source_directory(. sources)
-FOREACH(src ${sources})
- GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
- MESSAGE("${src_name}")
- ADD_EXECUTABLE(${src_name} ${src})
- TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS} mmutil_common)
-ENDFOREACH()
+++ /dev/null
-/*
- * libmm-utility
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Vineeth T M <vineeth.tm@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <glib.h>
-#include <limits.h>
-#include <mm_util_bmp.h>
-#include <mm_util_image.h>
-#include <tzplatform_config.h>
-
-#define SAFE_FREE(x) { if (x != NULL) { free(x); x = NULL; } }
-#define SAFE_IMAGE_FREE(x) { if (x != NULL) { mm_image_destroy_image(x); x = NULL; } }
-
-#define DECODE_FILE_PATH tzplatform_mkpath(TZ_USER_CONTENT, "bmp_test_dec_file.raw")
-#define DECODE_MEM_PATH tzplatform_mkpath(TZ_USER_CONTENT, "bmp_test_dec_mem.raw")
-#define ENCODE_FILE_PATH tzplatform_mkpath(TZ_USER_CONTENT, "bmp_test_enc_file.bmp")
-#define ENCODE_MEM_PATH tzplatform_mkpath(TZ_USER_CONTENT, "bmp_test_enc_mem.bmp")
-
-typedef enum {
- TEST_AUTO,
- TEST_DECODE_FILE,
- TEST_DECODE_MEMORY,
- TEST_ENCODE_FILE,
- TEST_ENCODE_MEMORY,
- TEST_NUM,
-} bmp_test_mode_e;
-
-static char *MODE_TO_STR[] = {
- "AUTO",
- "DECODE_FILE",
- "DECODE_MEMORY",
- "ENCODE_FILE",
- "ENCODE_MEMORY",
- "",
-};
-
-/* for arguments */
-static int g_test_mode = 0;
-static char *g_path = NULL;
-static unsigned int g_width = 0;
-static unsigned int g_height = 0;
-
-/* for reading file */
-static void *g_readed_data = NULL;
-static size_t g_readed_size = 0;
-
-static mm_util_image_h g_decoded_data = NULL;
-
-static gboolean _read_file(char *path, void **data, size_t *length)
-{
- FILE *fp = NULL;
- long len = 0;
-
- if (!path || !data || length == 0) {
- fprintf(stderr, "\t[BMP_testsuite] invalid data\n");
- return FALSE;
- }
-
- fprintf(stderr, "\t[BMP_testsuite] %s read\n", path);
-
- fp = fopen(path, "r");
- if (fp == NULL) {
- fprintf(stderr, "\t[BMP_testsuite] fopen failed (%d) \n", errno);
- return FALSE;
- }
-
- if (fseek(fp, 0, SEEK_END) < 0) {
- fprintf(stderr, "\t[BMP_testsuite] fseek failed \n");
- fclose(fp);
- return FALSE;
- }
-
- len = ftell(fp);
- if (len < 0) {
- fprintf(stderr, "\t[BMP_testsuite] ftell failed \n");
- fclose(fp);
- return FALSE;
- }
-
- rewind(fp);
- *data = g_malloc0(len);
- *length = fread(*data, 1, (size_t)len, fp);
- if (*length != len) {
- fprintf(stderr, "\t[BMP_testsuite] fread failed \n");
- }
-
- fclose(fp);
-
- *length = (size_t)len;
-
- fprintf(stderr, "\t[BMP_testsuite] %s %zu read DONE\n", path, *length);
-
- return TRUE;
-}
-
-static gboolean _write_file(const char *path, void *data, size_t length)
-{
- FILE *fp = NULL;
- size_t len = 0;
-
- if (!path || !data || length == 0) {
- fprintf(stderr, "\t[BMP_testsuite] invalid data\n");
- return FALSE;
- }
-
- fprintf(stderr, "\t[BMP_testsuite] %s %p %zu write\n", path, data, length);
-
- fp = fopen(path, "w");
- if (fp == NULL) {
- fprintf(stderr, "\t[BMP_testsuite] fopen failed (%d) \n", errno);
- return FALSE;
- }
-
- len = fwrite(data, 1, length, fp);
- if (len != length) {
- fprintf(stderr, "\t[BMP_testsuite] fwrite failed \n");
- }
-
- fclose(fp);
- fp = NULL;
-
- fprintf(stderr, "\t[BMP_testsuite] %s write DONE\n", path);
-
- return TRUE;
-}
-
-gboolean _get_input_data(const char *argv, const long min, const long max, int *data)
-{
- if (argv == NULL || strlen(argv) == 0)
- return FALSE;
-
- long temp = g_ascii_strtoll(argv, NULL, 10);
- if (temp < min || temp > max)
- return FALSE;
-
- *data = (int)temp;
-
- return TRUE;
-}
-
-void _print_help(const char *argv0)
-{
- fprintf(stderr, "\t[usage]\n");
- fprintf(stderr, "\t\t1. decode & encode : %s mode path\n", argv0);
- fprintf(stderr, "\t\t2. decode : %s mode path\n", argv0);
- fprintf(stderr, "\t\t3. encode : %s mode path width height\n", argv0);
- fprintf(stderr, "\t\t4. mode : 0 - auto, 1 - decode from file, 2 - decode from memory, 3 - encode to file, 4 - encode to memory\n");
-}
-
-gboolean _get_arguments(int argc, char *argv[])
-{
- int width = 0, height = 0;
-
- if (FALSE == _get_input_data(argv[1], TEST_AUTO, TEST_NUM - 1, &g_test_mode)) {
- fprintf(stderr, "\t[BMP_testsuite] wrong mode(%s) for test\n", argv[1]);
- _print_help(argv[0]);
- return FALSE;
- }
-
- g_path = g_strdup(argv[2]);
-
- if ((g_test_mode == TEST_AUTO) || (g_test_mode == TEST_DECODE_FILE) || (g_test_mode == TEST_DECODE_MEMORY)) {
- /* do nothing */
- } else if (g_test_mode == TEST_ENCODE_FILE || g_test_mode == TEST_ENCODE_MEMORY) {
- if (argc < 4) {
- fprintf(stderr, "\t[BMP_testsuite] not enough args\n");
- _print_help(argv[0]);
- return FALSE;
- }
- if (FALSE == _get_input_data(argv[3], 0, INT_MAX, &width)) {
- fprintf(stderr, "\t[BMP_testsuite] wrong width %s\n", argv[3]);
- return FALSE;
- }
- g_width = (unsigned int)width;
- if (FALSE == _get_input_data(argv[4], 0, INT_MAX, &height)) {
- fprintf(stderr, "\t[BMP_testsuite] wrong height %s\n", argv[4]);
- return FALSE;
- }
- g_height = (unsigned int)height;
- } else {
- fprintf(stderr, "\t[BMP_testsuite] wrong mode for test %s\n", argv[1]);
- return FALSE;
- }
-
- return TRUE;
-}
-
-gboolean _test_decode(const bmp_test_mode_e mode)
-{
- int ret = 0;
- unsigned char *data = NULL;
- size_t size = 0;
-
- /* test decoding bmp */
- if (mode == TEST_DECODE_FILE) {
- ret = mm_util_decode_from_bmp_file(g_path, &g_decoded_data);
- if (ret != MM_UTIL_ERROR_NONE) {
- fprintf(stderr, "\t[BMP_testsuite] mm_util_decode_from_bmp_file failed %d\n", ret);
- return FALSE;
- }
- ret = mm_image_get_image(g_decoded_data, &g_width, &g_height, NULL, &data, &size);
- if (ret != MM_UTIL_ERROR_NONE) {
- fprintf(stderr, "\t[BMP_testsuite] mm_image_get_image failed %d\n", ret);
- return FALSE;
- }
- if (FALSE == _write_file(DECODE_FILE_PATH, data, size)) {
- fprintf(stderr, "\t[BMP_testsuite] writing decoded data failed : %s\n", DECODE_FILE_PATH);
- SAFE_FREE(data);
- return FALSE;
- }
- SAFE_FREE(data);
- } else if (mode == TEST_DECODE_MEMORY) {
- if (FALSE == _read_file(g_path, &g_readed_data, &g_readed_size)) {
- fprintf(stderr, "\t[BMP_testsuite] reading file error\n");
- return FALSE;
- }
-
- ret = mm_util_decode_from_bmp_memory(g_readed_data, g_readed_size, &g_decoded_data);
- if (ret != MM_UTIL_ERROR_NONE) {
- fprintf(stderr, "\t[BMP_testsuite] mm_util_decode_from_bmp_memory failed %d\n", ret);
- return FALSE;
- }
- ret = mm_image_get_image(g_decoded_data, &g_width, &g_height, NULL, &data, &size);
- if (ret != MM_UTIL_ERROR_NONE) {
- fprintf(stderr, "\t[BMP_testsuite] mm_image_get_image failed %d\n", ret);
- return FALSE;
- }
- if (FALSE == _write_file(DECODE_MEM_PATH, data, size)) {
- fprintf(stderr, "\t[BMP_testsuite] writing decoded data failed : %s\n", DECODE_MEM_PATH);
- SAFE_FREE(data);
- return FALSE;
- }
- SAFE_FREE(data);
- }
-
- return TRUE;
-}
-
-gboolean _test_encode(const bmp_test_mode_e mode)
-{
- int ret = 0;
- /* for encoding bmp to memory */
- void *encoded_data = NULL;
- size_t encoded_size = 0;
-
- if ((mode != TEST_ENCODE_FILE) && (mode != TEST_ENCODE_MEMORY))
- return TRUE;
-
- if (FALSE == _read_file(g_path, &g_readed_data, &g_readed_size)) {
- fprintf(stderr, "\t[BMP_testsuite] reading file error\n");
- return FALSE;
- }
- ret = mm_image_create_image(g_width, g_height, MM_UTIL_COLOR_RGBA, (unsigned char *)g_readed_data,
- g_readed_size, &g_decoded_data);
- if (ret != MM_UTIL_ERROR_NONE) {
- fprintf(stderr, "\t[BMP_testsuite] mm_image_create_image failed : %d\n", ret);
- return FALSE;
- }
-
- /* test encoding bmp */
- if (mode == TEST_ENCODE_FILE) {
- ret = mm_util_encode_bmp_to_file(g_decoded_data, ENCODE_FILE_PATH);
- if (ret != MM_UTIL_ERROR_NONE) {
- fprintf(stderr, "\t[BMP_testsuite] mm_util_encode_bmp_to_file failed : %d\n", ret);
- return FALSE;
- }
- } else if (mode == TEST_ENCODE_MEMORY) {
- ret = mm_util_encode_bmp_to_memory(g_decoded_data, &encoded_data, &encoded_size);
- if (ret != MM_UTIL_ERROR_NONE) {
- fprintf(stderr, "\t[BMP_testsuite] mm_util_encode_bmp_to_memory failed : %d\n", ret);
- SAFE_FREE(encoded_data);
- return FALSE;
- }
- if (FALSE == _write_file(ENCODE_MEM_PATH, encoded_data, encoded_size)) {
- fprintf(stderr, "\t[BMP_testsuite] writing decoded data failed : %s\n", ENCODE_MEM_PATH);
- SAFE_FREE(encoded_data);
- return FALSE;
- }
- }
-
- SAFE_FREE(encoded_data);
- return TRUE;
-}
-
-gboolean _test_auto()
-{
- bmp_test_mode_e test_mode = TEST_DECODE_FILE;
-
- while (test_mode < TEST_NUM) {
- fprintf(stderr, "\t[BMP_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST START\n", MODE_TO_STR[test_mode]);
- if (TEST_ENCODE_FILE == test_mode) {
- g_free(g_path);
- g_path = g_strdup(DECODE_FILE_PATH);
- }
- /* test decoding bmp */
- if ((test_mode == TEST_DECODE_FILE) || (test_mode == TEST_DECODE_MEMORY)) {
- if (FALSE == _test_decode(test_mode)) {
- fprintf(stderr, "\t[BMP_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST FAIL\n", MODE_TO_STR[test_mode]);
- return FALSE;
- }
- }
-
- /* test encoding bmp */
- if ((test_mode == TEST_ENCODE_FILE) || (test_mode == TEST_ENCODE_MEMORY)) {
- if (FALSE == _test_encode(test_mode)) {
- fprintf(stderr, "\t[BMP_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST FAIL\n", MODE_TO_STR[test_mode]);
- return FALSE;
- }
- }
-
- fprintf(stderr, "\t[BMP_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST SUCCESS\n", MODE_TO_STR[test_mode]);
-
- g_free(g_readed_data);
- SAFE_IMAGE_FREE(g_decoded_data);
- test_mode++;
- }
-
- return TRUE;
-}
-
-int main(int argc, char *argv[])
-{
- if (argc < 2) {
- _print_help(argv[0]);
- return 0;
- }
-
- if (FALSE == _get_arguments(argc, argv)) {
- fprintf(stderr, "\t[BMP_testsuite] _get_arguments failed\n");
- goto out;
- }
-
- /* test all functions automatically */
- if (g_test_mode == TEST_AUTO) {
- if (FALSE == _test_auto())
- fprintf(stderr, "\t[BMP_testsuite] _test_auto failed\n");
- goto out;
- }
-
- /* test decoding bmp */
- if ((g_test_mode == TEST_DECODE_FILE) || (g_test_mode == TEST_DECODE_MEMORY)) {
- if (FALSE == _test_decode(g_test_mode)) {
- fprintf(stderr, "\t[BMP_testsuite] _test_decode(%s) failed\n", MODE_TO_STR[g_test_mode]);
- goto out;
- }
- }
-
- /* test encoding bmp */
- if ((g_test_mode == TEST_ENCODE_FILE) || (g_test_mode == TEST_ENCODE_MEMORY)) {
- if (FALSE == _test_encode(g_test_mode)) {
- fprintf(stderr, "\t[BMP_testsuite] _test_encode(%s) failed\n", MODE_TO_STR[g_test_mode]);
- goto out;
- }
- }
-
-out:
- g_free(g_path);
- g_free(g_readed_data);
- SAFE_IMAGE_FREE(g_decoded_data);
-
- return 0;
-}
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(gtest-libmm-bmp C CXX)
-
-SET(GTEST_TEST "gtest-libmm-bmp")
-ADD_DEFINITIONS("-DUSE_DLOG")
-
-SET(REQUIRES_LIST ${REQUIRES_LIST}
- glib-2.0
- gio-2.0
- gmock
- dlog
- libtzplatform-config
-)
-
-SET(PKG_LIBRARIES ${PKG_LIBRARIES}
- "mmutil_common"
- "mmutil_bmp"
-)
-
-SET(RESOURCE_LIST ${RESOURCE_LIST}
- "libmm-bmp-unittest.bmp"
-)
-
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(GTEST_TEST_PKG REQUIRED ${REQUIRES_LIST})
-
-FOREACH(flag ${GTEST_TEST_PKG_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -fPIE")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
-
-FILE(GLOB GTEST_TEST_SRCS *.cpp)
-SET(GTEST_TEST_SRCS ${GTEST_TEST_SRCS})
-
-ADD_EXECUTABLE(${GTEST_TEST} ${GTEST_TEST_SRCS})
-TARGET_LINK_LIBRARIES(${GTEST_TEST} ${PKG_LIBRARIES} ${GTEST_TEST_LDFLAGS} ${GTEST_TEST_PKG_LDFLAGS} -ldl)
-
-INSTALL(TARGETS ${GTEST_TEST} RUNTIME DESTINATION bin)
-INSTALL(FILES ${RESOURCE_LIST} DESTINATION bin)
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "FileInterface.h"
-
-FileInterface::FileInterface(const char *path)
-{
- fp = NULL;
- fileSize = 0;
-
- FileInterface::Open(path);
-}
-
-FileInterface::~FileInterface(void)
-{
- if (fp)
- fclose(fp);
- fp = NULL;
-
- if (readData)
- free(readData);
- readData = NULL;
-}
-
-void FileInterface::Open(const char *path)
-{
- fp = fopen(path, "r");
- if (!fp)
- return ;
-
- long size = 0;
-
- if (fseek(fp, 0, SEEK_END) < 0)
- return ;
-
- size = (size_t)ftell(fp);
- rewind(fp);
-
- if (size < 0)
- return ;
- fileSize = (size_t)size;
-}
-
-gboolean FileInterface::ReadData()
-{
- if (!fp || fileSize == 0)
- return FALSE;
-
- readData = (unsigned char *)calloc(1, fileSize);
- if (fread(readData, 1, fileSize, fp) != fileSize) {
- return FALSE;
- }
- readDataSize = fileSize;
- return TRUE;
-}
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FILE_INTERFACE_H__
-#define __FILE_INTERFACE_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <glib.h>
-
-class FileInterface {
- private:
- FILE *fp;
- size_t fileSize;
-
- void Open(const char *path);
- public:
- unsigned char *readData;
- size_t readDataSize;
-
- FileInterface(const char *path);
- ~FileInterface(void);
- gboolean ReadData();
-};
-
-#endif /*__FILE_INTERFACE_H__*/
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <tzplatform_config.h>
-
-#include "libmm_bmp_unittest.h"
-#include "FileInterface.h"
-#include "mm_util_bmp.h"
-#include "mm_util_image.h"
-
-#define DECODE_FILE_PATH tzplatform_mkpath(TZ_SYS_BIN, "libmm-bmp-unittest.bmp")
-#define ENCODE_FILE_PATH tzplatform_mkpath(TZ_USER_CONTENT, "libmm-bmp-result.bmp")
-
-using ::testing::InitGoogleTest;
-using ::testing::Test;
-using ::testing::TestCase;
-
-class libmm_bmp_Test : public ::testing::Test {
- protected:
- void SetUp() {
- std::cout << "SetUp()" << std::endl;
- }
-
- void TearDown() {
- std::cout << "TearDown()" << std::endl;
- }
-};
-
-TEST(libmm_bmp_Test, mm_util_decode_from_bmp_file_p)
-{
- int ret = MM_UTIL_ERROR_NONE;
- mm_util_image_h decode_image = NULL;
-
- ret = mm_util_decode_from_bmp_file(DECODE_FILE_PATH, &decode_image);
- EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
- EXPECT_TRUE(mm_image_is_valid_image(decode_image));
-
- mm_image_destroy_image(decode_image);
-}
-
-TEST(libmm_bmp_Test, mm_util_decode_from_bmp_file_n)
-{
- int ret = MM_UTIL_ERROR_NONE;
- mm_util_image_h decode_image = NULL;
-
- ret = mm_util_decode_from_bmp_file(NULL, &decode_image);
- EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
-
- ret = mm_util_decode_from_bmp_file(DECODE_FILE_PATH, NULL);
- EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
-}
-
-TEST(libmm_bmp_Test, mm_util_decode_from_bmp_memory_p)
-{
- int ret = MM_UTIL_ERROR_NONE;
- gboolean err = TRUE;
- mm_util_image_h decode_image = NULL;
-
- FileInterface IFile = FileInterface(DECODE_FILE_PATH);
- err = IFile.ReadData();
- EXPECT_TRUE(err);
-
- ret = mm_util_decode_from_bmp_memory(IFile.readData, IFile.readDataSize, &decode_image);
- EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
- EXPECT_TRUE(mm_image_is_valid_image(decode_image));
-
- mm_image_destroy_image(decode_image);
-}
-
-TEST(libmm_bmp_Test, mm_util_decode_from_bmp_memory_n)
-{
- int ret = MM_UTIL_ERROR_NONE;
- gboolean err = TRUE;
- mm_util_image_h decode_image = NULL;
-
- FileInterface IFile = FileInterface(DECODE_FILE_PATH);
- err = IFile.ReadData();
- EXPECT_TRUE(err);
-
- ret = mm_util_decode_from_bmp_memory(NULL, IFile.readDataSize, &decode_image);
- EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
-
- ret = mm_util_decode_from_bmp_memory(IFile.readData, IFile.readDataSize, NULL);
- EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
-}
-
-TEST(libmm_bmp_Test, mm_util_encode_bmp_to_file_p)
-{
- int ret = MM_UTIL_ERROR_NONE;
- mm_util_image_h decode_image = NULL;
-
- ret = mm_util_decode_from_bmp_file(DECODE_FILE_PATH, &decode_image);
- EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
- EXPECT_TRUE(mm_image_is_valid_image(decode_image));
-
- ret = mm_util_encode_bmp_to_file(decode_image, ENCODE_FILE_PATH);
- EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
-
- mm_image_destroy_image(decode_image);
-}
-
-TEST(libmm_bmp_Test, mm_util_encode_bmp_to_file_n)
-{
- int ret = MM_UTIL_ERROR_NONE;
- mm_util_image_h decode_image = NULL;
-
- ret = mm_util_decode_from_bmp_file(DECODE_FILE_PATH, &decode_image);
- EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
- EXPECT_TRUE(mm_image_is_valid_image(decode_image));
-
- ret = mm_util_encode_bmp_to_file(NULL, ENCODE_FILE_PATH);
- EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
-
- ret = mm_util_encode_bmp_to_file(decode_image, NULL);
- EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
-
- mm_image_destroy_image(decode_image);
-}
-
-TEST(libmm_bmp_Test, mm_util_encode_bmp_to_memory_p)
-{
- int ret = MM_UTIL_ERROR_NONE;
- mm_util_image_h decode_image = NULL;
- void *buffer = NULL;
- size_t size = 0;
-
- ret = mm_util_decode_from_bmp_file(DECODE_FILE_PATH, &decode_image);
- EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
- EXPECT_TRUE(mm_image_is_valid_image(decode_image));
-
- ret = mm_util_encode_bmp_to_memory(decode_image, &buffer, &size);
- EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
- EXPECT_TRUE(buffer != NULL);
- EXPECT_NE(size, 0);
-
- mm_image_destroy_image(decode_image);
-
- if (buffer != NULL)
- free(buffer);
-}
-
-TEST(libmm_bmp_Test, mm_util_encode_bmp_to_memory_n)
-{
- int ret = MM_UTIL_ERROR_NONE;
- mm_util_image_h decode_image = NULL;
- void *buffer = NULL;
- size_t size = 0;
-
- ret = mm_util_decode_from_bmp_file(DECODE_FILE_PATH, &decode_image);
- EXPECT_EQ(ret, MM_UTIL_ERROR_NONE);
- EXPECT_TRUE(mm_image_is_valid_image(decode_image));
-
- ret = mm_util_encode_bmp_to_memory(NULL, &buffer, &size);
- EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
-
- ret = mm_util_encode_bmp_to_memory(decode_image, NULL, &size);
- EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
-
- ret = mm_util_encode_bmp_to_memory(decode_image, &buffer, NULL);
- EXPECT_EQ(ret, MM_UTIL_ERROR_INVALID_PARAMETER);
-
- mm_image_destroy_image(decode_image);
-}
-
-int main(int argc, char **argv)
-{
- InitGoogleTest(&argc, argv);
-
- return RUN_ALL_TESTS();
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __LIB_MM_BMP_UNITTEST_H__
-#define __LIB_MM_BMP_UNITTEST_H__
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#undef LOG_TAG
-#define LOG_TAG "GTEST_LIBMM_BMP"
-
-#endif /*__LIB_MM_BMP_UNITTEST_H__*/
Name: libmm-utility
Summary: Multimedia Framework Utility Library
-Version: 0.1.43
+Version: 0.1.44
Release: 0
Group: System/Libraries
License: Apache-2.0