--- /dev/null
+Dongyoung Kim <dydot1.kim@samsung.com>
+Jongchul Park <jc0204.park@samsung.com>
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-content-media-content")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(dependents "dlog libmedia-service drm-service aul capi-base-common")
+
+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("-DSLP_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+INSTALL(TARGETS ${fw_name} DESTINATION lib)
+INSTALL(
+ DIRECTORY ${INC_DIR}/ DESTINATION include/media-content
+ FILES_MATCHING
+ PATTERN "*_private.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${dependents})
+SET(PC_LDFLAGS -l${fw_name})
+SET(PC_CFLAGS -I\${includedir}/content)
+
+CONFIGURE_FILE(
+ capi-content-media-content.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+ADD_SUBDIRECTORY(test)
+
+IF(UNIX)
+
+ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
+ADD_CUSTOM_COMMAND(
+ DEPENDS clean
+ COMMENT "distribution clean"
+ COMMAND find
+ ARGS .
+ -not -name config.cmake -and \(
+ -name tester.c -or
+ -name Testing -or
+ -name CMakeFiles -or
+ -name cmake.depends -or
+ -name cmake.check_depends -or
+ -name CMakeCache.txt -or
+ -name cmake.check_cache -or
+ -name *.cmake -or
+ -name Makefile -or
+ -name core -or
+ -name core.* -or
+ -name gmon.out -or
+ -name install_manifest.txt -or
+ -name *.pc -or
+ -name *~ \)
+ | grep -v TC | xargs rm -rf
+ TARGET distclean
+ VERBATIM
+)
+
+ENDIF(UNIX)
+
--- /dev/null
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+ Apache License\r
+ Version 2.0, January 2004\r
+ http://www.apache.org/licenses/\r
+\r
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+ 1. Definitions.\r
+\r
+ "License" shall mean the terms and conditions for use, reproduction,\r
+ and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+ "Licensor" shall mean the copyright owner or entity authorized by\r
+ the copyright owner that is granting the License.\r
+\r
+ "Legal Entity" shall mean the union of the acting entity and all\r
+ other entities that control, are controlled by, or are under common\r
+ control with that entity. For the purposes of this definition,\r
+ "control" means (i) the power, direct or indirect, to cause the\r
+ direction or management of such entity, whether by contract or\r
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+ outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+ "You" (or "Your") shall mean an individual or Legal Entity\r
+ exercising permissions granted by this License.\r
+\r
+ "Source" form shall mean the preferred form for making modifications,\r
+ including but not limited to software source code, documentation\r
+ source, and configuration files.\r
+\r
+ "Object" form shall mean any form resulting from mechanical\r
+ transformation or translation of a Source form, including but\r
+ not limited to compiled object code, generated documentation,\r
+ and conversions to other media types.\r
+\r
+ "Work" shall mean the work of authorship, whether in Source or\r
+ Object form, made available under the License, as indicated by a\r
+ copyright notice that is included in or attached to the work\r
+ (an example is provided in the Appendix below).\r
+\r
+ "Derivative Works" shall mean any work, whether in Source or Object\r
+ form, that is based on (or derived from) the Work and for which the\r
+ editorial revisions, annotations, elaborations, or other modifications\r
+ represent, as a whole, an original work of authorship. For the purposes\r
+ of this License, Derivative Works shall not include works that remain\r
+ separable from, or merely link (or bind by name) to the interfaces of,\r
+ the Work and Derivative Works thereof.\r
+\r
+ "Contribution" shall mean any work of authorship, including\r
+ the original version of the Work and any modifications or additions\r
+ to that Work or Derivative Works thereof, that is intentionally\r
+ submitted to Licensor for inclusion in the Work by the copyright owner\r
+ or by an individual or Legal Entity authorized to submit on behalf of\r
+ the copyright owner. For the purposes of this definition, "submitted"\r
+ means any form of electronic, verbal, or written communication sent\r
+ to the Licensor or its representatives, including but not limited to\r
+ communication on electronic mailing lists, source code control systems,\r
+ and issue tracking systems that are managed by, or on behalf of, the\r
+ Licensor for the purpose of discussing and improving the Work, but\r
+ excluding communication that is conspicuously marked or otherwise\r
+ designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+ "Contributor" shall mean Licensor and any individual or Legal Entity\r
+ on behalf of whom a Contribution has been received by Licensor and\r
+ subsequently incorporated within the Work.\r
+\r
+ 2. Grant of Copyright License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ copyright license to reproduce, prepare Derivative Works of,\r
+ publicly display, publicly perform, sublicense, and distribute the\r
+ Work and such Derivative Works in Source or Object form.\r
+\r
+ 3. Grant of Patent License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ (except as stated in this section) patent license to make, have made,\r
+ use, offer to sell, sell, import, and otherwise transfer the Work,\r
+ where such license applies only to those patent claims licensable\r
+ by such Contributor that are necessarily infringed by their\r
+ Contribution(s) alone or by combination of their Contribution(s)\r
+ with the Work to which such Contribution(s) was submitted. If You\r
+ institute patent litigation against any entity (including a\r
+ cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+ or a Contribution incorporated within the Work constitutes direct\r
+ or contributory patent infringement, then any patent licenses\r
+ granted to You under this License for that Work shall terminate\r
+ as of the date such litigation is filed.\r
+\r
+ 4. Redistribution. You may reproduce and distribute copies of the\r
+ Work or Derivative Works thereof in any medium, with or without\r
+ modifications, and in Source or Object form, provided that You\r
+ meet the following conditions:\r
+\r
+ (a) You must give any other recipients of the Work or\r
+ Derivative Works a copy of this License; and\r
+\r
+ (b) You must cause any modified files to carry prominent notices\r
+ stating that You changed the files; and\r
+\r
+ (c) You must retain, in the Source form of any Derivative Works\r
+ that You distribute, all copyright, patent, trademark, and\r
+ attribution notices from the Source form of the Work,\r
+ excluding those notices that do not pertain to any part of\r
+ the Derivative Works; and\r
+\r
+ (d) If the Work includes a "NOTICE" text file as part of its\r
+ distribution, then any Derivative Works that You distribute must\r
+ include a readable copy of the attribution notices contained\r
+ within such NOTICE file, excluding those notices that do not\r
+ pertain to any part of the Derivative Works, in at least one\r
+ of the following places: within a NOTICE text file distributed\r
+ as part of the Derivative Works; within the Source form or\r
+ documentation, if provided along with the Derivative Works; or,\r
+ within a display generated by the Derivative Works, if and\r
+ wherever such third-party notices normally appear. The contents\r
+ of the NOTICE file are for informational purposes only and\r
+ do not modify the License. You may add Your own attribution\r
+ notices within Derivative Works that You distribute, alongside\r
+ or as an addendum to the NOTICE text from the Work, provided\r
+ that such additional attribution notices cannot be construed\r
+ as modifying the License.\r
+\r
+ You may add Your own copyright statement to Your modifications and\r
+ may provide additional or different license terms and conditions\r
+ for use, reproduction, or distribution of Your modifications, or\r
+ for any such Derivative Works as a whole, provided Your use,\r
+ reproduction, and distribution of the Work otherwise complies with\r
+ the conditions stated in this License.\r
+\r
+ 5. Submission of Contributions. Unless You explicitly state otherwise,\r
+ any Contribution intentionally submitted for inclusion in the Work\r
+ by You to the Licensor shall be under the terms and conditions of\r
+ this License, without any additional terms or conditions.\r
+ Notwithstanding the above, nothing herein shall supersede or modify\r
+ the terms of any separate license agreement you may have executed\r
+ with Licensor regarding such Contributions.\r
+\r
+ 6. Trademarks. This License does not grant permission to use the trade\r
+ names, trademarks, service marks, or product names of the Licensor,\r
+ except as required for reasonable and customary use in describing the\r
+ origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+ 7. Disclaimer of Warranty. Unless required by applicable law or\r
+ agreed to in writing, Licensor provides the Work (and each\r
+ Contributor provides its Contributions) on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+ implied, including, without limitation, any warranties or conditions\r
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+ PARTICULAR PURPOSE. You are solely responsible for determining the\r
+ appropriateness of using or redistributing the Work and assume any\r
+ risks associated with Your exercise of permissions under this License.\r
+\r
+ 8. Limitation of Liability. In no event and under no legal theory,\r
+ whether in tort (including negligence), contract, or otherwise,\r
+ unless required by applicable law (such as deliberate and grossly\r
+ negligent acts) or agreed to in writing, shall any Contributor be\r
+ liable to You for damages, including any direct, indirect, special,\r
+ incidental, or consequential damages of any character arising as a\r
+ result of this License or out of the use or inability to use the\r
+ Work (including but not limited to damages for loss of goodwill,\r
+ work stoppage, computer failure or malfunction, or any and all\r
+ other commercial damages or losses), even if such Contributor\r
+ has been advised of the possibility of such damages.\r
+\r
+ 9. Accepting Warranty or Additional Liability. While redistributing\r
+ the Work or Derivative Works thereof, You may choose to offer,\r
+ and charge a fee for, acceptance of support, warranty, indemnity,\r
+ or other liability obligations and/or rights consistent with this\r
+ License. However, in accepting such obligations, You may act only\r
+ on Your own behalf and on Your sole responsibility, not on behalf\r
+ of any other Contributor, and only if You agree to indemnify,\r
+ defend, and hold each Contributor harmless for any liability\r
+ incurred by, or claims asserted against, such Contributor by reason\r
+ of your accepting any such warranty or additional liability.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ APPENDIX: How to apply the Apache License to your work.\r
+\r
+ To apply the Apache License to your work, attach the following\r
+ boilerplate notice, with the fields enclosed by brackets "[]"\r
+ replaced with your own identifying information. (Don't include\r
+ the brackets!) The text should be enclosed in the appropriate\r
+ comment syntax for the file format. We also recommend that a\r
+ file or class name and description of purpose be included on the\r
+ same "printed page" as the copyright notice for easier\r
+ identification within third-party archives.\r
+\r
+ Copyright [yyyy] [name of copyright owner]\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+\r
+\r
--- /dev/null
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/media-content
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir} @PC_CFLAGS@
+
--- /dev/null
+/usr/include/*
+/usr/include/*/*
+/usr/lib/pkgconfig/*.pc
+
--- /dev/null
+/usr/lib/lib*.so*
--- /dev/null
+capi-content-media-content (0.1.0-10) unstable; urgency=low
+
+ * Update the version.
+
+ -- Dongyoung Kim <dydot1.kim@samsung.com> Thu, 15 Dec 2011 13:38:10 +0900
+
+
+capi-content-media-content (0.0.1-1) unstable; urgency=low
+
+
+ * Initial release.
+
+
+ -- Dongyoung Kim <dydot1.kim@samsung.com> Wed, 07 Dec 2011 12:46:25 +0900
+
--- /dev/null
+Source: capi-content-media-content
+Section: libs
+Priority: extra
+Maintainer: Dongyoung Kim <dydot1.kim@samsung.com>, Jongchul Park <jc0204.park@samsung.com>
+Build-Depends: debhelper (>= 5), dlog-dev, libmedia-service-dev, drm-service-dev, libaul-1-dev, capi-base-common-dev
+Standards-Version: 0.1
+
+Package: capi-content-media-content
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: A Media content library in Tizen Native API
+
+Package: capi-content-media-content-dev
+Architecture: any
+Depends: capi-content-media-content (= ${Source-Version}), dlog-dev, libmedia-service-dev, drm-service-dev, libaul-1-dev, capi-base-common-dev
+Description: A Media content library in Tizen Native API (DEV)
+
+Package: capi-content-media-content-dbg
+Architecture: any
+Depends: ${misc:Depends}, capi-content-media-content (= ${Source-Version})
+Description: A Media content library in Tizen Native API (DBG)
+
--- /dev/null
+#!/usr/bin/make -f
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+CMAKE_ROOT_DIR ?= $(CURDIR)
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake ..
+ touch configure-stamp
+
+
+build: build-stamp
+build-stamp: configure-stamp
+ dh_testdir
+ cd $(CMAKE_BUILD_DIR) && $(MAKE)
+ touch $@
+
+clean:
+ cd $(CMAKE_ROOT_DIR)
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+ rm -f `find . -name *.pc`
+ rm -rf $(CMAKE_BUILD_DIR)
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+binary-indep: build install
+
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ dh_installexamples
+ dh_install --sourcedir=debian/tmp
+ dh_installman
+ dh_link
+ dh_strip --dbg-package=capi-content-media-content-dbg
+ dh_fixperms
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
+
--- /dev/null
+/*
+* Copyright (c) 2011 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 __TIZEN_AUDIO_META_H__
+#define __TIZEN_AUDIO_META_H__
+
+#include <media_content_type.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_AUDIO_META_MODULE
+ * @{
+ *
+ * @file audio_meta.h
+ * @brief This file contains the audio metadata API and related structure and enumeration. \n
+ * Description of the audio content involves: album, artist, author, genre and description tags. \n
+ * Parameters of the recording are also supported, as: format, bitrate, duration, size etc.
+ */
+
+
+/**
+ * @brief Destroys audio metadata.
+ *
+ * @param [in] audio The handle to audio metadata.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Get copy of audio metadata handle handle by calling audio_meta_clone()
+ * @see audio_meta_clone()
+ * @see media_info_get_audio_from_db()
+ */
+int audio_meta_destroy(audio_meta_h audio);
+
+
+/**
+ * @brief Clones audio metadata.
+ * @details Function copies the audio metadata handle handle from source to destination.
+ *
+ * @remark The destination handle must be released with audio_meta_destroy() by you.
+ *
+ * @param [out] dst A destination handle to audio metadata
+ * @param [in] src The source handle to audio metadata
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @see audio_meta_destroy()
+ */
+int audio_meta_clone(audio_meta_h* dst, audio_meta_h src);
+
+
+/**
+ * @brief Gets name of genre of given audio metadata.
+ *
+ * @remarks @a genre_name must be released with free() by you.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] genre_name The name of the genre
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ */
+int audio_meta_get_genre(audio_meta_h audio, char **genre_name);
+
+
+/**
+ * @brief Gets name of album of given audio metadata.
+ *
+ * @remarks @a album_name must be released with free() by you.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] album_name The name of the album
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ */
+int audio_meta_get_album(audio_meta_h audio, char **album_name);
+
+
+/**
+ * @brief Gets name of artist of given audio metadata.
+ *
+ * @remarks @a artist_name must be released with free() by you.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] artist_name The name of the artist
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ */
+int audio_meta_get_artist(audio_meta_h audio, char **artist_name);
+
+
+/**
+ * @brief Gets name of author of given audio metadata.
+ *
+ * @remarks @a author_name must be released with free() by you.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] author_name The name of the author of audio
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ */
+int audio_meta_get_author(audio_meta_h audio, char **author_name);
+
+
+/**
+ * @brief Gets year of given audio metadata.
+ *
+ * @remarks @a year must be released with free() by you.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] year The year of the audio file
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ */
+int audio_meta_get_year(audio_meta_h audio, char** year);
+
+
+/**
+ * @brief Gets copyright notice of given audio metadata.
+ *
+ * @remarks @a copyright must be released with free() by you.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] copyright The audio copyright notice
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ */
+int audio_meta_get_copyright(audio_meta_h audio, char **copyright);
+
+
+/**
+ * @brief Gets description of given audio metadata.
+ *
+ * @remarks @a description must be released with free() by you.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] description The audio description
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ */
+int audio_meta_get_description(audio_meta_h audio, char **description);
+
+
+/**
+ * @brief Gets format of given audio metadata.
+ *
+ * @remarks @a format must be released with free() by you.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] format The audio format
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ */
+int audio_meta_get_format(audio_meta_h audio, char **format);
+
+
+/**
+ * @brief Gets bitrate of given audio metadata in bitrate per second.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] bitrate The audio bitrate in bit per second [bps].
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int audio_meta_get_bitrate(audio_meta_h audio, int *bitrate);
+
+
+/**
+ * @brief Gets track number of given audio metadata.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] track_num The audio track number
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int audio_meta_get_track_num(audio_meta_h audio, int *track_num);
+
+
+/**
+ * @brief Gets track duration of given audio metadata.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] duration The audio file duration
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int audio_meta_get_duration(audio_meta_h audio, int *duration);
+
+
+/**
+ * @brief Gets track rating of given audio metadata.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] rating The rating of audio
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int audio_meta_get_rating(audio_meta_h audio, int *rating);
+
+
+/**
+ * @brief Gets number which represents how many times given audio has been played.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] count_played The counter of audio played
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int audio_meta_get_count_played(audio_meta_h audio, int *count_played);
+
+
+/**
+ * @brief Gets the audio's played time parameter.
+ * @details Function returns audio's elapsed playback time parameter as period
+ * starting from the beginning of the track.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] time_played The elapsed time of the audio
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int audio_meta_get_time_played(audio_meta_h audio, int *time_played);
+
+
+/**
+ * @brief Gets the time when audio file was added.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] time_added The time when audio file added
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int audio_meta_get_time_added(audio_meta_h audio, time_t *time_added);
+
+/**
+ * @brief Gets audio's file size in bytes.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] size The size of audio file in bytes.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int audio_meta_get_size(audio_meta_h audio, int *size);
+
+
+/**
+ * @brief Gets audio's category from desired audio metadata.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [out] category The audio category
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int audio_meta_get_category(audio_meta_h audio, audio_category_e *category);
+
+
+/**
+ * @brief Updates audio's played counter to the media database.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [in] count The new counter of audio played
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ */
+int audio_meta_update_count_played_to_db(audio_meta_h audio, int count);
+
+/**
+ * @brief Updates audio's played time parameter to the media database.
+ *
+ * @param [in] audio The handle to audio metadata
+ * @param [in] time The time from the beginning of audio
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ */
+int audio_meta_update_time_played_to_db(audio_meta_h audio, time_t time);
+
+
+/**
+ * @}
+ */
+
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_AUDIO_PLAYLIST_MODULE
+ * @{
+ */
+
+
+/**
+ * @brief Iterates through the audio playlist with optional @a filter from the media database.
+ * @details This function gets all audio playlist handles meeting the given filter.
+ * The callback function will be invoked for every retrieved audio playlist.
+ * If NULL is passed to the filter, no filtering is applied.
+
+ *
+ * @param [in] filter The handle to audio filter
+ * @param [in] callback The callback function to invoke.
+ * @param [in] user_data User data to be passed to the callback function.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes audio_playlist_cb().
+ * @see #audio_playlist_cb
+ * @see media_content_connect()
+ * @see media_audio_filter_create()
+ *
+ */
+int audio_playlist_foreach_playlist_from_db(media_audio_filter_h filter, audio_playlist_cb callback, void *user_data);
+
+
+/**
+ * @brief Iterates through the media files with optional @a filter in the given @a audio @a playlist from the media database.
+ * @details This function gets all media files associated with the given audio playlist and
+ * meeting desired filter option and calls registered callback function for
+ * every retrieved media info. If NULL is passed to the @a filter, no filtering is applied.
+ *
+ * @param [in] playlist The handle to audio playlist
+ * @param [in] filter The handle to audio filter
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes media_info_cb().
+ * @see #media_info_cb
+ * @see media_content_connect()
+ * @see media_audio_filter_create()
+ *
+ */
+int audio_playlist_foreach_media_from_db(audio_playlist_h playlist, media_audio_filter_h filter, media_info_cb callback, void *user_data);
+
+
+/**
+ * @brief Inserts a new playlist with given name in the media database.
+ *
+ * @remark The created handle must be released with audio_playlist_destroy() by you.
+ * @param [in] name The name of the inserted playlist.
+ * @param [out] playlist A created handle to audio playlist
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see audio_playlist_delete_from_db()
+ *
+ */
+int audio_playlist_insert_to_db(const char *name, audio_playlist_h *playlist);
+
+
+/**
+ * @brief Deletesthe given playlist from the media database.
+ *
+ * @param [in] playlist The handle to audio playlist
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see audio_playlist_insert_to_db()
+ *
+ */
+int audio_playlist_delete_from_db(audio_playlist_h playlist);
+
+/**
+ * @brief Gets number of media info for the given playlist present in the media database.
+
+ *
+ * @param [in] playlist The handle to audio playlist
+ * @param [out] count The number of playlist items
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ *
+ */
+int audio_playlist_get_media_count_from_db(audio_playlist_h playlist, int *count);
+
+
+/**
+ * @brief Destroys a playlist handle.
+ * @details Function frees all resources related to playlist handle. This
+ * handle no longer can be used to perform any operation. New handle has to
+ * be created before next usage.
+ *
+ * @param [in] playlist The handle to audio playlist
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see audio_playlist_clone()
+ * @pre Get copy of playlist handle by calling audio_playlist_clone() or audio_playlist_insert_to_db()
+ * @see audio_playlist_clone()
+ *
+ */
+int audio_playlist_destroy(audio_playlist_h playlist);
+
+
+/**
+ * @brief Clones playlist handle.
+ * @details This function copies the audio playlist handle from a source to
+ * destination. There is no audio_playlist_create() function. The audio_playlist_h is created internally and available through
+ * audio playlist foreach function such as audio_playlist_foreach_playlist_from_db(). To use this handle outside of these foreach functions,
+ * use this function.
+ *
+ * @remark The destination handle must be released with audio_playlist_destroy() by you.
+ *
+ * @param [in] src The source handle to audio playlist
+ * @param [out] dst A destination handle to audio playlist
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @see audio_playlist_destroy()
+ * @see audio_playlist_foreach_playlist_from_db()
+ */
+int audio_playlist_clone(audio_playlist_h *dst, audio_playlist_h src);
+
+/**
+ * @brief Gets a name of the playlist.
+ *
+ * @remarks @a playlist_name must be released with free() by you.
+ *
+ * @param [in] playlist The handle to audio playlist
+ * @param [out] playlist_name The playlist name
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ *
+ */
+int audio_playlist_get_name(audio_playlist_h playlist, char **playlist_name);
+
+
+/**
+ * @brief Updates the name of the given playlist in the media database.
+ *
+ * @param [in] playlist The handle to audio playlist
+ * @param [in] playlist_name The playlist name to set
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ */
+int audio_playlist_update_name_to_db(audio_playlist_h playlist, const char *playlist_name);
+
+/**
+ * @brief Adds a new media info to the playlist present in the media database.
+ *
+ * @param [in] playlist The handle to audio playlist
+ * @param [in] media The newly added media info handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see audio_playlist_remove_media_from_db()
+ */
+int audio_playlist_add_media_to_db(audio_playlist_h playlist, media_info_h media);
+
+/**
+ * @brief Removes the given @a media from the playlist present in the media database.
+ *
+ * @param [in] playlist The handle to audio playlist
+ * @param [in] media The handle to media info to be removed
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see audio_playlist_add_media_to_db()
+ */
+int audio_playlist_remove_media_from_db(audio_playlist_h playlist, media_info_h media);
+
+/**
+ * @}
+ */
+
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_AUDIO_GENRE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Iterates through the audio genre with optional @a filter from the media database.
+ * @details This function gets all audio genre handles meeting the given filter.
+ * The callback function will be invoked for every retrieved audio genre.
+ * If NULL is passed to the filter, no filtering is applied.
+
+ *
+ * @param [in] filter The handle to audio filter
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes audio_genre_cb().
+ * @see #audio_genre_cb
+ * @see media_content_connect()
+ * @see media_audio_filter_create()
+ *
+ */
+int audio_genre_foreach_genre_from_db(media_audio_filter_h filter, audio_genre_cb callback, void *user_data);
+
+
+/**
+ * @brief Iterates through the media files with optional @a filter in the given @a audio @a genre from the media database.
+ * @details This function gets all media files associated with the given audio genre and
+ * meeting desired filter option and calls registered callback function for
+ * every retrieved media info. If NULL is passed to the @a filter, no filtering is applied.
+ *
+ * @param [in] genre The handle to audio genre
+ * @param [in] filter The filter handle.
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes media_info_cb().
+ * @see #media_info_cb
+ * @see media_content_connect()
+ * @see media_audio_filter_create()
+ */
+int audio_genre_foreach_media_from_db(audio_genre_h genre, media_audio_filter_h filter, media_info_cb callback, void *user_data);
+
+
+/**
+ * @brief Gets number of media info for the given genre present in the media database.
+ *
+ * @param [in] genre The handle to audio genre
+ * @param [out] count The count of "genre group" media information.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ */
+int audio_genre_get_media_count_from_db(audio_genre_h genre, int *count);
+
+
+
+/**
+ * @brief Destroys genre handle.
+ * @details Function frees all resources related to genre handle. This handle
+ * no longer can be used to perform any operation. A new handle has to
+ * be created before the next use.
+ *
+ * @param [in] genre The handle to audio genre
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Get copy of genre handle by calling audio_genre_clone()
+ * @see audio_genre_clone()
+ */
+int audio_genre_destroy(audio_genre_h genre);
+
+/**
+ * @brief Clones genre handle.
+ * @details This function copies the audio genre handle from a source to
+ * destination. There is no audio_genre_create() function. The media_genre_h is created internally and available through
+ * audio genre foreach function such as audio_genre_foreach_genre_from_db(). To use this handle outside of these foreach functions,
+ * use this function.
+ *
+ * @remark The destination handle must be released with audio_genre_destroy() by you.
+ *
+ * @param [in] src The source handle to audio genre
+ * @param [out] dst A destination handle to audio genre
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @see audio_genre_destroy()
+ * @see audio_genre_foreach_genre_from_db()
+ */
+int audio_genre_clone(audio_genre_h *dst,audio_genre_h src);
+
+
+/**
+ * @brief Gets a name of the genre.
+ *
+ * @remarks @a genre_name must be released with free() by you.
+ *
+ * @param [in] genre The handle to audio genre
+ * @param [out] genre_name The name of the audio genre
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ */
+int audio_genre_get_name(audio_genre_h genre, char **genre_name);
+
+/**
+ * @}
+ */
+
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_AUDIO_ALBUM_MODULE
+ * @{
+ */
+
+/**
+ * @brief Iterates through the audio album with optional @a filter from the media database.
+ * @details This function gets all audio album handles meeting the given filter.
+ * The callback function will be invoked for every retrieved audio album.
+ * If NULL is passed to the filter, no filtering is applied.
+ *
+ * @param [in] filter The handle to audio filter
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes audio_album_cb().
+ * @see #audio_album_cb
+ * @see media_content_connect()
+ * @see media_audio_filter_create()
+ *
+ */
+int audio_album_foreach_album_from_db(media_audio_filter_h filter, audio_album_cb callback, void *user_data);
+
+
+/**
+ * @brief Iterates through the media files with optional @a filter in the given @a audio @a album from the media database.
+ * @details This function gets all media files associated with the given audio album and
+ * meeting desired filter option and calls registered callback function for
+ * every retrieved media info. If NULL is passed to the @a filter, no filtering is applied.
+ *
+ * @param [in] album The handle to audio album
+ * @param [in] filter The handle to audio filter
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes media_info_cb().
+ * @see #media_info_cb
+ * @see media_content_connect()
+ * @see media_audio_filter_create()
+ */
+int audio_album_foreach_media_from_db(audio_album_h album, media_audio_filter_h filter, media_info_cb callback, void *user_data);
+
+
+/**
+ * @brief Gets number of media info for the given album present in the media database.
+ *
+ * @param [in] album The handle to audio album
+ * @param [out] count A count of album
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ */
+int audio_album_get_media_count_from_db(audio_album_h album, int *count);
+
+
+
+
+/**
+ * @brief Destroys album handle.
+ * @details Function frees all resources related to album handle. This handle
+ * no longer can be used to perform any operation. A new handle has to
+ * be created before the next use.
+ *
+ * @param [in] album The handle to audio album
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Get copy of album handle by calling audio_album_clone()
+ * @see audio_album_clone()
+ */
+int audio_album_destroy(audio_album_h album);
+
+/**
+ * @brief Clones audio album.
+ * @details This function copies the audio album handle from a source to
+ * destination. There is no audio_album_create() function. The audio_album_h is created internally and available through
+ * audio album foreach function such as audio_album_foreach_album_from_db(). To use this handle outside of these foreach functions,
+ * use this function.
+ *
+ * @remark The destination handle must be released with audio_album_destroy() by you.
+ *
+ * @param [in] src The source handle to audio album
+ * @param [out] dst A destination handle to audio album
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @see audio_album_destroy()
+ * @see audio_album_foreach_album_from_db()
+ */
+int audio_album_clone(audio_album_h *dst,audio_album_h src);
+
+
+/**
+ * @brief Gets a name of the album.
+ *
+ * @remarks @a album_name must be released with free() by you.
+ *
+ * @param [in] album The handle to audio album
+ * @param [out] album_name A name of audio album handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ *
+ */
+int audio_album_get_name(audio_album_h album, char **album_name);
+
+/**
+ * @}
+ */
+
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_AUDIO_ARTIST_MODULE
+ * @{
+ */
+
+/**
+ * @brief Iterates through the media files with optional @a filter from the media database.
+ * @details This function gets all audio artist handles meeting the given filter.
+ * The callback function will be invoked for every retrieved audio artist.
+ * If NULL is passed to the filter, no filtering is applied.
+ *
+ * @param [in] filter The handle to audio filter
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes audio_artist_cb().
+ * @see #audio_artist_cb
+ * @see media_content_connect()
+ * @see media_audio_filter_create()
+ */
+int audio_artist_foreach_artist_from_db(media_audio_filter_h filter, audio_artist_cb callback, void *user_data);
+
+
+/**
+ * @brief Iterates through the media files with optional @a filter in the given @a audio @artist from the media database.
+ * @details This function gets all media files associated with the given audio artist and
+ * meeting desired filter option and calls registered callback function for
+ * every retrieved media info. If NULL is passed to the @a filter, no filtering is applied.
+
+ *
+ * @param [in] artist The handle to audio artist
+ * @param [in] filter The handle to audio filter
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes media_info_cb().
+ * @see #media_info_cb
+ * @see media_content_connect()
+ * @see media_audio_filter_create()
+ */
+int audio_artist_foreach_media_from_db(audio_artist_h artist, media_audio_filter_h filter, media_info_cb callback, void *user_data);
+
+
+/**
+ * @brief Gets number of media info for the given artist present in the media database.
+ *
+ * @param [in] artist The handle to audio artist
+ * @param [out] count The count of artist
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ */
+int audio_artist_get_media_count_from_db(audio_artist_h artist, int *count);
+
+/**
+ * @brief Destroys artist handle.
+ * @details Function frees all resources related to artist handle. This handle
+ * no longer can be used to perform any operation. A new handle has to
+ * be created before the next use.
+ *
+ * @param [in] artist The handle to audio artist
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Get copy of artist handle by calling audio_artist_clone()
+ * @see audio_artist_clone()
+ */
+int audio_artist_destroy(audio_artist_h artist);
+
+/**
+ * @brief Clones audio artist.
+ * @details This function copies the audio artist handle from a source to
+ * destination. There is no audio_artist_create() function. The audio_artist_h is created internally and available through
+ * audio artist foreach function such as audio_artist_foreach_artist_from_db(). To use this handle outside of these foreach functions,
+ * use this function.
+
+ *
+ * @remark The destination handle must be released with audio_artist_destroy() by you.
+ *
+ * @param [in] src The source handle to audio artist
+ * @param [out] dst A destination handle to audio artist
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @see audio_artist_destroy()
+ * @see audio_artist_foreach_artist_from_db()
+ */
+int audio_artist_clone(audio_artist_h *dst,audio_artist_h src);
+
+/**
+ * @brief Gets a name of the artist.
+ *
+ * @remarks @a artist_name must be released with free() by you.
+ *
+ * @param [in] artist The handle to audio artist
+ * @param [out] artist_name A name of the audio artist handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ */
+int audio_artist_get_name(audio_artist_h artist, char **artist_name);
+
+
+/**
+ * @}
+ */
+
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_AUDIO_AUTHOR_MODULE
+ * @{
+ */
+
+/**
+ *
+ * @brief Iterates through the audio author with optional @a filter from the media database.
+ * @details This function gets all audio author handles meeting the given filter.
+ * The callback function will be invoked for every retrieved audio playlist.
+ * If NULL is passed to the filter, no filtering is applied.
+ *
+ * @param [in] filter The handle to audio filter
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes audio_author_cb().
+ * @see #audio_author_cb
+ * @see media_content_connect()
+ * @see media_audio_filter_create()
+ */
+int audio_author_foreach_author_from_db(media_audio_filter_h filter, audio_author_cb callback, void *user_data);
+
+
+/**
+ * @brief Iterates through the media files with optional @a filter in the given @a audio @a author from the media database.
+ * @details This function gets all media files associated with the given audio author and
+ * meeting desired filter option and calls registered callback function for
+ * every retrieved media info. If NULL is passed to the @a filter, no filtering is applied.
+ *
+ *
+ * @param [in] author The handle to audio author
+ * @param [in] filter The handle to audio filter
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes media_info_cb().
+ * @see #media_info_cb
+ * @see media_content_connect()
+ * @see media_audio_filter_create()
+ */
+int audio_author_foreach_media_from_db(audio_author_h author, media_audio_filter_h filter, media_info_cb callback, void *user_data);
+
+
+/**
+ * @brief Gets number of media info for the given author present in the media database.
+ *
+ * @param [in] author The handle to audio author
+ * @param [out] count The count of author
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ */
+int audio_author_get_media_count_from_db(audio_author_h author, int *count);
+
+
+/**
+ * @brief Destroys author handle.
+ * @details Function frees all resources related to author handle. This handle
+ * no longer can be used to perform any operation. A new handle has to
+ * be created before the next use.
+ *
+ * @param [in] author The handle to audio author
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Get copy of author handle by calling audio_author_clone()
+ * @see audio_author_clone()
+ */
+int audio_author_destroy(audio_author_h author);
+
+
+/**
+ * @brief Clones audio author.
+ * @details This function copies the audio author handle from a source to
+ * destination. There is no audio_author_create() function. The audio_author_h is created internally and available through
+ * audio author foreach function such as audio_author_foreach_author_from_db(). To use this handle outside of these foreach functions,
+ * use this function.
+ *
+ *
+ * @param [in] src The source handle to audio author
+ * @param [out] dst A destination handle to audio author
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @post The destination handle should be deallocated by audio_author_destroy()
+ * @see audio_author_destroy()
+ * @see audio_author_foreach_author_from_db()
+ */
+int audio_author_clone(audio_author_h *dst,audio_author_h src);
+
+/**
+ * @brief Gets a name of the author.
+ *
+ * @remarks @a author_name must be released with free() by you.
+ *
+ * @param [in] author The handle to audio author
+ * @param [out] author_name The name of the "author group" handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Not enough memory is available
+ */
+int audio_author_get_name(audio_author_h author, char **author_name);
+
+
+/**
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /*__TIZEN_AUDIO_META_H__*/
--- /dev/null
+/*\r
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License. \r
+*/\r
+\r
+#ifndef __TIZEN_MEDIA_CONTENT_H__\r
+#define __TIZEN_MEDIA_CONTENT_H__\r
+\r
+#include <media_audio.h>\r
+#include <media_content_type.h>\r
+#include <media_filter.h>\r
+#include <media_folder.h>\r
+#include <media_image.h>\r
+#include <media_info.h>\r
+#include <media_tag.h>\r
+#include <media_video.h>\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+ * @addtogroup CAPI_MEDIA_CONTENT_MODULE\r
+ * @{\r
+ */\r
+\r
+\r
+/**\r
+ * @brief Connects to the media content service.\r
+ * @details Any media content related function call should be invoked after this function call.\r
+ *\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed \r
+ * @post media_content_disconnect()\r
+ * @see media_content_disconnect()\r
+ *\r
+ */\r
+int media_content_connect(void);\r
+\r
+/**\r
+ * @brief Disconnects from the media content service.\r
+ * @details This function closes connection to the media content service. Any further media content related operation\r
+ * cannot be performed after this function is called.\r
+ *\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed \r
+ * @pre media_content_connect()\r
+ * @see media_content_connect()\r
+ *\r
+ */\r
+int media_content_disconnect(void);\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+#endif /* __TIZEN_MEDIA_CONTENT_H__ */\r
+\r
+\r
--- /dev/null
+/*\r
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License. \r
+*/\r
+\r
+\r
+\r
+#ifndef __TIZEN_MEDIA_CONTENT_TYPE_H__\r
+#define __TIZEN_MEDIA_CONTENT_TYPE_H__\r
+\r
+#include <time.h>\r
+#include <tizen.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+#define ERROR_MASKL16 0xFFFF\r
+#define ERROR_SET(X) ((X) & ERROR_MASKL16)\r
+\r
+\r
+/**\r
+* @addtogroup CAPI_MEDIA_CONTENT_MODULE\r
+* @{\r
+*/\r
+\r
+/**\r
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE\r
+ * @brief The enumerations of the media file format.\r
+ */\r
+typedef enum\r
+{\r
+ MEDIA_CONTENT_TYPE_IMAGE = 0x01 << 0, /**<The type of image */\r
+ MEDIA_CONTENT_TYPE_VIDEO = 0x01 << 1, /**<The type of video */\r
+ MEDIA_CONTENT_TYPE_AUDIO = 0x01 << 2, /**<The type of audio */\r
+ MEDIA_CONTENT_TYPE_ALL = MEDIA_CONTENT_TYPE_IMAGE|MEDIA_CONTENT_TYPE_VIDEO|MEDIA_CONTENT_TYPE_AUDIO, /**< The type of all media content */\r
+\r
+} media_content_type_e;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_FOLDER_MODULE\r
+ * @brief The enumerations of the storage type.\r
+ * @detail This information is used to establish where the folder is.\r
+ */\r
+typedef enum\r
+{\r
+ MEDIA_CONTENT_STORAGE_INTERNAL = 0x01 << 0, /**< The device's internal storage */ \r
+ MEDIA_CONTENT_STORAGE_EXTERNAL = 0x01 << 1, /**< The device's external storage */ \r
+ //MEDIA_CONTENT_STORAGE_WEB = 0x01<< 2,\r
+} media_content_storage_e;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE\r
+ * @brief The type of orientation.\r
+ */\r
+typedef enum {\r
+ MEDIA_CONTENT_ORIENTATION_NOT_AVAILABLE=0, /**< Not available*/\r
+ MEDIA_CONTENT_ORIENTATION_NORMAL =1, /**< Normal*/\r
+ MEDIA_CONTENT_ORIENTATION_HFLIP =2, /**< Flip horizontal*/\r
+ MEDIA_CONTENT_ORIENTATION_ROT_180 =3, /**< Rotate 180 degrees*/\r
+ MEDIA_CONTENT_ORIENTATION_VFLIP =4, /**< Flip vertical*/\r
+ MEDIA_CONTENT_ORIENTATION_TRANSPOSE =5, /**< Transpose*/\r
+ MEDIA_CONTENT_ORIENTATION_ROT_90 =6, /**< Rotate 90 degrees*/\r
+ MEDIA_CONTENT_ORIENTATION_TRANSVERSE =7, /**< Transverse*/\r
+ MEDIA_CONTENT_ORIENTATION_ROT_270 =8, /**< Rotate 270 degrees*/\r
+} media_content_orientation_e;\r
+\r
+/**\r
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE\r
+ * @brief The enumerations of ordering.\r
+ */\r
+typedef enum\r
+{\r
+ MEDIA_CONTENT_SORT_NONE, /**< None order of sort*/\r
+ MEDIA_CONTENT_SORT_BY_NAME_ASC, /**< The sort by name in ascending order*/\r
+ MEDIA_CONTENT_SORT_BY_NAME_DESC, /**< The sort by name in descending order*/\r
+ MEDIA_CONTENT_SORT_BY_DATE_ASC, /**< The sort by date in ascending order*/\r
+ MEDIA_CONTENT_SORT_BY_DATE_DESC, /**< The sort by date in descending order*/ \r
+} media_content_order_e;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_META_MODULE\r
+ * @brief The category of audio.\r
+ */\r
+typedef enum{\r
+ CONTENT_AUDIO_MUSIC, /**< Music Category*/\r
+ CONTENT_AUDIO_SOUND /**< Sound Category*/\r
+} audio_category_e;\r
+\r
+/**\r
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE\r
+ * @brief The enumerations of media content error\r
+ */\r
+typedef enum\r
+{\r
+ MEDIA_CONTENT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */\r
+ MEDIA_CONTENT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */\r
+ MEDIA_CONTENT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */\r
+ MEDIA_CONTENT_ERROR_DB_FAILED = TIZEN_ERROR_CONTENT_CLASS | 0x01, /**< DB operation failed */\r
+ MEDIA_CONTENT_ERROR_NOT_SUPPORTED_AUDIO = TIZEN_ERROR_CONTENT_CLASS | 0x02, /**< Only video and image info can be added to Tag */\r
+} media_content_error_e;\r
+\r
+\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_FILTER_INFO_MODULE\r
+ * @brief The type of searchable media info \r
+ */\r
+typedef enum\r
+{\r
+ MEDIA_INFO_SEARCH_NONE = 0x00, /**< No Search */\r
+ MEDIA_INFO_SEARCH_BY_DISPLAY_NAME = 0x01 << 0, /**< The search by display name */\r
+ \r
+}media_info_search_type_e;\r
+\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_FILTER_FOLDER_MODULE\r
+ * @brief The type of searchable media folder \r
+ */\r
+typedef enum\r
+{\r
+ MEDIA_FOLDER_SEARCH_NONE = 0x00, /**< No Search */\r
+ MEDIA_FOLDER_SEARCH_BY_FOLDER_NAME = 0x01 << 0, /**< The searchabe type folder name */\r
+}media_folder_search_type_e;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_FILTER_AUDIO_MODULE\r
+ * @brief The type of searchable media audio \r
+ */\r
+typedef enum\r
+{\r
+ MEDIA_AUDIO_SEARCH_NONE = 0x00, /**< No Search */\r
+ MEDIA_AUDIO_SEARCH_BY_PLAYLIST = 0x01 << 0, /**< The searchabe type of playlist */\r
+ MEDIA_AUDIO_SEARCH_BY_ARTIST = 0x01 << 1, /**< The searchabe type of artist */\r
+ MEDIA_AUDIO_SEARCH_BY_ALBUM = 0x01 << 2, /**< The searchabe type of album */\r
+ MEDIA_AUDIO_SEARCH_BY_AUTHOR = 0x01 << 3, /**< The searchabe type of author */\r
+ MEDIA_AUDIO_SEARCH_BY_GENRE = 0x01 << 4, /**< The searchabe type of genre */\r
+}media_audio_search_type_e;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_FILTER_TAG_MODULE\r
+ * @brief The type of searchable media tag \r
+ */\r
+typedef enum\r
+{\r
+ MEDIA_TAG_SEARCH_NONE = 0x00, /**< No Search */\r
+ MEDIA_TAG_SEARCH_BY_TAG_NAME = 0x01 << 0, /**< The searchabe type folder name */\r
+}media_tag_search_type_e;\r
+\r
+\r
+\r
+\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_FILTER_INFO_MODULE\r
+ * @brief The handle to media infon filter.\r
+ */\r
+typedef struct media_info_filter_s* media_info_filter_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_FILTER_FOLDER_MODULE\r
+ * @brief The handle to media folder filter.\r
+ */\r
+typedef struct media_folder_filter_s* media_folder_filter_h;\r
+\r
+/** \r
+ * @ingroup CAPI_CONTENT_MEDIA_FILTER_TAG_MODULE\r
+ * @brief The handle to media tag filter.\r
+ */\r
+typedef struct media_tag_filter_s* media_tag_filter_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_FILTER_AUDIO_MODULE\r
+ * @brief The handle to media audio filter.\r
+ */\r
+typedef struct media_audio_filter_s* media_audio_filter_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_FILTER_BOOKMARK_MODULE\r
+ * @brief The handle to video bookmark filter.\r
+ */\r
+typedef struct video_bookmark_filter_s* video_bookmark_filter_h;\r
+\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE\r
+ * @brief The handle to media info.\r
+ */\r
+typedef struct media_info_s* media_info_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_FOLDER_MODULE\r
+ * @brief The handle to media folder.\r
+ */\r
+typedef struct media_folder_s* media_folder_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_TAG_MODULE\r
+ * @brief The handle to media tag.\r
+ */\r
+typedef struct media_tag_s* media_tag_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_IMAGE_MODULE\r
+ * @brief The handle to image metadata.\r
+ */\r
+typedef struct image_meta_s* image_meta_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_VIDEO_META_MODULE\r
+ * @brief The handle to video metadata.\r
+ */\r
+typedef struct video_meta_s* video_meta_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_VIDEO_BOOKMARK_MODULE\r
+ * @brief The handle to video bookmark.\r
+ */\r
+typedef struct video_bookmark_s* video_bookmark_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_META_MODULE\r
+ * @brief The handle to audio metadata.\r
+ */\r
+typedef struct audio_meta_s* audio_meta_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_PLAYLIST_MODULE\r
+ * @brief The handle to audio playlist.\r
+ */\r
+typedef struct audio_playlist_s* audio_playlist_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_ALBUM_MODULE\r
+ * @brief The handle to audio album.\r
+ */\r
+typedef struct audio_album_s* audio_album_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_AUTHOR_MODULE\r
+ * @brief The handle to audio author.\r
+ */\r
+typedef struct audio_author_s* audio_author_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_GENRE_MODULE\r
+ * @brief The handle to audio genre.\r
+ */\r
+typedef struct audio_genre_s* audio_genre_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_ARTIST_MODULE\r
+ * @brief The handle to audio artist.\r
+ */\r
+typedef struct audio_artist_s* audio_artist_h;\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_FOLDER_MODULE\r
+ * @brief Iterates over a list of folders.\r
+ *\r
+ * @details This callback is called for every available media folder.\n\r
+ *\r
+ * @remarks To use the @a folder outside this function, copy the handle with #media_folder_clone() function. \r
+ *\r
+ * @param[in] folder The handle to media folder\r
+ * @param[in] user_data The user data passed from the foreach function\r
+ \r
+ * @return true to continue with the next iteration of the loop, \r
+ * @return false to break out of the loop.\r
+ * @pre media_folder_foreach_folder_from_db() will invoke this function.\r
+ * @see media_folder_clone()\r
+ * @see media_folder_foreach_folder_from_db()\r
+ */\r
+typedef bool (*media_folder_cb)(media_folder_h folder, void *user_data);\r
+\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE\r
+ * @brief Iterates over a list of media info.\r
+ *\r
+ * @details This callback is called for every available media info.\n\r
+ *\r
+ * @remarks To use the @a media outside this function, copy the handle with #media_info_clone() function. \r
+ *\r
+ * @param[in] media The hande to media info\r
+ * @param[in] user_data The user data passed from the foreach function \r
+ * @return true to continue with the next iteration of the loop, \r
+ * @return false to break out of the loop.\r
+ * @pre media_tag_foreach_media_from_db(), audio_playlist_foreach_media_from_db(), audio_genre_foreach_media_from_db(),\r
+ * audio_album_foreach_media_from_db(), audio_artist_foreach_media_from_db(), audio_author_foreach_media_from_db(), \r
+ * media_info_foreach_media_from_db(), media_folder_foreach_media_from_db() will invoke this function.\r
+ * @see media_info_clone()\r
+ * @see audio_album_foreach_media_from_db()\r
+ * @see audio_playlist_foreach_media_from_db()\r
+ * @see audio_artist_foreach_media_from_db()\r
+ * @see audio_author_foreach_media_from_db()\r
+ * @see audio_genre_get_media_count_from_db()\r
+ * @see media_tag_foreach_media_from_db()\r
+ * @see media_info_foreach_media_from_db()\r
+ * @see media_folder_foreach_media_from_db()\r
+ */\r
+typedef bool (*media_info_cb)(media_info_h media, void *user_data);\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_TAG_MODULE\r
+ * @brief Iterates over a list of tags\r
+ *\r
+ * @details This callback is called for every tag in the obtained list of tags.\n\r
+ *\r
+ * @remarks To use the @a tag outside this function, copy the handle with #media_tag_clone() function. \r
+ *\r
+ * @param[in] tag The handle to media tag\r
+ * @param[in] user_data The user data passed from the foreach function\r
+ * @return true to continue with the next iteration of the loop, \r
+ * @return false to break out of the loop.\r
+ * @pre media_tag_foreach_tag_from_db(), media_info_foreach_tag_from_db() will invoke this function.\r
+ * @see media_tag_clone()\r
+ * @see media_tag_foreach_tag_from_db()\r
+ * @see media_info_foreach_tag_from_db()\r
+ */\r
+typedef bool (*media_tag_cb)(media_tag_h tag, void *user_data);\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_VIDEO_BOOKMARK_MODULE\r
+ * @brief Iterates over bookmark list\r
+ *\r
+ * @details This callback is called for every bookmark in obtained list of bookmarks.\n\r
+ *\r
+ * @remarks To use the @a bookmark outside this function, copy the handle with #video_bookmark_clone() function. \r
+ *\r
+ * @param[in] bookmark The handle to video bookmark\r
+ * @param[in] user_data The user data passed from the foreach function\r
+ * @return true to continue with the next iteration of the loop, \r
+ * @return false to break out of the loop.\r
+ * @pre video_bookmark_foreach_bookmark_from_db() will invoke this function.\r
+ * @see video_bookmark_clone()\r
+ * @see video_bookmark_foreach_bookmark_from_db()\r
+ */\r
+typedef bool (*video_bookmark_cb)(video_bookmark_h bookmark, void *user_data);\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_PLAYLIST_MODULE\r
+ * @brief Iterates over playlist list\r
+ *\r
+ * @details This callback is called for every playlist in obtained list of playlists.\n\r
+ *\r
+ * @remarks To use the @a playlist outside this function, copy the handle with #audio_playlist_clone() function. \r
+\r
+ *\r
+ * @param[in] playlist The handle to audio playlist\r
+ * @param[in] user_data The user data passed from the foreach function\r
+ * @return true to continue with the next iteration of the loop, \r
+ * @return false to break out of the loop.\r
+ * @pre audio_playlist_foreach_playlist_from_db() will invoke this function.\r
+ * @see audio_playlist_clone()\r
+ * @see audio_playlist_foreach_playlist_from_db()\r
+ */\r
+typedef bool (*audio_playlist_cb)(audio_playlist_h playlist, void *user_data);\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_GENRE_MODULE\r
+ * @brief Iterates over genre list\r
+ *\r
+ * @details This callback is called for every genre in obtained list of groups.\n\r
+ *\r
+ * @remarks To use the @a genre outside this function, copy the handle with #audio_genre_clone() function. \r
+ *\r
+ * @param[in] genre The handle to audio genre\r
+ * @param[in] user_data The user data passed from the foreach function\r
+ * @return true to continue with the next iteration of the loop, \r
+ * @return false to break out of the loop.\r
+ * @pre audio_genre_foreach_genre_from_db() will invoke this function.\r
+ * @see audio_genre_clone()\r
+ * @see audio_genre_foreach_genre_from_db()\r
+ */\r
+typedef bool (*audio_genre_cb)(audio_genre_h genre, void *user_data);\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_ARTIST_MODULE\r
+ * @brief Iterates over artist list\r
+ *\r
+ * @details This callback is called for every artist in obtained list of groups.\n\r
+ *\r
+ * @remarks To use the @a artist outside this function, copy the handle with #audio_artist_clone() function. \r
+ *\r
+ * @param[in] artist The handle to audio artist\r
+ * @param[in] user_data The user data passed from the foreach function\r
+ * @return true to continue with the next iteration of the loop, \r
+ * @return false to break out of the loop.\r
+ * @pre audio_artist_foreach_artist_from_db() will invoke this function.\r
+ * @see audio_artist_clone()\r
+ * @see audio_artist_foreach_artist_from_db()\r
+ */\r
+typedef bool (*audio_artist_cb)(audio_artist_h artist, void *user_data);\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_AUTHOR_MODULE\r
+ * @brief Iterates over author list\r
+ *\r
+ * @details This callback is called for every author in obtained list of groups.\n\r
+ *\r
+ * @remarks To use the @a author outside this function, copy the handle with #audio_author_clone() function. \r
+ *\r
+ * @param[in] author The handle to audio author\r
+ * @param[in] user_data The user data passed from the foreach function\r
+ * @return true to continue with the next iteration of the loop, \r
+ * @return false to break out of the loop.\r
+ * @pre audio_author_foreach_author_from_db() will invoke this function.\r
+ * @see audio_author_clone()\r
+ * @see audio_author_foreach_author_from_db()\r
+ */\r
+typedef bool (*audio_author_cb)(audio_author_h author, void *user_data);\r
+\r
+/**\r
+ * @ingroup CAPI_CONTENT_MEDIA_AUDIO_ALBUM_MODULE\r
+ * @brief Iterates over album list\r
+ *\r
+ * @details This callback is called for every album in obtained list of groups.\n\r
+ *\r
+ * @remarks To use the @a album outside this function, copy the handle with #audio_album_clone() function. \r
+ *\r
+ * @param[in] album The handle to audio album\r
+ * @param[in] user_data The user data passed from the foreach function\r
+ * @return true to continue with the next iteration of the loop, \r
+ * @return false to break out of the loop.\r
+ * @pre audio_album_foreach_album_from_db() will invoke this function.\r
+ * @see audio_album_clone()\r
+ * @see audio_album_foreach_album_from_db()\r
+ */\r
+\r
+typedef bool (*audio_album_cb)(audio_album_h album, void *user_data);\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /*__TIZEN_MEDIA_CONTENT_TYPE_H__*/\r
--- /dev/null
+/*\r
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License. \r
+*/\r
+\r
+\r
+\r
+#ifndef __TIZEN_MEDIA_FILTER_H__\r
+#define __TIZEN_MEDIA_FILTER_H__\r
+\r
+#include <media_content_type.h>\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+ * @addtogroup CAPI_CONTENT_MEDIA_FILTER_INFO_MODULE\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * @brief Creates a media info filter handle.\r
+ * @details This function creates a media info filter handle. The handle can be\r
+ * used to get filtered information based on filter properties i.e. offset, count,search type, search keyword, \r
+ * media type and order.\r
+ *@remarks The @a filter handle must be released with media_info_filter_destroy() by you. \r
+ * @param[out] filter A handle to media info filter\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @see media_info_filter_destroy()\r
+ *\r
+ */\r
+int media_info_filter_create(media_info_filter_h* filter);\r
+\r
+/**\r
+ * @brief Destroys a media info filter handle.\r
+ * @details The function frees all resources related to the media info filter handle. The filter\r
+ * handle no longer can be used to perform any operation. A new filter handle\r
+ * has to be created before the next usage.\r
+ *\r
+ * @param[in] filter The handle to media info filter\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_info_filter_create()\r
+ *\r
+ */\r
+int media_info_filter_destroy(media_info_filter_h filter);\r
+\r
+\r
+/**\r
+ * @brief Set the media info filter's offset and count.\r
+ * @details This function set the @a offset and @a count for the given filter used to limit number of items returned.\r
+ * For example, if you set the @a offset as 10 and @a count as 5, then only searched data from 10 to 14 will be returned when the filter is used with foreach functions. \r
+ *\r
+ * @param[in] filter The handle to media info filter\r
+ * @param[in] offset The start position of the given filter(Starting from zero).\r
+ * @param[in] count The number of items to be searched with respect to offset\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_info_filter_create()\r
+ * @see media_info_filter_destroy() \r
+ */\r
+int media_info_filter_set_offset(media_info_filter_h filter, int offset, int count);\r
+\r
+\r
+/**\r
+ * @brief Set the @a search @a keyword and @a search @a type for given @a filter.\r
+ *\r
+ * @param[in] filter The handle to media info filter\r
+ * @param[in] search_type The type which user want to search. e.g. display name\r
+ * @param[in] search_keyword The keyword which user want to search.\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_info_filter_create()\r
+ * @see media_info_filter_destroy() \r
+ */\r
+int media_info_filter_set_search_keyword(media_info_filter_h filter, media_info_search_type_e search_type, const char *search_keyword);\r
+\r
+\r
+/**\r
+ * @brief Set the media info filter's content order either descending or ascending.\r
+ *\r
+ * @param[in] filter The media info filter handle\r
+ * @param[in] order The search order type\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_info_filter_create()\r
+ * @see media_info_filter_destroy() \r
+ */\r
+int media_info_filter_set_order(media_info_filter_h filter, media_content_order_e order);\r
+\r
+\r
+/**\r
+ * @brief Set the media info filter's content type.\r
+ *\r
+\r
+ *\r
+ * @param[in] filter The handle to Media Info filter.\r
+ * @param[in] media_type The type of the content(#media_content_type_e) \n\r
+ * To allow searching over different content types, you should use bitwise 'OR' operator to compose 'type' parameter. \r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_info_filter_create()\r
+ * @see media_info_filter_destroy() \r
+ */\r
+int media_info_filter_set_media_type(media_info_filter_h filter,int media_type);\r
+\r
+\r
+/**\r
+ * @brief Gets the @a offset and @a count for the given @a filter used to limit number of items returned.\r
+ *\r
+ * @param[in] filter The handle to Media Info filter\r
+ * @param[out] offset The start position of the given filter(Starting from zero).\r
+ * @param[out] count The number of items to be searched with respect to offset.\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_info_filter_create()\r
+ * @see media_info_filter_destroy() \r
+ */\r
+int media_info_filter_get_offset(media_info_filter_h filter, int* offset, int* count);\r
+\r
+\r
+/**\r
+ * @brief Gets the @a search @a keyword and @a search @a type for given @a filter.\r
+ *\r
+ * @remarks @a search_keyword must be released with free() by you. \r
+ * @param[in] filter The handle to media info filter\r
+ * @param[out] search_type The type of search\r
+ * @param[out] search_keyword The keyword which user want to search\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_info_filter_create()\r
+ * @see media_info_filter_destroy() \r
+ */\r
+int media_info_filter_get_search_keyword(media_info_filter_h filter,media_info_search_type_e* search_type, char **search_keyword);\r
+\r
+\r
+/**\r
+ * @brief Gets the media info filter's content order.\r
+ * @details This function gets the @a order for given @a filter.\r
+ *\r
+ * @param[in] filter The handle to media info filter\r
+ * @param[out] order The search order type\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_info_filter_create()\r
+ * @see media_info_filter_destroy() \r
+ */\r
+int media_info_filter_get_order(media_info_filter_h filter, media_content_order_e* order);\r
+\r
+\r
+/**\r
+ * @brief Gets the media info filter's content type.\r
+ * @details This function gets the content type (#media_content_type_e) for given filter\r
+ *\r
+ *\r
+ * @param[in] filter The handle to media info filter\r
+ * @param[out] type The type of the media content(#media_content_type_e) \n\r
+ * To allow searching over different content types, you should use bitwise 'OR' operator to compose 'type' parameter. \r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_info_filter_create()\r
+ * @see media_info_filter_destroy() \r
+ */\r
+int media_info_filter_get_media_type(media_info_filter_h filter,int* type);\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+\r
+\r
+/**\r
+ * @addtogroup CAPI_CONTENT_MEDIA_FILTER_FOLDER_MODULE\r
+ * @{\r
+ */\r
+\r
+\r
+/**\r
+ * @brief Creates a media folder filter handle.\r
+ * @details This function creates a media folder filter handle. The handle can be\r
+ * used to get filtered information based on filter properties i.e. offset, count, search type, search keyword\r
+ * and order.\r
+ *\r
+ * @remarks The @a filter handle must be released with media_info_filter_destroy() by you. \r
+ * @param[out] filter A handle to media folder filter\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @see media_folder_filter_destroy(),\r
+ *\r
+ */\r
+int media_folder_filter_create(media_folder_filter_h* filter);\r
+\r
+/**\r
+ * @brief Destroys a media media folder filter\r
+ * @details The function frees all resources related to the media folder filter handle. The filter\r
+ * handle no longer can be used to perform any operation. A new filter handle\r
+ * has to be created before the next usage.\r
+ *\r
+ * @param[in] filter The handle to media folder filter\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_folder_filter_create()\r
+ *\r
+ */\r
+\r
+int media_folder_filter_destroy(media_folder_filter_h filter);\r
+\r
+\r
+/**\r
+ * @brief Set the media folder filter's offset and count.\r
+ * @details This function set the @a offset and @a count for the given filter used to limit number of items returned.\r
+ * For example, if you set the @a offset as 10 and @a count as 5, then only searched data from 10 to 14 will be returned when the filter is used with foreach functions. \r
+ *\r
+ * @param[in] filter The handle to media folder filter\r
+ * @param[in] offset The start position of the given filter(Starting from zero).\r
+ * @param[in] count The number of items to be searched with respect to offset.\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_folder_filter_create()\r
+ * @see media_folder_filter_destroy() \r
+ */\r
+int media_folder_filter_set_offset(media_folder_filter_h filter, int offset, int count);\r
+\r
+\r
+/**\r
+ * @brief Set the @a search @a keyword and @a search @a type for given @a filter.\r
+ *\r
+ * @param[in] filter The handle to media folder filter\r
+ * @param[in] search_type The type which user want to search.\r
+ * @param[in] search_keyword The keyword which user want to search\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_folder_filter_create()\r
+ * @see media_folder_filter_destroy() \r
+ */\r
+int media_folder_filter_set_search_keyword(media_folder_filter_h filter,media_folder_search_type_e search_type,const char *search_keyword);\r
+\r
+\r
+/**\r
+ * @brief Set the media folder filter's content order either descending or ascending.\r
+ *\r
+ * @param[in] filter the handle to media folder filter\r
+ * @param[in] order The search order type\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_folder_filter_create()\r
+ * @see media_folder_filter_destroy() \r
+ */\r
+int media_folder_filter_set_order(media_folder_filter_h filter, media_content_order_e order);\r
+\r
+\r
+\r
+/**\r
+ * @brief Gets the @a offset and @a count for the given @a filter used to limit number of items returned.\r
+ *\r
+ * @param[in] filter The handle to media folder filter\r
+ * @param[out] offset The start position of the given filter(Starting from zero).\r
+ * @param[out] count The number of items to be searched with respect to offset.\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_folder_filter_create()\r
+ * @see media_folder_filter_destroy()\r
+ */\r
+int media_folder_filter_get_offset(media_folder_filter_h filter, int* offset, int* count);\r
+\r
+\r
+/**\r
+ * @brief Gets the @a search @a keyword and @a search @a type for given @a filter.\r
+ *\r
+ * @remarks search_keyword must be released with free() by you. \r
+ * @param[in] filter The handle to media folder filter\r
+ * @param[out] search_type The type of search\r
+ * @param[out] search_keyword The keyword which user want to search\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_folder_filter_create()\r
+ * @see media_folder_filter_destroy()\r
+ */\r
+int media_folder_filter_get_search_keyword(media_folder_filter_h filter,media_folder_search_type_e* search_type, char **search_keyword);\r
+\r
+\r
+/**\r
+ * @brief Gets the media folder filter's content order.\r
+ * @details This function gets the @a order for given @a filter.\r
+ *\r
+ * @param[in] filter The handle to media folder filter\r
+ * @param[out] order The search order type\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_folder_filter_create()\r
+ * @see media_folder_filter_destroy() \r
+ */\r
+int media_folder_filter_get_order(media_folder_filter_h filter, media_content_order_e* order);\r
+\r
+\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+\r
+\r
+\r
+/**\r
+ * @addtogroup CAPI_CONTENT_MEDIA_FILTER_AUDIO_MODULE\r
+ * @{\r
+ */\r
+ \r
+\r
+\r
+/**\r
+ * @brief Creates a audio filter handle.\r
+ * @details This function creates a #media_audio_filter_h filter handle. The handle can be\r
+ * used to get filtered information based on filter properties i.e. offset, count, search keyword\r
+ * and order.\r
+ *\r
+ * @param[out] filter A handle to media audio filter\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @see media_audio_filter_destroy(),\r
+ *\r
+ */\r
+int media_audio_filter_create(media_audio_filter_h* filter);\r
+\r
+/**\r
+ * @brief Destroys a media audio filter handle.\r
+ * @details The function frees all resources related to the media audio filter handle. The filter\r
+ * handle no longer can be used to perform any operation. A new filter handle\r
+ * has to be created before the next usage.\r
+ *\r
+ * @param[in] filter The handle to media audio filter\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_audio_filter_create()\r
+ *\r
+ */\r
+\r
+int media_audio_filter_destroy(media_audio_filter_h filter);\r
+\r
+\r
+/**\r
+ * @brief Set the media audio filter's offset and count.\r
+ * @details This function set the @a offset and @a count for the given filter used to limit number of items returned.\r
+ * For example, if you set the @a offset as 10 and @a count as 5, then only searched data from 10 to 14 will be returned when the filter is used with foreach functions. \r
+ *\r
+ * @param[in] filter The handle to media audio filter\r
+ * @param[in] offset The start position of the given filter (Starting from zero).\r
+ * @param[in] count The number of items to be searched with respect to offset.\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_audio_filter_create()\r
+ * @see media_audio_filter_destroy() \r
+ */\r
+int media_audio_filter_set_offset(media_audio_filter_h filter, int offset, int count);\r
+\r
+\r
+/**\r
+ * @brief Set the @a search @a keyword and @a search @a type for given @a filter.\r
+ *\r
+ * @param[in] filter The handle to media audio filter\r
+ * @param[in] search_keyword The keyword which user want to search\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_audio_filter_create()\r
+ * @see media_audio_filter_destroy() \r
+ */\r
+int media_audio_filter_set_search_keyword(media_audio_filter_h filter,media_audio_search_type_e search_type,const char *search_keyword);\r
+\r
+\r
+/**\r
+ * @brief Set the media audio filter's content order either descending or ascending.\r
+ *\r
+ * @param[in] filter The handle to media audio filter\r
+ * @param[in] order The search order type\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_audio_filter_create()\r
+ * @see media_audio_filter_destroy() \r
+ */\r
+int media_audio_filter_set_order(media_audio_filter_h filter, media_content_order_e order);\r
+\r
+\r
+\r
+\r
+/**\r
+ * @brief Gets the @a offset and @a count for the given @a filter used to limit number of items returned.\r
+ *\r
+ * @param[in] filter The handle to media audio filter\r
+ * @param[out] offset The start position of the given filter (Starting from zero).\r
+ * @param[out] count The number of items to be searched with respect to offset.\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_audio_filter_create()\r
+ * @see media_audio_filter_destroy() \r
+ */\r
+int media_audio_filter_get_offset(media_audio_filter_h filter, int* offset, int* count);\r
+\r
+\r
+/**\r
+ * @brief Gets the @a search @a keyword and @a search @a type for given @a filter.\r
+ *\r
+ * @remarks search_keyword must be released with free() by you. \r
+ * @param[in] filter The handle to media audio filter\r
+ * @param[out] search_type The type of search\r
+ * @param[out] search_keyword The keyword which user want to search\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_audio_filter_create()\r
+ * @see media_audio_filter_destroy() \r
+ */\r
+int media_audio_filter_get_search_keyword(media_audio_filter_h filter,media_audio_search_type_e* search_type,char **search_keyword);\r
+\r
+\r
+/**\r
+ * @brief Gets the media audio filter's content order.\r
+ * @details This function gets the @a order for given @a filter.\r
+ *\r
+ * @param[in] filter The handle to media audio filter\r
+ * @param[out] order The search order type\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_audio_filter_create()\r
+ * @see media_audio_filter_destroy() \r
+ */\r
+int media_audio_filter_get_order(media_audio_filter_h filter, media_content_order_e* order);\r
+\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+\r
+\r
+/**\r
+ * @addtogroup CAPI_CONTENT_MEDIA_FILTER_TAG_MODULE\r
+ * @{\r
+ */\r
+\r
+\r
+/**\r
+ * @brief Creates a media tag filter handle.\r
+ * @details This function creates a #media_tag_filter_h filter handle. The handle can be\r
+ * used to get filtered information based on filter properties i.e. offset, count, search keyword\r
+ * and order.\r
+ *\r
+ * @param[out] filter A handle to media tag filter\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @see media_tag_filter_destroy(),\r
+ *\r
+ */\r
+int media_tag_filter_create(media_tag_filter_h* filter);\r
+\r
+/**\r
+ * @brief Destroys a media tag filter handle.\r
+ * @details The function frees all resources related to the tag filter handle. The filter\r
+ * handle no longer can be used to perform any operation. A new filter handle\r
+ * has to be created before the next usage.\r
+ *\r
+ * @param[in] The handle to media tag filter\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_tag_filter_create()\r
+ *\r
+ */\r
+\r
+int media_tag_filter_destroy(media_tag_filter_h filter);\r
+\r
+/**\r
+ * @brief Set the media tag filter's offset and count.\r
+ * @details This function set the @a offset and @a count for the given filter used to limit number of items returned.\r
+ * For example, if you set the @a offset as 10 and @a count as 5, then only searched data from 10 to 14 will be returned when the filter is used with foreach functions. \r
+ *\r
+ *\r
+ * @param[in] filter The handle to media tag filter\r
+ * @param[in] offset The start position of the given filter(Starting from zero).\r
+ * @param[in] count The number of items to be searched with respect to offset.\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_tag_filter_create()\r
+ * @see media_tag_filter_destroy() \r
+ */\r
+int media_tag_filter_set_offset(media_tag_filter_h filter, int offset, int count);\r
+\r
+\r
+/**\r
+ * @brief Set the @a search @a keyword and @a search @a type for given @a filter.\r
+ *\r
+ * @param[in] filter The handle to media tag filter\r
+ * @param[in] search_type The type which user want to search. \r
+ * @param[in] search_keyword The keyword which user want to search.\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_tag_filter_create()\r
+ * @see media_tag_filter_destroy() \r
+ */\r
+int media_tag_filter_set_search_keyword(media_tag_filter_h filter,media_tag_search_type_e search_type,const char *search_keyword);\r
+\r
+\r
+/**\r
+ * @brief Set the media tag filter's content order either descending or ascending.\r
+ *\r
+ * @param[in] filter The handle to media tag filter\r
+ * @param[in] order The search order type\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_tag_filter_create()\r
+ * @see media_tag_filter_destroy() \r
+ */\r
+int media_tag_filter_set_order(media_tag_filter_h filter, media_content_order_e order);\r
+\r
+\r
+\r
+/**\r
+ * @brief Gets the @a offset and @a count for the given @a filter used to limit number of items returned.\r
+ *\r
+ * @param[in] filter The handle to media tag filter\r
+ * @param[out] offset The start position of the given filter(Starting from zero).\r
+ * @param[out] count The number of items to be searched with respect to offset.\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_tag_filter_create()\r
+ * @see media_tag_filter_destroy() \r
+ */\r
+int media_tag_filter_get_offset(media_tag_filter_h filter, int* offset, int* count);\r
+\r
+\r
+/**\r
+ * @brief Gets the @a search @a keyword and @a search @a type for given @a filter.\r
+ *\r
+ * @remarks search_keyword must be released with free() by you.\r
+ * @param[in] filter The handle to media tag filter\r
+ * @param[out] search_type The type of search\r
+ * @param[out] search_keyword The keyword which user want to search\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_tag_filter_create()\r
+ * @see media_tag_filter_destroy() \r
+ */\r
+int media_tag_filter_get_search_keyword(media_tag_filter_h filter, media_tag_search_type_e *search_type,char **search_keyword);\r
+\r
+\r
+/**\r
+ * @brief Gets the media tag filter's content order.\r
+ * @details This function gets the @a order for given @a filter.\r
+ *\r
+ * @param[in] filter The handle to media tag filter\r
+ * @param[out] order The search order type\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_tag_filter_create()\r
+ * @see media_tag_filter_destroy() \r
+ */\r
+int media_tag_filter_get_order(media_tag_filter_h filter, media_content_order_e* order);\r
+\r
+/**\r
+ * @}\r
+ */\r
+ \r
+\r
+\r
+/**\r
+ * @addtogroup CAPI_CONTENT_MEDIA_FILTER_BOOKMARK_MODULE\r
+ * @{\r
+ */\r
+ \r
+\r
+\r
+/**\r
+ * @brief Creates a video bookmark filter handle.\r
+ * @details This function creates a #video_bookmark_filter_h filter handle. The handle can be\r
+ * used to get filtered information based on filter properties i.e. offset, count and order.\r
+ *\r
+ * @param[out] filter A handle to video bookmark filter\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @see video_bookmark_filter_destroy(),\r
+ *\r
+ */\r
+int video_bookmark_filter_create(video_bookmark_filter_h* filter);\r
+\r
+/**\r
+ * @brief Destroys a video bookmark filter handle.\r
+ * @details The function frees all resources related to the bookmark filter handle. The filter\r
+ * handle no longer can be used to perform any operation. A new filter handle\r
+ * has to be created before the next usage.\r
+ *\r
+ * @param[in] filter The handle to video bookmark filter\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see video_bookmark_filter_create()\r
+ *\r
+ */\r
+\r
+int video_bookmark_filter_destroy(video_bookmark_filter_h filter);\r
+\r
+/**\r
+ * @brief Set the video bookmark filter's offset.\r
+ * @details This function set the offset and count for the given bookmark filter used to limit number of items returned.\r
+ *\r
+ * @param[in] filter The handle to video bookmark filter\r
+ * @param[in] offset The start position of the given filter (Starting from zero).\r
+ * @param[in] count The number of items to be searched with respect to offset.\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see video_bookmark_filter_create()\r
+ * @see video_bookmark_filter_destroy() \r
+ */\r
+int video_bookmark_filter_set_offset(video_bookmark_filter_h filter, int offset, int count);\r
+\r
+\r
+/**\r
+ * @brief Set the video bookmark filter's content order either descending or ascending.\r
+ *\r
+ * @param[in] filter The handle to video bookmark filter\r
+ * @param[in] order The search order type\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see video_bookmark_filter_create()\r
+ * @see video_bookmark_filter_destroy() \r
+ */\r
+int video_bookmark_filter_set_order(video_bookmark_filter_h filter, media_content_order_e order);\r
+\r
+\r
+/**\r
+ * @brief Gets the @a offset and @a count for the given @a filter used to limit number of items returned.\r
+ *\r
+ * @param[in] filter The handle to video bookmark filter\r
+ * @param[out] offset The start position of the given filter (Starting from zero).\r
+ * @param[out] count The number of items to be searched with respect to offset.\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see video_bookmark_filter_create()\r
+ * @see video_bookmark_filter_destroy() \r
+ */\r
+int video_bookmark_filter_get_offset(video_bookmark_filter_h filter, int* offset, int* count);\r
+\r
+\r
+/**\r
+ * @brief Gets the video bookmark filter's content order.\r
+ * @details This function gets the @a order for given @a filter.\r
+ *\r
+ * @param[in] filter The handle to video bookmark filter\r
+ * @param[out] order The search order type\r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see video_bookmark_filter_create()\r
+ * @see video_bookmark_filter_destroy()\r
+ */\r
+int video_bookmark_filter_get_order(video_bookmark_filter_h filter, media_content_order_e* order);\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+#endif /* __TIZEN_MEDIA_FILTER_H__ */\r
+\r
--- /dev/null
+/*\r
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License. \r
+*/\r
+\r
+\r
+#ifndef __TIZEN_MEDIA_FOLDER_H__\r
+#define __TIZEN_MEDIA_FOLDER_H__\r
+\r
+\r
+#include <media_content_type.h>\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+ * @addtogroup CAPI_CONTENT_MEDIA_FOLDER_MODULE\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * @brief Iterates through all available media folders from the media database.\r
+ * @details This function gets all media folder handles meeting the given \r
+ * @a filter. The @a callback function will be invoked for every retrieved\r
+ * folder. If NULL is passed to the @a filter, no filtering is applied. \r
+ *\r
+ * @param[in] filter The handle to media folder filter\r
+ * @param[in] callback The callback function to invoke\r
+ * @param[in] user_data The user data to be passed to the callback function \r
+ * @return return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @pre This function requires opened connection to content service by media_content_connect().\r
+ * @pre A filter handle has to be created by calling media_folder_filter_create()\r
+ * @post This function invokes media_folder_cb()\r
+ * @see media_content_connect()\r
+ * @see #media_folder_cb\r
+ * @see media_folder_filter_create()\r
+ */\r
+int media_folder_foreach_folder_from_db(media_folder_filter_h filter, media_folder_cb callback, void *user_data);\r
+\r
+/**\r
+ * @brief Iterates through the media files with optional @a filter in the given @a folder from the media database.\r
+ * @details This function gets all media files associated with the given folder and\r
+ * meeting desired filter option and calls registered callback function for\r
+ * every retrieved media item. If NULL is passed to the @a filter, no filtering is applied. \r
+ *\r
+ * @param[in] folder The handle to media folder\r
+ * @param[in] filter The handle to media info filter\r
+ * @param[in] callback The callback function to invoke\r
+ * @param[in] user_data The user data to be passed to the callback function \r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @pre This function requires opened connection to content service by media_content_connect().\r
+ * @post This function invokes media_info_cb()\r
+ * @see #media_info_cb\r
+ * @see media_content_connect()\r
+ * @see media_folder_filter_create()\r
+ */\r
+int media_folder_foreach_media_from_db(media_folder_h folder, media_info_filter_h filter, media_info_cb callback, void *user_data);\r
+\r
+\r
+/**\r
+ * @brief Gets the number of media files for the passed @a type in the given @a folder from the media database.\r
+ *\r
+ * @param[in] folder The handle to media folder\r
+ * @param[in] type The type of media content. \n To allow searching over different content types, you should use bitwise 'OR' operator to compose @a type.\r
+ * @param[out] count The count of media folder items\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed \r
+ * @pre This function requires opened connection to content service by media_content_connect().\r
+ * @see media_content_connect()\r
+ *\r
+ */\r
+int media_folder_get_media_count_from_db(media_folder_h folder, media_content_type_e type, int *count);\r
+\r
+/**\r
+ * @brief Clones the media folder.\r
+ * @details This function copies the media folder handle from a source to\r
+ * destination. There is no media_folder_create() function. The media_folder_h is created internally and available through \r
+ * media folder foreach function such as media_folder_foreach_folder_from_db(). To use this handle outside of these foreach functions, \r
+ * use this function. \r
+ * @remark The destination handle must be released with media_folder_destroy() by you. \r
+ * @param[out] dst A destination handle to media folder\r
+ * @param[in] src The source handle to media folder\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @see media_folder_destroy()\r
+ * @see media_folder_foreach_folder_from_db() \r
+ */\r
+int media_folder_clone(media_folder_h* dst, media_folder_h src);\r
+\r
+\r
+/**\r
+ * @brief Destroys the media folder.\r
+ * @details The function frees all resources related to the folder handle. This handle\r
+ * no longer can be used to perform any operation. A new handle has to\r
+ * be created before the next use.\r
+ *\r
+ * @param[in] folder The handle to media folder\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @pre A copy of the media folder handle created by calling media_folder_clone()\r
+ * @see media_folder_clone()\r
+ */\r
+int media_folder_destroy(media_folder_h folder);\r
+\r
+\r
+/**\r
+ * @brief Gets the absolute path to the folder.\r
+ *\r
+ * @remarks @a path must be released with free() by you.\r
+ *\r
+ * @param[in] folder The handle to media folder\r
+ * @param[out] path The path of the media folder\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ *\r
+ */\r
+int media_folder_get_path(media_folder_h folder, char **path);\r
+\r
+/**\r
+ * @brief Gets the folder name.\r
+ *\r
+ * @remarks @a folder_name must be released with free() by you.\r
+ *\r
+ * @param[in] folder The handle to media folder\r
+ * @param[out] folder_name The name of the media folder\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ *\r
+ */\r
+int media_folder_get_name(media_folder_h folder, char **folder_name);\r
+\r
+/**\r
+ * @brief Gets the folder storage type.\r
+ *\r
+ * @param[in] folder The handle to media folder\r
+ * @param[out] storage_type The storage type of the media folder\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ *\r
+ */\r
+int media_folder_get_storage_type(media_folder_h folder, media_content_storage_e *storage_type);\r
+\r
+/**\r
+ * @brief Gets the modifed date of the folder.\r
+ *\r
+ * @param[in] folder The handle to media folder\r
+ * @param[out] date The modifed date of folder \r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ *\r
+ */\r
+int media_folder_get_date_modified(media_folder_h folder, time_t *date);\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+#endif /* __TIZEN_MEDIA_FOLDER_H__ */\r
+\r
--- /dev/null
+/*
+* Copyright (c) 2011 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 __TIZEN_IMAGE_META_H__
+#define __TIZEN_IMAGE_META_H__
+
+#include <media_content_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_IMAGE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Clones image metadata.
+ * @details Function copies the image metadata handle from source to destination.
+ *
+ * @remark The destination handle must be released with image_meta_destroy() by you.
+ *
+ * @param [out] dst A destination handle to image metadata
+ * @param [in] src The source handle to image metadata
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @see image_meta_destroy()
+ */
+int image_meta_clone(image_meta_h *dst, image_meta_h src);
+
+
+/**
+ * @brief Destroys image metadata.
+ * @details The function frees all resources related to the image metadata handle. This handle
+ * no longer can be used to perform any operation. A new handle has to
+ * be created before next usage.
+ *
+ * @param [in] image The handle to image metadata
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @pre Get copy of image_meta handle by calling image_meta_clone()
+ * @see image_meta_clone()
+ */
+int image_meta_destroy(image_meta_h image);
+
+
+
+/**
+ * @brief Gets the longitude from image metadata.
+ * @details Function gives geographic position: longitude value in degrees,
+ * which is positive for east and negative for west.
+ *
+ * @param [in] image The handle to image metadata
+ * @param [out] longitude The image longitude in degrees
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int image_meta_get_longitude(image_meta_h image, double *longitude);
+
+
+/**
+ * @brief Gets the latitude from image metadata.
+ * @details Function gives geographic position: latitude value in degrees,
+ * which is positive for north and negative for south.
+ *
+ * @param [in] image The handle to image metadata
+ * @param [out] latitude The image latitude in degrees
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int image_meta_get_latitude(image_meta_h image, double *latitude);
+
+
+/**
+ * @brief Gets the image description.
+ *
+ * @remarks @a description must be released with free() by you.
+ *
+ * @param [in] image The handle to image metadata
+ * @param [out] description The image description or NULL
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int image_meta_get_description(image_meta_h image, char **description);
+
+
+/**
+ * @brief Gets image's width in pixels.
+ *
+ * @param [in] image The handle to image metadata
+ * @param [out] width The image width in pixels
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int image_meta_get_width(image_meta_h image, int *width);
+
+
+/**
+ * @brief Gets image's height in pixels.
+ *
+ * @param [in] image The handle to image metadata
+ * @param [out] height The image height in pixels
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int image_meta_get_height(image_meta_h image, int *height);
+
+
+/**
+ * @brief Gets the image orientation.
+ *
+ * @param [in] image The handle to image metadata
+ * @param [out] orientation The image orientation
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int image_meta_get_orientation(image_meta_h image, media_content_orientation_e *orientation);
+
+
+/**
+ * @brief Gets the date, when image was created as time_t structure.
+ *
+ * @param [in] image The handle to image metadata
+ * @param [out] date_taken The time, when image was taken (in seconds, since the Epoch)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int image_meta_get_date_taken(image_meta_h image, time_t *date_taken);
+
+
+/**
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /*__TIZEN_IMAGE_META_H__*/
--- /dev/null
+/*
+* Copyright (c) 2011 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 __TIZEN_MEDIA_INFORMATION_H__
+#define __TIZEN_MEDIA_INFORMATION_H__
+
+#include <media_content_type.h>
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_INFO_MODULE
+ * @{
+ */
+
+/**
+ * @brief Iterates through media info from the media database.
+ * @details This function gets all media info handles meeting the given @a filter. The @a callback function will be invoked for every retrieved media info.
+ * If NULL is passed to the @a filter, no filtering is applied.
+ * @param[in] filter The handle to media info filter
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes media_info_cb().
+ * @see media_content_connect()
+ * @see #media_info_cb
+ * @see media_info_filter_create()
+ *
+ */
+int media_info_foreach_media_from_db(media_info_filter_h filter, media_info_cb callback, void *user_data);
+
+
+
+/**
+ * @brief Iterates through the media tag in the given @a media @a info from the media database.
+ * @details This function gets all media tag associated with the given @a media and calls registered callback function for every retrieved media tag.
+ * @param[in] media The handle to media info
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes media_tag_cb().
+ * @see media_content_connect()
+ * @see #media_tag_cb
+ */
+int media_info_foreach_tag_from_db(media_info_h media, media_tag_cb callback, void *user_data);
+
+
+
+/**
+ * @brief Clones the media info handle.
+ *
+ * @details This function copies the media info handle from a source to destination.
+ * There is no media_info_create() function. The media_info_h is created internally and
+ * available through media info foreach function such as media_info_foreach_media_from_db().
+ * To use this handle outside of these foreach functions, use this function.
+ * @remark The destination handle must be released with media_info_destroy() by you.
+ *
+ * @param[out] dst A destination handle to media info
+ * @param[in] src The source handle to media info
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @see media_info_destroy()
+ * @see audio_album_foreach_media_from_db()
+ * @see audio_playlist_foreach_media_from_db()
+ * @see audio_artist_foreach_media_from_db()
+ * @see audio_author_foreach_media_from_db()
+ * @see audio_genre_get_media_count_from_db()
+ * @see media_tag_foreach_media_from_db()
+ * @see media_info_foreach_media_from_db()
+ * @see media_folder_foreach_media_from_db()
+ *
+ */
+int media_info_clone(media_info_h* dst, media_info_h src);
+
+
+/**
+ * @brief Destroys the media info.
+ * @details The function frees all resources related to the meida info handle. This handle
+ * no longer can be used to perform any operation. New media info handle has to
+ * be created before next usage.
+ *
+ * @param[in] media The handle to media info
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Get copy of media_info handle by calling media_info_clone()
+ * @see media_info_clone()
+ */
+int media_info_destroy(media_info_h media);
+
+
+
+/**
+ * @brief Gets path to media info.
+ *
+ * @remarks @a path must be released with free() by you.
+ *
+ * @param[in] media The handle to media info
+ * @param[out] path The path of media info
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ */
+int media_info_get_file_path(media_info_h media, char **path);
+
+/**
+ * @brief Gets name to media info.
+ *
+ * @remarks @a name must be released with free() by you.
+ *
+ * @param[in] media The handle to media info
+ * @param[out] name The name of media info
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int media_info_get_display_name(media_info_h media, char **name);
+
+/**
+ * @brief Gets the thumbnail to media info.
+ *
+ * @remarks @a path must be released with free() by you.
+ *
+ * @param[in] media The handle to media info
+ * @param[out] path The path to thumbnail of media info
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int media_info_get_thumbnail_path(media_info_h media, char **path);
+
+/**
+ * @brief Gets media info's date of modification.
+ *
+ * @param[in] media The handle to media info
+ * @param[out] time The date of modification
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int media_info_get_date_modified(media_info_h media, time_t *time);
+
+/**
+ * @brief Gets media info's content type.
+ *
+ * @param[in] media The handle to media info
+ * @param[out] type The type of media content(#media_content_type_e). \n
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int media_info_get_media_type(media_info_h media, int *type);
+
+
+
+/**
+ * @brief Gets image metadata for a given media info from the media database.
+ * @details This function returns an image metadata handle retrieved from the media info.
+ *
+ * @remark The @a image handle must be released with image_meta_destroy() by you.
+ *
+ * @param[in] media The handle to media info
+ * @param[out] image A handle to image meta
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see image_meta_destroy()
+ */
+int media_info_get_image_from_db(media_info_h media, image_meta_h* image);
+
+/**
+ * @brief Gets video metadata for a given media info from the media database.
+ * @details This function returns a video metadata handle retrieved from the media info handle.
+ *
+ * @remark The @a video handle must be released with video_meta_destroy() by you.
+ *
+ * @param[in] media The handle to media info
+ * @param[out] video A handle to the video meta
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see video_meta_destroy()
+ *
+ */
+int media_info_get_video_from_db(media_info_h media, video_meta_h* video);
+
+/**
+ * @brief Gets audio metadata for a given media info from the media database.
+ * @details This function returns an audio metadata handle retrieved from the media info handle.
+ *
+ * @remark The @a audio handle must be released with audio_meta_destroy() by you.
+ *
+ * @param[in] media The handle to media info
+ * @param[out] audio A handle to the audio meta
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see audio_meta_destroy()
+ */
+int media_info_get_audio_from_db(media_info_h media, audio_meta_h* audio);
+
+
+/**
+ * @brief Gets the given media info's favorite status.
+ *
+ * @param [in] media The handle to media info
+ * @param [out] favorite The media favorite status(non zero if favorite, 0 if not favorite)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int media_info_get_favorite(media_info_h media, int* favorite);
+
+
+/**
+ * @brief Updates media info's favorite status to the media database.
+ *
+ * @param [in] media The handle to media info
+ * @param [in] favorite The media favorite status(non zero if favorite, 0 if not favorite)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see media_info_meta_get_favorite()
+ */
+int media_info_update_favorite_to_db(media_info_h media, int favorite);
+
+
+
+/**
+ * @brief Inserts media file into the media database.
+ * @details This function inserts an media item with desired @a type into the content storage.
+ * Normally, inserting a media file in database is done automatically by media server, without calling this function.
+ * This function is only called when media server is busy and user needs to get quick result of inserting
+ * e.g. Taking a photo while media server is busy and user want to see the quick snapshot of the photo taken.
+ *
+ * @param[in] type The type of media content
+ * @param[in] path The path to the media file
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see #media_content_type_e media_content_connect()
+ */
+int media_info_insert_to_db(media_content_type_e type, const char *path);
+
+
+
+
+/**
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIA_INFORMATION_H__ */
+
--- /dev/null
+/*
+* Copyright (c) 2011 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 __TIZEN_MEDIA_INFO_PRIVATE_H__
+#define __TIZEN_MEDIA_INFO_PRIVATE_H__
+
+
+#include <media_content_type.h>
+#include <string.h>
+#include <sqlite3.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#define MEDIA_CONTENT_TYPE 5
+
+#define MEDIA_CONTENT_PATH_PHONE "/opt/media" /**< File path prefix of files stored in phone */
+#define MEDIA_CONTENT_PATH_MMC "/mnt/mmc" /**< File path prefix of files stored in mmc card */
+
+#define MAX_QUERY_SIZE 4096
+#define MIN_QUERY_SIZE 256
+#define DEFAULT_QUERY_SIZE 1024
+#define MAX_KEYWORD_SIZE 2048
+
+
+
+typedef struct
+{
+ media_content_type_e media_type; // image, audio, video, all
+ int offset; // position of start
+ int count; // offset
+ media_info_search_type_e search_type;
+ char* keyword; // search condition like a sql "like"
+ media_content_order_e order; //The sort order
+
+}media_info_filter_s;
+
+
+typedef struct
+{
+ int offset; // position of start
+ int count; // offset
+ media_folder_search_type_e search_type;
+ char* keyword; // search condition like a sql "like"
+ media_content_order_e order; //The sort order
+
+}media_folder_filter_s;
+
+
+typedef struct
+{
+ int offset; // position of start
+ int count; // offset
+ media_tag_search_type_e search_type;
+ char* keyword; // search condition like a sql "like"
+ media_content_order_e order; //The sort order
+
+}media_tag_filter_s;
+
+
+typedef struct
+{
+ int offset; // position of start
+ int count; // offset
+ media_audio_search_type_e search_type;
+ char* keyword; // search condition like a sql "like"
+ media_content_order_e order; //The sort order
+
+}media_audio_filter_s;
+
+typedef struct
+{
+ int offset; // position of start
+ int count; // offset
+ media_content_order_e order; //The sort order
+
+}video_bookmark_filter_s;
+
+
+typedef struct
+{
+ char* folder_uid; //image id , audio id, video id
+ char* path;
+ char* name;
+ time_t date_modified;
+ media_content_storage_e storage_type;
+}media_folder_s;
+
+typedef struct
+{
+ char* item_id; //image id , audio id, video id
+ char* file_path;
+ char* display_name;
+ char* thumbnail;
+ time_t date_modified;
+ int favorite;
+ media_content_type_e media_type;
+}media_info_s;
+
+
+typedef struct
+{
+ int tag_id;
+ //int content_id; //replace to glist of item_h
+ char* name;
+
+}media_tag_s;
+
+
+typedef struct
+{
+ char* image_id;
+ int longitude;
+ int latitude;
+ char* thumbnail;
+ char* description;
+ int width;
+ int height;
+ int favorite;
+ media_content_orientation_e orientation;
+ time_t date_taken;
+}image_meta_s;
+
+
+typedef struct
+{
+ char* video_id;
+ int longitude;
+ int latitude;
+ char* album;
+ char* artist;
+ char* title;
+ char* description;
+ char* thumbnail;
+ int time_played;
+ int duration;
+ int width;
+ int height;
+ int favorite;
+ media_content_orientation_e orientation;
+ time_t date_taken;
+}video_meta_s;
+
+
+typedef struct
+{
+ int bookmark_id;
+ char* video_id;
+ time_t time_marked;
+ char* thumbnail;
+
+}video_bookmark_s;
+
+
+typedef struct
+{
+ char* audio_id;
+ char* genre;
+ char* author;
+ char* album;
+ char* artist;
+ char* year;
+ char* copyright;
+ char* description;
+ char* format;
+ int bitrate;
+ int track_num;
+ int duration;
+ int rating;
+ int count_played;
+ int time_played;
+ time_t time_added;
+ int size;
+ int category;
+
+}audio_meta_s;
+
+typedef struct
+{
+ int playlist_id; //playlist id
+ char* name; // playlist name
+
+}audio_playlist_s;
+
+
+typedef struct
+{
+ char* name;
+}audio_artist_s;
+
+typedef struct
+{
+ char* name;
+}audio_genre_s;
+
+
+typedef struct
+{
+ char* name;
+}audio_author_s;
+
+typedef struct
+{
+ char* name;
+}audio_album_s;
+
+
+
+
+
+#define CONDITION_TYPE_IMAGE "content_type=1"
+#define CONDITION_TYPE_VIDEO "content_type=2"
+#define CONDITION_TYPE_AUDIO "content_type=3"
+#define QUERY_KEYWORD_AND "and"
+#define QUERY_KEYWORD_OR "or"
+#define QUERY_KEYWORD_ORDER_BY "order by"
+#define QUERY_KEYWORD_LIMIT "limit"
+#define QUERY_KEYWORD_DESC "desc"
+#define QUERY_KEYWORD_SPACE " "
+#define DB_FIELD_FOLDER_UID "folder_uuid"
+#define DB_FILED_DISPLAY_NAME "display_name"
+#define DB_FILED_MODIFIED_DATE "modified_date"
+#define DB_FILED_NAME "name"
+#define DB_FIELD_THUMBNAIL_PATH "thumbnail_path"
+#define DB_FIELD_MARKED_TIME "marked_time"
+#define DB_FIELD_TAG_NAME "tag_name"
+#define DB_FIELD_ID "_id"
+#define DB_FIELD_ADDED_TIME "added_time"
+
+#define SELECT_MEDIA_ITEM "select item_id, file_path, display_name, thumbnail, date_modified,content_type, favourite from item_view where 1"
+#define SELECT_ALL_FOLDER "select uuid, path, name, storage_type,modified_date from (select uuid, path, folder_name as name, storage_type,modified_date from visual_folder where valid=1 union select _id, path, folder_name as name, storage_type,modified_date from audio_folder) where 1"
+#define SELECT_COUNT_ITEM "select count(*) from item_view where 1"
+#define SELECT_TAG_LIST "select _id, tag_name from visual_tag where 1"
+#define SELECT_MEDIA_FROM_TAG "SELECT t._id, tm.media_uuid, m.display_name as display_name, modified_date from ( select _id, tag_name from visual_tag WHERE tag_name='%s' ORDER BY tag_name ASC ) t, ( select media_uuid, tag_id from visual_tag_map ) tm, ( select uuid, folder_uuid, display_name, modified_date from visual_media) m, ( select uuid, lock_status from visual_folder where valid=1 ) f where tm.tag_id = t._id and m.uuid = tm.media_uuid and m.folder_uuid = f.uuid and f.lock_status=0 "
+#define SELECT_PLAYLIST "select _id,name from audio_playlists where 1"
+#define SELECT_MEDIA_FROM_PLAYLIST "select item_id, file_path, display_name, thumbnail, date_modified,content_type, favourite from item_view where 1 and content_type=3 and item_id IN (select audio_id from audio_playlists_map where playlist_id=%d)"
+#define SELECT_GENRE_LIST "select distinct genre as name from audio_media where valid=1"
+#define SELECT_MEDIA_FROM_GENRE "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and genre='%s'"
+#define SELECT_MEDIA_COUNT_FROM_GENRE "select count(*) from audio_media where valid=1 and genre='%s'"
+#define SELECT_ALBUM_LIST "select distinct album as name from audio_media where valid=1 "
+#define SELECT_MEDIA_FROM_ALBUM "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and album='%s'"
+#define SELECT_MEDIA_COUNT_FROM_ALBUM "select count(*) from audio_media where valid=1 and genre='%s'"
+#define SELECT_AUTHOR_LIST "select distinct author as name from audio_media where valid=1 "
+#define SELECT_MEDIA_FROM_AUTHOR "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and author='%s'"
+#define SELECT_MEDIA_COUNT_FROM_AUTHOR "select count(*) from audio_media where valid=1 and genre='%s'"
+#define SELECT_MEDIA_ARTIST_LIST "select distinct artist as name from audio_media where valid=1"
+#define SELECT_MEDIA_FROM_ARTIST "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and artist='%s'"
+#define SELECT_MEDIA_COUNT_FROM_ARTIST "select count(*) from audio_media where valid=1 and genre='%s'"
+#define SELECT_BOOKMARK_FROM_VIDEO "select _id,media_uuid,marked_time,thumbnail_path from video_bookmark where media_uuid='%s' "
+
+
+/**
+ *@internal
+ */
+void _content_folder_get_detail(sqlite3_stmt *stmt, media_folder_h folder);
+
+/**
+ *@internal
+ */
+int _content_query_prepare(sqlite3_stmt **stmt, char *select_query,char *condition_query, char *search_query, char *limit_query,char *order );
+
+
+/**
+ *@internal
+ */
+void _content_item_get_detail(sqlite3_stmt *stmt, media_info_h item);
+
+/**
+ *@internal
+ */
+int _content_error_capi(media_content_type_e type, int cotent_error);
+
+/**
+ *@internal
+ */
+int _content_get_storage_type(const char* full_path);
+
+/**
+ *@internal
+ */
+int _content_get_audio_category(const char* file_full_path,int* category);
+
+/**
+ *@internal
+ */
+int _content_query_sql(char *query_str);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /*__TIZEN_MEDIA_INFO_PRIVATE_H__*/
+
+
+
--- /dev/null
+/*\r
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License. \r
+*/\r
+\r
+\r
+\r
+#ifndef __TIZEN_MEDIA_TAG_H__\r
+#define __TIZEN_MEDIA_TAG_H__\r
+\r
+#include <media_content_type.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+\r
+/**\r
+ * @addtogroup CAPI_CONTENT_MEDIA_TAG_MODULE\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * @brief Iterates through tags from the media database.\r
+ * @details This function gets all tags meeting a desired @a filter\r
+ * and calls a registered callback function for every retrieved tag. If NULL is passed to the @a filter, no filtering is applied. \r
+ *\r
+ * @param[in] filter The handle to tag filter \r
+ * @param[in] callback The callback function to invoke\r
+ * @param[in] user_data The user data to be passed to the callback function\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory \r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @pre This function requires opened connection to content service by media_content_connect().\r
+ * @post This function invokes media_tag_cb().\r
+ * @see media_content_connect()\r
+ * @see #media_tag_cb\r
+ * @see media_tag_filter_create()\r
+ *\r
+ */\r
+\r
+\r
+int media_tag_foreach_tag_from_db(media_tag_filter_h filter, media_tag_cb callback, void *user_data);\r
+\r
+\r
+/**\r
+ * @brief Iterates through media items for a given tag from the media database.\r
+ * @details This function gets all media items associated with a given tag and\r
+ * meeting a desired @a filter and calls a registered callback function for\r
+ * every retrieved media item. If NULL is passed to the @a filter, no filtering is applied. \r
+ *\r
+ * @param[in] tag The handle to media tag\r
+ * @param[in] filter The handle to media info filter\r
+ * @param[in] callback The callback function to invoke\r
+ * @param[in] user_data The user data to be passed to the callback function\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @pre This function requires opened connection to content service by media_content_connect().\r
+ * @post This function invokes media_info_cb().\r
+ * @see media_content_connect()\r
+ * @see #media_info_cb \r
+ * @see media_info_filter_create()\r
+ */\r
+int media_tag_foreach_media_from_db(media_tag_h tag, media_info_filter_h filter, media_info_cb callback, void *user_data);\r
+\r
+/**\r
+ * @brief Inserts a new tag in the media database.\r
+ *\r
+ * @remark The created tag handle must be released with media_tag_destroy() by you. \r
+ *\r
+ * @param[in] tag_name The tag name to be inserted\r
+ * @param[out] tag A created handle to media tag\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @pre This function requires opened connection to content service by media_content_connect(). \r
+ * @see media_content_connect()\r
+ * @see media_tag_delete_from_db()\r
+ * @see media_tag_destroy()\r
+ *\r
+ */\r
+ int media_tag_insert_to_db(const char *tag_name, media_tag_h *tag);\r
+\r
+/**\r
+ * @brief Deletes a given tag from the media database.\r
+ *\r
+ * @param[in] tag The handle to media tag\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_NOT_SUPPORTED_AUDIO Only video and image info can be added to Tag\r
+ * @pre This function requires opened connection to content service by media_content_connect().\r
+ * @see media_content_connect()\r
+ * @see media_tag_insert_to_db()\r
+ *\r
+ */\r
+ int media_tag_delete_from_db(media_tag_h tag);\r
+\r
+\r
+/**\r
+ * @brief Adds a new media info to the tag to media database.\r
+ *\r
+ * @param[in] tag The handle to media tag\r
+ * @param[in] media The handle to media info which is added\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @retval #MEDIA_CONTENT_ERROR_NOT_SUPPORTED_AUDIO Only video and image info can be added to Tag\r
+ * @pre This function requires opened connection to content service by media_content_connect().\r
+ * @see media_content_connect()\r
+ * @see media_tag_remove_media_from_db()\r
+ *\r
+ */\r
+int media_tag_add_media_to_db(media_tag_h tag, media_info_h media);\r
+\r
+/**\r
+ * @brief Removes the media info from the given tag in the media database.\r
+ * @param[in] tag The handle to media tag\r
+ * @param[in] media The media info handle which should be removed\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_NOT_SUPPORTED_AUDIO Only video and image info can be supported to Tag \r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @pre This function requires opened connection to content service by media_content_connect().\r
+ * @see media_content_connect()\r
+ * @see media_tag_add_media_to_db()\r
+ *\r
+ */\r
+int media_tag_remove_media_from_db(media_tag_h tag, media_info_h media);\r
+\r
+\r
+/**\r
+ * @brief Clones the media tag.\r
+ * @details This function copies the media tag handle from a source to destination. \r
+ * There is no media_tag_create() function. The media_tag_h is created internally and available through media tag foreach function \r
+ * such as media_tag_foreach_tag_from_db(). \r
+ * To use this handle outside of these foreach functions, use this function. \r
+ * @remark The destination handle must be released with media_tag_destroy() by you. \r
+ *\r
+ * @param[out] dst A destination handle to media tag\r
+ * @param[in] src The source handle to media tag\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter \r
+ * @see media_tag_destroy()\r
+ *\r
+ */\r
+int media_tag_clone(media_tag_h *dst, media_tag_h src);\r
+\r
+\r
+\r
+/**\r
+ * @brief Destroys the media tag.\r
+ * @details This function frees all resources related to the tag handle. The tag handle can no longer\r
+ * be used for any operation. A new tag handle has to be created before next usage.\r
+ *\r
+ * @param[in] tag The media tag handle\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @pre A copy of the media tag handle created by calling media_tag_clone() or media_tag_insert_to_db()\r
+ * @see media_tag_clone()\r
+ * @see media_tag_insert_to_db()\r
+ *\r
+ */\r
+int media_tag_destroy(media_tag_h tag);\r
+\r
+\r
+/**\r
+ * @brief Gets the tag name.\r
+ *\r
+ * @remarks @a tag_name must be released with free() by you.\r
+ *\r
+ * @param[in] tag The handle to media tag\r
+ * @param[out] tag_name The name of the tag\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory\r
+ *\r
+ */\r
+int media_tag_get_name(media_tag_h tag, char **tag_name);\r
+\r
+/**\r
+ * @brief Updates the tag name.\r
+ * @details This function updates the tag name in media database.\r
+ *\r
+ *\r
+ * @param[in] tag The handle to media tag\r
+ * @param[in] tag_name The new name for the tag\r
+ * @return 0 on success, otherwise a negative error value.\r
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory \r
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
+ * @pre This function requires opened connection to content service by media_content_connect().\r
+ * @see media_content_connect()\r
+ */\r
+int media_tag_update_name_to_db(media_tag_h tag, const char *tag_name);\r
+\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+#endif /* __TIZEN_MEDIA_TAG_H__ */\r
+\r
+\r
--- /dev/null
+/*
+* Copyright (c) 2011 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 __TIZEN_VIDEO_META_H__
+#define __TIZEN_VIDEO_META_H__
+
+#include <media_content_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_VIDEO_META_MODULE
+ * @{
+ */
+
+/**
+ * @brief Clones video metadata.
+ * @details This function copies the video metadata handle from a source to
+ * destination.
+
+ * @remark The destination handle must be released with video_meta_destroy() by you.
+ *
+ * @param [out] dst A destination handle to video metadata
+ * @param [in] src The source handle to video metadata
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @see video_meta_destroy()
+ */
+int video_meta_clone(video_meta_h *dst, video_meta_h src);
+
+
+/**
+ * @brief Destroys video metadata.
+ * @details Function frees all resources related to video metadata handle. This handle
+ * no longer can be used to perform any operation. A new handle has to
+ * be created before the next use.
+ *
+ * @param [in] video The handle to video metadata
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Get copy of video metadata handle by calling video_meta_clone()
+ * @see video_meta_clone()
+ *
+ */
+int video_meta_destroy(video_meta_h video);
+
+
+/**
+ * @brief Gets the longitude from video metadata.
+ * @details Function gives geographic position: @a longitude in degrees,
+ * which is positive for east and negative for west.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] longitude The video longitude in degrees
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int video_meta_get_longitude(video_meta_h video, double *longitude);
+
+
+/**
+ * @brief Gets the latitude from video metadata.
+ * @details Function gives geographic position: @a latitude in degrees,
+ * which is positive for north and negative for south.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] latitude The video latitude in degrees
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int video_meta_get_latitude(video_meta_h video, double *latitude);
+
+
+/**
+ * @brief Gets the video's album.
+ *
+ * @remarks @a album must be released with free() by you.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] album The video album or NULL
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int video_meta_get_album(video_meta_h video, char **album);
+
+
+/**
+ * @brief Gets the video's artist.
+ *
+ * @remarks @a artist must be released with free() by you.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] artist The artist of video metadata
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int video_meta_get_artist(video_meta_h video, char **artist);
+
+
+/**
+ * @brief Gets the video's title.
+ *
+ * @remarks @a title must be released with free() by you.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] title The title of video metadata
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int video_meta_get_title(video_meta_h video, char **title);
+
+
+/**
+ * @brief Gets the video's description.
+ *
+ * @remarks @a description must be released with free() by you.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] description The description of video metadata
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int video_meta_get_description(video_meta_h video, char **description);
+
+
+/**
+ * @brief Gets the video's time played parameter.
+ * @details Function returns video's elapsed playback time parameter as period
+ * starting from the beginning of the movie.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] time_played The time period from the beginning of the video (in milliseconds)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see video_meta_update_time_played_to_db()
+ */
+int video_meta_get_time_played(video_meta_h video, int *time_played);
+
+
+/**
+ * @brief Gets duration of video metadata.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] duration The video duration in milliseconds
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int video_meta_get_duration(video_meta_h video, int *duration);
+
+
+/**
+ * @brief Gets the video's width in pixels.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] width The video width in pixels
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int video_meta_get_width(video_meta_h video, int *width);
+
+
+/**
+ * @brief Gets the video's height in pixels.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] height The video height in pixels
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int video_meta_get_height(video_meta_h video, int *height);
+
+
+/**
+ * @brief Gets the video's orientation.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] orientation The orientation of video metadata
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int video_meta_get_orientation(video_meta_h video, media_content_orientation_e *orientation);
+
+
+/**
+ * @brief Gets the date, when video was created
+ *
+ * @param [in] video The handle to video metadata
+ * @param [out] date_taken The date, when video was taken (in seconds, since the Epoch)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int video_meta_get_date_taken(video_meta_h video, time_t *date_taken);
+
+
+/**
+ * @brief Updates video's time played parameter to the media database.
+ * @details Function updates video's time played parameter
+ * This parameter describes elapsed playback time, starting from the
+ * beginning of the movie.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [in] time_played The video time played (in milliseconds)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see video_meta_get_time_played()
+ */
+int video_meta_update_time_played_to_db(video_meta_h video, int time_played);
+
+
+/**
+ *@}
+ */
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_VIDEO_BOOKMARK_MODULE
+ * @{
+ */
+
+
+/**
+ * @brief Iterates through video bookmarks with optional filter in the given video metadata from the media database.
+ * @details This function gets all video bookmarks associated with the given folder and meeting desired filter option and
+calls registered callback function for every retrieved item. If NULL is passed to the @a filter, no filtering is applied.
+ * @remarks Only start position and offset details of filter can be set,
+ * beacuse searching by bookmark name information is not supported.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [in] filter The handle to video bookmark filter
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes video_bookmark_cb().
+ * @see media_content_connect()
+ * @see #video_bookmark_cb
+ * @see video_bookmark_filter_create()
+ *
+ */
+int video_bookmark_foreach_bookmark_from_db(video_meta_h video, video_bookmark_filter_h filter, video_bookmark_cb callback, void *user_data);
+
+
+/**
+ * @brief Clones video bookmark.
+ * @details This function copies the video bookmark handle from a source to destination. There is no video_bookmark_create() function.
+ * The video_bookmark_h is created internally and available through video bookmark foreach function such as video_bookmark_foreach_bookmark_from_db().
+ * To use this handle outside of these foreach functions, use this function.
+ *
+ * @remark The destination handle must be released with video_bookmark_destroy() by you.
+ *
+ * @param [out] dst A destination handle to video bookmark
+ * @param [in] src The source handle to video bookmark
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @see video_bookmark_destroy()
+ * @see video_bookmark_foreach_bookmark_from_db()
+ *
+ */
+int video_bookmark_clone(video_bookmark_h *dst, video_bookmark_h src);
+
+
+/**
+ * @brief Destroys video bookmark.
+ * @details Function frees all resources related to bookmark handle. This handle
+ * no longer can be used to perform any operation. A new handle has to
+ * be created before the next use.
+ *
+ * @param [in] bookmark The handle to video bookmark
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Get copy of bookmark handle by calling video_bookmark_clone()
+ * @see video_bookmark_clone()
+ */
+int video_bookmark_destroy(video_bookmark_h bookmark);
+
+
+/**
+ * @brief Gets bookmark's time marked parameter.
+ * @details Function returns time offset in milliseconds from beginning of the movie on which bookmark
+ * was placed.
+ *
+ * @param [in] bookmark The handle to video bookmark
+ * @param [out] time_marked The bookmark time offset (in milliseconds)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int video_bookmark_get_time_marked(video_bookmark_h bookmark, time_t *time_marked);
+
+
+/**
+ * @brief Gets the video bookmark's thumbnail
+ *
+ * @remarks thumbnail must be released with free() by you.
+ *
+ * @param [in] bookmark The handle to video bookmark
+ * @param [out] thumbnail_path The thumbnail path of video bookmark
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int video_bookmark_get_thumbnail_path(video_bookmark_h bookmark, char **thumbnail_path);
+
+
+/**
+ * @brief Inserts a new bookmark in video on specified time offset to the media database.
+ *
+ * @param [in] video The handle to video metadata
+ * @param [in] time The bookmark time offset (in seconds)
+ * @param [in] thumbnail_path The thumbnail path of video bookmark.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see video_bookmark_delete_from_db()
+ *
+ */
+int video_bookmark_insert_to_db(video_meta_h video, time_t time, const char *thumbnail_path);
+
+
+/**
+ * @brief Removes video bookmark from the media database.
+ *
+ * @param [in] bookmark The handle to video bookmark
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see video_bookmark_insert_to_db()
+ *
+ */
+int video_bookmark_delete_from_db(video_bookmark_h bookmark);
+
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /*__TIZEN_VIDEO_META_H__*/
+
+
--- /dev/null
+Name: capi-content-media-content
+Summary: A Media content library in SLP C API
+Version: 0.0.1
+Release: 1
+Group: TO_BE/FILLED_IN
+License: TO BE FILLED IN
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(libmedia-service)
+BuildRequires: pkgconfig(drm-service)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(capi-base-common)
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+
+
+%package devel
+Summary: A Media content library in Tizen Native API (Development)
+Group: TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+
+%prep
+%setup -q
+
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=/usr
+
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%{_libdir}/libcapi-content-media-content.so
+
+%files devel
+%{_includedir}/media-content/*.h
+%{_libdir}/pkgconfig/*.pc
+
+
--- /dev/null
+/*\r
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License. \r
+*/\r
+\r
+\r
+#include <media_content.h>\r
+#include <media-info-error.h>\r
+#include <media-svc-error.h>\r
+#include <media-info.h>\r
+#include <audio-svc.h>\r
+#include <audio-svc-error.h>\r
+#include <media_info_private.h>\r
+\r
+#include <dlog.h>\r
+\r
+#ifdef LOG_TAG\r
+#undef LOG_TAG\r
+#endif\r
+\r
+#define LOG_TAG "TIZEN_N_MEDIACONTENT"\r
+\r
+\r
+\r
+int audio_meta_destroy(audio_meta_h audio)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ if(_audio->audio_id)\r
+ {\r
+ free(_audio->audio_id);\r
+ }\r
+ if(_audio->genre) \r
+ {\r
+ free(_audio->genre);\r
+ } \r
+ if(_audio->author) \r
+ {\r
+ free(_audio->author);\r
+ } \r
+ if(_audio->copyright) \r
+ {\r
+ free(_audio->copyright);\r
+ } \r
+ if(_audio->description) \r
+ {\r
+ free(_audio->description);\r
+ } \r
+ if(_audio->format) \r
+ {\r
+ free(_audio->format);\r
+ } \r
+\r
+ free(_audio);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+int audio_meta_clone(audio_meta_h* dst, audio_meta_h src)\r
+{\r
+ int ret;\r
+ audio_meta_s* _src = (audio_meta_s*)src; \r
+\r
+ if(_src != NULL)\r
+ {\r
+ \r
+ audio_meta_s* _dst = (audio_meta_s*)calloc(1,sizeof(audio_meta_s)); \r
+\r
+ if(_dst == NULL)\r
+ {\r
+\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ \r
+ _dst->audio_id = strdup(_src->audio_id);\r
+ if(_dst->audio_id == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ _dst->year= _src->year;\r
+ _dst->bitrate = _src->bitrate;\r
+ _dst->track_num = _src->track_num ;\r
+ _dst->duration = _src->duration;\r
+ _dst->rating = _src->rating;\r
+ _dst->count_played = _src->count_played;\r
+ _dst->time_played = _src->time_played;\r
+ _dst->time_added = _src->time_added;\r
+ _dst->size = _src->size;\r
+ _dst->category = _src->category;\r
+ \r
+ \r
+ if((_src->genre != NULL) && (strlen(_src->genre) > 0))\r
+ {\r
+ _dst->genre = strdup(_src->genre);\r
+ if(_dst->genre == NULL)\r
+ {\r
+ audio_meta_destroy((audio_meta_h)_dst);\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+\r
+ if((_src->author != NULL) && (strlen(_src->author ) > 0))\r
+ {\r
+ _dst->author = strdup(_src->author );\r
+ if(_dst->author == NULL)\r
+ {\r
+ audio_meta_destroy((audio_meta_h)_dst);\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY); \r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ if((_src->copyright != NULL) && (strlen(_src->copyright) > 0))\r
+ {\r
+ _dst->copyright = strdup(_src->copyright);\r
+ if(_dst->copyright == NULL)\r
+ {\r
+ audio_meta_destroy((audio_meta_h)_dst);\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ } \r
+ }\r
+ if((_src->description != NULL) && (strlen(_src->description) > 0))\r
+ {\r
+ _dst->description = strdup(_src->description);\r
+ if(_dst->description == NULL)\r
+ {\r
+ audio_meta_destroy((audio_meta_h)_dst);\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ } \r
+ }\r
+ if((_src->format != NULL) && (strlen(_src->format) > 0))\r
+ {\r
+ _dst->format = strdup(_src->format);\r
+ if(_dst->format == NULL)\r
+ {\r
+ audio_meta_destroy((audio_meta_h)_dst);\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ } \r
+ }\r
+ *dst = (audio_meta_h)_dst;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int audio_meta_get_genre(audio_meta_h audio, char** name)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ if((_audio->genre != NULL) && (strlen(_audio->genre) > 0))\r
+ {\r
+ *name = strdup(_audio->genre);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+ \r
+}\r
+\r
+int audio_meta_get_album(audio_meta_h audio, char **name)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ if((_audio->album != NULL) && (strlen(_audio->album) > 0))\r
+ {\r
+ *name = strdup(_audio->album);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+int audio_meta_get_artist(audio_meta_h audio, char **name)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ if((_audio->artist != NULL) && (strlen(_audio->artist) > 0))\r
+ {\r
+ *name = strdup(_audio->artist);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+\r
+\r
+}\r
+\r
+int audio_meta_get_author(audio_meta_h audio, char** name)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ if((_audio->author != NULL) && (strlen(_audio->author) > 0))\r
+ {\r
+ *name = strdup(_audio->author);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int audio_meta_get_year(audio_meta_h audio,char** year)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ if((_audio->year != NULL) && (strlen(_audio->year) > 0))\r
+ {\r
+ *year = strdup(_audio->year);\r
+ if(*year == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ *year = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+int audio_meta_get_copyright(audio_meta_h audio, char** copyright)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ if((_audio->copyright != NULL) && (strlen(_audio->copyright) > 0))\r
+ {\r
+ *copyright = strdup(_audio->copyright);\r
+ if(*copyright == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ *copyright = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+}\r
+\r
+\r
+\r
+int audio_meta_get_description(audio_meta_h audio, char** description)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ if((_audio->description != NULL) && (strlen(_audio->description) > 0))\r
+ {\r
+ *description = strdup(_audio->description);\r
+ if(*description == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ *description = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+ return ret;\r
+}\r
+\r
+\r
+int audio_meta_get_format(audio_meta_h audio, char** format)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ if((_audio->format != NULL) && (strlen(_audio->format) > 0))\r
+ {\r
+ *format = strdup(_audio->format);\r
+ if(*format == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ *format = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int audio_meta_get_bitrate(audio_meta_h audio,int* bitrate)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio && bitrate) \r
+ {\r
+ *bitrate = _audio->bitrate;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+}\r
+\r
+\r
+int audio_meta_get_track_num(audio_meta_h audio,int* track_num)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio && track_num) \r
+ {\r
+ *track_num = _audio->track_num;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+}\r
+\r
+\r
+int audio_meta_get_duration(audio_meta_h audio,int* duration)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ *duration = _audio->duration;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+}\r
+\r
+\r
+int audio_meta_get_rating(audio_meta_h audio,int* rating)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ *rating= _audio->rating;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+}\r
+\r
+\r
+int audio_meta_get_count_played(audio_meta_h audio,int* count_played)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ *count_played = _audio->count_played;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+}\r
+\r
+\r
+int audio_meta_get_time_played(audio_meta_h audio,int* time_played)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ *time_played = _audio->time_played;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+}\r
+\r
+\r
+int audio_meta_get_time_added(audio_meta_h audio,time_t* time_added)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ *time_added = _audio->time_added;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+}\r
+\r
+\r
+int audio_meta_get_size(audio_meta_h audio,int* size)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ *size = _audio->size;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+}\r
+\r
+\r
+int audio_meta_get_category(audio_meta_h audio,audio_category_e* category)\r
+{\r
+ int ret;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio; \r
+ if(_audio) \r
+ {\r
+ *category = _audio->category;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+} \r
+\r
+\r
+int audio_meta_update_count_played_to_db(audio_meta_h audio,int count)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ audio_meta_s* _audio = (audio_meta_s*)audio;\r
+\r
+\r
+ if(_audio != NULL)\r
+ {\r
+ ret = audio_svc_update_item_metadata(_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_COUNT,count,-1);\r
+\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ \r
+ return ret; \r
+}\r
+\r
+\r
+int audio_meta_update_time_played_to_db(audio_meta_h audio,time_t time)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ audio_meta_s* _audio = (audio_meta_s*)audio;\r
+\r
+ \r
+ if(_audio != NULL)\r
+ {\r
+ ret = audio_svc_update_item_metadata(_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_TIME,time,-1);\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret); \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ \r
+ return ret; \r
+}\r
+\r
+\r
+\r
+int audio_playlist_foreach_playlist_from_db(media_audio_filter_h filter, audio_playlist_cb callback, void* user_data )\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char order_query[MIN_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+\r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+ media_audio_filter_s* _filter = NULL;\r
+\r
+ if( callback == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+\r
+ if(filter != NULL)\r
+ _filter = (media_audio_filter_s*)filter;\r
+ else\r
+ {\r
+ media_audio_filter_create((media_audio_filter_h*)&_filter);\r
+ }\r
+ \r
+ \r
+ memset(limit_query,0x00,sizeof(limit_query));\r
+ memset(search_query,0x00,sizeof(search_query));\r
+ memset(order_query,0x00,sizeof(order_query));\r
+ memset(select_query,0x00,sizeof(select_query));\r
+\r
+\r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and name like '%%%s%%'", _filter->keyword);\r
+ }\r
+ else\r
+ {\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ {\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+ }\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ } \r
+\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+ snprintf(select_query,sizeof(select_query),"%s", SELECT_PLAYLIST);\r
+\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ADDED_TIME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ADDED_TIME,QUERY_KEYWORD_DESC); \r
+ }\r
+\r
+\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ return ret;\r
+ }\r
+ \r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ audio_playlist_s* playlist = (audio_playlist_s*)calloc(1,sizeof(audio_playlist_s));\r
+ if(playlist == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ \r
+ playlist->playlist_id= (int)sqlite3_column_int(stmt,0);\r
+ playlist->name= strdup((const char *)sqlite3_column_text(stmt, 1));\r
+ if(callback((audio_playlist_h)playlist,user_data) == false)\r
+ {\r
+ audio_playlist_destroy((audio_playlist_h)playlist);\r
+ break;\r
+ }\r
+ audio_playlist_destroy((audio_playlist_h)playlist);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int audio_playlist_foreach_media_from_db(audio_playlist_h playlist, media_audio_filter_h filter, media_info_cb callback, void* user_data )\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ \r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char order_query[MIN_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+ media_audio_filter_s* _filter = NULL;\r
+ \r
+ memset(limit_query,0x00,sizeof(limit_query));\r
+ memset(search_query,0x00,sizeof(search_query));\r
+ memset(order_query,0x00,sizeof(order_query));\r
+ memset(select_query,0x00,sizeof(select_query));\r
+\r
+ audio_playlist_s* _playlist = (audio_playlist_s*)playlist;\r
+\r
+ if(_playlist == NULL )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ if(callback == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ \r
+ if(filter != NULL)\r
+ _filter = (media_audio_filter_s*)filter;\r
+ else\r
+ {\r
+ media_audio_filter_create((media_audio_filter_h*)&_filter);\r
+ }\r
+ \r
+\r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query),\r
+ " and display_name like '%%%s%%' ",\r
+ _filter->keyword);\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ } \r
+\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+ snprintf(select_query, sizeof(select_query),SELECT_MEDIA_FROM_PLAYLIST, _playlist->playlist_id);\r
+\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE,QUERY_KEYWORD_DESC); \r
+ } \r
+\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+ \r
+ ret = _content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ media_info_s* item = (media_info_s*)calloc(1,sizeof(media_info_s));\r
+ if(item == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ \r
+ _content_item_get_detail(stmt,(media_info_h)item);\r
+ if(callback((media_info_h)item,user_data) == false )\r
+ {\r
+ media_info_destroy((media_info_h)item);\r
+ break;\r
+ }\r
+ media_info_destroy((media_info_h)item); \r
+\r
+ }\r
+\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+\r
+ return ret;\r
+}\r
+\r
+int audio_playlist_get_media_count_from_db(audio_playlist_h playlist,int* count)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ audio_playlist_s* _playlist = (audio_playlist_s*)playlist;\r
+\r
+ if(_playlist != NULL)\r
+ {\r
+ ret = audio_svc_count_playlist_item(_playlist->playlist_id,NULL,NULL, count);\r
+\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int audio_playlist_insert_to_db(const char* name, audio_playlist_h* playlist)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ int playlist_id;\r
+ \r
+ if(name != NULL)\r
+ {\r
+ audio_playlist_s* _playlist = (audio_playlist_s*)calloc(1,sizeof(audio_playlist_s));\r
+\r
+ if( _playlist == NULL )\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ \r
+ \r
+ ret = audio_svc_add_playlist(name,&playlist_id);\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ free(_playlist);\r
+ return ret;\r
+ }\r
+\r
+ _playlist->playlist_id = playlist_id;\r
+ _playlist->name = strdup(name);\r
+ if(_playlist->name == NULL)\r
+ {\r
+ free(_playlist);\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ *playlist = (audio_playlist_h)_playlist;\r
+ \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int audio_playlist_delete_from_db(audio_playlist_h playlist)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ audio_playlist_s* _playlist = (audio_playlist_s*)playlist;\r
+\r
+ if(_playlist != NULL)\r
+ {\r
+ ret = audio_svc_delete_playlist(_playlist->playlist_id);\r
+\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+int audio_playlist_destroy(audio_playlist_h playlist)\r
+{\r
+ int ret;\r
+ audio_playlist_s* _playlist = (audio_playlist_s*)playlist; \r
+ if(_playlist) \r
+ {\r
+ if(_playlist->name) \r
+ {\r
+ free(_playlist->name);\r
+ } \r
+\r
+ free(_playlist);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ }\r
+ return ret;\r
+\r
+}\r
+int audio_playlist_clone(audio_playlist_h* dst, audio_playlist_h src)\r
+{\r
+ int ret;\r
+ audio_playlist_s* _src = (audio_playlist_s*)src; \r
+\r
+ if(_src != NULL )\r
+ {\r
+ audio_playlist_s* _dst = (audio_playlist_s*)calloc(1,sizeof(audio_playlist_s)); \r
+ if(_dst == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ \r
+ _dst->playlist_id = _src->playlist_id;\r
+\r
+ if((_src->name != NULL) && (strlen(_src->name) > 0))\r
+ {\r
+ _dst->name = strdup(_src->name);\r
+ if(_dst->name == NULL)\r
+ {\r
+ audio_playlist_destroy((audio_playlist_h)_dst);\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ *dst = (audio_playlist_h)_dst;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int audio_playlist_get_name(audio_playlist_h playlist,char** name)\r
+{\r
+ int ret;\r
+ audio_playlist_s* _playlist = (audio_playlist_s*)playlist; \r
+ if(_playlist) \r
+ {\r
+ if((_playlist->name!= NULL) && (strlen(_playlist->name) > 0))\r
+ {\r
+ *name = strdup(_playlist->name);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+\r
+int audio_playlist_update_name_to_db(audio_playlist_h playlist,const char* name)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ audio_playlist_s* _playlist = (audio_playlist_s*)playlist; \r
+ \r
+ \r
+ if(_playlist != NULL && name != NULL)\r
+ {\r
+ ret = audio_svc_update_playlist_name(_playlist->playlist_id,name);\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+ if(ret == MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ free(_playlist->name);\r
+ _playlist->name = strdup(name);\r
+ if(_playlist->name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ } \r
+ \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ }\r
+\r
+ \r
+ return ret; \r
+}\r
+\r
+int audio_playlist_add_media_to_db(audio_playlist_h playlist, media_info_h item)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ \r
+ audio_playlist_s* _playlist = (audio_playlist_s*)playlist; \r
+ media_info_s* _item = (media_info_s*)item;\r
+\r
+ if(_playlist != NULL && _item != NULL && _item->media_type == 4)\r
+ {\r
+\r
+ ret = audio_svc_add_item_to_playlist(_playlist->playlist_id,_item->item_id);\r
+\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+ \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ }\r
+ \r
+ return ret; \r
+}\r
+\r
+\r
+int audio_playlist_remove_media_from_db(audio_playlist_h playlist, media_info_h item)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ \r
+ audio_playlist_s* _playlist = (audio_playlist_s*)playlist; \r
+ media_info_s* _item = (media_info_s*)item;\r
+\r
+ if(_playlist != NULL && _item != NULL && _item->media_type == 4)\r
+ {\r
+\r
+ ret = audio_svc_remove_item_from_playlist_by_audio_id(_playlist->playlist_id,_item->item_id);\r
+\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret); \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ }\r
+\r
+ \r
+ return ret; \r
+}\r
+\r
+int audio_genre_foreach_genre_from_db(media_audio_filter_h filter, audio_genre_cb callback, void *user_data)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char order_query[MIN_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+ \r
+ media_audio_filter_s* _filter = NULL;\r
+\r
+\r
+ if(callback == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ \r
+ memset(limit_query,0x00,sizeof(limit_query));\r
+ memset(search_query,0x00,sizeof(search_query));\r
+ memset(order_query,0x00,sizeof(order_query));\r
+ memset(select_query,0x00,sizeof(select_query));\r
+\r
+ if(filter != NULL)\r
+ _filter = (media_audio_filter_s*)filter;\r
+ else\r
+ {\r
+ media_audio_filter_create((media_audio_filter_h*)&_filter);\r
+ }\r
+ \r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and name like '%%%s%%'", _filter->keyword);\r
+ \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ } \r
+\r
+ snprintf(select_query,sizeof(select_query),"%s", SELECT_GENRE_LIST);\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+ \r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ADDED_TIME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ADDED_TIME,QUERY_KEYWORD_DESC); \r
+ }\r
+\r
+\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ \r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ audio_genre_s* genre = (audio_genre_s*)calloc(1,sizeof(audio_genre_s)); \r
+ memset(genre,0x00,sizeof(audio_genre_s));\r
+ genre->name= strdup((const char *)sqlite3_column_text(stmt, 0));\r
+ if(callback((audio_genre_h)genre,user_data) == false)\r
+ {\r
+ audio_genre_destroy((audio_genre_h)genre);\r
+ break;\r
+ }\r
+ audio_genre_destroy((audio_genre_h)genre);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+int audio_genre_foreach_media_from_db(audio_genre_h genre, media_audio_filter_h filter, media_info_cb callback, void* user_data )\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char order_query[MIN_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+ \r
+ sqlite3_stmt *stmt = NULL;\r
+ media_audio_filter_s* _filter = NULL;\r
+\r
+ audio_genre_s* _genre = (audio_genre_s*)genre;\r
+ \r
+\r
+ if(_genre == NULL || callback == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ \r
+ memset(limit_query,0x00,sizeof(limit_query));\r
+ memset(search_query,0x00,sizeof(search_query));\r
+ memset(order_query,0x00,sizeof(order_query));\r
+ memset(select_query,0x00,sizeof(select_query));\r
+\r
+ if(filter != NULL)\r
+ _filter = (media_audio_filter_s*)filter;\r
+ else\r
+ {\r
+ media_audio_filter_create((media_audio_filter_h*)&_filter);\r
+ }\r
+ \r
+\r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and display_name like '%%%s%%'", _filter->keyword);\r
+ \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter); \r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ } \r
+\r
+ snprintf(select_query, sizeof(select_query),SELECT_MEDIA_FROM_GENRE, _genre->name);\r
+\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE,QUERY_KEYWORD_DESC); \r
+ } \r
+\r
+\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+\r
+ ret= _content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ \r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ media_info_s* item = (media_info_s*)calloc(1,sizeof(media_info_s)); \r
+\r
+ _content_item_get_detail(stmt, (media_info_h)item);\r
+ if(callback((media_info_h)item,user_data) == false)\r
+ {\r
+ media_info_destroy((media_info_h)item);\r
+ break;\r
+ }\r
+ media_info_destroy((media_info_h)item);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+ \r
+ return ret;\r
+}\r
+\r
+\r
+int audio_genre_get_media_count_from_db(audio_genre_h genre,int* count)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+ audio_genre_s* _genre = (audio_genre_s*)genre;\r
+ \r
+\r
+ memset(select_query,0x00,sizeof(select_query));\r
+ \r
+ if(_genre == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ snprintf(select_query,sizeof(select_query),SELECT_MEDIA_COUNT_FROM_GENRE,_genre->name);\r
+\r
+\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,NULL,NULL,NULL);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ *count = (int)sqlite3_column_int(stmt,0);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+int audio_genre_destroy(audio_genre_h genre)\r
+{\r
+ int ret;\r
+ audio_genre_s* _genre = (audio_genre_s*)genre; \r
+ if(_genre) \r
+ {\r
+ if(_genre->name) \r
+ {\r
+ free(_genre->name);\r
+ } \r
+\r
+ free(_genre);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+int audio_genre_clone(audio_genre_h* dst,audio_genre_h src)\r
+{\r
+ int ret;\r
+ audio_genre_s* _src = (audio_genre_s*)src; \r
+\r
+\r
+ if(_src != NULL)\r
+ {\r
+ audio_genre_s* _dst = (audio_genre_s*)calloc(1,sizeof(audio_genre_s)); \r
+ if(_dst == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ \r
+ if((_src->name != NULL) && (strlen(_src->name) > 0))\r
+ {\r
+ _dst->name = strdup(_src->name);\r
+ if(_dst->name == NULL)\r
+ {\r
+ audio_genre_destroy((audio_genre_h)_dst);\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+\r
+ *dst = (audio_genre_h)_dst;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+ \r
+int audio_genre_get_name(audio_genre_h genre, char** name)\r
+{\r
+ int ret;\r
+ audio_genre_s* _genre = (audio_genre_s*)genre; \r
+ if(_genre) \r
+ {\r
+ if((_genre->name!= NULL) && (strlen(_genre->name) > 0))\r
+ {\r
+ *name = strdup(_genre->name);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int audio_album_foreach_album_from_db(media_audio_filter_h filter, audio_album_cb callback, void *user_data)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char order_query[MIN_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+ \r
+ sqlite3_stmt *stmt = NULL;\r
+ media_audio_filter_s* _filter = NULL;\r
+ \r
+\r
+ if(callback == NULL )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ memset(limit_query,0x00,sizeof(limit_query));\r
+ memset(search_query,0x00,sizeof(search_query));\r
+ memset(order_query,0x00,sizeof(order_query));\r
+ memset(select_query,0x00,sizeof(select_query));\r
+\r
+ if(filter != NULL)\r
+ _filter = (media_audio_filter_s*)filter;\r
+ else\r
+ {\r
+ media_audio_filter_create((media_audio_filter_h*)&_filter);\r
+ }\r
+ \r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and name like '%%%s%%'",_filter->keyword);\r
+ \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ } \r
+ snprintf(select_query,sizeof(select_query),"%s", SELECT_ALBUM_LIST);\r
+\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ADDED_TIME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ADDED_TIME,QUERY_KEYWORD_DESC); \r
+ }\r
+\r
+\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ audio_album_s* album = (audio_album_s*)calloc(1,sizeof(audio_album_s));\r
+\r
+ if(album == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+\r
+ album->name= strdup((const char *)sqlite3_column_text(stmt, 0));\r
+ if(callback((audio_album_h)album,user_data) == false)\r
+ {\r
+ audio_album_destroy((audio_album_h)album);\r
+ break;\r
+ }\r
+ audio_album_destroy((audio_album_h)album);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+int audio_album_foreach_media_from_db(audio_album_h album, media_audio_filter_h filter, media_info_cb callback, void* user_data )\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char order_query[MIN_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+ media_audio_filter_s* _filter = NULL;\r
+ \r
+\r
+ audio_album_s* _album = (audio_album_s*)album;\r
+\r
+\r
+ if( _album == NULL || callback == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ memset(limit_query,0x00,sizeof(limit_query));\r
+ memset(search_query,0x00,sizeof(search_query));\r
+ memset(order_query,0x00,sizeof(order_query));\r
+ memset(select_query,0x00,sizeof(select_query));\r
+\r
+\r
+ if(filter != NULL)\r
+ _filter = (media_audio_filter_s*)filter;\r
+ else\r
+ {\r
+ media_audio_filter_create((media_audio_filter_h*)&_filter);\r
+ }\r
+\r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and display_name like '%%%s%%'", _filter->keyword);\r
+ \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ } \r
+\r
+\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+ snprintf(select_query, sizeof(select_query),SELECT_MEDIA_FROM_ALBUM, _album->name);\r
+\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE,QUERY_KEYWORD_DESC); \r
+ } \r
+\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ \r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ media_info_s* item = (media_info_s*)calloc(1,sizeof(media_info_s)); \r
+\r
+ _content_item_get_detail(stmt, (media_info_h)item);\r
+ if(callback((media_info_h)item,user_data) == false)\r
+ {\r
+ media_info_destroy((media_info_h)item);\r
+ break;\r
+ }\r
+ media_info_destroy((media_info_h)item); \r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ return ret;\r
+\r
+\r
+}\r
+\r
+\r
+int audio_album_get_media_count_from_db(audio_album_h album,int* count)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ sqlite3_stmt *stmt = NULL;\r
+ audio_album_s* _album = (audio_album_s*)album;\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+ \r
+ memset(select_query,0x00,sizeof(select_query));\r
+\r
+ if(_album == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ snprintf(select_query,sizeof(select_query),SELECT_MEDIA_COUNT_FROM_ALBUM,_album ->name);\r
+\r
+\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,NULL,NULL,NULL);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ *count = (int)sqlite3_column_int(stmt,0);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+int audio_album_destroy(audio_album_h album )\r
+{\r
+ int ret;\r
+ audio_album_s* _album = (audio_album_s*)album; \r
+ if(_album) \r
+ {\r
+ if(_album->name) \r
+ {\r
+ free(_album->name);\r
+ } \r
+\r
+ free(_album);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+int audio_album_clone(audio_album_h* dst,audio_album_h src)\r
+{\r
+ int ret;\r
+ audio_album_s* _src = (audio_album_s*)src; \r
+ \r
+\r
+ if(_src != NULL)\r
+ {\r
+ audio_album_s* _dst = (audio_album_s*)calloc(1,sizeof(audio_album_s)); \r
+\r
+ if(_dst == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ \r
+ if((_src->name != NULL) && (strlen(_src->name) > 0))\r
+ {\r
+ _dst->name = strdup(_src->name);\r
+ if(_dst->name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ audio_album_destroy((audio_album_h)_dst);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+\r
+ *dst = (audio_album_h)_dst;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+ \r
+ return ret;\r
+\r
+}\r
+ \r
+int audio_album_get_name(audio_album_h album, char** name)\r
+{\r
+ int ret;\r
+ audio_album_s* _album = (audio_album_s*)album; \r
+ if(_album) \r
+ {\r
+ if((_album->name!= NULL) && (strlen(_album->name) > 0))\r
+ {\r
+ *name = strdup(_album->name);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int audio_author_foreach_author_from_db(media_audio_filter_h filter, audio_author_cb callback, void *user_data)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char order_query[MIN_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+ media_audio_filter_s* _filter = NULL;\r
+\r
+ if(callback == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ memset(limit_query,0x00,sizeof(limit_query));\r
+ memset(search_query,0x00,sizeof(search_query));\r
+ memset(order_query,0x00,sizeof(order_query));\r
+ memset(select_query,0x00,sizeof(select_query));\r
+\r
+ if(filter != NULL)\r
+ _filter = (media_audio_filter_s*)filter;\r
+ else\r
+ {\r
+ media_audio_filter_create((media_audio_filter_h*)&_filter);\r
+ }\r
+ \r
+\r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and name like '%%%s%%'", _filter->keyword);\r
+ \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ } \r
+ \r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+ snprintf(select_query,sizeof(select_query),"%s", SELECT_AUTHOR_LIST);\r
+\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ADDED_TIME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ADDED_TIME,QUERY_KEYWORD_DESC); \r
+ }\r
+\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+ \r
+\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+ \r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ audio_author_s* author = (audio_author_s*)calloc(1,sizeof(audio_author_s));\r
+ if(author == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+\r
+ author->name= strdup((const char *)sqlite3_column_text(stmt, 0));\r
+ if(callback((audio_author_h)author,user_data) == false)\r
+ {\r
+ audio_author_destroy((audio_author_h)author);\r
+ break;\r
+ }\r
+ audio_author_destroy((audio_author_h)author);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+int audio_author_foreach_media_from_db(audio_author_h author, media_audio_filter_h filter, media_info_cb callback, void* user_data )\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char order_query[MIN_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+ media_audio_filter_s* _filter = NULL;\r
+\r
+ audio_author_s* _author = (audio_author_s*)author;\r
+ \r
+\r
+ if(_author == NULL || callback == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ if(filter != NULL)\r
+ _filter = (media_audio_filter_s*)filter;\r
+ else\r
+ {\r
+ media_audio_filter_create((media_audio_filter_h*)&_filter);\r
+ }\r
+\r
+ memset(limit_query,0x00,sizeof(limit_query));\r
+ memset(search_query,0x00,sizeof(search_query));\r
+ memset(order_query,0x00,sizeof(order_query));\r
+ memset(select_query,0x00,sizeof(select_query));\r
+\r
+ \r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and display_name like '%%%s%%'", _filter->keyword);\r
+ \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter); \r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ } \r
+\r
+ \r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+ snprintf(select_query, sizeof(select_query),SELECT_MEDIA_FROM_AUTHOR, _author->name);\r
+\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE,QUERY_KEYWORD_DESC); \r
+ } \r
+\r
+\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+\r
+ ret =_content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ \r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ media_info_s* item = (media_info_s*)calloc(1,sizeof(media_info_s));\r
+ if(item == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ \r
+ _content_item_get_detail(stmt, (media_info_h)item);\r
+ if(callback((media_info_h)item,user_data) == false)\r
+ {\r
+ media_info_destroy((media_info_h)item);\r
+ break;\r
+ }\r
+ media_info_destroy((media_info_h)item);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ return ret;\r
+\r
+\r
+}\r
+\r
+\r
+int audio_author_get_media_count_from_db(audio_author_h author,int* count)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ sqlite3_stmt *stmt = NULL;\r
+ audio_author_s* _author = (audio_author_s*)author;\r
+ char select_query[DEFAULT_QUERY_SIZE];\r
+\r
+ \r
+ memset(select_query,0x00,sizeof(select_query));\r
+\r
+ if(_author == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+\r
+ snprintf(select_query,sizeof(select_query),SELECT_MEDIA_COUNT_FROM_AUTHOR,_author ->name);\r
+\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,NULL,NULL,NULL);\r
+ if(ret!= MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ *count = (int)sqlite3_column_int(stmt,0);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+int audio_author_destroy(audio_author_h author )\r
+{\r
+ int ret;\r
+ audio_author_s* _author = (audio_author_s*)author; \r
+ if(_author) \r
+ {\r
+ if(_author->name) \r
+ {\r
+ free(_author->name);\r
+ } \r
+\r
+ free(_author);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+int audio_author_clone(audio_author_h* dst,audio_author_h src)\r
+{\r
+ int ret;\r
+ audio_author_s* _src = (audio_author_s*)src; \r
+ \r
+\r
+ if(_src != NULL)\r
+ {\r
+ audio_author_s* _dst = (audio_author_s*)calloc(1,sizeof(audio_author_s)); \r
+\r
+ if(_dst == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ \r
+ if((_src->name != NULL) && (strlen(_src->name) > 0))\r
+ {\r
+ _dst->name = strdup(_src->name);\r
+ if(_dst->name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ audio_author_destroy((audio_author_h)_dst);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+\r
+ *dst = (audio_author_h)_dst;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+ \r
+ return ret;\r
+\r
+}\r
+ \r
+int audio_author_get_name(audio_author_h author, char** name)\r
+{\r
+ int ret;\r
+ audio_author_s* _author = (audio_author_s*)author; \r
+ if(_author) \r
+ {\r
+ if((_author->name!= NULL) && (strlen(_author->name) > 0))\r
+ {\r
+ *name = strdup(_author->name);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+\r
+int audio_artist_foreach_artist_from_db(media_audio_filter_h filter, audio_artist_cb callback, void *user_data)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char order_query[MIN_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+ media_audio_filter_s* _filter = NULL;\r
+\r
+ if(callback == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ if(filter != NULL)\r
+ _filter = (media_audio_filter_s*)filter;\r
+ else\r
+ {\r
+ media_audio_filter_create((media_audio_filter_h*)&_filter);\r
+ }\r
+\r
+ memset(limit_query,0x00,sizeof(limit_query));\r
+ memset(search_query,0x00,sizeof(search_query));\r
+ memset(order_query,0x00,sizeof(order_query));\r
+ memset(select_query,0x00,sizeof(select_query));\r
+ \r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and name like '%%%s%%'", _filter->keyword);\r
+ \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ } \r
+\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+ snprintf(select_query,sizeof(select_query),"%s", SELECT_MEDIA_ARTIST_LIST);\r
+\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ADDED_TIME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ADDED_TIME,QUERY_KEYWORD_DESC); \r
+ }\r
+\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+\r
+ ret =_content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ audio_artist_s* artist = (audio_artist_s*)calloc(1,sizeof(audio_artist_s));\r
+ if(artist == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+\r
+ artist->name= strdup((const char *)sqlite3_column_text(stmt, 0));\r
+ if(callback((audio_artist_h)artist,user_data) == false)\r
+ {\r
+ audio_artist_destroy((audio_artist_h)artist); \r
+ break;\r
+ }\r
+ audio_artist_destroy((audio_artist_h)artist);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ return ret;\r
+\r
+}\r
+\r
+int audio_artist_foreach_media_from_db(audio_artist_h artist, media_audio_filter_h filter, media_info_cb callback, void* user_data )\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char order_query[MIN_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+ media_audio_filter_s* _filter = NULL;\r
+\r
+ audio_artist_s* _artist = (audio_artist_s*)artist;\r
+\r
+\r
+ if(_artist == NULL || callback == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+\r
+ if(filter != NULL)\r
+ _filter = (media_audio_filter_s*)filter;\r
+ else\r
+ {\r
+ media_audio_filter_create((media_audio_filter_h*)&_filter);\r
+ } \r
+\r
+ memset(limit_query,0x00,sizeof(limit_query));\r
+ memset(search_query,0x00,sizeof(search_query));\r
+ memset(order_query,0x00,sizeof(order_query));\r
+ memset(select_query,0x00,sizeof(select_query));\r
+\r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and display_name like '%%%s%%'", _filter->keyword);\r
+ \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter); \r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ } \r
+\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+ snprintf(select_query, sizeof(select_query),SELECT_MEDIA_FROM_ARTIST, _artist->name);\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE,QUERY_KEYWORD_DESC); \r
+ } \r
+\r
+ if((media_audio_filter_s*)filter != _filter)\r
+ media_audio_filter_destroy((media_audio_filter_h)_filter);\r
+\r
+\r
+ ret= _content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ media_info_s* item = (media_info_s*)calloc(1,sizeof(media_info_s));\r
+ if(item == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+\r
+ _content_item_get_detail(stmt, (media_info_h)item);\r
+ if(callback((media_info_h)item,user_data) == false)\r
+ {\r
+ media_info_destroy((media_info_h)item);\r
+ break;\r
+ }\r
+ media_info_destroy((media_info_h)item);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ return ret;\r
+\r
+\r
+}\r
+\r
+\r
+int audio_artist_get_media_count_from_db(audio_artist_h artist,int* count)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ sqlite3_stmt *stmt = NULL;\r
+ audio_artist_s* _artist = (audio_artist_s*)artist;\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+\r
+ \r
+ memset(select_query,0x00,sizeof(select_query));\r
+ if(_artist == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ snprintf(select_query,sizeof(select_query),SELECT_MEDIA_COUNT_FROM_ARTIST,_artist ->name);\r
+\r
+ ret = _content_query_prepare(&stmt,select_query,NULL, NULL,NULL,NULL);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ *count = (int)sqlite3_column_int(stmt,0);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ \r
+ return ret;\r
+\r
+}\r
+\r
+int audio_artist_destroy(audio_artist_h artist )\r
+{\r
+ int ret;\r
+ audio_artist_s* _artist = (audio_artist_s*)artist; \r
+ if(_artist) \r
+ {\r
+ if(_artist->name) \r
+ {\r
+ free(_artist->name);\r
+ } \r
+\r
+ free(_artist);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+int audio_artist_clone(audio_artist_h* dst,audio_artist_h src)\r
+{\r
+ int ret;\r
+ audio_artist_s* _src = (audio_artist_s*)src; \r
+ \r
+\r
+ if(_src != NULL )\r
+ {\r
+\r
+ audio_artist_s* _dst = (audio_artist_s*)calloc(1,sizeof(audio_artist_s)); \r
+\r
+ if(_dst == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ \r
+ if((_src->name != NULL) && (strlen(_src->name) > 0))\r
+ {\r
+ _dst->name = strdup(_src->name);\r
+ if(_dst->name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ audio_artist_destroy((audio_artist_h)_dst);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+\r
+ *dst = (audio_artist_h)_dst;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+ \r
+ return ret;\r
+\r
+}\r
+ \r
+int audio_artist_get_name(audio_artist_h artist, char** name)\r
+{\r
+ int ret;\r
+ audio_artist_s* _artist = (audio_artist_s*)artist; \r
+ if(_artist) \r
+ {\r
+ if((_artist->name!= NULL) && (strlen(_artist->name) > 0))\r
+ {\r
+ *name = strdup(_artist->name);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER ;\r
+ } \r
+\r
+ return ret;\r
+}\r
+\r
--- /dev/null
+/*\r
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License. \r
+*/\r
+\r
+\r
+\r
+#include <media_content.h>\r
+#include <media_info_private.h>\r
+#include <audio-svc.h>\r
+#include <audio-svc-error.h>\r
+#include <audio-svc-types.h>\r
+#include <media-info-error.h>\r
+#include <media-svc-error.h>\r
+#include <minfo-types.h>\r
+#include <minfo-api.h>\r
+#include <media-info.h>\r
+\r
+\r
+#include <dlog.h>\r
+\r
+#ifdef LOG_TAG\r
+#undef LOG_TAG\r
+#endif\r
+\r
+#define LOG_TAG "TIZEN_N_MEDIACONTENT"\r
+\r
+static sqlite3* db_handle;\r
+\r
+\r
+\r
+\r
+int media_content_connect()\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ int _ret;\r
+ _ret = mediainfo_connect_db_with_handle(&db_handle);\r
+\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,_ret);\r
+ if( ret == MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ _ret = mediainfo_open();\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,_ret);\r
+ }\r
+ return ret;\r
+}\r
+\r
+\r
+int media_content_disconnect()\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ int _ret;\r
+ \r
+ if(db_handle != NULL)\r
+ {\r
+ _ret = mediainfo_disconnect_db_with_handle(db_handle);\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,_ret);\r
+ if( ret == MEDIA_CONTENT_ERROR_NONE)\r
+ { \r
+ _ret = mediainfo_close();\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,_ret);\r
+ db_handle = NULL;\r
+ }\r
+ }\r
+ \r
+ return ret;\r
+}\r
+\r
+\r
+int _content_query_prepare(sqlite3_stmt** stmt,char* select_query,char* condition_query, char* search_query,char* limit_query,char* order)\r
+{\r
+ char* query = NULL;\r
+ int len_query;\r
+ \r
+ if(db_handle == NULL)\r
+ {\r
+ LOGE("[%s]DB_FAILED(0x%08x) database is not connected", __FUNCTION__, MEDIA_CONTENT_ERROR_DB_FAILED);\r
+ return MEDIA_CONTENT_ERROR_DB_FAILED; \r
+ }\r
+ \r
+ if((select_query != NULL) && (select_query[0] != 0x00))\r
+ {\r
+ if((search_query == NULL) || search_query[0] == 0x00)\r
+ {\r
+ search_query = " ";\r
+ }\r
+ if((limit_query == NULL) || limit_query[0] == 0x00)\r
+ {\r
+ limit_query = " ";\r
+ } \r
+ if((order == NULL) || order[0] == 0x00)\r
+ {\r
+ order = " ";\r
+ }\r
+ if((condition_query == NULL) ||condition_query[0] == 0x00)\r
+ {\r
+ condition_query = " ";\r
+ }\r
+\r
+ len_query= strlen(select_query) + 1 + strlen(search_query)+ 1 + strlen(condition_query)+ 1 + strlen(limit_query)+ 1 + strlen(order)+1;\r
+\r
+ query = (char*)calloc(len_query,sizeof(char));\r
+\r
+ if(query == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ \r
+ snprintf(query,len_query,"%s %s %s %s %s",select_query,condition_query,search_query,order,limit_query );\r
+\r
+ LOGV("[%s]Query : %s",__func__,query); \r
+ if( sqlite3_prepare(db_handle, query, strlen(query),stmt, NULL) != SQLITE_OK )\r
+ {\r
+ LOGE("[%s]DB_FAILED(0x%08x) fail to sqlite3_prepare(), %s", __FUNCTION__, MEDIA_CONTENT_ERROR_DB_FAILED,sqlite3_errmsg(db_handle));\r
+ exit(1);\r
+ } \r
+ free(query);\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return MEDIA_CONTENT_ERROR_NONE;\r
+\r
+}\r
+\r
+\r
+\r
+int _content_error_capi(media_content_type_e type, int content_error)\r
+{\r
+ if(type == MEDIA_CONTENT_TYPE)\r
+ {\r
+ if(content_error == MB_SVC_ERROR_NONE)\r
+ return MEDIA_CONTENT_ERROR_NONE;\r
+ else if(content_error == MB_SVC_ERROR_INVALID_PARAMETER || content_error == AUDIO_SVC_ERROR_INVALID_PARAMETER)\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ else if(content_error == MB_SVC_ERROR_DB_INTERNAL || content_error == AUDIO_SVC_ERROR_DB_INTERNAL)\r
+ return MEDIA_CONTENT_ERROR_DB_FAILED;\r
+ else if(content_error == MEDIA_INFO_ERROR_DATABASE_CONNECT || content_error == AUDIO_SVC_ERROR_DB_CONNECT)\r
+ return MEDIA_CONTENT_ERROR_DB_FAILED;\r
+ else if(content_error == MEDIA_INFO_ERROR_DATABASE_DISCONNECT)\r
+ return MEDIA_CONTENT_ERROR_DB_FAILED; \r
+ \r
+ }\r
+ return MEDIA_CONTENT_ERROR_NONE;\r
+ \r
+}\r
+\r
+\r
+int _content_query_sql(char *query_str)\r
+{\r
+ int err = MEDIA_CONTENT_ERROR_NONE;\r
+ char *err_msg;\r
+\r
+ if(db_handle == NULL)\r
+ {\r
+ LOGE("[%s]DB_FAILED(0x%08x) database is not connected",__FUNCTION__, MEDIA_CONTENT_ERROR_DB_FAILED);\r
+ return MEDIA_CONTENT_ERROR_DB_FAILED; \r
+ }\r
+\r
+\r
+ err = sqlite3_exec(db_handle, query_str, NULL, NULL, &err_msg);\r
+ if (SQLITE_OK != err) \r
+ {\r
+ if (err_msg) \r
+ {\r
+ sqlite3_free(err_msg);\r
+ }\r
+ LOGE("[%s]DB_FAILED(0x%08x) database operation is failed",__FUNCTION__, MEDIA_CONTENT_ERROR_DB_FAILED);\r
+ return MEDIA_CONTENT_ERROR_DB_FAILED;\r
+ }\r
+\r
+ if (err_msg)\r
+ sqlite3_free(err_msg);\r
+ \r
+ return err;\r
+}\r
+\r
+\r
--- /dev/null
+/*\r
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License. \r
+*/\r
+\r
+\r
+#include <media_content.h>\r
+#include <media_info_private.h>\r
+#include <audio-svc.h>\r
+#include <audio-svc-error.h>\r
+#include <audio-svc-types.h>\r
+#include <media-info-error.h>\r
+#include <media-svc-error.h>\r
+#include <minfo-types.h>\r
+#include <minfo-api.h>\r
+#include <media-info.h>\r
+\r
+#include <dlog.h>\r
+\r
+#ifdef LOG_TAG\r
+#undef LOG_TAG\r
+#endif\r
+\r
+#define LOG_TAG "TIZEN_N_MEDIACONTENT"\r
+\r
+\r
+int media_info_filter_create(media_info_filter_h* filter)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ if(filter == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ \r
+ media_info_filter_s* _filter = (media_info_filter_s*)calloc(1, sizeof(media_info_filter_s));\r
+\r
+ if(_filter == NULL) \r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ ret = MEDIA_CONTENT_ERROR_OUT_OF_MEMORY ;\r
+ } \r
+ else {\r
+ _filter->media_type = MEDIA_CONTENT_TYPE_ALL; \r
+ _filter->offset = -1;\r
+ _filter->count = -1;\r
+ _filter->order = MEDIA_CONTENT_SORT_NONE;\r
+ _filter->search_type = MEDIA_INFO_SEARCH_NONE;\r
+ _filter->keyword = NULL;\r
+\r
+ *filter = (media_info_filter_h)_filter;\r
+ \r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+\r
+int media_info_filter_destroy(media_info_filter_h filter)\r
+{\r
+ int ret;\r
+ media_info_filter_s* _filter = (media_info_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ if(_filter->keyword) \r
+ {\r
+ free(_filter->keyword);\r
+ } \r
+ free(_filter);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ { \r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+int media_info_filter_set_offset(media_info_filter_h filter, int offset, int count)\r
+{\r
+ int ret;\r
+ media_info_filter_s* _filter = (media_info_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ _filter->offset = offset;\r
+ _filter->count = count;\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_info_filter_set_search_keyword(media_info_filter_h filter,media_info_search_type_e search_type,const char *search_keyword)\r
+{\r
+ int ret;\r
+ media_info_filter_s* _filter = (media_info_filter_s*)filter;\r
+ if(_filter) \r
+ {\r
+ if((_filter->keyword != NULL) && (strlen(_filter->keyword) > 0))\r
+ {\r
+ free(_filter->keyword);\r
+ _filter->keyword = NULL;\r
+ }\r
+\r
+ if(search_type == MEDIA_INFO_SEARCH_BY_DISPLAY_NAME)\r
+ { \r
+ if((search_keyword != NULL) && (strlen(search_keyword) > 0))\r
+ {\r
+ _filter->search_type = search_type;\r
+ _filter->keyword = strdup(search_keyword);\r
+ if(_filter->keyword == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else if(search_type == MEDIA_INFO_SEARCH_NONE)\r
+ {\r
+ _filter->search_type = search_type;\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_info_filter_set_order(media_info_filter_h filter, media_content_order_e order)\r
+{\r
+ int ret;\r
+ media_info_filter_s* _filter = (media_info_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ _filter->order = order;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+int media_info_filter_set_media_type(media_info_filter_h filter,int media_type)\r
+{\r
+ int ret;\r
+ media_info_filter_s* _filter = (media_info_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ if( !(media_type & MEDIA_CONTENT_TYPE_ALL))\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ \r
+ _filter->media_type = media_type;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_info_filter_get_offset(media_info_filter_h filter, int* offset, int* count)\r
+{\r
+ int ret;\r
+ media_info_filter_s* _filter = (media_info_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ \r
+ *offset = _filter->offset;\r
+ *count = _filter->count;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_info_filter_get_search_keyword(media_info_filter_h filter,media_info_search_type_e* search_type, char **search_keyword)\r
+{\r
+ int ret;\r
+ media_info_filter_s* _filter = (media_info_filter_s*)filter;\r
+ if(_filter && (search_type != NULL)) \r
+ {\r
+ if((_filter->keyword != NULL) && (strlen(_filter->keyword) > 0))\r
+ {\r
+ *search_keyword = strdup(_filter->keyword);\r
+ if(*search_keyword == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ *search_type = _filter->search_type;\r
+ }\r
+ else\r
+ {\r
+ *search_type = _filter->search_type;\r
+ *search_keyword = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_info_filter_get_order(media_info_filter_h filter, media_content_order_e* order)\r
+{\r
+ int ret;\r
+ media_info_filter_s* _filter = (media_info_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ *order = _filter->order;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+int media_info_filter_get_media_type(media_info_filter_h filter,int* media_type)\r
+{\r
+ int ret;\r
+ media_info_filter_s* _filter = (media_info_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ *media_type = _filter->media_type;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_folder_filter_create(media_folder_filter_h* filter)\r
+{\r
+ int ret= MEDIA_CONTENT_ERROR_NONE;\r
+ if(filter == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ media_folder_filter_s* _filter = (media_folder_filter_s*)calloc(1, sizeof(media_folder_filter_s));\r
+\r
+ if(_filter == NULL) \r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ ret = MEDIA_CONTENT_ERROR_OUT_OF_MEMORY ;\r
+ } \r
+ else \r
+ {\r
+ \r
+ _filter->offset = -1;\r
+ _filter->count = -1;\r
+ _filter->order = MEDIA_CONTENT_SORT_NONE;;\r
+ _filter->search_type = MEDIA_FOLDER_SEARCH_NONE;\r
+ _filter->keyword = NULL;\r
+ \r
+ *filter = (media_folder_filter_h)_filter;\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+\r
+ return ret;\r
+\r
+}\r
+\r
+int media_folder_filter_destroy(media_folder_filter_h filter)\r
+{\r
+ int ret;\r
+ media_folder_filter_s* _filter = (media_folder_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ if(_filter->keyword) \r
+ {\r
+ free(_filter->keyword);\r
+ } \r
+ free(_filter);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+\r
+int media_folder_filter_set_offset(media_folder_filter_h filter, int offset, int count)\r
+{\r
+ int ret;\r
+ media_folder_filter_s* _filter = (media_folder_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ _filter->offset = offset;\r
+ _filter->count = count;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_folder_filter_set_search_keyword(media_folder_filter_h filter,media_folder_search_type_e search_type,const char *search_keyword)\r
+{\r
+ int ret;\r
+ media_folder_filter_s* _filter = (media_folder_filter_s*)filter;\r
+ if(_filter) \r
+ {\r
+\r
+ if((_filter->keyword != NULL) && (strlen(_filter->keyword) > 0))\r
+ {\r
+ free(_filter->keyword);\r
+ _filter->keyword = NULL;\r
+ }\r
+ \r
+ if(search_type == MEDIA_FOLDER_SEARCH_BY_FOLDER_NAME)\r
+ { \r
+ if((search_keyword != NULL) && (strlen(search_keyword) > 0))\r
+ {\r
+ _filter->search_type = search_type;\r
+ _filter->keyword = strdup(search_keyword);\r
+ if(_filter->keyword == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else if(search_type == MEDIA_FOLDER_SEARCH_NONE)\r
+ {\r
+ _filter->search_type = search_type;\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ \r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_folder_filter_set_order(media_folder_filter_h filter, media_content_order_e order)\r
+{\r
+ int ret;\r
+ media_folder_filter_s* _filter = (media_folder_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ _filter->order = order;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+//-----------------------------------------\r
+int media_folder_filter_get_offset(media_folder_filter_h filter, int* offset, int* count)\r
+{\r
+ int ret;\r
+ media_folder_filter_s* _filter = (media_folder_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ *offset = _filter->offset;\r
+ *count = _filter->count;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_folder_filter_get_search_keyword(media_folder_filter_h filter,media_folder_search_type_e* search_type, char **search_keyword)\r
+{\r
+ int ret;\r
+ media_folder_filter_s* _filter = (media_folder_filter_s*)filter;\r
+ if(_filter && (search_type != NULL)) \r
+ {\r
+ if((_filter->keyword != NULL) && (strlen(_filter->keyword) > 0))\r
+ {\r
+ *search_keyword = strdup(_filter->keyword);\r
+ if(*search_keyword == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ *search_type =_filter->search_type;\r
+ }\r
+ else\r
+ {\r
+ *search_type = _filter->search_type;\r
+ *search_keyword = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_folder_filter_get_order(media_folder_filter_h filter, media_content_order_e* order)\r
+{\r
+ int ret;\r
+ media_folder_filter_s* _filter = (media_folder_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ *order = _filter->order;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_tag_filter_create( media_tag_filter_h* filter)\r
+{\r
+ int ret= MEDIA_CONTENT_ERROR_NONE;\r
+ if(filter == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ media_tag_filter_s* _filter = (media_tag_filter_s*)calloc(1, sizeof(media_tag_filter_s));\r
+\r
+ if(_filter == NULL) \r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ ret = MEDIA_CONTENT_ERROR_OUT_OF_MEMORY ;\r
+ } \r
+ else \r
+ {\r
+ _filter->offset = -1;\r
+ _filter->count = -1;\r
+ _filter->order = MEDIA_CONTENT_SORT_NONE;\r
+ _filter->search_type = MEDIA_INFO_SEARCH_NONE;\r
+ _filter->keyword = NULL;\r
+\r
+ *filter = (media_tag_filter_h)_filter;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+\r
+ return ret;\r
+\r
+}\r
+\r
+int media_tag_filter_destroy(media_tag_filter_h filter)\r
+{\r
+ int ret;\r
+ media_tag_filter_s* _filter = (media_tag_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ if(_filter->keyword) \r
+ {\r
+ free(_filter->keyword);\r
+ } \r
+ free(_filter);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+\r
+\r
+int media_tag_filter_set_offset(media_tag_filter_h filter, int offset, int count)\r
+{\r
+ int ret;\r
+ media_tag_filter_s* _filter = (media_tag_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ _filter->offset = offset;\r
+ _filter->count = count;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_tag_filter_set_search_keyword(media_tag_filter_h filter,media_tag_search_type_e search_type,const char *search_keyword)\r
+{\r
+ int ret;\r
+ media_tag_filter_s* _filter = (media_tag_filter_s*)filter;\r
+ if(_filter) \r
+ {\r
+\r
+ if((_filter->keyword != NULL) && (strlen(_filter->keyword) > 0))\r
+ {\r
+ free(_filter->keyword);\r
+ _filter->keyword = NULL;\r
+ }\r
+\r
+ if(search_type == MEDIA_TAG_SEARCH_BY_TAG_NAME)\r
+ { \r
+ if((search_keyword != NULL) && (strlen(search_keyword) > 0))\r
+ {\r
+ _filter->search_type = search_type;\r
+ _filter->keyword = strdup(search_keyword); \r
+ if(_filter->keyword == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else if(search_type == MEDIA_TAG_SEARCH_NONE)\r
+ {\r
+ _filter->search_type = search_type;\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_tag_filter_set_order(media_tag_filter_h filter, media_content_order_e order)\r
+{\r
+ int ret;\r
+ media_tag_filter_s* _filter = (media_tag_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ _filter->order = order;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_tag_filter_get_offset(media_tag_filter_h filter, int* offset, int* count)\r
+{\r
+ int ret;\r
+ media_tag_filter_s* _filter = (media_tag_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ *offset = _filter->offset;\r
+ *count = _filter->count;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_tag_filter_get_search_keyword(media_tag_filter_h filter,media_tag_search_type_e *search_type, char **search_keyword)\r
+{\r
+ int ret;\r
+ media_tag_filter_s* _filter = (media_tag_filter_s*)filter;\r
+ if(_filter && (search_type != NULL)) \r
+ {\r
+ if((_filter->keyword != NULL) && (strlen(_filter->keyword) > 0))\r
+ {\r
+ *search_keyword = strdup(_filter->keyword);\r
+ if(*search_keyword == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ *search_type = _filter->search_type;\r
+ }\r
+ else\r
+ {\r
+ *search_type = _filter->search_type;\r
+ *search_keyword = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ { \r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_tag_filter_get_order(media_tag_filter_h filter, media_content_order_e* order)\r
+{\r
+ int ret;\r
+ media_tag_filter_s* _filter = (media_tag_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ *order = _filter->order;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_audio_filter_create(media_audio_filter_h* filter)\r
+{\r
+ int ret= MEDIA_CONTENT_ERROR_NONE;\r
+ if(filter == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ media_audio_filter_s* _filter = (media_audio_filter_s*)calloc(1, sizeof(media_audio_filter_s));\r
+\r
+ if(_filter == NULL) \r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ ret = MEDIA_CONTENT_ERROR_OUT_OF_MEMORY ;\r
+ } \r
+ else \r
+ {\r
+ _filter->offset = -1;\r
+ _filter->count = -1;\r
+ _filter->order = MEDIA_CONTENT_SORT_NONE;\r
+ _filter->search_type = MEDIA_AUDIO_SEARCH_NONE;\r
+ _filter->keyword = NULL;\r
+\r
+ *filter = (media_audio_filter_h)_filter;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_audio_filter_destroy(media_audio_filter_h filter)\r
+{\r
+ int ret;\r
+ media_audio_filter_s* _filter = (media_audio_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ if(_filter->keyword) \r
+ {\r
+ free(_filter->keyword);\r
+ } \r
+ free(_filter);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_audio_filter_set_offset(media_audio_filter_h filter, int offset, int count)\r
+{\r
+ int ret;\r
+ media_audio_filter_s* _filter = (media_audio_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ _filter->offset = offset;\r
+ _filter->count = count;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_audio_filter_set_search_keyword(media_audio_filter_h filter,media_audio_search_type_e search_type,const char *search_keyword)\r
+{\r
+ int ret;\r
+ media_audio_filter_s* _filter = (media_audio_filter_s*)filter;\r
+ if(_filter) \r
+ {\r
+\r
+\r
+ if((_filter->keyword != NULL) && (strlen(_filter->keyword) > 0))\r
+ {\r
+ free(_filter->keyword);\r
+ _filter->keyword = NULL;\r
+ }\r
+\r
+ if((search_type == MEDIA_AUDIO_SEARCH_BY_PLAYLIST) || \r
+ (search_type == MEDIA_AUDIO_SEARCH_BY_ARTIST) ||\r
+ (search_type == MEDIA_AUDIO_SEARCH_BY_GENRE) ||\r
+ (search_type == MEDIA_AUDIO_SEARCH_BY_ALBUM) ||\r
+ (search_type == MEDIA_AUDIO_SEARCH_BY_AUTHOR) ||\r
+ (search_type == MEDIA_AUDIO_SEARCH_NONE) )\r
+ { \r
+ if((search_keyword != NULL) && (strlen(search_keyword) > 0))\r
+ {\r
+ _filter->search_type = search_type;\r
+ _filter->keyword = strdup(search_keyword); \r
+ if(_filter->keyword == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else if(search_type == MEDIA_AUDIO_SEARCH_NONE)\r
+ {\r
+ _filter->search_type = search_type;\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_audio_filter_set_order(media_audio_filter_h filter, media_content_order_e order)\r
+{\r
+ int ret;\r
+ media_audio_filter_s* _filter = (media_audio_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ _filter->order = order;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+int media_audio_filter_get_offset(media_audio_filter_h filter, int* offset, int* count)\r
+{\r
+ int ret;\r
+ media_audio_filter_s* _filter = (media_audio_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ *offset = _filter->offset;\r
+ *count = _filter->count;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ { \r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int media_audio_filter_get_search_keyword(media_audio_filter_h filter,media_audio_search_type_e* search_type,char **keyword)\r
+{\r
+ int ret;\r
+ media_audio_filter_s* _filter = (media_audio_filter_s*)filter;\r
+ if(_filter && (search_type != NULL)) \r
+ {\r
+ if((_filter->keyword != NULL) && (strlen(_filter->keyword) > 0))\r
+ {\r
+ *keyword = strdup(_filter->keyword);\r
+ if(*keyword == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ *search_type = _filter->search_type;\r
+ }\r
+ else\r
+ {\r
+ *search_type = _filter->search_type;\r
+ *keyword = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_audio_filter_get_order(media_audio_filter_h filter, media_content_order_e* order)\r
+{\r
+ int ret;\r
+ media_audio_filter_s* _filter = (media_audio_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ *order = _filter->order;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+\r
+int video_bookmark_filter_create(video_bookmark_filter_h* filter)\r
+{\r
+ int ret= MEDIA_CONTENT_ERROR_NONE;\r
+ if(filter == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ video_bookmark_filter_s* _filter = (video_bookmark_filter_s*)calloc(1, sizeof(video_bookmark_filter_s));\r
+\r
+ if(_filter == NULL) \r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ ret = MEDIA_CONTENT_ERROR_OUT_OF_MEMORY ;\r
+ } \r
+ else \r
+ {\r
+\r
+ _filter->offset = -1;\r
+ _filter->count = -1;\r
+ _filter->order = MEDIA_CONTENT_SORT_NONE;\r
+\r
+ *filter = (video_bookmark_filter_h)_filter;\r
+ \r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int video_bookmark_filter_destroy(video_bookmark_filter_h filter)\r
+{\r
+ int ret;\r
+ video_bookmark_filter_s* _filter = (video_bookmark_filter_s*)filter; \r
+ if(_filter) \r
+ { \r
+ free(_filter);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int video_bookmark_filter_set_offset(video_bookmark_filter_h filter, int offset, int count)\r
+{\r
+ int ret;\r
+ video_bookmark_filter_s* _filter = (video_bookmark_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ _filter->offset = offset;\r
+ _filter->count = count;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+int video_bookmark_filter_set_order(video_bookmark_filter_h filter, media_content_order_e order)\r
+{\r
+ int ret;\r
+ video_bookmark_filter_s* _filter = (video_bookmark_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ _filter->order = order;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+int video_bookmark_filter_get_offset(video_bookmark_filter_h filter, int* offset, int* count)\r
+{\r
+ int ret;\r
+ video_bookmark_filter_s* _filter = (video_bookmark_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ *offset = _filter->offset;\r
+ *count = _filter->count;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
+int video_bookmark_filter_get_order(video_bookmark_filter_h filter, media_content_order_e* order)\r
+{\r
+ int ret;\r
+ video_bookmark_filter_s* _filter = (video_bookmark_filter_s*)filter; \r
+ if(_filter) \r
+ {\r
+ *order = _filter->order;\r
+\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret; \r
+\r
+}\r
+\r
--- /dev/null
+ /*\r
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License. \r
+ */\r
+\r
+\r
+\r
+#include <media_content.h>\r
+#include <media_info_private.h>\r
+#include <audio-svc.h>\r
+#include <audio-svc-error.h>\r
+#include <audio-svc-types.h>\r
+#include <media-info-error.h>\r
+#include <media-svc-error.h>\r
+#include <minfo-types.h>\r
+#include <minfo-api.h>\r
+\r
+#include <dlog.h>\r
+\r
+#ifdef LOG_TAG\r
+#undef LOG_TAG\r
+#endif\r
+\r
+#define LOG_TAG "TIZEN_N_MEDIACONTENT"\r
+\r
+\r
+\r
+int media_folder_foreach_media_from_db(media_folder_h folder,media_info_filter_h filter,media_info_cb callback, void* user_data)\r
+{\r
+ int ret= MEDIA_CONTENT_ERROR_NONE;\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char condition_query[DEFAULT_QUERY_SIZE]; \r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char condition_type[MIN_QUERY_SIZE];\r
+ char select_query1[DEFAULT_QUERY_SIZE]; \r
+ char order_query[MIN_QUERY_SIZE];\r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+ media_info_filter_s* _filter = NULL;\r
+\r
+ media_folder_s* _folder = (media_folder_s*)folder;\r
+\r
+ if(_folder == NULL || callback == NULL )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ if(filter != NULL)\r
+ {\r
+ _filter = (media_info_filter_s*)filter;\r
+ \r
+ if(!(_filter->media_type & (MEDIA_CONTENT_TYPE_IMAGE | MEDIA_CONTENT_TYPE_VIDEO | MEDIA_CONTENT_TYPE_AUDIO)) )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ } \r
+ else\r
+ {\r
+ ret = media_info_filter_create((media_info_filter_h*)&_filter);\r
+\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ return ret;\r
+ }\r
+ \r
+ if(_filter->media_type == 0)\r
+ {\r
+ _filter->media_type = (MEDIA_CONTENT_TYPE_IMAGE | MEDIA_CONTENT_TYPE_VIDEO | MEDIA_CONTENT_TYPE_AUDIO); \r
+ }\r
+ }\r
+\r
+ memset(order_query,0x00,sizeof(order_query)); \r
+ memset(condition_type,0x00,sizeof(condition_type)); \r
+ memset(condition_query,0x00,sizeof(condition_query)); \r
+ memset(limit_query,0x00,sizeof(limit_query)); \r
+ memset(search_query,0x00,sizeof(search_query)); \r
+ memset(select_query1,0x00,sizeof(select_query1)); \r
+\r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and display_name like '%%%s%%'", _filter->keyword);\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_info_filter_s*)filter != _filter)\r
+ media_info_filter_destroy((media_info_filter_h)_filter); \r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ }\r
+\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+ if(_filter->media_type & MEDIA_CONTENT_TYPE_IMAGE)\r
+ {\r
+ strncat(condition_type,CONDITION_TYPE_IMAGE,strlen(CONDITION_TYPE_IMAGE));\r
+ }\r
+ if(_filter->media_type & MEDIA_CONTENT_TYPE_VIDEO)\r
+ {\r
+ if(strlen(condition_type) > 0 )\r
+ {\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE));\r
+ strncat(condition_type,QUERY_KEYWORD_OR, strlen(QUERY_KEYWORD_OR));\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE)); \r
+ }\r
+ strncat(condition_type,CONDITION_TYPE_VIDEO,strlen(CONDITION_TYPE_VIDEO));\r
+\r
+ }\r
+ if(_filter->media_type & MEDIA_CONTENT_TYPE_AUDIO)\r
+ {\r
+ if(strlen(condition_type) > 0 )\r
+ {\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE)); \r
+ strncat(condition_type,QUERY_KEYWORD_OR, strlen(QUERY_KEYWORD_OR));\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE)); \r
+ }\r
+ \r
+ strncat(condition_type,CONDITION_TYPE_AUDIO,strlen(CONDITION_TYPE_AUDIO));\r
+ }\r
+\r
+\r
+ snprintf(select_query1,sizeof(select_query1),"%s", SELECT_MEDIA_ITEM);\r
+\r
+\r
+ snprintf(condition_query,sizeof(condition_query), "%s %s='%s' %s (%s)",\r
+ QUERY_KEYWORD_AND, DB_FIELD_FOLDER_UID,_folder->folder_uid, QUERY_KEYWORD_AND, condition_type);\r
+ \r
+\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_DISPLAY_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_DISPLAY_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE,QUERY_KEYWORD_DESC); \r
+ }\r
+\r
+ if((media_info_filter_s*)filter != _filter)\r
+ media_info_filter_destroy((media_info_filter_h)_filter); \r
+ \r
+ ret = _content_query_prepare(&stmt,select_query1, condition_query,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ return ret;\r
+ }\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ media_info_s* item1 = (media_info_s*)calloc(1,sizeof(media_info_s));\r
+ if(item1 == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ _content_item_get_detail(stmt,(media_info_h)item1);\r
+ if( callback((media_info_h)item1,user_data) == 0)\r
+ {\r
+ media_info_destroy((media_info_h)item1);\r
+ break;\r
+ } \r
+ media_info_destroy((media_info_h)item1);\r
+ \r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ return ret;\r
+}\r
+\r
+int media_folder_foreach_folder_from_db(media_folder_filter_h filter,media_folder_cb callback, void* user_data)\r
+{\r
+ int ret= MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char order_query[MIN_QUERY_SIZE];\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+ char condition_query[DEFAULT_QUERY_SIZE]; \r
+ \r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+ media_folder_filter_s* _filter = NULL;\r
+ \r
+ \r
+ if( callback == NULL )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ \r
+ memset(order_query,0x00,sizeof(order_query)); \r
+ memset(limit_query,0x00,sizeof(limit_query)); \r
+ memset(search_query,0x00,sizeof(search_query));\r
+ memset(select_query,0x00,sizeof(select_query)); \r
+ memset(condition_query,0x00,sizeof(condition_query)); \r
+\r
+\r
+ if(filter != NULL)\r
+ _filter = (media_folder_filter_s*)filter;\r
+ else\r
+ {\r
+ media_folder_filter_create((media_folder_filter_h*)&_filter);\r
+ } \r
+\r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and name like '%%%s%%'", _filter->keyword);\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_folder_filter_s*)filter != _filter)\r
+ media_folder_filter_destroy((media_folder_filter_h)_filter); \r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ }\r
+\r
+ snprintf(select_query,sizeof(select_query),"%s",SELECT_ALL_FOLDER);\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE,QUERY_KEYWORD_DESC); \r
+ }\r
+ \r
+ if((media_folder_filter_s*)filter != _filter)\r
+ media_folder_filter_destroy((media_folder_filter_h)_filter); \r
+\r
+ if(select_query != NULL)\r
+ {\r
+ ret = _content_query_prepare(&stmt,select_query,condition_query,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ return ret;\r
+ }\r
+ }\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ media_folder_s* _folder = (media_folder_s*)calloc(1,sizeof(media_folder_s));\r
+\r
+ if(_folder == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+\r
+ _content_folder_get_detail(stmt,(media_folder_h)_folder);\r
+ if(callback((media_folder_h)_folder,user_data) == false)\r
+ {\r
+ media_folder_destroy((media_folder_h) _folder);\r
+\r
+ break;\r
+\r
+ } \r
+\r
+ media_folder_destroy((media_folder_h) _folder);\r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+ \r
+ return ret;\r
+}\r
+int media_folder_get_media_count_from_db(media_folder_h folder,media_content_type_e type, int* count)\r
+{\r
+ int _tmp;\r
+\r
+ int ret= MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char condition_query[MIN_QUERY_SIZE];\r
+ char condition_type[MIN_QUERY_SIZE]; \r
+ char select_query[DEFAULT_QUERY_SIZE];\r
+ sqlite3_stmt *stmt = NULL;\r
+\r
+ media_folder_s* _folder = (media_folder_s*)folder;\r
+\r
+ if(_folder == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ memset(condition_type, 0x00,sizeof(condition_type));\r
+ memset(condition_query, 0x00,sizeof(condition_query));\r
+ memset(select_query, 0x00,sizeof(select_query)); \r
+\r
+\r
+\r
+ if(type & MEDIA_CONTENT_TYPE_IMAGE)\r
+ {\r
+ strncat(condition_type,CONDITION_TYPE_IMAGE,strlen(CONDITION_TYPE_IMAGE));\r
+ }\r
+ if(type & MEDIA_CONTENT_TYPE_VIDEO)\r
+ {\r
+ if(strlen(condition_type) > 0 )\r
+ {\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE));\r
+ strncat(condition_type,QUERY_KEYWORD_OR, strlen(QUERY_KEYWORD_OR));\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE)); \r
+ }\r
+ strncat(condition_type,CONDITION_TYPE_VIDEO,strlen(CONDITION_TYPE_VIDEO));\r
+\r
+ }\r
+ if(type & MEDIA_CONTENT_TYPE_AUDIO)\r
+ {\r
+ if(strlen(condition_type) > 0 )\r
+ {\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE)); \r
+ strncat(condition_type,QUERY_KEYWORD_OR, strlen(QUERY_KEYWORD_OR));\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE)); \r
+ }\r
+ \r
+ strncat(condition_type,CONDITION_TYPE_AUDIO,strlen(CONDITION_TYPE_AUDIO));\r
+ }\r
+ \r
+ snprintf(condition_query,sizeof(condition_query), "%s %s='%s' %s (%s)",\r
+ QUERY_KEYWORD_AND, DB_FIELD_FOLDER_UID,_folder->folder_uid, QUERY_KEYWORD_AND, condition_type);\r
+\r
+ snprintf(select_query,sizeof(select_query),"%s", SELECT_COUNT_ITEM);\r
+\r
+ \r
+ _tmp = _content_query_prepare(&stmt,select_query,condition_query,NULL,NULL,NULL);\r
+\r
+ if(_tmp != MEDIA_CONTENT_ERROR_NONE)\r
+ return _tmp;\r
+ \r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ *count = (int)sqlite3_column_int(stmt,0);\r
+ } \r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_folder_destroy(media_folder_h folder)\r
+{\r
+ int ret;\r
+ media_folder_s* _folder = (media_folder_s*)folder; \r
+ if(_folder) \r
+ {\r
+ if(_folder->path) \r
+ {\r
+ free(_folder->path);\r
+ } \r
+ if(_folder->name) \r
+ {\r
+ free(_folder->name);\r
+ } \r
+ if(_folder->folder_uid)\r
+ {\r
+ free(_folder->folder_uid);\r
+ }\r
+ free(_folder);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret;\r
+\r
+}\r
+int media_folder_clone(media_folder_h* dst, media_folder_h src)\r
+{\r
+ int ret;\r
+ media_folder_s* _src = (media_folder_s*)src; \r
+\r
+\r
+ if(_src != NULL)\r
+ {\r
+ media_folder_s* _dst = (media_folder_s*)calloc(1,sizeof(media_folder_s)); \r
+ if(_dst == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ _dst->folder_uid = strdup(_src->folder_uid);\r
+ if(_dst->folder_uid == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+\r
+ }\r
+ _dst->storage_type = _src->storage_type;\r
+ if((_src->name != NULL) && (strlen(_src->name) > 0))\r
+ {\r
+ _dst->name = strdup(_src->name);\r
+ if(_dst->name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ media_folder_destroy((media_folder_h)_dst);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ if((_src->path != NULL) && (strlen(_src->path) > 0))\r
+ {\r
+ _dst->path = strdup(_src->path);\r
+ if(_dst->path == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ media_folder_destroy((media_folder_h)_dst);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+\r
+ *dst = (media_folder_h)_dst;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+ \r
+ return ret;\r
+}\r
+\r
+int media_folder_get_path(media_folder_h folder, char** path)\r
+{\r
+ int ret;\r
+ media_folder_s* _folder = (media_folder_s*)folder; \r
+ if(_folder) \r
+ {\r
+ if((_folder->path != NULL) && (strlen(_folder->path) > 0))\r
+ {\r
+ *path = strdup(_folder->path);\r
+ if(*path == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ *path = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+int media_folder_get_name(media_folder_h folder, char** name)\r
+{ \r
+ int ret;\r
+ media_folder_s* _folder = (media_folder_s*)folder; \r
+ if(_folder) \r
+ {\r
+ if((_folder->name != NULL) && (strlen(_folder->name) > 0))\r
+ {\r
+ *name = strdup(_folder->name);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+}\r
+ \r
+int media_folder_get_storage_type(media_folder_h folder, media_content_storage_e* storage_type)\r
+{\r
+ int ret;\r
+ media_folder_s* _folder = (media_folder_s*)folder; \r
+ if(_folder) \r
+ {\r
+ *storage_type = _folder->storage_type;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_folder_get_date_modified(media_folder_h folder, time_t* time)\r
+{\r
+ int ret;\r
+ media_folder_s* _folder = (media_folder_s*)folder; \r
+ if(_folder) \r
+ {\r
+ *time = _folder->date_modified;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+void _content_folder_get_detail(sqlite3_stmt* stmt, media_folder_h folder)\r
+{\r
+ media_folder_s* _folder = (media_folder_s*)folder;\r
+ _folder->folder_uid = strdup((const char *)sqlite3_column_text(stmt, 0));\r
+ _folder->path= strdup((const char *)sqlite3_column_text(stmt, 1));\r
+ _folder->name=strdup((const char *)sqlite3_column_text(stmt, 2));\r
+ _folder->storage_type=(int)sqlite3_column_int(stmt,3);\r
+ _folder->date_modified=(int)sqlite3_column_int(stmt,4); \r
+}\r
+\r
+\r
--- /dev/null
+/*
+* Copyright (c) 2011 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 <media_image.h>
+#include <media_content.h>
+#include <media_info_private.h>
+#include <media-info-error.h>
+#include <media-svc-error.h>
+#include <minfo-types.h>
+#include <minfo-api.h>
+#include <media-info.h>
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "TIZEN_N_MEDIACONTENT"
+
+
+
+#define DUPLICATE_STRING(destination, src) \
+{ \
+ char* tmp = src; \
+ if(tmp != NULL && strlen(tmp) > 0) \
+ { \
+ char* new_str = strdup(tmp); \
+ destination = new_str; \
+ } \
+ else \
+ { \
+ destination = NULL; \
+ } \
+}
+
+#define DUPLICATE_FIELD(field) DUPLICATE_STRING(_dst->field, _src->field)
+
+int image_meta_destroy(image_meta_h image)
+{
+ int ret;
+ image_meta_s* _image = (image_meta_s*)image;
+ if(_image)
+ {
+ if(_image->image_id)
+ free(_image->image_id);
+ if(_image->thumbnail)
+ free(_image->thumbnail);
+ if(_image->description)
+ free(_image->description);
+
+ free(_image);
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+ return ret;
+
+}
+
+
+int image_meta_clone(image_meta_h* dst, image_meta_h src)
+{
+ int ret;
+ image_meta_s* _src = (image_meta_s*)src;
+
+ if(_src != NULL)
+ {
+
+ image_meta_s* _dst = (image_meta_s*)calloc(1,sizeof(image_meta_s));
+ if (NULL == _dst)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ _dst->image_id = strdup(_src->image_id);
+ _dst->longitude = _src->longitude;
+ _dst->latitude= _src->latitude;
+ _dst->width = _src->width;
+ _dst->height = _src->height;
+ _dst->orientation = _src->orientation;
+ _dst->date_taken = _src->date_taken;
+
+ DUPLICATE_FIELD(thumbnail)
+ DUPLICATE_FIELD(description)
+
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ *dst = (image_meta_h)_dst;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+
+int image_meta_get_longitude(image_meta_h image, double* longitude)
+{
+ int ret;
+ image_meta_s* _image = (image_meta_s*)image;
+ if(_image && longitude)
+ {
+ *longitude= _image->longitude;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int image_meta_get_latitude(image_meta_h image, double* latitude)
+{
+ int ret;
+ image_meta_s* _image = (image_meta_s*)image;
+ if(_image && latitude)
+ {
+ *latitude = _image->latitude;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+
+int image_meta_get_description(image_meta_h image, char** description)
+{
+ int ret;
+ image_meta_s* _image = (image_meta_s*)image;
+ if(_image && description)
+ {
+ if((_image->description != NULL) && (strlen(_image->description) > 0))
+ {
+ *description = strdup(_image->description);
+ if (NULL == *description)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else
+ {
+ *description = NULL;
+ }
+ ret = MEDIA_CONTENT_ERROR_NONE;
+
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int image_meta_get_width(image_meta_h image, int* width)
+{
+ int ret;
+ image_meta_s* _image = (image_meta_s*)image;
+ if(_image && width)
+ {
+ *width = _image->width;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int image_meta_get_height(image_meta_h image, int* height)
+{
+ int ret;
+ image_meta_s* _image = (image_meta_s*)image;
+ if(_image && height)
+ {
+ *height = _image->height;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int image_meta_get_orientation(image_meta_h image, media_content_orientation_e* orientation)
+{
+ int ret;
+ image_meta_s* _image = (image_meta_s*)image;
+ if(_image)
+ {
+ *orientation = _image->orientation;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int image_meta_get_date_taken(image_meta_h image,time_t* date_taken)
+{
+ int ret;
+ image_meta_s* _image = (image_meta_s*)image;
+ if(_image && date_taken)
+ {
+ *date_taken = _image->date_taken;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+
+
--- /dev/null
+/*\r
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License. \r
+*/\r
+\r
+\r
+#include <media_content.h>\r
+#include <media_info_private.h>\r
+#include <media-info-error.h>\r
+#include <media-svc-error.h>\r
+#include <media-info.h>\r
+#include <audio-svc.h>\r
+#include <audio-svc-error.h>\r
+#include <audio-svc-types.h>\r
+\r
+#include <media-svc-error.h>\r
+#include <minfo-types.h>\r
+#include <minfo-api.h>\r
+#include <media-info.h>\r
+\r
+#include <drm-service.h>\r
+#include <aul.h>\r
+\r
+#include <dlog.h>\r
+\r
+#ifdef LOG_TAG\r
+#undef LOG_TAG\r
+#endif\r
+\r
+#define LOG_TAG "TIZEN_N_MEDIACONTENT"\r
+\r
+\r
+#define SELECT_AUDIO_FROM_MEDIA "select audio_id,genre,album,artist,author,year,copyright,description,format,bitrate,track_num,duration,rating,played_count,last_played_time,added_time,size,category from audio_media where audio_id='%s' "\r
+#define SELECT_TAG_LIST_FROM_MEDIA "select t._id, t.tag_name from (select _id, tag_name from visual_tag ORDER BY tag_name ASC ) t, ( select media_uuid, tag_id from visual_tag_map where media_uuid='%s' ) tm, ( select uuid, folder_uuid from visual_media) m, ( select uuid, lock_status from visual_folder where valid=1 ) f where tm.tag_id = t._id and m.uuid = tm.media_uuid and m.folder_uuid = f.uuid and f.lock_status=0; "\r
+\r
+int media_info_insert_to_db(media_content_type_e type,const char* path)\r
+{\r
+ int ret= MEDIA_CONTENT_ERROR_NONE;\r
+ int storage_type;\r
+ int category=0;\r
+ minfo_file_type _type;\r
+ if(path == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ switch(type)\r
+ {\r
+ case MEDIA_CONTENT_TYPE_IMAGE:\r
+ _type = MINFO_ITEM_IMAGE;\r
+ ret = minfo_add_media(path, _type);\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);\r
+ break;\r
+ case MEDIA_CONTENT_TYPE_VIDEO:\r
+ _type = MINFO_ITEM_VIDEO;\r
+ ret = minfo_add_media(path, _type);\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret); \r
+ break;\r
+\r
+ case MEDIA_CONTENT_TYPE_AUDIO:\r
+ storage_type = _content_get_storage_type(path);\r
+ ret = _content_get_audio_category(path,&category);\r
+ if(ret >= 0)\r
+ {\r
+ ret = audio_svc_insert_item(storage_type,path,category); \r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER; \r
+ }\r
+ break;\r
+\r
+ default:\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ break;\r
+\r
+ }\r
+\r
+ return ret;\r
+}\r
+\r
+\r
+\r
+int media_info_destroy(media_info_h item)\r
+{\r
+\r
+ int ret;\r
+ media_info_s* _item = (media_info_s*)item; \r
+ if(_item) \r
+ {\r
+ if(_item->item_id)\r
+ {\r
+ free(_item->item_id);\r
+ }\r
+\r
+ if(_item->file_path) \r
+ {\r
+ free(_item->file_path);\r
+ } \r
+ if(_item->display_name) \r
+ {\r
+ free(_item->display_name);\r
+ } \r
+ if(_item->thumbnail) \r
+ {\r
+ free(_item->thumbnail);\r
+ }\r
+ free(_item);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret;\r
+\r
+\r
+\r
+}\r
+int media_info_clone(media_info_h* dst, media_info_h src)\r
+{\r
+ int ret;\r
+ media_info_s* _src = (media_info_s*)src; \r
+\r
+\r
+ if(_src != NULL )\r
+ {\r
+ media_info_s* _dst = (media_info_s*)calloc(1,sizeof(media_info_s)); \r
+\r
+ if(_dst == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ \r
+ _dst->item_id = strdup(_src->item_id);\r
+ if( _dst->item_id == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ _dst->date_modified= _src->date_modified;\r
+ _dst->favorite = _src->favorite;\r
+ _dst->media_type = _src->media_type;\r
+ if((_src->file_path != NULL) && (strlen(_src->file_path) > 0))\r
+ {\r
+ _dst->file_path = strdup(_src->file_path);\r
+ if(_dst->file_path == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ media_info_destroy((media_info_h)_dst);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ if((_src->display_name != NULL) && (strlen(_src->display_name) > 0))\r
+ {\r
+ _dst->display_name = strdup(_src->display_name);\r
+ if(_dst->display_name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ media_info_destroy((media_info_h)_dst);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ if((_src->thumbnail != NULL) && (strlen(_src->thumbnail) > 0))\r
+ {\r
+ _dst->thumbnail = strdup(_src->thumbnail);\r
+ if(_dst->thumbnail == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ media_info_destroy((media_info_h)_dst);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+\r
+ } \r
+ *dst = (media_info_h)_dst;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+ \r
+ return ret; \r
+}\r
+\r
+int media_info_get_file_path(media_info_h item, char** path)\r
+{ \r
+ int ret;\r
+ media_info_s* _item = (media_info_s*)item; \r
+ \r
+ if(_item) \r
+ {\r
+ if((_item->file_path != NULL) && (strlen(_item->file_path) > 0))\r
+ {\r
+ *path = strdup(_item->file_path);\r
+ if(*path == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ *path = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+}\r
+ \r
+\r
+int media_info_get_display_name(media_info_h item, char** name)\r
+{ \r
+ int ret;\r
+ media_info_s* _item = (media_info_s*)item; \r
+ if(_item) \r
+ {\r
+ if((_item->display_name != NULL) && (strlen(_item->display_name) > 0))\r
+ {\r
+ *name = strdup(_item->display_name);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+}\r
+ \r
+\r
+int media_info_get_thumbnail_path(media_info_h item, char** path)\r
+{ \r
+ int ret;\r
+ media_info_s* _item = (media_info_s*)item; \r
+ if(_item) \r
+ {\r
+ if((_item->thumbnail != NULL) && (strlen(_item->thumbnail) > 0))\r
+ {\r
+ *path = strdup(_item->thumbnail);\r
+ if(*path == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ }\r
+ else\r
+ {\r
+ *path = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+}\r
+ \r
+\r
+int media_info_get_date_modified(media_info_h item, time_t* time)\r
+{\r
+ int ret;\r
+ media_info_s* _item = (media_info_s*)item; \r
+ if(_item) \r
+ {\r
+ *time = _item->date_modified;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+int media_info_get_media_type(media_info_h item, int* type)\r
+{\r
+ int ret;\r
+ media_info_s* _item = (media_info_s*)item; \r
+ if(_item) \r
+ {\r
+ *type = _item->media_type;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+\r
+int media_info_get_favorite(media_info_h media, int* favorite)\r
+{\r
+ int ret;\r
+ media_info_s* _media = (media_info_s*)media;\r
+ if(_media)\r
+ {\r
+\r
+ *favorite = _media->favorite;\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+int media_info_update_favorite_to_db(media_info_h media, int favorite)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ media_info_s* _media = (media_info_s*)media;\r
+\r
+ if(media != NULL)\r
+ {\r
+ if(_media->media_type == MEDIA_CONTENT_TYPE_AUDIO)\r
+ {\r
+ if(favorite)\r
+ {\r
+ ret = audio_svc_add_item_to_playlist( AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);\r
+ }\r
+ else\r
+ {\r
+ ret = audio_svc_remove_item_from_playlist_by_audio_id(AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);\r
+ }\r
+ }\r
+ else\r
+ { \r
+ ret = minfo_update_media_favorite(_media->item_id,favorite);\r
+ }\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+\r
+ }\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+\r
+int media_info_foreach_media_from_db(media_info_filter_h filter,media_info_cb callback, void* user_data)\r
+{\r
+ int ret= MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char condition_query[DEFAULT_QUERY_SIZE]; \r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char condition_type[MIN_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+ char order_query[MIN_QUERY_SIZE];\r
+\r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+\r
+\r
+ media_info_filter_s* _filter = NULL;\r
+ \r
+ if( callback == NULL )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+\r
+\r
+ if(filter != NULL)\r
+ {\r
+ _filter = (media_info_filter_s*)filter;\r
+ \r
+ if(!(_filter->media_type & (MEDIA_CONTENT_TYPE_IMAGE | MEDIA_CONTENT_TYPE_VIDEO | MEDIA_CONTENT_TYPE_AUDIO)) )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ } \r
+ else\r
+ {\r
+ ret = media_info_filter_create((media_info_filter_h*)&_filter);\r
+\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ return ret;\r
+ }\r
+ \r
+ if(_filter->media_type == 0)\r
+ {\r
+ _filter->media_type = (MEDIA_CONTENT_TYPE_IMAGE | MEDIA_CONTENT_TYPE_VIDEO | MEDIA_CONTENT_TYPE_AUDIO); \r
+ }\r
+ }\r
+\r
+ memset(order_query,0x00,sizeof(order_query)); \r
+ memset(condition_type,0x00,sizeof(condition_type)); \r
+ memset(condition_query,0x00,sizeof(condition_query)); \r
+ memset(limit_query,0x00,sizeof(limit_query)); \r
+ memset(search_query,0x00,sizeof(search_query)); \r
+ memset(select_query,0x00,sizeof(select_query)); \r
+\r
+\r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and display_name like '%%%s%%'", _filter->keyword);\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_info_filter_s*)filter != _filter)\r
+ media_info_filter_destroy((media_info_filter_h)_filter); \r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ }\r
+\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+ \r
+\r
+ if(_filter->media_type & MEDIA_CONTENT_TYPE_IMAGE)\r
+ {\r
+ strncat(condition_type,CONDITION_TYPE_IMAGE,strlen(CONDITION_TYPE_IMAGE));\r
+ }\r
+ if(_filter->media_type & MEDIA_CONTENT_TYPE_VIDEO)\r
+ {\r
+ if(strlen(condition_type) > 0 )\r
+ {\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE));\r
+ strncat(condition_type,QUERY_KEYWORD_OR, strlen(QUERY_KEYWORD_OR));\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE)); \r
+ }\r
+ strncat(condition_type,CONDITION_TYPE_VIDEO,strlen(CONDITION_TYPE_VIDEO));\r
+\r
+ }\r
+ if(_filter->media_type & MEDIA_CONTENT_TYPE_AUDIO)\r
+ {\r
+ if(strlen(condition_type) > 0 )\r
+ {\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE)); \r
+ strncat(condition_type,QUERY_KEYWORD_OR, strlen(QUERY_KEYWORD_OR));\r
+ strncat(condition_type,QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE)); \r
+ }\r
+ \r
+ strncat(condition_type,CONDITION_TYPE_AUDIO,strlen(CONDITION_TYPE_AUDIO));\r
+ }\r
+\r
+\r
+ snprintf(select_query,sizeof(select_query),"%s", SELECT_MEDIA_ITEM);\r
+\r
+ snprintf(condition_query,sizeof(condition_query), "%s (%s)", QUERY_KEYWORD_AND, condition_type);\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_DISPLAY_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_DISPLAY_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE,QUERY_KEYWORD_DESC); \r
+ }\r
+\r
+ \r
+ if((media_info_filter_s*)filter != _filter)\r
+ media_info_filter_destroy((media_info_filter_h)_filter); \r
+\r
+\r
+ ret = _content_query_prepare(&stmt,select_query,condition_query, search_query,limit_query,order_query);\r
+ if( ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ \r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ media_info_s* item1 = (media_info_s*)calloc(1,sizeof(media_info_s));\r
+\r
+ if(item1 == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ _content_item_get_detail(stmt,(media_info_h)item1);\r
+\r
+ if( callback((media_info_h)item1,user_data) == false)\r
+ {\r
+ media_info_destroy((media_info_h) item1);\r
+ break;\r
+ }\r
+ media_info_destroy((media_info_h) item1); \r
+ }\r
+ \r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ return ret;\r
+\r
+}\r
+\r
+\r
+\r
+int media_info_get_image_from_db(media_info_h item, image_meta_h* image)\r
+{\r
+ int p_ret;\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ Mitem* p_item = NULL;\r
+ image_meta_s* _image = NULL; \r
+ \r
+\r
+ \r
+ media_info_s* _item = (media_info_s*)item;\r
+\r
+ if( _item == NULL )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ if(_item->media_type != MEDIA_CONTENT_TYPE_IMAGE)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ p_ret = minfo_get_item_by_id(_item->item_id,&p_item);\r
+\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);\r
+ if( (ret == MEDIA_CONTENT_ERROR_NONE) && ( p_item != NULL))\r
+ {\r
+ ret = minfo_get_meta_info(_item->item_id,&(p_item->meta_info));\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret); \r
+\r
+ if( ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ minfo_destroy_mtype_item(p_item);\r
+ return ret;\r
+ }\r
+ _image = (image_meta_s*)calloc(1, sizeof(image_meta_s));\r
+ if(_image == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ minfo_destroy_mtype_item(p_item);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+\r
+ }\r
+\r
+ _image->image_id = strdup(p_item->uuid);\r
+ if(p_item->thumb_url != NULL)\r
+ _image->thumbnail = strdup(p_item->thumb_url);\r
+ if(p_item->rate > 0)\r
+ _image->favorite = true;\r
+ else\r
+ _image->favorite = false;\r
+\r
+ if(p_item->meta_info != NULL)\r
+ {\r
+ _image->longitude = p_item->meta_info->longitude;\r
+ _image->latitude = p_item->meta_info->latitude;\r
+ _image->width = p_item->meta_info->width;\r
+ _image->height = p_item->meta_info->height;\r
+ _image->date_taken = p_item->meta_info->datetaken;\r
+ if(p_item->meta_info->description != NULL)\r
+ _image->description = strdup(p_item->meta_info->description); \r
+ }\r
+ if((p_item->meta_info != NULL) && (p_item->meta_info->image_info != NULL))\r
+ {\r
+ _image->orientation = p_item->meta_info->image_info->orientation;\r
+ }\r
+ \r
+ *image = (image_meta_h)_image;\r
+ p_ret = minfo_destroy_mtype_item(p_item);\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);\r
+ }\r
+\r
+ \r
+ return ret;\r
+}\r
+\r
+\r
+int media_info_get_video_from_db(media_info_h item, video_meta_h* video)\r
+{\r
+\r
+ int p_ret;\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ Mitem* p_item = NULL;\r
+ video_meta_s* _video = NULL;\r
+\r
+\r
+ media_info_s* _item = (media_info_s*)item; \r
+ if( _item == NULL )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ if(_item->media_type != MEDIA_CONTENT_TYPE_VIDEO)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ p_ret = minfo_get_item_by_id(_item->item_id,&p_item);\r
+\r
+\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);\r
+ if( (ret == MEDIA_CONTENT_ERROR_NONE) && ( p_item != NULL))\r
+ {\r
+ ret = minfo_get_meta_info(_item->item_id,&(p_item->meta_info));\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret); \r
+ if( ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ minfo_destroy_mtype_item(p_item);\r
+ return ret;\r
+ }\r
+\r
+ _video = (video_meta_s*)calloc(1,sizeof(video_meta_s));\r
+ if( _video == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ minfo_destroy_mtype_item(p_item);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ _video->video_id = strdup(p_item->uuid);\r
+ if(p_item->thumb_url)\r
+ _video->thumbnail = strdup(p_item->thumb_url);\r
+ \r
+ if(p_item->rate > 0)\r
+ _video->favorite = true;\r
+ else\r
+ _video->favorite = false;\r
+\r
+\r
+ if(p_item->meta_info != NULL)\r
+ {\r
+ _video->longitude = p_item->meta_info->longitude;\r
+ _video->latitude = p_item->meta_info->latitude;\r
+ _video->width = p_item->meta_info->width; \r
+ _video->height = p_item->meta_info->height;\r
+ _video->date_taken = p_item->meta_info->datetaken;\r
+ if(p_item->meta_info->description)\r
+ _video->description = strdup(p_item->meta_info->description); \r
+ } \r
+ if((p_item->meta_info != NULL) && (p_item->meta_info->video_info != NULL))\r
+ {\r
+ if(p_item->meta_info->video_info->album_name != NULL)\r
+ {\r
+ _video->album = strdup(p_item->meta_info->video_info->album_name);\r
+ }\r
+ if(p_item->meta_info->video_info->artist_name != NULL)\r
+ _video->artist = strdup(p_item->meta_info->video_info->artist_name);\r
+ if(p_item->meta_info->video_info->title != NULL)\r
+ _video->title = strdup(p_item->meta_info->video_info->title);\r
+\r
+ \r
+ _video->time_played = p_item->meta_info->video_info->last_played_pos;\r
+ _video->duration = p_item->meta_info->video_info->duration;\r
+ }\r
+ *video = (video_meta_h)_video;\r
+ p_ret = minfo_destroy_mtype_item(p_item);\r
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);\r
+ \r
+ }\r
+ return ret;\r
+}\r
+\r
+int media_info_get_audio_from_db(media_info_h item, audio_meta_h* audio)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ \r
+ media_info_s* _item = (media_info_s*)item;\r
+ \r
+ char select_query[DEFAULT_QUERY_SIZE];\r
+ sqlite3_stmt *stmt = NULL;\r
+\r
+ if(_item == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ if(_item->media_type != MEDIA_CONTENT_TYPE_AUDIO)\r
+ {\r
+ LOGE("[%s] the type of media is not an audio.",__func__);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ \r
+ memset(select_query,0x00,sizeof(select_query)); \r
+\r
+ snprintf(select_query,sizeof(select_query), SELECT_AUDIO_FROM_MEDIA,_item->item_id);\r
+\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,NULL,NULL,NULL);\r
+\r
+\r
+ if( ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ \r
+ audio_meta_s* _audio = (audio_meta_s*)calloc(1,sizeof(audio_meta_s));\r
+ if(_audio == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ _audio->audio_id = strdup((const char *)sqlite3_column_text(stmt, 0));\r
+ _audio->genre = strdup((const char *)sqlite3_column_text(stmt, 1)); \r
+ _audio->album = strdup((const char *)sqlite3_column_text(stmt, 2));\r
+ _audio->artist= strdup((const char *)sqlite3_column_text(stmt, 3));\r
+ _audio->author= strdup((const char *)sqlite3_column_text(stmt, 4));\r
+ _audio->year= strdup((const char *)sqlite3_column_text(stmt, 5));\r
+ _audio->copyright= strdup((const char *)sqlite3_column_text(stmt, 6));\r
+ _audio->description= strdup((const char *)sqlite3_column_text(stmt, 7));\r
+ _audio->format= strdup((const char *)sqlite3_column_text(stmt, 8));\r
+ _audio->bitrate = (int)sqlite3_column_int(stmt,9);\r
+ _audio->track_num = (int)sqlite3_column_int(stmt,10);\r
+ _audio->duration = (int)sqlite3_column_int(stmt,11);\r
+ _audio->rating = (int)sqlite3_column_int(stmt,12);\r
+ _audio->count_played = (int)sqlite3_column_int(stmt,13);\r
+ _audio->time_played = (int)sqlite3_column_int(stmt,14);\r
+ _audio->time_added = (int)sqlite3_column_int(stmt,15);\r
+ _audio->size = (int)sqlite3_column_int(stmt,16);\r
+ _audio->category = (int)sqlite3_column_int(stmt,17);\r
+ }\r
+ *audio = (audio_meta_h)_audio;\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+ \r
+\r
+ return ret;\r
+}\r
+\r
+\r
+\r
+int media_info_foreach_tag_from_db(media_info_h item, media_tag_cb callback, void *user_data)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ char select_query[DEFAULT_QUERY_SIZE];\r
+ sqlite3_stmt *stmt = NULL;\r
+\r
+ media_info_s* _item = (media_info_s*)item; \r
+ \r
+ if(_item == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ if(callback == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ snprintf(select_query,sizeof(select_query),SELECT_TAG_LIST_FROM_MEDIA,_item->item_id);\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,NULL,NULL,NULL);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ media_tag_s* _tag = (media_tag_s*)calloc(1,sizeof(media_tag_s));\r
+\r
+ if(_tag == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+\r
+ _tag->tag_id = (int)sqlite3_column_int(stmt,0);\r
+ _tag->name = strdup((const char *)sqlite3_column_text(stmt, 1)); \r
+ if(callback((media_tag_h)_tag,user_data) == false)\r
+ {\r
+ media_tag_destroy((media_tag_h) _tag);\r
+ break;\r
+ }\r
+ media_tag_destroy((media_tag_h) _tag);\r
+ \r
+ }\r
+\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ return ret;\r
+\r
+}\r
+\r
+void _content_item_get_detail(sqlite3_stmt* stmt, media_info_h item)\r
+{\r
+ //item_id, file_path, display_name, thumbnail, date_modified,content_type, valid\r
+ media_info_s* _item = (media_info_s*)item;\r
+ _item->item_id = strdup((const char *)sqlite3_column_text(stmt, 0));\r
+ _item->file_path= strdup((const char *)sqlite3_column_text(stmt, 1));\r
+ _item->display_name=strdup((const char *)sqlite3_column_text(stmt, 2));\r
+ _item->thumbnail=strdup((const char *)sqlite3_column_text(stmt, 3)); \r
+ _item->date_modified = (int)sqlite3_column_int(stmt,4);\r
+ _item->media_type = (int)sqlite3_column_int(stmt,5);\r
+ _item->media_type = _item->media_type==3?4:_item->media_type;\r
+ _item->favorite = (int)sqlite3_column_int(stmt,6);\r
+}\r
+\r
+int _content_get_storage_type(const char* full_path)\r
+{\r
+ if (full_path != NULL) { \r
+ if (strncmp(full_path, MEDIA_CONTENT_PATH_PHONE , strlen(MEDIA_CONTENT_PATH_PHONE )) == 0) \r
+ {\r
+ return MEDIA_CONTENT_STORAGE_INTERNAL;\r
+ }\r
+ else if (strncmp(full_path, MEDIA_CONTENT_PATH_MMC , strlen(MEDIA_CONTENT_PATH_MMC )) == 0) \r
+ {\r
+ return MEDIA_CONTENT_STORAGE_EXTERNAL;\r
+ }\r
+ }\r
+ \r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+}\r
+\r
+\r
+#define CONTENT_TYPE_NUM 4\r
+#define FEX_CATEGORY_UNKNOWN 0x00000000 /**< Default */\r
+#define FEX_CATEGORY_ETC 0x00000001 /**< ETC category */\r
+#define FEX_CATEGORY_IMAGE 0x00000002 /**< Image category */\r
+#define FEX_CATEGORY_VIDEO 0x00000004 /**< Video category */\r
+#define FEX_CATEGORY_MUSIC 0x00000008 /**< Music category */\r
+#define FEX_CATEGORY_SOUND 0x00000010 /**< Sound category */\r
+#define FEX_CATEGORY_DRM 0x00000020 /**< DRM category */\r
+#define SOUND_MIME_NUM 1\r
+#define MINE_LENGTH 30\r
+#define MUSIC_MIME_NUM 12\r
+\r
+\r
+typedef struct\r
+{\r
+ char content_type[15];\r
+ int category_by_mime;\r
+}fex_content_table_t;\r
+\r
+static const fex_content_table_t content_category[CONTENT_TYPE_NUM] = {\r
+ {"audio", FEX_CATEGORY_SOUND},\r
+ {"image", FEX_CATEGORY_IMAGE},\r
+ {"video", FEX_CATEGORY_VIDEO},\r
+ {"application", FEX_CATEGORY_ETC},\r
+};\r
+\r
+static const char sound_mime_table[SOUND_MIME_NUM][MINE_LENGTH] = {\r
+ "x-smaf",\r
+};\r
+static const char music_mime_table[MUSIC_MIME_NUM][MINE_LENGTH] = {\r
+ "ac3",\r
+ "mp2",\r
+ "mpeg",\r
+ "ogg",\r
+ "vnd.rn-realaudio",\r
+ "x-ape",\r
+ "x-flac",\r
+ "x-flac+ogg",\r
+ "x-matroska",\r
+ "x-ms-asx",\r
+ "x-ms-wma",\r
+ "x-vorbis+ogg",\r
+};\r
+\r
+#define FMS_DRM_CONTENT_TYPE_LENGTH 100\r
+\r
+int _content_get_audio_category(const char* file_full_path,int* category)\r
+{\r
+ int i = 0;\r
+ char mimetype[255] = {0,};\r
+ int result = 0;\r
+ bool is_drm = false;\r
+ drm_content_info_t contentInfo = {0};\r
+\r
+ if (file_full_path == NULL)\r
+ return FEX_CATEGORY_UNKNOWN;\r
+\r
+\r
+ if (drm_svc_is_drm_file(file_full_path) == DRM_TRUE)\r
+ {\r
+\r
+ // 2008.8.13 han. In this case, use drm_svc_get_content_info api.\r
+ result = drm_svc_get_content_info(file_full_path, &contentInfo);\r
+ if (result != DRM_RESULT_SUCCESS)\r
+ {\r
+ *category = FEX_CATEGORY_UNKNOWN;\r
+ }\r
+\r
+ strncpy(mimetype, contentInfo.contentType, strlen(contentInfo.contentType)+1);\r
+ *category = *category | FEX_CATEGORY_DRM;\r
+ is_drm = true;\r
+ }\r
+ else\r
+ {\r
+ result = aul_get_mime_from_file(file_full_path, mimetype, sizeof(mimetype));\r
+ if(result < 0)\r
+ {\r
+ *category = FEX_CATEGORY_UNKNOWN;\r
+ }\r
+\r
+ }\r
+\r
+ for(i = 0; i < CONTENT_TYPE_NUM; i ++)\r
+ {\r
+ if (strstr(mimetype, content_category[i].content_type) != NULL)\r
+ {\r
+ *category = (*category | content_category[i].category_by_mime);\r
+ break;\r
+ }\r
+ }\r
+ if (*category & FEX_CATEGORY_ETC)\r
+ {\r
+ int prefix_len = strlen(content_category[0].content_type);\r
+\r
+ for(i = 0; i < SOUND_MIME_NUM; i ++)\r
+ {\r
+ if (strstr(mimetype+prefix_len, sound_mime_table[i]) != NULL)\r
+ {\r
+ *category = FEX_CATEGORY_SOUND;\r
+ break;\r
+ }\r
+ }\r
+\r
+ if(is_drm)\r
+ *category = *category | FEX_CATEGORY_DRM;;\r
+ }\r
+\r
+ if (!(*category & FEX_CATEGORY_SOUND))\r
+ {\r
+ return result;\r
+ }\r
+ else\r
+ {\r
+ if(is_drm) //if sound file is DRM, it is always music file.\r
+ {\r
+ *category = FEX_CATEGORY_MUSIC;\r
+ *category = *category | FEX_CATEGORY_DRM;\r
+ }\r
+ else //check music file in soun files.\r
+ {\r
+ int prefix_len = strlen(content_category[0].content_type);\r
+\r
+ for(i = 0; i < MUSIC_MIME_NUM; i ++)\r
+ {\r
+ if (strstr(mimetype+prefix_len, music_mime_table[i]) != NULL)\r
+ {\r
+ *category = FEX_CATEGORY_MUSIC;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return result;\r
+\r
+\r
+\r
+}\r
+\r
--- /dev/null
+/*\r
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License. \r
+*/\r
+\r
+\r
+#include <media_content.h>\r
+#include <media_info_private.h>\r
+#include <audio-svc.h>\r
+#include <audio-svc-error.h>\r
+#include <audio-svc-types.h>\r
+#include <media-info-error.h>\r
+#include <media-svc-error.h>\r
+#include <minfo-types.h>\r
+#include <minfo-api.h>\r
+#include <dlog.h>\r
+\r
+#ifdef LOG_TAG\r
+#undef LOG_TAG\r
+#endif\r
+\r
+#define LOG_TAG "TIZEN_N_MEDIACONTENT"\r
+\r
+\r
+\r
+int media_tag_foreach_tag_from_db(media_tag_filter_h filter, media_tag_cb callback,void* user_data)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ \r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char search_query[DEFAULT_QUERY_SIZE];\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+ char order_query[MIN_QUERY_SIZE];\r
+\r
+ sqlite3_stmt *stmt = NULL;\r
+\r
+\r
+ media_tag_filter_s* _filter = NULL;\r
+ \r
+\r
+ if(callback == NULL )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+\r
+ memset(limit_query,0x00,sizeof(limit_query)); \r
+ memset(search_query,0x00,sizeof(search_query)); \r
+ memset(select_query,0x00,sizeof(select_query)); \r
+ memset(order_query,0x00,sizeof(order_query)); \r
+ \r
+\r
+ if(filter != NULL)\r
+ _filter = (media_tag_filter_s*)filter;\r
+ else\r
+ {\r
+ media_tag_filter_create((media_tag_filter_h*)&_filter);\r
+ }\r
+\r
+\r
+ snprintf(select_query,sizeof(select_query),"%s", SELECT_TAG_LIST);\r
+\r
+\r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and tag_name like '%%%s%%'", _filter->keyword);\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_tag_filter_s*)filter != _filter)\r
+ media_tag_filter_destroy((media_tag_filter_h)_filter);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ }\r
+\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_TAG_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_TAG_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ID);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_ID,QUERY_KEYWORD_DESC); \r
+ }\r
+\r
+\r
+ if((media_tag_filter_s*)filter != _filter)\r
+ media_tag_filter_destroy((media_tag_filter_h)_filter);\r
+ \r
+ if(select_query != NULL)\r
+ {\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+ }\r
+\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ media_tag_s* _tag = (media_tag_s*)calloc(1,sizeof(media_tag_s));\r
+\r
+ if(_tag == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ \r
+ memset(_tag,0x00,sizeof(media_tag_s));\r
+ _tag->tag_id = (int)sqlite3_column_int(stmt,0);\r
+ _tag->name= strdup((const char *)sqlite3_column_text(stmt, 1));\r
+ if(callback((media_tag_h)_tag,user_data) == false)\r
+ {\r
+ media_tag_destroy((media_tag_h)_tag);\r
+ break;\r
+ }\r
+ media_tag_destroy((media_tag_h)_tag);\r
+ \r
+ }\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+ \r
+ return ret;\r
+}\r
+\r
+\r
+\r
+int media_tag_insert_to_db(const char* tag_name,media_tag_h* tag)\r
+{\r
+ \r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ \r
+ if(tag_name == NULL || strlen(tag_name) == 0)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ media_tag_s *_tag = (media_tag_s*)calloc(1,sizeof(media_tag_s));\r
+\r
+ _tag->name = strdup(tag_name);\r
+\r
+ if(_tag->name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ ret = minfo_add_tag(NULL,tag_name);\r
+\r
+ if(ret == MB_SVC_ERROR_NONE)\r
+ {\r
+ *tag = (media_tag_h)_tag;\r
+ }\r
+\r
+ return _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+\r
+}\r
+\r
+int media_tag_delete_from_db(media_tag_h tag)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ if(tag == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ \r
+ media_tag_s* _tag = (media_tag_s*)tag;\r
+ \r
+ \r
+ ret = minfo_delete_tag(NULL, _tag->name);\r
+ \r
+ return _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+\r
+}\r
+\r
+int media_tag_add_media_to_db(media_tag_h tag,media_info_h media)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+\r
+ media_tag_s* _tag = (media_tag_s*)tag;\r
+ media_info_s* _item = (media_info_s*)media;\r
+ \r
+ if(_tag == NULL || _item == NULL )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ if(_item->media_type == MEDIA_CONTENT_TYPE_AUDIO)\r
+ {\r
+ LOGE("[%s]_NOT_SUPPORTED_AUDIO(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_NOT_SUPPORTED_AUDIO);\r
+\r
+ return MEDIA_CONTENT_ERROR_NOT_SUPPORTED_AUDIO;\r
+ }\r
+ \r
+ if(_tag->name == NULL || strlen(_tag->name) == 0)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER; \r
+ }\r
+ \r
+ ret = minfo_add_tag(_item->item_id,_tag->name);\r
+\r
+ return _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+\r
+}\r
+\r
+int media_tag_remove_media_from_db(media_tag_h tag,media_info_h media)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ char *query_string = NULL;\r
+ \r
+ media_tag_s* _tag = (media_tag_s*)tag;\r
+ media_info_s* _item = (media_info_s*)media; \r
+ if(_tag == NULL || _item == NULL )\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ if(_item->media_type == MEDIA_CONTENT_TYPE_AUDIO)\r
+ {\r
+ LOGE("[%s]_NOT_SUPPORTED_AUDIO(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_NOT_SUPPORTED_AUDIO);\r
+ return MEDIA_CONTENT_ERROR_NOT_SUPPORTED_AUDIO;\r
+ }\r
+\r
+\r
+ if(_tag->name == NULL || strlen(_tag->name) == 0)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ query_string = sqlite3_mprintf("DELETE FROM visual_tag_map WHERE media_id=%s and tag_name=%d",\r
+ _item->item_id, _tag->name);\r
+\r
+ \r
+ _content_query_sql(query_string);\r
+\r
+ sqlite3_free(query_string);\r
+\r
+ return _content_error_capi(MEDIA_CONTENT_TYPE,ret); \r
+\r
+}\r
+\r
+\r
+int media_tag_destroy(media_tag_h tag)\r
+{\r
+ int ret;\r
+ media_tag_s* _tag = (media_tag_s*)tag; \r
+ if(_tag) \r
+ {\r
+ if(_tag->name) \r
+ {\r
+ free(_tag->name);\r
+ } \r
+\r
+ free(_tag);\r
+ ret = MEDIA_CONTENT_ERROR_NONE;\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ return ret;\r
+\r
+}\r
+int media_tag_clone(media_tag_h* dst, media_tag_h src)\r
+{\r
+ int ret;\r
+ media_tag_s* _src = (media_tag_s*)src; \r
+ media_tag_s* _dst = NULL;\r
+\r
+\r
+ if((_src != NULL))\r
+ {\r
+ _dst = (media_tag_s*)calloc(1,sizeof(media_tag_s)); \r
+ \r
+ if(_dst == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ \r
+ _dst->tag_id = _src->tag_id;\r
+ \r
+ if((_src->name != NULL) && (strlen(_src->name) > 0))\r
+ {\r
+ _dst->name = strdup(_src->name);\r
+ if(_dst->name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ free(_dst);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ *dst = (media_tag_h)_dst;\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+ \r
+ return ret; \r
+}\r
+\r
+int media_tag_get_name(media_tag_h tag, char** name)\r
+{\r
+ int ret;\r
+ media_tag_s* _tag = (media_tag_s*)tag; \r
+ if(_tag) \r
+ {\r
+ if((_tag->name != NULL) && (strlen(_tag->name) > 0))\r
+ {\r
+ *name = strdup(_tag->name);\r
+ if(*name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ *name = NULL;\r
+ }\r
+ ret = MEDIA_CONTENT_ERROR_NONE; \r
+\r
+ }\r
+ else \r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ } \r
+\r
+ return ret;\r
+\r
+}\r
+int media_tag_update_name_to_db(media_tag_h tag, const char* name)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+\r
+ media_tag_s* _tag = (media_tag_s*)tag;\r
+ if(_tag == NULL || name == NULL || strlen(name) <= 0)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ ret = minfo_rename_tag(_tag->name,name);\r
+\r
+ if(ret == MB_SVC_ERROR_NONE)\r
+ {\r
+ free(_tag->name);\r
+ _tag->name = strdup(name);\r
+ if(_tag->name == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
+ }\r
+ }\r
+ \r
+ return _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+}\r
+\r
+int media_tag_foreach_media_from_db(media_tag_h tag,media_info_filter_h filter, media_info_cb callback,void* user_data)\r
+{\r
+ int ret = MEDIA_CONTENT_ERROR_NONE;\r
+ char* media_id = NULL;\r
+ Mitem *mitem = NULL;\r
+ char select_query[DEFAULT_QUERY_SIZE]; \r
+ char search_query[MAX_KEYWORD_SIZE];\r
+ char limit_query[MIN_QUERY_SIZE];\r
+ char order_query[MIN_QUERY_SIZE];\r
+\r
+ media_tag_filter_s* _filter = NULL;\r
+ \r
+ sqlite3_stmt *stmt = NULL;\r
+\r
+ memset(select_query,0x00,sizeof(select_query)); \r
+ memset(search_query,0x00,sizeof(search_query)); \r
+ memset(limit_query,0x00,sizeof(limit_query)); \r
+ memset(order_query,0x00,sizeof(order_query)); \r
+\r
+ media_tag_s* _tag = (media_tag_s*)tag; \r
+ \r
+ if(_tag == NULL || callback == NULL)\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ \r
+ if(filter != NULL)\r
+ _filter = (media_tag_filter_s*)filter;\r
+ else\r
+ {\r
+ media_tag_filter_create((media_tag_filter_h*)&_filter);\r
+ }\r
+\r
+ \r
+ snprintf(select_query,sizeof(select_query),SELECT_MEDIA_FROM_TAG,_tag->name);\r
+\r
+\r
+ if((_filter->keyword != NULL) && strlen(_filter->keyword) > 0)\r
+ {\r
+ if(strlen(_filter->keyword) < sizeof(search_query))\r
+ {\r
+ snprintf(search_query,sizeof(search_query)," and display_name like '%%%s%%'", _filter->keyword);\r
+ }\r
+ else\r
+ {\r
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);\r
+ if((media_tag_filter_s*)filter != _filter)\r
+ media_tag_filter_destroy((media_tag_filter_h)_filter); \r
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ search_query[0] = ' ';\r
+ }\r
+\r
+\r
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);\r
+\r
+ \r
+\r
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_DISPLAY_NAME);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_DISPLAY_NAME,QUERY_KEYWORD_DESC);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE);\r
+ }\r
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
+ {\r
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE,QUERY_KEYWORD_DESC); \r
+ }\r
+\r
+\r
+ if((media_tag_filter_s*)filter != _filter)\r
+ media_tag_filter_destroy((media_tag_filter_h)_filter);\r
+\r
+ ret = _content_query_prepare(&stmt,select_query,NULL,search_query,limit_query,order_query);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ return ret;\r
+\r
+\r
+ while( sqlite3_step(stmt) == SQLITE_ROW)\r
+ {\r
+ media_info_s* _item = (media_info_s*)calloc(1,sizeof(media_info_s));\r
+\r
+ if(_item == NULL)\r
+ {\r
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);\r
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; \r
+ }\r
+ memset(_item,0x00,sizeof(media_info_s));\r
+ media_id = (char*)sqlite3_column_text(stmt, 1);\r
+ ret = minfo_get_item_by_id(media_id, &mitem);\r
+\r
+ if(ret < 0)\r
+ {\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+ media_info_destroy((media_info_h)_item);\r
+ return _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+ }\r
+ _item->item_id = strdup(media_id);\r
+ _item->file_path = strdup(mitem->file_url);\r
+ _item->display_name = strdup(mitem->display_name);\r
+ _item->thumbnail = strdup(mitem->thumb_url);\r
+ _item->date_modified = mitem->mtime;\r
+ _item->media_type = mitem->type; \r
+ if(callback((media_info_h)_item,user_data) == false)\r
+ {\r
+ media_info_destroy((media_info_h)_item);\r
+ break;\r
+ }\r
+ media_info_destroy((media_info_h)_item);\r
+ }\r
+ \r
+ if(mitem != NULL)\r
+ minfo_destroy_mtype_item(mitem);\r
+ if(stmt != NULL)\r
+ {\r
+ sqlite3_finalize(stmt);\r
+ }\r
+\r
+ return ret;\r
+}\r
+\r
--- /dev/null
+/*
+* Copyright (c) 2011 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 <media_content.h>
+#include <media_info_private.h>
+#include <media-info-error.h>
+#include <media-svc-error.h>
+#include <minfo-types.h>
+#include <minfo-api.h>
+#include <media-info.h>
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "TIZEN_N_MEDIACONTENT"
+
+
+int video_meta_destroy(video_meta_h video)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video)
+ {
+ if(_video->video_id)
+ {
+ free(_video->video_id);
+ }
+
+ if(_video->album)
+ {
+ free(_video->album);
+ }
+ if(_video->artist)
+ {
+ free(_video->artist);
+ }
+ if(_video->title)
+ {
+ free(_video->title);
+ }
+ if(_video->thumbnail)
+ {
+ free(_video->thumbnail);
+ }
+
+ free(_video);
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+ return ret;
+
+}
+
+#define DUPLICATE_STRING(destination, src) \
+{ \
+ char* tmp = src; \
+ if(tmp != NULL && strlen(tmp) > 0) \
+ { \
+ char* new_str = strdup(tmp); \
+ destination = new_str; \
+ } \
+ else \
+ { \
+ destination = NULL; \
+ } \
+}
+
+#define DUPLICATE_FIELD(field) DUPLICATE_STRING(_dst->field, _src->field)
+
+
+
+
+int video_meta_clone( video_meta_h* dst, video_meta_h src)
+{
+ int ret;
+ video_meta_s* _src;
+ video_meta_s* _dst;
+
+ if((src != NULL))
+ {
+ _src = (video_meta_s*)src;
+ _dst = (video_meta_s*)calloc(1,sizeof(video_meta_s));
+ if(_dst == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+
+ _dst->video_id = strdup(_src->video_id);
+ _dst->longitude = _src->longitude;
+ _dst->latitude= _src->latitude;
+ _dst->time_played = _src->time_played;
+ _dst->duration = _src->duration;
+ _dst->width = _src->width;
+ _dst->height = _src->height;
+ _dst->orientation = _src->orientation;
+ _dst->date_taken = _src->date_taken;
+
+
+ if(_src->album != NULL)
+ {
+ _dst->album = (char*)strdup(_src->album);
+ if(_dst->album == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ video_meta_destroy((video_meta_h)_dst);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ if(_src->artist != NULL)
+ {
+ _dst->artist = (char*)strdup(_src->artist);
+ if(_dst->artist == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ video_meta_destroy((video_meta_h)_dst);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ if(_src->title != NULL)
+ {
+ _dst->title = (char*)strdup(_src->title);
+ if(_dst->title == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ video_meta_destroy((video_meta_h)_dst);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ if(_src->description != NULL)
+ {
+ _dst->description = (char*)strdup(_src->description);
+ if(_dst->description == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ video_meta_destroy((video_meta_h)_dst);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ if(_src->thumbnail != NULL)
+ {
+ _dst->thumbnail = (char*)strdup(_src->thumbnail);
+ if(_dst->thumbnail == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ video_meta_destroy((video_meta_h)_dst);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ *dst =(video_meta_h)_dst;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+
+}
+
+
+int video_meta_get_longitude(video_meta_h video, double* longitude)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video && longitude)
+ {
+ *longitude = _video->longitude;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+int video_meta_get_latitude(video_meta_h video, double* latitude)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video && latitude)
+ {
+ *latitude = _video->latitude;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+
+int video_meta_get_album(video_meta_h video, char** album)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video)
+ {
+ if((_video->album != NULL) && (strlen(_video->album) > 0))
+ {
+ char* new_string = strdup(_video->album);
+ if(NULL == new_string)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ *album = new_string;
+ }
+ else
+ {
+ *album = NULL;
+ }
+ ret = MEDIA_CONTENT_ERROR_NONE;
+
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int video_meta_get_artist(video_meta_h video, char** artist)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video)
+ {
+ if((_video->artist != NULL) && (strlen(_video->artist) > 0))
+ {
+ char* new_string = strdup(_video->artist);
+ if(NULL == new_string)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ *artist = new_string;
+ }
+ else
+ {
+ *artist = NULL;
+ }
+ ret = MEDIA_CONTENT_ERROR_NONE;
+
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int video_meta_get_title(video_meta_h video, char** title)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video)
+ {
+ if((_video->title != NULL) && (strlen(_video->title) > 0))
+ {
+ char* new_string = strdup(_video->title);
+ if(NULL == new_string)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ *title = new_string;
+ }
+ else
+ {
+ *title = NULL;
+ }
+ ret = MEDIA_CONTENT_ERROR_NONE;
+
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int video_meta_get_description(video_meta_h video, char** description)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video)
+ {
+ if((_video->description != NULL) && (strlen(_video->description) > 0))
+ {
+ char* new_string = strdup(_video->description);
+ if(NULL == new_string)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ *description = new_string;
+ }
+ else
+ {
+ *description = NULL;
+ }
+ ret = MEDIA_CONTENT_ERROR_NONE;
+
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+
+
+int video_meta_get_time_played(video_meta_h video, int* time_played)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video)
+ {
+ *time_played = _video->time_played;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int video_meta_get_duration(video_meta_h video, int* duration)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video && duration)
+ {
+ *duration = _video->duration;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int video_meta_get_width(video_meta_h video, int* width)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video && width)
+ {
+ *width = _video->width;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int video_meta_get_height(video_meta_h video, int* height)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video && height)
+ {
+ *height = _video->height;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int video_meta_get_orientation(video_meta_h video, media_content_orientation_e* orientation)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video && orientation)
+ {
+ *orientation = _video->orientation;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int video_meta_get_date_taken(video_meta_h video, time_t* date_taken)
+{
+ int ret;
+ video_meta_s* _video = (video_meta_s*)video;
+ if(_video && date_taken)
+ {
+ *date_taken = _video->date_taken;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+
+int video_meta_update_time_played_to_db(video_meta_h video, int time_played)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ video_meta_s* _video = (video_meta_s*)video;
+
+ if(_video != NULL )
+ {
+ ret = minfo_update_video_meta_info_int(_video->video_id,MINFO_VIDEO_META_BOOKMARK_LAST_PLAYED,time_played);
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+
+ return ret;
+
+}
+
+
+
+int video_bookmark_foreach_bookmark_from_db(video_meta_h video,video_bookmark_filter_h filter, video_bookmark_cb callback,void* user_data)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ char limit_query[MIN_QUERY_SIZE];
+ char order_query[MIN_QUERY_SIZE];
+ char select_query[DEFAULT_QUERY_SIZE];
+
+ sqlite3_stmt *stmt = NULL;
+
+
+ video_bookmark_filter_s* _filter = NULL;
+
+ video_meta_s* _video = (video_meta_s*)video;
+
+
+ if(_video == NULL || callback == NULL)
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ memset(order_query,0x00,sizeof(order_query));
+ memset(limit_query,0x00,sizeof(limit_query));
+ memset(select_query,0x00,sizeof(select_query));
+
+
+ if(filter != NULL)
+ _filter = (video_bookmark_filter_s*)filter;
+ else
+ {
+ video_bookmark_filter_create((video_bookmark_filter_h*)&_filter);
+ }
+
+
+ snprintf(select_query,sizeof(select_query), SELECT_BOOKMARK_FROM_VIDEO,_video->video_id);
+
+ snprintf(limit_query,sizeof(limit_query),"%s %d,%d",QUERY_KEYWORD_LIMIT,_filter->offset,_filter->count);
+
+
+ if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_ASC)
+ {
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_THUMBNAIL_PATH);
+ }
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_NAME_DESC)
+ {
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_THUMBNAIL_PATH,QUERY_KEYWORD_DESC);
+ }
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)
+ {
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_MARKED_TIME);
+ }
+ else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)
+ {
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FIELD_MARKED_TIME,QUERY_KEYWORD_DESC);
+ }
+
+ if((video_bookmark_filter_s*)filter != _filter)
+ video_bookmark_filter_destroy((video_bookmark_filter_h)_filter);
+
+ ret = _content_query_prepare(&stmt,select_query,NULL,NULL,limit_query,order_query);
+
+ if(ret != MEDIA_CONTENT_ERROR_NONE)
+ return ret;
+
+
+ while( sqlite3_step(stmt) == SQLITE_ROW)
+ {
+ video_bookmark_s* bookmark = (video_bookmark_s*)calloc(1,sizeof(video_bookmark_s));
+ if(bookmark == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+
+ bookmark->bookmark_id= (int)sqlite3_column_int(stmt,0);
+ bookmark->video_id= strdup((const char *)sqlite3_column_text(stmt, 1));
+ bookmark->time_marked = (int)sqlite3_column_int(stmt,2);
+ bookmark->thumbnail= strdup((const char *)sqlite3_column_text(stmt, 3));
+ if(callback((video_bookmark_h)bookmark,user_data) == false)
+ {
+ video_bookmark_destroy((video_bookmark_h)bookmark);
+ break;
+ }
+ video_bookmark_destroy((video_bookmark_h)bookmark);
+ }
+ if(stmt != NULL)
+ {
+ sqlite3_finalize(stmt);
+ }
+
+ return ret;
+
+
+
+}
+
+
+int video_bookmark_destroy(video_bookmark_h bookmark)
+{
+ int ret;
+ video_bookmark_s* _bookmark = (video_bookmark_s*)bookmark;
+ if(_bookmark)
+ {
+ if(_bookmark->video_id!= NULL)
+ free(_bookmark->video_id);
+ if(_bookmark->thumbnail != NULL)
+ free(_bookmark->thumbnail);
+ free(_bookmark);
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+ return ret;
+
+}
+int video_bookmark_clone(video_bookmark_h* dst, video_bookmark_h src)
+{
+ int ret;
+
+ if((src != NULL))
+ {
+ video_bookmark_s* _src = (video_bookmark_s*)src;
+ video_bookmark_s* _dst = (video_bookmark_s*)calloc(1,sizeof(video_bookmark_s));
+ if (NULL == _dst)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ _dst->bookmark_id = _src->bookmark_id;
+ _dst->video_id = strdup(_src->video_id);
+ _dst->time_marked= _src->time_marked;
+
+ if(_src->thumbnail != NULL)
+ {
+ _dst->thumbnail = (char*)strdup(_src->thumbnail);
+ if(_dst->thumbnail == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ video_bookmark_destroy((video_bookmark_h)_dst);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ *dst = (video_bookmark_h)_dst;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+
+int video_bookmark_get_time_marked(video_bookmark_h bookmark, time_t* time_marked)
+{
+ int ret;
+ video_bookmark_s* _bookmark = (video_bookmark_s*)bookmark;
+ if(_bookmark )
+ {
+ *time_marked = _bookmark->time_marked;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int video_bookmark_get_thumbnail_path(video_bookmark_h bookmark, char** thumbnail)
+{
+ int ret;
+ video_bookmark_s* _bookmark = (video_bookmark_s*)bookmark;
+ if(_bookmark)
+ {
+ if((_bookmark->thumbnail != NULL) && (strlen(_bookmark->thumbnail) > 0))
+ {
+ *thumbnail = strdup(_bookmark->thumbnail);
+ if (NULL == *thumbnail)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else
+ {
+ *thumbnail = NULL;
+ }
+ ret = MEDIA_CONTENT_ERROR_NONE;
+
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+
+
+
+
+int video_bookmark_insert_to_db(video_meta_h video, time_t time, const char* thumbnail_path)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ video_meta_s* _video = (video_meta_s*)video;
+
+ if(_video != NULL)
+ {
+ ret = minfo_add_bookmark(_video->video_id,time,thumbnail_path);
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+int video_bookmark_delete_from_db(video_bookmark_h bookmark)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ video_bookmark_s* _bookmark = (video_bookmark_s*)bookmark;
+
+ if( _bookmark != NULL)
+ {
+ ret = minfo_delete_bookmark(_bookmark->bookmark_id);
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
+ }
+ else
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+
+}
+
+
+
--- /dev/null
+SET(fw_test "${fw_name}-test")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_test} REQUIRED glib-2.0)
+
+FOREACH(flag ${${fw_test}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
+
+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})
+ENDFOREACH()
--- /dev/null
+/*\r
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License. \r
+*/\r
+\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <media_content.h>\r
+#include <dlog.h>\r
+#include <pthread.h>\r
+\r
+#ifdef LOG_TAG\r
+#undef LOG_TAG\r
+#endif\r
+#define LOG_TAG "TIZEN_N_MEDIACONTENT"\r
+\r
+\r
+int test_content_connect_database()\r
+{\r
+ int ret;\r
+\r
+ LOGI("\n============DB Connection Test============\n\n");\r
+\r
+ ret = media_content_connect();\r
+\r
+ if(ret == MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGI("connection is success\n\n");\r
+ }\r
+ else\r
+ LOGE("connection is failed\n\n");\r
+\r
+ return ret;\r
+}\r
+\r
+void test_content_disconnect_database()\r
+{\r
+\r
+ int ret;\r
+ LOGI("\n============DB Disconnection Test============\n\n");\r
+\r
+ ret = media_content_disconnect();\r
+\r
+ if(ret == MEDIA_CONTENT_ERROR_NONE)\r
+ LOGI("disconnection is success\n\n");\r
+ else\r
+ LOGE("disconnection is failed\n\n");\r
+\r
+}\r
+\r
+bool capi_media_list_cb(media_info_h item, void *user_data)\r
+{\r
+ int ret = true; \r
+\r
+ char* file_path = NULL;\r
+\r
+ char* name = NULL;\r
+ char* thumbnail_path = NULL;\r
+ time_t date_modified;\r
+ int type;\r
+ \r
+ if(item != NULL)\r
+ {\r
+ if(media_info_get_file_path(item,&file_path) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_info_get_file_path is failed\n");\r
+ ret = false;\r
+ }\r
+ \r
+ if(media_info_get_display_name(item,&name) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_info_get_display_name is failed\n");\r
+ ret = false;\r
+ }\r
+ if(media_info_get_thumbnail_path(item,&thumbnail_path) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_info_get_thumbnail_path is failed\n");\r
+ ret = false;\r
+ }\r
+ if(media_info_get_date_modified(item,&date_modified) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_info_get_date_modified is failed\n");\r
+ ret = false;\r
+ }\r
+ if(media_info_get_media_type(item,&type) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_info_get_content_type is failed\n");\r
+ ret = false;\r
+ } \r
+ LOGI("[%d] name : %s , file path : %s , date : %s , thumbnail path : %s \n"\r
+ ,type,name,file_path,ctime(&date_modified),thumbnail_path);\r
+\r
+\r
+\r
+\r
+ if(type == MEDIA_CONTENT_TYPE_IMAGE)\r
+ {\r
+ image_meta_h image;\r
+\r
+ double lati;\r
+ double longi;\r
+ \r
+ if(media_info_get_image_from_db(item,&image) == MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ image_meta_get_latitude(image,&lati);\r
+ image_meta_get_longitude(image,&longi);\r
+ //printf("[image] latitude : %f , longitude : %f \n",lati, longi); \r
+\r
+ image_meta_destroy(image);\r
+ }\r
+ else\r
+ LOGE("[image_error] \n");\r
+\r
+ }\r
+ if(type == MEDIA_CONTENT_TYPE_VIDEO)\r
+ {\r
+ video_meta_h video;\r
+ double lati;\r
+ double longi;\r
+\r
+ if(media_info_get_video_from_db(item,&video) == MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ video_meta_get_latitude(video,&lati);\r
+ video_meta_get_longitude(video,&longi); \r
+ video_meta_destroy(video);\r
+ }\r
+ else\r
+ LOGE("[video_error] \n");\r
+\r
+ } \r
+ if(type == MEDIA_CONTENT_TYPE_AUDIO)\r
+ {\r
+ audio_meta_h audio;\r
+\r
+ if(media_info_get_audio_from_db(item,&audio) == MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ \r
+ audio_meta_destroy(audio);\r
+ }\r
+ else\r
+ LOGE("[audio_error] \n");\r
+\r
+ } \r
+\r
+\r
+ if(file_path != NULL)\r
+ free(file_path);\r
+ if(name != NULL)\r
+ free(name);\r
+ if(thumbnail_path != NULL)\r
+ free(thumbnail_path);\r
+ \r
+ }\r\r
+\r
+ return ret;\r
+}\r
+\r
+bool capi_folder_list_cb(media_folder_h folder, void* user_data)\r
+{\r
+ int item_count;\r
+ char* folder_path;\r
+ char* folder_name;\r
+ media_content_storage_e storage_type;\r
+ bool ret;\r
+ media_folder_h* _folder = (media_folder_h*)user_data;\r
+ \r
+ if(folder != NULL)\r
+ {\r
+ media_folder_clone(_folder,folder);\r
+ \r
+ if(media_folder_get_path(folder,&folder_path) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_folder_get_path is failed\n");\r
+ ret = false;\r
+ } \r
+ if(media_folder_get_name(folder,&folder_name) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_folder_get_name is failed\n");\r
+ ret = false;\r
+ } \r
+ if(media_folder_get_storage_type(folder,&storage_type) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_folder_get_storage_type is failed\n");\r
+ ret = false;\r
+ } \r
+ if(media_folder_get_media_count_from_db(folder,MEDIA_CONTENT_TYPE_IMAGE|MEDIA_CONTENT_TYPE_VIDEO|MEDIA_CONTENT_TYPE_AUDIO,&item_count) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_folder_get_media_count_from_db is failed\n");\r
+ ret = false;\r
+ } \r
+ LOGI("[name : %s] media count : %d , storage type : %d, path : %s \n",\r
+ folder_name,item_count,storage_type,folder_path);\r
+\r
+ if(folder_path != NULL)\r
+ {\r
+ free(folder_path);\r
+ }\r
+ if(folder_name != NULL)\r
+ {\r
+ free(folder_name);\r
+ }\r
+\r
+ //media_folder_destroy(_folder);\r
+ ret = true;\r
+ }\r
+ else\r
+ {\r
+ ret = false;\r
+ }\r
+\r
+ return ret;\r
+}\r
+\r
+\r
+bool capi_audio_list_cb(audio_album_h album,void* user_data)\r
+{\r
+ int ret;\r
+ char* name = NULL;\r
+ \r
+ if(album != NULL)\r
+ {\r
+ if(audio_album_get_name(album,&name) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] audio_album_get_name is failed\n");\r
+ ret = false;\r
+ } \r
+\r
+ if(name != NULL)\r
+ {\r
+ LOGE("album is found : %s \n",name);\r
+ free(name);\r
+ }\r
+\r
+ \r
+ }\r
+ else\r
+ ret = false;\r
+\r
+ return ret;\r
+}\r
+ \r
+\r
+\r
+void test_folder_foreach_from_db()\r
+{\r
+ int ret;\r
+ media_folder_h folder;\r
+\r
+\r
+ //test.1 set the filter\r
+ media_folder_filter_h filter; // handle of filter\r
+ \r
+ if(media_folder_filter_create(&filter) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_folder_filter_create is failed\n");\r
+ return ;\r
+ }\r
+ //test.2 get the folder\r
+ ret = media_folder_foreach_folder_from_db(filter, capi_folder_list_cb,&folder);\r
+\r
+ //test.3 get the media list in first folder\r
+ media_info_filter_h m_filter = NULL;\r
+ if(media_info_filter_create(&m_filter) != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_info_filter_create is failed\n");\r
+ return ;\r
+ \r
+ }\r
+ media_info_filter_set_media_type(m_filter,MEDIA_CONTENT_TYPE_IMAGE);\r
+ media_info_filter_set_offset(m_filter,1,5);\r
+ media_info_filter_set_search_keyword(m_filter,MEDIA_INFO_SEARCH_BY_DISPLAY_NAME,"ph");\r
+ media_info_filter_set_order(m_filter,MEDIA_CONTENT_SORT_BY_NAME_DESC);\r
+\r
+ ret = media_folder_foreach_media_from_db(folder,m_filter, capi_media_list_cb,NULL);\r
+\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] media_folder_foreach_media_from_db is failed, error code : %d\n",ret);\r
+ }\r
+\r
+ media_folder_filter_destroy(filter);\r
+ media_info_filter_destroy(m_filter);\r
+ \r
+}\r\r
+\r
+\r
+void test_media_info_foreach_from_db()\r
+{\r
+ int ret;\r
+ LOGI("\n============Content get Media Test============\n\n");\r
+\r
+ //test4-1. get all items\r
+ media_info_filter_h filter;\r
+\r
+ \r
+ media_info_filter_create(&filter);\r
+\r
+ ret = media_info_foreach_media_from_db(filter, capi_media_list_cb,NULL);\r
+\r
+ if(ret == MEDIA_CONTENT_ERROR_NONE)\r
+ LOGI("media_info_foreach_media_from_db is success\n\n");\r
+ else\r
+ LOGE("media_info_foreach_media_from_db is failed\n\n");\r
+ \r
+ \r
+ media_info_filter_destroy(filter);\r
+}\r
+\r
+\r
+void test_audio_album_foreach_from_db()\r
+{\r
+ int ret;\r
+ media_audio_filter_h filter = NULL;\r
+ \r
+ media_audio_filter_create(&filter);\r
+\r
+ ret = audio_album_foreach_album_from_db(filter,capi_audio_list_cb,NULL);\r
+\r
+ if(ret == MEDIA_CONTENT_ERROR_NONE)\r
+ LOGI("audio_album_foreach_album_from_db is success\n\n");\r
+ else\r
+ LOGE("audio_album_foreach_album_from_db is failed\n\n"); \r
+\r
+\r
+ if(filter != NULL)\r
+ media_audio_filter_destroy(filter);\r
+ \r
+ \r
+}\r
+\r
+\r
+bool capi_find_media_cb(media_info_h item,void* user_data)\r
+{\r
+ media_info_h* _item = (media_info_h*)user_data;\r
+ if(item != NULL)\r
+ {\r
+ char* name = NULL;\r
+ media_info_get_display_name(item,&name);\r
+\r
+ LOGI("[media]display name : %s \n",name);\r
+\r
+ if(name != NULL)\r
+ free(name);\r
+ media_info_clone(_item,item);\r
+ }\r
+ return false;\r
+}\r
+\r
+bool capi_taginfo_cb(media_tag_h tag, void* user_data)\r
+{\r
+ char* tag_name;\r
+ media_tag_h* _tag = (media_tag_h*)user_data;\r
+ if(tag != NULL)\r
+ {\r
+ media_tag_get_name(tag,&tag_name);\r
+ LOGI("[tag name] : %s \n",tag_name);\r
+ media_tag_clone(_tag,tag);\r
+\r
+ if(tag_name != NULL)\r
+ free(tag_name);\r
+ }\r
+ return false;\r
+}\r
+\r
+\r
+void test_tag_operation()\r
+{\r
+\r
+ //test . insert tag information\r
+ //condition : item is needed to insert the tag, tag is not support for audio\r
+ media_tag_h tag = NULL;\r
+ media_info_h item = NULL;\r
+ media_info_filter_h media_filter = NULL;\r
+ media_info_filter_create(&media_filter);\r
+\r
+ //find the item which display_name is "1_photo.jpg"\r
+ media_info_foreach_media_from_db(media_filter,capi_find_media_cb,(void *)&item);\r
+ if(media_filter != NULL)\r
+ media_info_filter_destroy(media_filter);\r
+\r
+ if(item != NULL)\r
+ {\r
+ //insert tag \r
+ media_tag_insert_to_db("test_tag",&tag);\r
+ \r
+\r
+\r
+ //add the media to tag.\r
+ media_tag_add_media_to_db(tag,item);\r
+ \r
+\r
+ //delete the tag\r
+ if(tag != NULL)\r
+ { \r
+ media_tag_delete_from_db(tag);\r
+ media_tag_destroy(tag);\r
+\r
+ }\r
+\r
+ media_info_destroy(item);\r
+ }\r
+ \r
+ \r
+}\r
+\r
+\r
+\r
+bool capi_get_video_cb(media_info_h item, void* user_data)\r
+{\r
+ video_meta_h* _video = (video_meta_h*)user_data;\r
+ char* name = NULL;\r
+ if(item != NULL)\r
+ {\r
+ media_info_get_display_name(item,&name);\r
+ LOGI(" video name : %s \n" , name);\r
+ \r
+ media_info_get_video_from_db(item,_video);\r
+ \r
+\r
+ if(name != NULL)\r
+ free(name);\r
+\r
+ }\r
+ return false;\r
+}\r
+\r
+bool capi_get_bookmarks_cb(video_bookmark_h bookmark,void* user_data)\r
+{\r
+ //get the first bookmark.\r
+ // it is needed array of bookmark, if user wan to get list of bookmarks.\r
+ video_bookmark_h* _bookmark = (video_bookmark_h*)user_data;\r
+ if(bookmark != NULL)\r
+ { \r
+ char* name = NULL;\r
+ video_bookmark_get_thumbnail_path(bookmark,&name);\r
+ \r
+ video_bookmark_clone(_bookmark,bookmark);\r
+\r
+ if(name != NULL)\r
+ {\r
+ LOGI("deleted the bookmark path : %s \n",name);\r
+\r
+ free(name);\r
+ }\r
+ }\r
+ return false; \r
+}\r
+\r
+void test_video_bookmark_operation()\r
+{\r
+ //bookmark is only supported for video information.\r
+ video_meta_h video = NULL;\r
+ media_info_filter_h media_filter = NULL;\r
+\r
+ \r
+ media_info_filter_create(&media_filter);\r
+ media_info_filter_set_media_type(media_filter,MEDIA_CONTENT_TYPE_VIDEO);\r
+\r
+ //get the media_info which is returned first , and get the video's instance from media_info.\r
+ media_info_foreach_media_from_db(media_filter,capi_get_video_cb,(void *)&video); \r
+\r
+ media_info_filter_destroy(media_filter);\r
+ \r
+\r
+ if(video != NULL)\r
+ { \r
+\r
+ video_bookmark_h bookmark = NULL;\r
+ \r
+ //insert bookmark to video \r
+ char* thumbnail_path1 = "/opt/media/Images and videos/My video clips/teat11.jpg";\r
+ video_bookmark_insert_to_db(video, 200,thumbnail_path1);\r
+\r
+ //get the bookmark\r
+ video_bookmark_filter_h bookmark_filter = NULL;\r
+ video_bookmark_filter_create(&bookmark_filter);\r
+ \r
+ video_bookmark_foreach_bookmark_from_db(video,bookmark_filter,capi_get_bookmarks_cb,(void*)&bookmark);\r
+\r
+ video_bookmark_filter_destroy(bookmark_filter);\r
+ \r
+ if(bookmark != NULL)\r
+ {\r
+ video_bookmark_delete_from_db(bookmark);\r
+ }\r
+\r
+ video_bookmark_destroy(bookmark);\r
+\r
+\r
+\r
+ }\r
+\r
+ video_meta_destroy(video);\r
+\r
+}\r
+\r
+\r
+#include <time.h>\r
+#include <memory.h>\r
+void test_insert_item(int count)\r
+{\r
+ int i =0,ret;\r
+ char img_path[1024];\r
+\r
+ clock_t start, end;\r
+\r
+ start = clock();\r
+ for(i =0 ; i< count; i++)\r
+ { \r
+ memset(img_path, 0x00, sizeof(img_path));\r
+ snprintf(img_path,sizeof(img_path),"%s%d.jpg","/opt/media/Images and videos/My photo clips/a",i+0);\r
+\r
+ ret = media_info_insert_to_db(MEDIA_CONTENT_TYPE_IMAGE,img_path);\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE(" image insert error \n");\r
+ }\r
+ }\r
+ end = clock();\r
+ LOGI(" time : %f \n",(double)(end-start)/CLOCKS_PER_SEC);\r
+\r
+ \r
+}\r
+\r
+void test_filter_operation()\r
+{\r
+ int ret;\r
+ int media_type;\r
+ int offset;\r
+ int count;\r
+ char *keyword= NULL;\r
+ media_info_search_type_e search_type;\r
+ \r
+ \r
+ media_info_filter_h filter;\r
+ media_info_filter_create(&filter);\r
+\r
+ media_info_filter_get_offset( filter,&offset,&count);\r
+ media_info_filter_get_media_type( filter, &media_type);\r
+ media_info_filter_get_search_keyword( filter,&search_type,&keyword);\r
+ \r
+ LOGI("1. media : %d , offset : %d / %d , search : %d / %s \n",media_type, offset,count,search_type,keyword);\r
+\r
+ ret = media_info_filter_set_search_keyword(filter,MEDIA_INFO_SEARCH_BY_DISPLAY_NAME,"test");\r
+ media_info_filter_get_search_keyword( filter,&search_type,&keyword); \r
+ LOGI("2. media : %d , offset : %d / %d , search : %d / %s ret : %d\n",media_type, offset,count,search_type,keyword, ret);\r
+\r
+ ret = media_info_filter_set_search_keyword(filter,MEDIA_INFO_SEARCH_NONE,NULL);\r
+ media_info_filter_get_search_keyword( filter,&search_type,&keyword);\r
+ LOGI("3. media : %d , offset : %d / %d , search : %d /%s ret : %d\n",media_type, offset,count,search_type,keyword, ret);\r
+ \r
+}\r
+\r
+bool capi_audio_playlist_cb(audio_playlist_h playlist, void *user_data)\r
+{\r
+ char* playlist_name = NULL;\r
+ if(playlist != NULL)\r
+ {\r
+ audio_playlist_get_name(playlist,&playlist_name);\r
+\r
+ if(playlist_name != NULL)\r
+ {\r
+ LOGI(" Playlist Name : %s \n", playlist_name);\r
+ free(playlist_name);\r
+ }\r
+ \r
+ }\r
+ return true;\r
+}\r
+\r
+bool capi_audio_info_cb(media_info_h media,void* user_data)\r
+{\r
+\r
+ media_info_h* add_media = (media_info_h*)user_data;\r
+ if(media != NULL)\r
+ {\r
+ media_info_clone(add_media,media);\r
+ }\r
+ \r
+ return false;\r
+}\r
+\r
+bool capi_media_info_in_playlist_cb(media_info_h media,void* user_data)\r
+{\r
+\r
+ char* media_name = NULL;\r
+\r
+ if(media != NULL)\r
+ {\r
+ media_info_get_display_name(media,&media_name);\r
+\r
+ if(media_name != NULL)\r
+ {\r
+ LOGI("[Playlist] Media Name : %s \n",media_name);\r
+ free(media_name);\r
+ }\r
+ }\r
+ return true;\r
+}\r
+\r
+void test_playlist_operation()\r
+{\r
+ //1. insert the playlist\r
+ audio_playlist_h playlist;\r
+ char *playlist_name = "myPlaylist";\r
+ int ret = audio_playlist_insert_to_db(playlist_name, &playlist);\r
+\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] Insert operation is failed\n");\r
+ }\r
+\r
+ //2. get the playlist using foreach function.\r
+ // if filter is NULL, all item will be retrieved.\r
+ audio_playlist_foreach_playlist_from_db(NULL,capi_audio_playlist_cb,NULL);\r
+\r
+\r
+ //3. add the audio to playlist\r
+ media_info_h audio_info = NULL;\r
+ media_info_filter_h media_filter;\r
+ media_info_filter_create(&media_filter);\r
+ media_info_filter_set_media_type(media_filter,MEDIA_CONTENT_TYPE_AUDIO);\r
+ media_info_foreach_media_from_db(media_filter,capi_audio_info_cb,&audio_info);\r
+\r
+ ret = audio_playlist_add_media_to_db(playlist,audio_info);\r
+\r
+ media_info_destroy(audio_info);\r
+\r
+ //4. get the media from playlist\r
+ audio_playlist_foreach_media_from_db(playlist,NULL,capi_media_info_in_playlist_cb,NULL);\r
+ \r
+ //5. deletes the playlist\r
+ ret = audio_playlist_delete_from_db(playlist);\r
+\r
+ if(ret != MEDIA_CONTENT_ERROR_NONE)\r
+ {\r
+ LOGE("[ERROR] Delete operation is failed\n");\r
+ }\r
+ \r
+}\r
+\r
+int main(int argc, char *argv[])\r
+{\r
+\r
+ LOGI("--- content manager test start ---\n\n");\r
+\r
+ //scenario 1. DB connection\r
+ if(test_content_connect_database() != MEDIA_CONTENT_ERROR_NONE)\r
+ return MEDIA_CONTENT_ERROR_NONE;\r
+ \r
+ \r
+ //scenario 2-1 .1 set the filter\r
+ // .2 gets the folders\r
+ test_folder_foreach_from_db();\r
+ \r
+ //test_insert_item(1000);\r
+ //scenario 2-2. gets the media\r
+ test_media_info_foreach_from_db();\r
+ \r
+ //scenario 2-3. searching the data by filter.\r
+ test_audio_album_foreach_from_db();\r
+\r
+ //scenario 3. operation of tag information\r
+ // 1. insert the tag\r
+ // 2. get the tag list\r
+ // 3. delete the tag\r
+ test_tag_operation();\r
+ \r
+\r
+ //scenario 4. the operation of bookmark \r
+ // 1. insert the bookmark\r
+ // 2. get the bookmark list\r
+ // 3. delete the bookmark \r
+ test_video_bookmark_operation();\r
+\r
+ //scenario 5. the operation of playlist \r
+ test_playlist_operation();\r
+ \r
+\r
+ //scenario 6. DB disconnection\r
+ test_content_disconnect_database(); \r
+ return 0;\r
+ \r
+}\r
+\r
+\r
+\r