-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6...2.8.12)
PROJECT(media-service C CXX)
SET(VERSION_MAJOR 1)
SET(VERSION "${VERSION_MAJOR}.0.0")
CONFIGURE_FILE(libmedia-service.pc.in libmedia-service.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmedia-service.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-IF(BUILD_GTESTS)
- ADD_SUBDIRECTORY(unittest)
-ENDIF(BUILD_GTESTS)
-
LINK_DIRECTORIES(${LIB_INSTALL_DIR})
ADD_LIBRARY(${MEDIASERVICE-LIB} SHARED ${SRCS})
#ifndef _MEDIA_SVC_H_
#define _MEDIA_SVC_H_
-#include <media-util.h>
#include <stdbool.h>
+#include <sys/types.h>
#include <sqlite3.h>
+#include <glib.h>
#ifdef __cplusplus
extern "C" {
int media_svc_set_item_validity(const char *path, int validity, uid_t uid);
int media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid);
-int media_svc_send_dir_update_noti(const char *dir_path, const char *folder_id, media_item_update_type_e update_type, int pid);
-int media_svc_publish_noti(media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type);
+int media_svc_send_dir_update_noti(const char *dir_path, const char *folder_id, int update_type, int pid);
+int media_svc_publish_update_noti(const char *path, int media_type, const char *uuid, const char *mime_type);
int media_svc_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity);
int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid);
int media_svc_create_thumbnail(const char *file_path, int media_type, uid_t uid, char **thumbnail_path);
int media_svc_get_book_by_keyword(sqlite3 *handle, const char *keyword, uid_t uid, GList **result);
+int media_svc_check_db(sqlite3 *handle, uid_t uid);
#ifdef __cplusplus
}
BuildRequires: pkgconfig(libpodofo)
BuildRequires: pkgconfig(iniparser)
-%if 0%{?gtests:1}
-BuildRequires: pkgconfig(gmock)
-%endif
-
%description
This package is a library that provides the media information service for the multimedia applications.
%build
export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE -DSYSCONFDIR=\\\"%{_sysconfdir}\\\" -DPATH_LIBDIR=\\\"%{_libdir}\\\""
-%cmake . -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0}
+%cmake .
make %{?jobs:-j%jobs}
%install
%{_libdir}/libmedia-content-plugin.so
%{_libdir}/libmedia-content-plugin.so.*
%{_libdir}/libmedia-ebook-plugin.so
-%if 0%{?gtests:1}
-%{_bindir}/gtest*
-%endif
#License
%license LICENSE.APLv2.0
*
*/
-#include <string.h>
-#include <mm_file.h>
-#include <media-util.h>
+#include <stddef.h>
#include "media-svc.h"
-#include "media-svc-util.h"
int insert_item_begin(bool with_noti, int from_pid)
{
int send_dir_update_noti(const char *dir_path, const char *folder_id, int update_type, int pid)
{
- return media_svc_send_dir_update_noti(dir_path, folder_id, (media_item_update_type_e)update_type, pid);
+ return media_svc_send_dir_update_noti(dir_path, folder_id, update_type, pid);
}
int check_db(sqlite3 *handle, uid_t uid)
{
- int ret = MS_MEDIA_ERR_NONE;
- bool exist = false;
-
- ret = media_svc_check_table_exist(handle, &exist);
- if (ret != MS_MEDIA_ERR_NONE)
- return ret;
-
- if (!exist)
- ret = media_svc_create_table(uid);
-
- return ret;
+ return media_svc_check_db(handle, uid);
}
int check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity, uid_t uid)
*
*/
-#include <media-util-err.h>
#include "media-svc-album.h"
#include "media-svc-debug.h"
#include "media-svc-env.h"
*/
#include <unistd.h>
-#include <media-util.h>
+#include <media-util-db.h>
#include <errno.h>
+
#include "media-svc-env.h"
#include "media-svc-debug.h"
#include "media-svc-util.h"
#include "media-svc-db-utils.h"
-#include "media-util-err.h"
-#include "media-util-db.h"
#include "media-svc-media.h"
static GHashTable *table;
*/
#include <glib/gstdio.h>
-#include <media-util-err.h>
+#include <media-util-user.h>
+
#include "media-svc-media-folder.h"
#include "media-svc-debug.h"
#include "media-svc-env.h"
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
-#include <media-util-err.h>
#include "media-svc-media.h"
#include "media-svc-media-folder.h"
#include "media-svc-debug.h"
g_free(item);
}
-int _media_svc_publish_noti(media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type)
+int _media_svc_publish_noti(media_item_update_type_e update_type, const char *path, int media_type, const char *uuid, const char *mime_type)
{
int ret = MS_MEDIA_ERR_NONE;
media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
int ret = MS_MEDIA_ERR_NONE;
media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
- ret = media_db_update_send(pid, MS_MEDIA_ITEM_DIRECTORY, update_type, path, uuid, MS_MEDIA_UNKNOWN, NULL);
+ ret = media_db_update_send(pid, MS_MEDIA_ITEM_DIRECTORY, update_type, path, uuid, 0, NULL);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Send dir noti failed[%d][%s]", ret, path);
media_svc_sec_debug("Send dir noti [%s]", path);
*
*/
-#include "media-util-err.h"
+
+#include <media-util-user.h>
#include "media-svc-debug.h"
#include "media-svc-env.h"
#include "media-svc-db-utils.h"
#include <aul/aul.h>
#include <mm_file.h>
#include <libexif/exif-data.h>
-#include <media-util.h>
#include <uuid/uuid.h>
#include <media-thumbnail.h>
+#include <media-util-user.h>
#include "media-svc-util.h"
#include "media-svc-db-utils.h"
#include "media-svc-debug.h"
//1. make thumb path
ret = __media_svc_get_thumbnail_path(thumb_path, path, NULL, uid);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("Failed to create thumbnail path[%d]", ret);
- g_strlcpy(thumb_path, "", MAX_FILEPATH_LEN);
- return ret;
- }
+ media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Failed to create thumbnail path[%d]", ret);
//2. save thumbnail
if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE)
return ret;
}
-int media_svc_send_dir_update_noti(const char *dir_path, const char *folder_id, media_item_update_type_e update_type, int pid)
+int media_svc_send_dir_update_noti(const char *dir_path, const char *folder_id, int update_type, int pid)
{
media_svc_retvm_if(!STRING_VALID(dir_path), MS_MEDIA_ERR_INVALID_PARAMETER, "dir_path is NULL");
- return _media_svc_publish_dir_noti(update_type, dir_path, folder_id, pid);
+ return _media_svc_publish_dir_noti((media_item_update_type_e)update_type, dir_path, folder_id, pid);
}
-int media_svc_publish_noti(media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type)
+int media_svc_publish_update_noti(const char *path, int media_type, const char *uuid, const char *mime_type)
{
- return _media_svc_publish_noti(update_type, path, media_type, uuid, mime_type);
+ return _media_svc_publish_noti(MS_MEDIA_ITEM_UPDATE, path, media_type, uuid, mime_type);
}
int media_svc_set_storage_validity(const char *storage_id, int validity, uid_t uid)
char *sql = NULL;
// 1. Check media type
- if (media_type != MS_MEDIA_IMAGE && media_type != MS_MEDIA_VIDEO)
+ if (media_type != MEDIA_SVC_MEDIA_TYPE_IMAGE && media_type != MEDIA_SVC_MEDIA_TYPE_VIDEO)
return MS_MEDIA_ERR_THUMB_UNSUPPORTED;
// 2. try to create thumbnail
return ret;
}
+
+int media_svc_check_db(sqlite3 *handle, uid_t uid)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+ bool exist = false;
+
+ ret = media_svc_check_table_exist(handle, &exist);
+ if (ret != MS_MEDIA_ERR_NONE)
+ return ret;
+
+ if (!exist)
+ ret = media_svc_create_table(uid);
+
+ return ret;
+}
\ No newline at end of file
#include <sqlite3.h>
#include <stdbool.h>
-#include <media-util.h>
int _media_svc_update_folder_modified_time(const char *folder_path, uid_t uid);
int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, long long int *folder_id, uid_t uid);
int pid;
media_item_type_e update_item;
media_item_update_type_e update_type;
- media_type_e media_type;
+ int media_type;
char *media_uuid;
char *path;
char *mime_type;
void _media_svc_insert_item_to_noti_list(media_svc_content_info_s *content_info);
void _media_svc_publish_noti_list(void);
void _media_svc_destroy_noti_item(media_svc_noti_item *item);
-int _media_svc_publish_noti(media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type);
+int _media_svc_publish_noti(media_item_update_type_e update_type, const char *path, int media_type, const char *uuid, const char *mime_type);
int _media_svc_publish_dir_noti(media_item_update_type_e update_type, const char *path, const char *uuid, int pid);
#endif /*_MEDIA_SVC_NOTI_H_*/
#include <string.h>
#include <stdbool.h>
+#include <sys/types.h>
#include <sqlite3.h>
#include <time.h>
-#include <media-util.h>
+#include <glib.h>
+#include <media-util-err.h>
#ifdef __cplusplus
extern "C" {
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(gtest-libmedia-service C CXX)
-
-SET(GTEST_TEST "gtest-libmedia-service")
-ADD_DEFINITIONS("-DUSE_DLOG")
-
-SET(REQUIRES_LIST ${REQUIRES_LIST}
- glib-2.0
- gio-2.0
- gmock
- dlog
- libmedia-utils
-)
-
-SET(PKG_LIBRARIES ${PKG_LIBRARIES}
- "media-service"
-)
-
-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)
+++ /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 "libmedia_service_unittest.h"
-#include "media-svc.h"
-#include <media-util.h>
-
-
-using ::testing::InitGoogleTest;
-using ::testing::Test;
-using ::testing::TestCase;
-
-class libmedia_service_Test : public ::testing::Test {
- protected:
- void SetUp() {
- std::cout << "SetUp()" << std::endl;
- }
-
- void TearDown() {
- std::cout << "TearDown()" << std::endl;
- }
-};
-
-TEST(libmedia_service_Test, media_svc_connect_disconnect_p)
-{
- MediaSvcHandle *handle = NULL;
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = media_svc_connect(&handle, getuid(), false);
- EXPECT_EQ(ret, MS_MEDIA_ERR_NONE);
-
- ret = media_svc_disconnect(handle);
- EXPECT_EQ(ret, MS_MEDIA_ERR_NONE);
-}
-
-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_MEDIA_SERVICE_UNITTEST_H__
-#define __LIB_MEDIA_SERVICE_UNITTEST_H__
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#undef LOG_TAG
-#define LOG_TAG "GTEST_LIBMEDIA_SERVICE"
-
-#endif /*__LIB_MM_UTILITY_UNITTEST_H__*/