diff options
author | Kim Kibum <kb0929.kim@samsung.com> | 2012-04-29 16:58:28 +0900 |
---|---|---|
committer | Kim Kibum <kb0929.kim@samsung.com> | 2012-04-29 16:58:28 +0900 |
commit | 7393965421a6622d88bc8af45e574688711e115e (patch) | |
tree | 5a93f3419747df9f2f39f078513e93f84b07e3ea | |
parent | a04330477c975ccca2d402a46e5d10fa1d79abc3 (diff) | |
download | metadata-extractor-7393965421a6622d88bc8af45e574688711e115e.tar.gz metadata-extractor-7393965421a6622d88bc8af45e574688711e115e.tar.bz2 metadata-extractor-7393965421a6622d88bc8af45e574688711e115e.zip |
upload tizen1.0 source
35 files changed, 2833 insertions, 0 deletions
@@ -0,0 +1,2 @@ +Seungkeun Lee <sngn.lee@samsung.com> +Kangho Hur <kanho.hur@samsung.com> diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..ea323ed --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,114 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(Services + "application" + "base" + "content" + "location" + "media" + "messaging" + "network" + "social" + "telephony" + "system" + ) + + +# project +SET(project_prefix "capi") +SET(prefix "/usr") +SET(version "0.0.1") +SET(maintainer "Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>") +SET(description "A Metadata Extractor library in Tizen Native API") +SET(service "media") +SET(submodule "metadata-extractor") + +# for package file +SET(dependents "dlog mm-fileinfo capi-base-common") + +SET(fw_name "${project_prefix}-${service}-${submodule}") + +PROJECT(${fw_name}) + +SET(CMAKE_INSTALL_PREFIX ${prefix}) +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(VERSION ${version}) + +SET(INC_DIR include) +INCLUDE_DIRECTORIES(${INC_DIR}) + +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") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") + +IF("${ARCH}" MATCHES "^arm.*") + ADD_DEFINITIONS("-DTARGET") +ENDIF("${ARCH}" MATCHES "^arm.*") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DTIZEN_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/${service} + 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}/${service}) + +CONFIGURE_FILE( + ${fw_name}.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) @@ -0,0 +1,206 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
+
+
diff --git a/TC/_export_env.sh b/TC/_export_env.sh new file mode 100755 index 0000000..72a11ec --- /dev/null +++ b/TC/_export_env.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +. ./config +export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh new file mode 100755 index 0000000..5ddaa53 --- /dev/null +++ b/TC/_export_target_env.sh @@ -0,0 +1,7 @@ +#!/bin/sh +. ./config +export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..72aad6c --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ +tcc -b -j $JOURNAL_RESULT -p ./ +grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/clean.sh b/TC/clean.sh new file mode 100755 index 0000000..29743e0 --- /dev/null +++ b/TC/clean.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +RESULT_DIR=results + +tcc -c -p ./ # executing tcc, with clean option (-c) +rm -r $RESULT_DIR +rm -r tet_tmp_dir +rm testcase/tet_captured diff --git a/TC/config b/TC/config new file mode 100755 index 0000000..5567064 --- /dev/null +++ b/TC/config @@ -0,0 +1,3 @@ +TET_INSTALL_HOST_PATH=/home/backto.kim/workspace/TETware +TET_INSTALL_TARGET_PATH=/mnt/nfs/workspace/TETware + diff --git a/TC/config.default b/TC/config.default new file mode 100755 index 0000000..12ac1e2 --- /dev/null +++ b/TC/config.default @@ -0,0 +1,3 @@ +CAPI_PROJECT_ROOT=/home/abyss/capi +TET_INSTALL_HOST_PATH=/home/abyss/TETware +TET_INSTALL_TARGET_PATH=/mnt/nfs/TETware diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100755 index 0000000..a4f6095 --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +. ./_export_target_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile new file mode 100755 index 0000000..08ab7cd --- /dev/null +++ b/TC/testcase/Makefile @@ -0,0 +1,23 @@ +CC ?= gcc + +C_FILES = $(shell ls *.c) + +PKGS = capi-media-metadata-extractor +LDFLAGS = `pkg-config --libs $(PKGS)` +LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s + +CFLAGS = -I. `pkg-config --cflags $(PKGS)` +CFLAGS += -I$(TET_ROOT)/inc/tet3 +CFLAGS += -Wall + +TCS := $(shell ls -1 *.c | cut -d. -f1) + +all: $(TCS) + +%: %.c + $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) + +clean: + rm -f $(TCS) diff --git a/TC/testcase/tslist b/TC/testcase/tslist new file mode 100755 index 0000000..d01002b --- /dev/null +++ b/TC/testcase/tslist @@ -0,0 +1 @@ +/testcase/utc_metadata_extractor diff --git a/TC/testcase/utc_metadata_extractor.c b/TC/testcase/utc_metadata_extractor.c new file mode 100755 index 0000000..f157dab --- /dev/null +++ b/TC/testcase/utc_metadata_extractor.c @@ -0,0 +1,275 @@ +/* +* 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 <tet_api.h> +#include <stdlib.h> +#include <metadata_extractor.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + + +#define MEDIA_PATH "/opt/media/Music/Over the horizon.mp3" + +metadata_extractor_h metadata = NULL; + + +static void utc_metadata_extractor_create_n(void); +static void utc_metadata_extractor_create_p(void); +static void utc_metadata_extractor_set_path_n(void); +static void utc_metadata_extractor_set_path_p(void); +static void utc_metadata_extractor_destroy_n(void); +static void utc_metadata_extractor_destroy_p(void); +static void utc_metadata_extractor_get_metadata_n(void); +static void utc_metadata_extractor_get_metadata_p(void); +static void utc_metadata_extractor_get_artwork_n(void); +static void utc_metadata_extractor_get_artwork_p(void); +static void utc_metadata_extractor_get_frame_n(void); +static void utc_metadata_extractor_get_frame_p(void); +static void utc_metadata_extractor_get_synclyrics_n(void); +static void utc_metadata_extractor_get_synclyrics_p(void); + + +struct tet_testlist tet_testlist[] = { + { utc_metadata_extractor_create_n, 1 }, + { utc_metadata_extractor_create_p, 1 }, + { utc_metadata_extractor_set_path_n, 2 }, + { utc_metadata_extractor_set_path_p, 2 }, + { utc_metadata_extractor_get_metadata_n, 2 }, + { utc_metadata_extractor_get_metadata_p, 2 }, + { utc_metadata_extractor_get_artwork_n, 2 }, + { utc_metadata_extractor_get_artwork_p, 2 }, + { utc_metadata_extractor_get_frame_n, 2 }, + { utc_metadata_extractor_get_frame_p, 2 }, + { utc_metadata_extractor_get_synclyrics_n, 2 }, + { utc_metadata_extractor_get_synclyrics_p, 2 }, + { utc_metadata_extractor_destroy_n, 3 }, + { utc_metadata_extractor_destroy_p, 3 }, + { NULL, 0 }, +}; + + +static void startup(void) +{ + /* start of TC */ +} + + +static void cleanup(void) +{ + /* end of TC */ +} + + +/** + * @brief Negative test case of metadata_extractor_create() + */ +static void utc_metadata_extractor_create_n(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + + ret = metadata_extractor_create(NULL); + + dts_check_eq("utc_metadata_extractor_create_n", ret, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER, "Must return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER in case of invalid parameter"); +} + +/** + * @brief Positive test case of metadata_extractor_create() + */ +static void utc_metadata_extractor_create_p(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + + ret = metadata_extractor_create(&metadata); + + dts_check_eq("utc_metadata_extractor_create_p", ret, METADATA_EXTRACTOR_ERROR_NONE, "Failed to create handle"); +} + +/** + * @brief Negative test case of metadata_extractor_set_path() + */ +static void utc_metadata_extractor_set_path_n(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + + ret = metadata_extractor_set_path(NULL, MEDIA_PATH); + + dts_check_eq("utc_metadata_extractor_create_n", ret, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER, "Must return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER in case of invalid parameter"); +} + +/** + * @brief Positive test case of metadata_extractor_set_path() + */ +static void utc_metadata_extractor_set_path_p(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + + ret = metadata_extractor_set_path(metadata, MEDIA_PATH); + + dts_check_eq("utc_metadata_extractor_set_path_p", ret, METADATA_EXTRACTOR_ERROR_NONE, "Failed to set path"); +} + +/** + * @brief Negative test case of metadata_extractor_get_metadata() + */ +static void utc_metadata_extractor_get_metadata_n(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + char * value = NULL; + + ret = metadata_extractor_get_metadata(metadata, -1, &value); + + dts_check_eq("utc_metadata_extractor_get_metadata_n", ret, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER, "Must return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER in case of invalid parameter"); +} + +/** + * @brief Positive test case of metadata_extractor_get_metadata() + */ +static void utc_metadata_extractor_get_metadata_p(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + char * value = NULL; + + ret = metadata_extractor_get_metadata(metadata, METADATA_TITLE, &value); + if(value) + free(value); + + dts_check_eq("utc_metadata_extractor_get_metadata_p", ret, METADATA_EXTRACTOR_ERROR_NONE, "Failed to get metadata"); +} + +/** + * @brief Negative test case of metadata_extractor_get_artwork() + */ +static void utc_metadata_extractor_get_artwork_n(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + void * artwork = NULL; + char * artwork_mime = NULL; + int artwork_size = 0; + + ret = metadata_extractor_get_artwork(NULL, &artwork, &artwork_size, &artwork_mime); + + dts_check_eq("utc_metadata_extractor_get_artwork_n", ret, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER, "Must return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER in case of invalid parameter"); +} + +/** + * @brief Positive test case of metadata_extractor_get_artwork() + */ +static void utc_metadata_extractor_get_artwork_p(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + void * artwork = NULL; + char * artwork_mime = NULL; + int artwork_size = 0; + + ret = metadata_extractor_get_artwork(metadata, &artwork, &artwork_size, &artwork_mime); + if(artwork) + free(artwork); + if(artwork_mime) + free(artwork_mime); + + dts_check_eq("utc_metadata_extractor_get_artwork_p", ret, METADATA_EXTRACTOR_ERROR_NONE, "Failed to get artwork"); +} + +/** + * @brief Negative test case of metadata_extractor_get_frame() + */ +static void utc_metadata_extractor_get_frame_n(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + void * frame = NULL; + int frame_size = 0; + + ret = metadata_extractor_get_frame(NULL, &frame, &frame_size); + + dts_check_eq("utc_metadata_extractor_get_frame_n", ret, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER, "Must return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER in case of invalid parameter"); +} + +/** + * @brief Positive test case of metadata_extractor_get_frame() + */ +static void utc_metadata_extractor_get_frame_p(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + void * frame = NULL; + int frame_size = 0; + + ret = metadata_extractor_get_frame(metadata, &frame, &frame_size); + if(frame) + free(frame); + + dts_check_eq("utc_metadata_extractor_get_frame_p", ret, METADATA_EXTRACTOR_ERROR_NONE, "Failed to get frame"); +} + +/** + * @brief Negative test case of metadata_extractor_get_synclyrics() + */ +static void utc_metadata_extractor_get_synclyrics_n(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + unsigned long time_info = 0; + char * lyrics = NULL; + + ret = metadata_extractor_get_synclyrics(NULL, 1, &time_info, &lyrics); + + dts_check_eq("utc_metadata_extractor_get_synclyrics_n", ret, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER, "Must return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER in case of invalid parameter"); +} + +/** + * @brief Positive test case of metadata_extractor_get_synclyrics() + */ +static void utc_metadata_extractor_get_synclyrics_p(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + unsigned long time_info = 0; + char * lyrics = NULL; + + ret = metadata_extractor_get_synclyrics(metadata, 1, &time_info, &lyrics); + if(lyrics) + free(lyrics); + + dts_check_eq("utc_metadata_extractor_get_synclyrics_p", ret, METADATA_EXTRACTOR_ERROR_NONE, "Failed to get lyrics"); +} + +/** + * @brief Negative test case of metadata_extractor_destroy() + */ +static void utc_metadata_extractor_destroy_n(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + + ret = metadata_extractor_destroy(NULL); + + dts_check_eq("utc_metadata_extractor_destroy_n", ret, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER, "Must return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER in case of invalid parameter"); +} + +/** + * @brief Positive test case of metadata_extractor_destroy() + */ + +static void utc_metadata_extractor_destroy_p(void) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + + ret = metadata_extractor_destroy(metadata); + + dts_check_eq("utc_metadata_extractor_destroy_p", ret, METADATA_EXTRACTOR_ERROR_NONE, "Failed to destroy handle"); +} + diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100755 index 0000000..03f029a --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/testcase/tslist diff --git a/TC/tet_xres b/TC/tet_xres new file mode 100755 index 0000000..a2e94c2 --- /dev/null +++ b/TC/tet_xres @@ -0,0 +1,21 @@ +15|0 3.7-lite 4|TCM Start +400|0 1 1 03:32:00|IC Start +200|0 1 03:32:00|TP Start +520|-1 1 00002484 1 1|20000207 03:32:00__[__type=CheckPass, api_name=utc_wav_player_start_p, file=(null)/utc_wav_player.c, func=utc_wav_player_start_p, line=48__]__ +220|0 1 0 03:32:00|PASS +410|0 1 1 03:32:00|IC End +400|0 2 1 03:32:00|IC Start +200|0 2 03:32:00|TP Start +520|-1 2 00002484 1 2|20000207 03:32:00__[__type=CheckPass, api_name=utc_wav_player_start_n, file=(null)/utc_wav_player.c, func=utc_wav_player_start_n, line=54__]__ +220|0 2 0 03:32:00|PASS +410|0 2 1 03:32:00|IC End +400|0 3 1 03:32:00|IC Start +200|0 3 03:32:00|TP Start +520|-1 3 00002484 1 3|20000207 03:32:00__[__type=CheckPass, api_name=utc_wav_player_stop_p, file=(null)/utc_wav_player.c, func=utc_wav_player_stop_p, line=62__]__ +220|0 3 0 03:32:00|PASS +410|0 3 1 03:32:00|IC End +400|0 4 1 03:32:00|IC Start +200|0 4 03:32:00|TP Start +520|-1 4 00002484 1 4|20000207 03:32:00__[__type=CheckPass, api_name=utc_wav_player_stop_n, file=(null)/utc_wav_player.c, func=utc_wav_player_stop_n, line=68__]__ +220|0 4 0 03:32:00|PASS +410|0 4 1 03:32:00|IC End diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100755 index 0000000..f7eda55 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option for build operation checking +TET_BUILD_TOOL=make # build with using make command +TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build +TET_API_COMPLIANT=True # use TET API in Test Case ? +TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100755 index 0000000..02d7030 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option +TET_CLEAN_TOOL= make clean # clean tool +TET_CLEAN_FILE= Makefile # file for clean +TET_API_COMPLIANT=True # TET API useage +TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100755 index 0000000..ef3e452 --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capturing execution or not +TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional +TET_EXEC_FILE= # ex) exectool : execution file/ Optional +TET_API_COMPLIANT=True # Test case or Tool usesTET API? +TET_PASS_TC_NAME=True # showing Passed TC name ? diff --git a/capi-media-metadata-extractor.pc.in b/capi-media-metadata-extractor.pc.in new file mode 100755 index 0000000..773d667 --- /dev/null +++ b/capi-media-metadata-extractor.pc.in @@ -0,0 +1,15 @@ + +# Package Information for pkg-config + +prefix=@PREFIX@ +exec_prefix=/usr +libdir=/usr/lib +includedir=/usr/include/media + +Name: @PC_NAME@ +Description: @PACKAGE_DESCRIPTION@ +Version: @VERSION@ +Requires: @PC_REQUIRED@ +Libs: -L${libdir} @PC_LDFLAGS@ +Cflags: -I${includedir} @PC_CFLAGS@ + diff --git a/debian/README b/debian/README new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/debian/README diff --git a/debian/capi-media-metadata-extractor-dev.install b/debian/capi-media-metadata-extractor-dev.install new file mode 100755 index 0000000..761a28b --- /dev/null +++ b/debian/capi-media-metadata-extractor-dev.install @@ -0,0 +1,4 @@ +/usr/include/* +/usr/include/*/* +/usr/lib/pkgconfig/*.pc + diff --git a/debian/capi-media-metadata-extractor-dev.postinst b/debian/capi-media-metadata-extractor-dev.postinst new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/debian/capi-media-metadata-extractor-dev.postinst @@ -0,0 +1 @@ +#!/bin/sh diff --git a/debian/capi-media-metadata-extractor.install b/debian/capi-media-metadata-extractor.install new file mode 100755 index 0000000..4a755a4 --- /dev/null +++ b/debian/capi-media-metadata-extractor.install @@ -0,0 +1 @@ +/usr/lib/lib*.so* diff --git a/debian/capi-media-metadata-extractor.postinst b/debian/capi-media-metadata-extractor.postinst new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/debian/capi-media-metadata-extractor.postinst @@ -0,0 +1 @@ +#!/bin/sh diff --git a/debian/changelog b/debian/changelog new file mode 100755 index 0000000..fe30465 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,7 @@ +capi-media-metadata-extractor (0.1.0-0) unstable; urgency=low + + * Initial release + * Git: slp/api/metadata-extractor + * Tag: capi-media-metadata-extractor_0.1.0-0 + + -- Haejeong Kim <backto.kim@samsung.com> Mon, 19 Mar 2012 12:10:16 +0900 diff --git a/debian/compat b/debian/compat new file mode 100755 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100755 index 0000000..ae7c10b --- /dev/null +++ b/debian/control @@ -0,0 +1,22 @@ + +Source: capi-media-metadata-extractor +Section: libs +Priority: extra +Maintainer: Haejeong Kim <backto.kim@samsung.com>, Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kangho.hur@samsung.com> +Build-Depends: debhelper (>= 5), libmm-fileinfo-dev , capi-base-common-dev , dlog-dev + +Package: capi-media-metadata-extractor +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: A Metadata Extractor library in Tizen Native API + +Package: capi-media-metadata-extractor-dev +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-metadata-extractor (= ${Source-Version}), dlog-dev, capi-base-common-dev, libmm-fileinfo-dev +Description: A Metadata Extractor library in Tizen Native API (DEV) + +Package: capi-media-metadata-extractor-dbg +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-metadata-extractor (= ${Source-Version}) +Description: A Metadata Extractor library in Tizen Native API (DBG) + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..1a88a3a --- /dev/null +++ b/debian/rules @@ -0,0 +1,68 @@ +#!/usr/bin/make -f + +CFLAGS = -Wall -g + +FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1) +MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1) + +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 .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER} + 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-media-metadata-extractor-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 + diff --git a/include/metadata_extractor.h b/include/metadata_extractor.h new file mode 100755 index 0000000..0a858c8 --- /dev/null +++ b/include/metadata_extractor.h @@ -0,0 +1,172 @@ +/*
+* 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_METADATA_EXTRACTOR_H__
+#define __TIZEN_MEDIA_METADATA_EXTRACTOR_H__
+
+
+#include <tizen.h>
+#include <metadata_extractor_type.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @addtogroup CAPI_METADATA_EXTRACTOR_MODULE
+ * @{
+ *
+ * @file metadata_extractor.h
+ * @brief This file contains the multimedia content metadata extractor API and related structure and enumeration. \n
+ * Description of metadata: duration, bitrate, album, artist, author, genre and description etc. \n
+ */
+
+
+/**
+ * @brief Create metadata
+ *
+ * @remarks @a metadata must be released metadata_extractor_destroy() by you
+ *
+ * @param [in] metadata The handle to metadata
+ * @return 0 on success, otherwise a negative error value
+ * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful
+ * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @see metadata_extractor_destroy()
+ */
+int metadata_extractor_create(metadata_extractor_h* metadata);
+
+
+/**
+ * @brief Set file path to extract
+ *
+ * @param [in] metadata The handle to metadata
+ * @param [in] path path to extract metadata
+ * @return 0 on success, otherwise a negative error value
+ * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful
+ * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #METADATA_EXTRACTOR_ERROR_FILE_EXISTS File not exist
+ * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail
+ * @pre Create metadata handle by calling metadata_extractor_create()
+ * @see metadata_extractor_create(), metadata_extractor_destroy()
+ */
+int metadata_extractor_set_path(metadata_extractor_h metadata, const char* path);
+
+
+/**
+ * @brief Destroy metadata
+ *
+ * @param [in] metadata The handle to metadata
+ * @return 0 on success, otherwise a negative error value
+ * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful
+ * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail
+ * @pre Create metadata handle by calling metadata_extractor_create()
+ * @see metadata_extractor_create()
+ */
+int metadata_extractor_destroy(metadata_extractor_h metadata);
+
+
+/**
+ * @brief Get metadata
+ *
+ * @remarks @a value must be released with @c free() by you
+ *
+ * @param [in] metadata The handle to metadata
+ * @param [in] attribute key attribute name to get
+ * @param [out] value The value of the attribute
+ * @return 0 on success, otherwise a negative error value
+ * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful
+ * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail
+ * @pre Set path to extract by calling metadata_extractor_set_path()
+ * @see metadata_extractor_create(), metadata_extractor_destroy()
+ */
+int metadata_extractor_get_metadata(metadata_extractor_h metadata, metadata_extractor_attr_e attribute, char ** value);
+
+
+/**
+ * @brief Get artwork image in media file
+ *
+ * @remarks @a artwork and @a artwork_mime must be released with @c free() by you
+ *
+ * @param [in] metadata The handle to metadata
+ * @param [out] artwork encoded artwork image
+ * @param [out] size encoded artwork size
+ * @param [out] mime_type mime type of artwork
+ * @return 0 on success, otherwise a negative error value
+ * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful
+ * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail
+ * @pre Set path to extract by calling metadata_extractor_set_path()
+ * @see metadata_extractor_create(), metadata_extractor_destroy()
+ */
+int metadata_extractor_get_artwork(metadata_extractor_h metadata, void ** artwork, int * size, char ** mime_type);
+
+
+/**
+ * @brief Get frame of video media file
+ *
+ * @remarks @a frame must be released with @c free() by you
+ *
+ * @param [in] metadata The handle to metadata
+ * @param [out] frame raw frame data
+ * @param [out] size The frame data size
+ * @return 0 on success, otherwise a negative error value
+ * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful
+ * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY Not enough memory is available
+ * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail
+ * @pre Set path to extract by calling metadata_extractor_set_path()
+ * @see metadata_extractor_create(), metadata_extractor_destroy()
+ */
+int metadata_extractor_get_frame(metadata_extractor_h metadata, void ** frame, int * size);
+
+
+/**
+ * @brief Get synclyric of media file
+ *
+ * @remarks @a lyrics must be released with @c free() by you
+ *
+ * @param [in] metadata The handle to metadata
+ * @param [in] index Index of time/lyrics set
+ * @param [out] time_info Time information of index
+ * @param [out] lyrics Lyric of index
+ * @return 0 on success, otherwise a negative error value
+ * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful
+ * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail
+ * @pre Set path to extract by calling metadata_extractor_set_path()
+ * @pre Get time/lyrics set number by calling metadata_extractor_get_metadata(METADATA_SYNCLYRICS_NUM)
+ * @see metadata_extractor_create(), metadata_extractor_destroy()
+ */
+int metadata_extractor_get_synclyrics(metadata_extractor_h metadata, int index, unsigned long *time_stamp, char ** lyrics);
+
+/**
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIA_METADATA_EXTRACTOR_H__ */
+
+
diff --git a/include/metadata_extractor_private.h b/include/metadata_extractor_private.h new file mode 100755 index 0000000..5027b17 --- /dev/null +++ b/include/metadata_extractor_private.h @@ -0,0 +1,46 @@ +/* +* 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_METADATA_EXTRACTOR_PRIVATE_H__ +#define __TIZEN_MEDIA_METADATA_EXTRACTOR_PRIVATE_H__ + + +#include <mm_types.h> + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +typedef struct +{ + int audio_track_cnt; + int video_track_cnt; + + MMHandleType attr_h; + MMHandleType tag_h; +}metadata_extractor_s; + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /*__TIZEN_MEDIA_METADATA_EXTRACTOR_PRIVATE_H__*/ + + + diff --git a/include/metadata_extractor_type.h b/include/metadata_extractor_type.h new file mode 100755 index 0000000..b3d8987 --- /dev/null +++ b/include/metadata_extractor_type.h @@ -0,0 +1,103 @@ +/*
+* 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_METADATA_EXTRACTOR_TYPE_H__
+#define __TIZEN_MEDIA_METADATA_EXTRACTOR_TYPE_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/**
+* @addtogroup CAPI_METADATA_EXTRACTOR_MODULE
+* @{
+*/
+
+/** Content Error Class */
+#define METADATA_EXTRACTOR_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x80
+
+/**
+ * @ingroup CAPI_METADATA_EXTRACTOR_MODULE
+ * @brief The enumerations of metadata extractor error
+ */
+typedef enum
+{
+ METADATA_EXTRACTOR_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ METADATA_EXTRACTOR_ERROR_FILE_EXISTS = TIZEN_ERROR_FILE_EXISTS, /**< File not exist */
+ METADATA_EXTRACTOR_ERROR_OPERATION_FAILED = METADATA_EXTRACTOR_ERROR_CLASS |0x01, /** < Invalid internal operation*/
+} metadata_extractor_error_e;
+
+
+/**
+ * @ingroup CAPI_METADATA_EXTRACTOR_MODULE
+ * @brief The enumerations of attribute
+ */
+typedef enum
+{
+ METADATA_DURATION = 0, /**< Duration */
+ METADATA_VIDEO_BITRATE, /**< Video Bitrate */
+ METADATA_VIDEO_FPS, /**< Video FPS */
+ METADATA_VIDEO_WIDTH, /**< Video Width*/
+ METADATA_VIDEO_HEIGHT, /**< Video Height*/
+ METADATA_HAS_VIDEO, /**< Video stream count */
+ METADATA_AUDIO_BITRATE, /**< Audio Bitrate*/
+ METADATA_AUDIO_CHANNELS, /**< Audio Channels*/
+ METADATA_AUDIO_SAMPLERATE, /**< Audio Samplerate*/
+ METADATA_HAS_AUDIO, /**< Audio stream count */
+ METADATA_ARTIST, /**< Artist*/
+ METADATA_TITLE, /**< Title*/
+ METADATA_ALBUM, /**< Album*/
+ METADATA_GENRE, /**< Genre*/
+ METADATA_AUTHOR, /**< Author*/
+ METADATA_COPYRIGHT, /**< Copyright*/
+ METADATA_DATE, /**< Date*/
+ METADATA_DESCRIPTION, /**< Description*/
+ METADATA_TRACK_NUM, /**< Track number info*/
+ METADATA_CLASSIFICATION, /**< Classification*/
+ METADATA_RATING, /**< Rating*/
+ METADATA_LONGITUDE, /**< Longitude*/
+ METADATA_LATITUDE, /**< Latitude*/
+ METADATA_ALTITUDE, /**< Altitude*/
+ METADATA_CONDUCTOR, /**< Conductor*/
+ METADATA_UNSYNCLYRICS, /**< Unsyncronized lyric*/
+ METADATA_SYNCLYRICS_NUM, /**< Syncronized lyric (time/lyric set) number*/
+ METADATA_RECDATE, /**< Recording date*/
+} metadata_extractor_attr_e;
+
+
+/**
+ * @ingroup CAPI_METADATA_EXTRACTOR_MODULE
+ * @brief The handle of metadata extractor
+ */
+typedef struct metadata_extractor_s* metadata_extractor_h;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /*__TIZEN_MEDIA_METADATA_EXTRACTOR_TYPE_H__*/
diff --git a/packaging/capi-media-metadata-extractor.spec b/packaging/capi-media-metadata-extractor.spec new file mode 100755 index 0000000..598b9ee --- /dev/null +++ b/packaging/capi-media-metadata-extractor.spec @@ -0,0 +1,53 @@ +Name: capi-media-metadata-extractor +Summary: A media metadata extractor library in SLP C API +Version: 0.1.0 +Release: 2 +Group: TO_BE/FILLED_IN +License: TO BE FILLED IN +Source0: %{name}-%{version}.tar.gz +BuildRequires: cmake +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(mm-fileinfo) +BuildRequires: pkgconfig(mm-player) +BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(capi-media-sound-manager) +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +%description +A media metadata extractor library in SLP C API + +%package devel +Summary: A media metadata extractor library in SLP C API (Development) +Group: TO_BE/FILLED_IN + +%description devel +A media metadata extractor library in SLP C API + +%prep +%setup -q + + +%build +MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} + + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + +%files + +%files devel +/usr/include/media/*.h +/usr/lib/libcapi-media-metadata-extractor.so +/usr/lib/pkgconfig/capi-media-metadata-extractor.pc + diff --git a/src/metadata_extractor.c b/src/metadata_extractor.c new file mode 100755 index 0000000..b7eb3fb --- /dev/null +++ b/src/metadata_extractor.c @@ -0,0 +1,1334 @@ +/*
+* 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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <mm_file.h>
+#include <mm_error.h>
+#include <dlog.h>
+#include <metadata_extractor.h>
+#include <metadata_extractor_private.h>
+
+#define SAFE_FREE(src) { if(src) {free(src); src = NULL;}}
+#define META_MAX_LEN 256
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_METADATAEXTRACTOR"
+
+
+static int __metadata_extractor_create_content_attrs(metadata_extractor_s* metadata, const char* path);
+static int __metadata_extractor_create_tag_attr(metadata_extractor_s* metadata, const char* path);
+static int __metadata_extractor_get_artwork(metadata_extractor_s* metadata, void ** artwork, int * artwork_size);
+static int __metadata_extractor_get_artwork_mime(metadata_extractor_s* metadata, char ** artwork_mime);
+static int __metadata_extractor_get_video_thumbnail(metadata_extractor_s* metadata, void ** thumbnail, int * thumbnail_len);
+static int __metadata_extractor_get_duration(metadata_extractor_s* metadata, int * duration);
+static int __metadata_extractor_get_audio_bitrate(metadata_extractor_s* metadata, int * bitrate);
+static int __metadata_extractor_get_audio_channel(metadata_extractor_s* metadata, int * channel);
+static int __metadata_extractor_get_audio_samplerate(metadata_extractor_s* metadata, int * samplerate);
+static int __metadata_extractor_get_audio_track_count(metadata_extractor_s* metadata, int * track_cnt);
+static int __metadata_extractor_get_video_bitrate(metadata_extractor_s* metadata, int * bitrate);
+static int __metadata_extractor_get_video_FPS(metadata_extractor_s* metadata, int * fps);
+static int __metadata_extractor_get_video_width(metadata_extractor_s* metadata, int * width);
+static int __metadata_extractor_get_video_height(metadata_extractor_s* metadata, int * height);
+static int __metadata_extractor_get_video_track_count(metadata_extractor_s* metadata, int * track_cnt);
+static int __metadata_extractor_get_artist(metadata_extractor_s* metadata, char ** artist);
+static int __metadata_extractor_get_title(metadata_extractor_s* metadata, char ** title);
+static int __metadata_extractor_get_album(metadata_extractor_s* metadata, char ** album);
+static int __metadata_extractor_get_genre(metadata_extractor_s* metadata, char ** genre);
+static int __metadata_extractor_get_author(metadata_extractor_s* metadata, char ** author);
+static int __metadata_extractor_get_copyright(metadata_extractor_s* metadata, char ** copyright);
+static int __metadata_extractor_get_date(metadata_extractor_s* metadata, char ** date);
+static int __metadata_extractor_get_description(metadata_extractor_s* metadata, char ** description);
+static int __metadata_extractor_get_track_num(metadata_extractor_s* metadata, char ** track_num);
+static int __metadata_extractor_get_classification(metadata_extractor_s* metadata, char ** classification);
+static int __metadata_extractor_get_rating(metadata_extractor_s* metadata, char ** rating);
+static int __metadata_extractor_get_longitude(metadata_extractor_s* metadata, double * longitude);
+static int __metadata_extractor_get_latitude(metadata_extractor_s* metadata, double * latitude);
+static int __metadata_extractor_get_altitude(metadata_extractor_s* metadata, double * altitude);
+static int __metadata_extractor_get_conductor(metadata_extractor_s* metadata, char ** conductor);
+static int __metadata_extractor_get_unsynclyrics(metadata_extractor_s* metadata, char ** unsynclyrics);
+static int __metadata_extractor_get_recording_date(metadata_extractor_s* metadata, char ** rec_date);
+static int __metadata_extractor_get_synclyrics_pair_num(metadata_extractor_s* metadata, int * synclyrics_num);
+static int __metadata_extractor_destroy_handle(metadata_extractor_s* metadata);
+
+static int __metadata_extractor_create_content_attrs(metadata_extractor_s* metadata, const char* path)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ MMHandleType content = 0;
+ char * err_attr_name = NULL;
+
+ int _audio_track_cnt = 0;
+ int _video_track_cnt = 0;
+
+ LOGI("[%s] enter \n", __FUNCTION__);
+
+ ret = mm_file_create_content_attrs(&content, path);
+
+ if(ret != MM_ERROR_NONE)
+ {
+ if(ret == MM_ERROR_FILE_NOT_FOUND)
+ {
+ LOGE("[%s]FILE_NOT_EXISTS(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_FILE_EXISTS);
+ return METADATA_EXTRACTOR_ERROR_FILE_EXISTS;
+ }
+ else
+ {
+ LOGE("[%s]ERROR_UNKNOWN(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ ret = mm_file_get_attrs(content, &err_attr_name,
+ MM_FILE_CONTENT_VIDEO_TRACK_COUNT, &_video_track_cnt,
+ MM_FILE_CONTENT_AUDIO_TRACK_COUNT, &_audio_track_cnt,
+ NULL);
+
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ mm_file_destroy_content_attrs(content);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ metadata->attr_h = content;
+ metadata->audio_track_cnt = _audio_track_cnt;
+ metadata->video_track_cnt = _video_track_cnt;
+
+ LOGI("[%s] leave \n", __FUNCTION__);
+
+ return ret;
+
+}
+
+
+static int __metadata_extractor_create_tag_attr(metadata_extractor_s* metadata, const char* path)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ MMHandleType tag = 0;
+
+ LOGI("[%s] enter \n", __FUNCTION__);
+ ret = mm_file_create_tag_attrs(&tag, path);
+
+ if(ret != MM_ERROR_NONE)
+ {
+ if(ret == MM_ERROR_FILE_NOT_FOUND)
+ {
+ LOGE("[%s]FILE_NOT_EXISTS(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_FILE_EXISTS);
+ return METADATA_EXTRACTOR_ERROR_FILE_EXISTS;
+ }
+ else
+ {
+ LOGE("[%s]ERROR_UNKNOWN(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ metadata->tag_h= tag;
+
+ LOGI("[%s] leave \n", __FUNCTION__);
+ return ret;
+
+}
+
+static int __metadata_extractor_get_duration(metadata_extractor_s* metadata, int * duration)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ int _duration = 0;
+
+ if((!metadata) && (!metadata->attr_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_DURATION, &_duration, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *duration = _duration;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_audio_bitrate(metadata_extractor_s* metadata, int * bitrate)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ int _audio_bitrate = 0;
+
+ if((!metadata) && (!metadata->attr_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->audio_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_AUDIO_BITRATE, &_audio_bitrate, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *bitrate = _audio_bitrate;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_audio_channel(metadata_extractor_s* metadata, int * channel)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ int _audio_channel = 0;
+
+ if((!metadata) && (!metadata->attr_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->audio_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_AUDIO_CHANNELS, &_audio_channel, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *channel = _audio_channel;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_audio_samplerate(metadata_extractor_s* metadata, int * samplerate)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ int _audio_samplerate = 0;
+
+ if((!metadata) && (!metadata->attr_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->audio_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_AUDIO_SAMPLERATE, &_audio_samplerate, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *samplerate = _audio_samplerate;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_audio_track_count(metadata_extractor_s* metadata, int * track_cnt)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+
+ if(!metadata)
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ *track_cnt = metadata->audio_track_cnt;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_bitrate(metadata_extractor_s* metadata, int * bitrate)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ int _video_bitrate = 0;
+
+ if((!metadata) && (!metadata->attr_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->video_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_VIDEO_BITRATE, &_video_bitrate, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+ *bitrate = _video_bitrate;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_FPS(metadata_extractor_s* metadata, int * fps)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ int _video_fps = 0;
+
+ if((!metadata) && (!metadata->attr_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->video_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_VIDEO_FPS, &_video_fps, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *fps = _video_fps;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_width(metadata_extractor_s* metadata, int * width)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ int _video_width = 0;
+
+ if((!metadata) && (!metadata->attr_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->video_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_VIDEO_WIDTH, &_video_width, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *width = _video_width;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_height(metadata_extractor_s* metadata, int * height)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ int _video_height = 0;
+
+ if((!metadata) && (!metadata->attr_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->video_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_VIDEO_HEIGHT, &_video_height, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *height = _video_height;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_thumbnail(metadata_extractor_s* metadata, void ** thumbnail, int * thumbnail_len)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ void * _video_thumbnail = NULL;
+ int _video_thumbnail_len = 0;
+
+ if((!metadata) && (!metadata->attr_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->video_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_VIDEO_THUMBNAIL, &_video_thumbnail, &_video_thumbnail_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *thumbnail = _video_thumbnail;
+ *thumbnail_len = _video_thumbnail_len;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_track_count(metadata_extractor_s* metadata, int * track_cnt)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+
+ if(!metadata)
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ *track_cnt = metadata->video_track_cnt;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_artist(metadata_extractor_s* metadata, char ** artist)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _artist = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ARTIST, &_artist, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *artist = _artist;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_title(metadata_extractor_s* metadata, char ** title)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _title = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_TITLE, &_title, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *title = _title;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_album(metadata_extractor_s* metadata, char ** album)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _album = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ALBUM, &_album, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *album = _album;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_genre(metadata_extractor_s* metadata, char ** genre)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _genre = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_GENRE, &_genre, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *genre = _genre;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_author(metadata_extractor_s* metadata, char ** author)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _author = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_AUTHOR, &_author, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *author = _author;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_copyright(metadata_extractor_s* metadata, char ** copyright)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _copyright = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_COPYRIGHT, &_copyright, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *copyright = _copyright;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_date(metadata_extractor_s* metadata, char ** date)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _date = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_DATE, &_date, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *date = _date;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_description(metadata_extractor_s* metadata, char ** description)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _description = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_DESCRIPTION, &_description, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *description = _description;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_artwork(metadata_extractor_s* metadata, void ** artwork, int * artwork_size)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ void * _artwork = NULL;
+ int _artwork_size = 0;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ARTWORK_SIZE, &_artwork_size, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ if(_artwork_size > 0)
+ {
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ARTWORK, &_artwork, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *artwork = _artwork;
+ *artwork_size = _artwork_size;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_artwork_mime(metadata_extractor_s* metadata, char ** artwork_mime)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _artwork_mime = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ARTWORK_MIME, &_artwork_mime, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *artwork_mime = _artwork_mime;
+
+ return ret;
+}
+
+
+static int __metadata_extractor_get_track_num(metadata_extractor_s* metadata, char ** track_num)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _track_num = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_TRACK_NUM, &_track_num, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *track_num = _track_num;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_classification(metadata_extractor_s* metadata, char ** classification)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _classification = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_CLASSIFICATION, &_classification, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *classification = _classification;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_rating(metadata_extractor_s* metadata, char ** rating)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _rating = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_RATING, &_rating, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *rating = _rating;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_longitude(metadata_extractor_s* metadata, double * longitude)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ double _longitude = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_LONGITUDE, &_longitude, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *longitude = _longitude;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_latitude(metadata_extractor_s* metadata, double * latitude)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ double _latitude = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_LATIDUE, &_latitude, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *latitude = _latitude;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_altitude(metadata_extractor_s* metadata, double * altitude)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ double _altitude = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ALTIDUE, &_altitude, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *altitude = _altitude;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_conductor(metadata_extractor_s* metadata, char ** conductor)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _conductor = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_CONDUCTOR, &_conductor, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *conductor = _conductor;
+
+ return ret;
+}
+static int __metadata_extractor_get_unsynclyrics(metadata_extractor_s* metadata, char ** unsynclyrics)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _unsynclyrics = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_UNSYNCLYRICS, &_unsynclyrics, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *unsynclyrics = _unsynclyrics;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_recording_date(metadata_extractor_s* metadata, char ** rec_date)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ char * _rec_date = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_RECDATE, &_rec_date, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *rec_date = _rec_date;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_synclyrics_pair_num(metadata_extractor_s* metadata, int * synclyrics_num)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char * err_attr_name = NULL;
+ int _synclyrics_num = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_SYNCLYRICS_NUM, &_synclyrics_num, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", __FUNCTION__, err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *synclyrics_num = _synclyrics_num;
+
+ return ret;
+}
+
+static int __metadata_extractor_destroy_handle(metadata_extractor_s* metadata)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+
+ LOGI("[%s] enter \n", __FUNCTION__);
+
+ if(metadata->attr_h)
+ {
+ ret = mm_file_destroy_content_attrs(metadata->attr_h);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]ERROR_UNKNOWN(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ if(metadata->tag_h)
+ {
+ ret = mm_file_destroy_tag_attrs(metadata->tag_h);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]ERROR_UNKNOWN(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ LOGI("[%s] leave \n", __FUNCTION__);
+
+ return ret;
+}
+
+
+int metadata_extractor_create(metadata_extractor_h* metadata)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+
+ LOGI("[%s] enter \n", __FUNCTION__);
+
+ if(metadata == NULL)
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ metadata_extractor_s* _metadata = (metadata_extractor_s*)calloc(1,sizeof(metadata_extractor_s));
+ if(_metadata == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY);
+ return METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY;
+ }
+
+ *metadata = (metadata_extractor_h)_metadata;
+
+ LOGI("[%s] leave \n", __FUNCTION__);
+
+ return ret;
+}
+
+int metadata_extractor_set_path(metadata_extractor_h metadata, const char* path)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s* _metadata = (metadata_extractor_s*)metadata;
+
+ LOGI("[%s] enter \n", __FUNCTION__);
+
+ if((_metadata == NULL) || (path == NULL))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ LOGI("[%s] path [%s] \n", __FUNCTION__, path);
+
+ if((_metadata->attr_h) || (_metadata->tag_h))
+ {
+ LOGI("[%s]Handle already exist", __FUNCTION__);
+ ret = __metadata_extractor_destroy_handle(_metadata);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ LOGE("[%s]Fail to destory handle(0x%08x)", __FUNCTION__, ret);
+ return ret;
+ }
+
+ memset(_metadata, 0x00, sizeof(metadata_extractor_s));
+ }
+
+ ret = __metadata_extractor_create_content_attrs(_metadata, path);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ ret = __metadata_extractor_create_tag_attr(_metadata, path);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ LOGI("[%s] leave \n", __FUNCTION__);
+
+ return ret;
+}
+
+int metadata_extractor_destroy(metadata_extractor_h metadata)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+
+ LOGI("[%s] enter \n", __FUNCTION__);
+
+ if(!metadata)
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = __metadata_extractor_destroy_handle(metadata);
+
+ SAFE_FREE(metadata);
+
+ LOGI("[%s] leave \n", __FUNCTION__);
+
+ return ret;
+}
+
+int metadata_extractor_get_synclyrics(metadata_extractor_h metadata, int index, unsigned long *time_stamp, char ** lyrics)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s* _metadata = (metadata_extractor_s*)metadata;
+ unsigned long _time_info = 0;
+ char * _lyrics = NULL;
+ int _synclyrics_num = 0;
+
+ if((!_metadata) || (!_metadata->attr_h) || (!_metadata->tag_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = __metadata_extractor_get_synclyrics_pair_num(_metadata, &_synclyrics_num);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ if((_synclyrics_num > 0) && (index < _synclyrics_num))
+ {
+ ret = mm_file_get_synclyrics_info((MMHandleType)_metadata->tag_h, index, &_time_info, &_lyrics);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s]ERROR_UNKNOWN(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *lyrics = _lyrics;
+ *time_stamp = _time_info;
+ }
+ else
+ {
+ *lyrics = NULL;
+ *time_stamp = 0;
+ }
+
+ return ret;
+}
+
+int metadata_extractor_get_metadata(metadata_extractor_h metadata, metadata_extractor_attr_e attribute, char ** value)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s* _metadata = (metadata_extractor_s*)metadata;
+ int i_value = 0;
+ double d_value = 0;
+ char * s_value = NULL;
+ int is_string = 0;
+ int is_double = 0;
+
+ if((!_metadata) || (!_metadata->attr_h) || (!_metadata->tag_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ switch (attribute) {
+ case METADATA_DURATION:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_duration(_metadata, &i_value);
+ break;
+ }
+ case METADATA_VIDEO_BITRATE:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_video_bitrate(_metadata, &i_value);
+ break;
+ }
+ case METADATA_VIDEO_FPS:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_video_FPS(_metadata, &i_value);
+ break;
+ }
+ case METADATA_VIDEO_WIDTH:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_video_width(_metadata, &i_value);
+ break;
+ }
+ case METADATA_VIDEO_HEIGHT:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_video_height(_metadata, &i_value);
+ break;
+ }
+ case METADATA_HAS_VIDEO:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_video_track_count(_metadata, &i_value);
+ break;
+ }
+ case METADATA_AUDIO_BITRATE:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_audio_bitrate(_metadata, &i_value);
+ break;
+ }
+ case METADATA_AUDIO_CHANNELS:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_audio_channel(_metadata, &i_value);
+ break;
+ }
+ case METADATA_AUDIO_SAMPLERATE:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_audio_samplerate(_metadata, &i_value);
+ break;
+ }
+ case METADATA_HAS_AUDIO:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_audio_track_count(_metadata, &i_value);
+ break;
+ }
+ case METADATA_ARTIST:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_artist(_metadata, &s_value);
+ break;
+ }
+ case METADATA_TITLE:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_title(_metadata, &s_value);
+ break;
+ }
+ case METADATA_ALBUM:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_album(_metadata, &s_value);
+ break;
+ }
+ case METADATA_GENRE:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_genre(_metadata, &s_value);
+ break;
+ }
+ case METADATA_AUTHOR:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_author(_metadata, &s_value);
+ break;
+ }
+ case METADATA_COPYRIGHT:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_copyright(_metadata, &s_value);
+ break;
+ }
+ case METADATA_DATE:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_date(_metadata, &s_value);
+ break;
+ }
+ case METADATA_DESCRIPTION:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_description(_metadata, &s_value);
+ break;
+ }
+ case METADATA_TRACK_NUM:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_track_num(_metadata, &s_value);
+ break;
+ }
+ case METADATA_CLASSIFICATION:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_classification(_metadata, &s_value);
+ break;
+ }
+ case METADATA_RATING:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_rating(_metadata, &s_value);
+ break;
+ }
+ case METADATA_LONGITUDE:
+ {
+ is_double = 1;
+ ret = __metadata_extractor_get_longitude(_metadata, &d_value);
+ break;
+ }
+ case METADATA_LATITUDE:
+ {
+ is_double = 1;
+ ret = __metadata_extractor_get_latitude(_metadata, &d_value);
+ break;
+ }
+ case METADATA_ALTITUDE:
+ {
+ is_double = 1;
+ ret = __metadata_extractor_get_altitude(_metadata, &d_value);
+ break;
+ }
+ case METADATA_CONDUCTOR:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_conductor(_metadata, &s_value);
+ break;
+ }
+ case METADATA_UNSYNCLYRICS:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_unsynclyrics(_metadata, &s_value);
+ break;
+ }
+ case METADATA_SYNCLYRICS_NUM:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_synclyrics_pair_num(_metadata, &i_value);
+ break;
+ }
+ case METADATA_RECDATE:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_recording_date(_metadata, &s_value);
+ break;
+ }
+ default:
+ {
+ LOGE("[%s]INVALID_PARAMETER [%d] (0x%08x)", __FUNCTION__, attribute, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ *value = NULL;
+ return ret;
+ }
+
+ if(is_string)
+ {
+ if((s_value != NULL) && (strlen(s_value) > 0))
+ {
+ *value = strdup(s_value);
+ if(*value == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY);
+ return METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else
+ {
+ *value = NULL;
+ }
+ }
+ else
+ {
+ char metadata[META_MAX_LEN] = {0, };
+
+ if(is_double)
+ {
+ snprintf(metadata, sizeof(metadata), "%f", d_value);
+ }
+ else
+ {
+ snprintf(metadata, sizeof(metadata), "%d", i_value);
+ }
+
+ *value = strdup(metadata);
+ }
+
+ return ret;
+}
+
+int metadata_extractor_get_artwork(metadata_extractor_h metadata, void ** artwork, int * size, char ** mime_type)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s* _metadata = (metadata_extractor_s*)metadata;
+ void * _artwork = NULL;
+ int _artwork_size = 0;
+ char * _artwork_mime = NULL;
+
+ if((!_metadata) || (!_metadata->attr_h) || (!_metadata->tag_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = __metadata_extractor_get_artwork(_metadata, &_artwork, &_artwork_size);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ if((_artwork_size > 0) && (_artwork != NULL))
+ {
+ ret = __metadata_extractor_get_artwork_mime(_metadata, &_artwork_mime);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ *artwork = NULL;
+ *size = 0;
+
+ return ret;
+ }
+
+ *artwork = calloc(1, _artwork_size);
+ memcpy(*artwork, _artwork, _artwork_size);
+ *size = _artwork_size;
+
+ if((_artwork_mime != NULL) && (strlen(_artwork_mime) > 0))
+ {
+ *mime_type = strdup(_artwork_mime);
+ if(*mime_type == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY);
+ return METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else
+ {
+ *mime_type = NULL;
+ }
+
+ }
+ else
+ {
+ *artwork = NULL;
+ *mime_type = NULL;
+ *size = 0;
+ }
+
+ return ret;
+}
+
+int metadata_extractor_get_frame(metadata_extractor_h metadata, void ** frame, int * size)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s* _metadata = (metadata_extractor_s*)metadata;
+ void * _frame = NULL;
+ int _frame_size = 0;
+
+ if((!_metadata) || (!_metadata->attr_h) || (!_metadata->tag_h))
+ {
+ LOGE("[%s]INVALID_PARAMETER(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = __metadata_extractor_get_video_thumbnail(_metadata, &_frame, &_frame_size);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ if((_frame_size > 0) && (_frame != NULL))
+ {
+ *frame = calloc(1, _frame_size);
+ if(*frame == NULL)
+ {
+ LOGE("[%s]OUT_OF_MEMORY(0x%08x)", __FUNCTION__, METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY);
+ return METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY;
+ }
+ memcpy(*frame, _frame, _frame_size);
+ *size = _frame_size;
+ }
+ else
+ {
+ *frame = NULL;
+ *size = 0;
+ }
+
+ return ret;
+}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100755 index 0000000..f2e2846 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,18 @@ +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() diff --git a/test/multimeida_metadata_extractor_test.c b/test/multimeida_metadata_extractor_test.c new file mode 100755 index 0000000..01ab89d --- /dev/null +++ b/test/multimeida_metadata_extractor_test.c @@ -0,0 +1,260 @@ +/*
+* 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 <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <dlog.h>
+#include <metadata_extractor.h>
+
+#define SAFE_FREE(src) { if(src) {free(src); src = NULL;}}
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_METADATAEXTRACTOR"
+
+
+static int _is_file_exist (const char *filename);
+static bool __capi_metadata_extractor(metadata_extractor_h metadata);
+
+static int _is_file_exist (const char *filename)
+{
+ int ret = 1;
+ if (filename) {
+ const char* to_access = (strstr(filename,"file://")!=NULL)? filename+7:filename;
+ ret = access (to_access, R_OK );
+ if (ret != 0) {
+ LOGI("file [%s] not found.\n", to_access);
+ }
+ }
+ return !ret;
+}
+
+//bool capi_metadata_extractor_cb(metadata_extractor_h metadata, void* user_data)
+static bool __capi_metadata_extractor(metadata_extractor_h metadata)
+{
+ char * duration = 0;
+ char * audio_bitrate = 0;
+ char * audio_channel = 0;
+ char * audio_samplerate = 0;
+ char * audio_track_cnt = 0;
+ char * video_bitrate = 0;
+ char * video_fps = 0;
+ char * video_width = 0;
+ char * video_height = 0;
+ char * video_track_cnt = 0;
+ void * video_thumbnail = NULL;
+ int video_thumbnail_len = 0;
+
+ /*Tag info*/
+ char * artist = NULL;
+ char * title = NULL;
+ char * album = NULL;
+ char * genre = NULL;
+ char * author = NULL;
+ char * copyright = NULL;
+ char * date = NULL;
+ char * description = NULL;
+ void * artwork = NULL;
+ int artwork_size = 0;
+ char * artwork_mime = NULL;
+ char * track_num = NULL;
+ char * classification = NULL;
+ char * rating = NULL;
+ char * longitude = 0;
+ char * latitude = 0;
+ char * altitude = 0;
+ char * conductor = NULL;
+ char * unsynclyrics = NULL;
+ char * synclyrics_num = 0;
+ char * rec_date = NULL;
+
+ int idx = 0;
+ unsigned long time_info = 0;
+ char * lyrics = NULL;
+
+ if(metadata == NULL)
+ {
+ LOGI("Invalid handle \n");
+ return false;
+ }
+
+ /*Get metadata*/
+ metadata_extractor_get_metadata(metadata, METADATA_DURATION, &duration);
+ LOGI("duration = [%s]\n", duration);
+ metadata_extractor_get_metadata(metadata, METADATA_AUDIO_BITRATE, &audio_bitrate);
+ LOGI("audio_bitrate = [%s]bps\n", audio_bitrate);
+ metadata_extractor_get_metadata(metadata, METADATA_AUDIO_CHANNELS, &audio_channel);
+ LOGI("audio_channel = [%s]\n", audio_channel);
+ metadata_extractor_get_metadata(metadata, METADATA_AUDIO_SAMPLERATE, &audio_samplerate);
+ LOGI("audio_samplerate = [%s]Hz\n", audio_samplerate);
+ metadata_extractor_get_metadata(metadata, METADATA_HAS_AUDIO, &audio_track_cnt);
+ LOGI("audio_track_cnt = [%s]\n", audio_track_cnt);
+ metadata_extractor_get_metadata(metadata, METADATA_VIDEO_BITRATE, &video_bitrate);
+ LOGI("video_bitrate = [%s]bps\n", video_bitrate);
+ metadata_extractor_get_metadata(metadata, METADATA_VIDEO_FPS, &video_fps);
+ LOGI("video_fps = [%s]\n", video_fps);
+ metadata_extractor_get_metadata(metadata, METADATA_VIDEO_WIDTH, &video_width);
+ LOGI("video_width = [%s]\n", video_width);
+ metadata_extractor_get_metadata(metadata, METADATA_VIDEO_HEIGHT, &video_height);
+ LOGI("video_height = [%s]\n", video_height);
+ metadata_extractor_get_metadata(metadata, METADATA_HAS_VIDEO, &video_track_cnt);
+ LOGI("video_track_cnt = [%s]\n", video_track_cnt);
+
+ metadata_extractor_get_metadata(metadata, METADATA_ARTIST, &artist);
+ LOGI("artist = [%s]\n", artist);
+ metadata_extractor_get_metadata(metadata, METADATA_TITLE, &title);
+ LOGI("title = [%s]\n", title);
+ metadata_extractor_get_metadata(metadata, METADATA_ALBUM, &album);
+ LOGI("album = [%s]\n", album);
+ metadata_extractor_get_metadata(metadata, METADATA_GENRE, &genre);
+ LOGI("genre = [%s]\n", genre);
+ metadata_extractor_get_metadata(metadata, METADATA_AUTHOR, &author);
+ LOGI("author = [%s]\n", author);
+ metadata_extractor_get_metadata(metadata, METADATA_COPYRIGHT, ©right);
+ LOGI("copyright = [%s]\n", copyright);
+ metadata_extractor_get_metadata(metadata, METADATA_DATE, &date);
+ LOGI("date = [%s]\n", date);
+ metadata_extractor_get_metadata(metadata, METADATA_DESCRIPTION, &description);
+ LOGI("description = [%s]\n", description);
+ metadata_extractor_get_metadata(metadata, METADATA_TRACK_NUM, &track_num);
+ LOGI("track_num = [%s]\n", track_num);
+ metadata_extractor_get_metadata(metadata, METADATA_CLASSIFICATION, &classification);
+ LOGI("classification = [%s]\n", classification);
+ metadata_extractor_get_metadata(metadata, METADATA_RATING, &rating);
+ LOGI("rating = [%s]\n", rating);
+ metadata_extractor_get_metadata(metadata, METADATA_LONGITUDE, &longitude);
+ LOGI("longitude = [%s]\n", longitude);
+ metadata_extractor_get_metadata(metadata, METADATA_LATITUDE, &latitude);
+ LOGI("latitude = [%s]\n", latitude);
+ metadata_extractor_get_metadata(metadata, METADATA_ALTITUDE, &altitude);
+ LOGI("altitude = [%s]\n", altitude);
+ metadata_extractor_get_metadata(metadata, METADATA_CONDUCTOR, &conductor);
+ LOGI("conductor = [%s]\n", conductor);
+ metadata_extractor_get_metadata(metadata, METADATA_UNSYNCLYRICS, &unsynclyrics);
+ LOGI("unsynclyrics = [%s]\n", unsynclyrics);
+ metadata_extractor_get_metadata(metadata, METADATA_RECDATE, &rec_date);
+ LOGI("rec_date = [%s]\n", rec_date);
+
+ metadata_extractor_get_metadata(metadata, METADATA_SYNCLYRICS_NUM, &synclyrics_num);
+ int s_num = atoi(synclyrics_num);
+ for(idx = 0; idx < s_num; idx++)
+ {
+ metadata_extractor_get_synclyrics(metadata, idx, &time_info, &lyrics);
+ LOGI("[%2d][%6d][%s]\n", idx, time_info, lyrics);
+ SAFE_FREE(lyrics);
+ }
+
+ /*Get Artwork*/
+ metadata_extractor_get_artwork(metadata, &artwork, &artwork_size, &artwork_mime);
+ LOGI("artwork = [%p], artwork_size = [%d]\n", artwork, artwork_size);
+ LOGI("artwork_mime = [%s]\n", artwork_mime);
+
+ /*Get Thumbnail*/
+ metadata_extractor_get_frame(metadata, &video_thumbnail, &video_thumbnail_len);
+ LOGI("video_thumbnail[%p], video_thumbnail_len = [%d]\n\n", video_thumbnail, video_thumbnail_len);
+
+ SAFE_FREE(duration );
+ SAFE_FREE(audio_bitrate );
+ SAFE_FREE(audio_channel );
+ SAFE_FREE(audio_samplerate );
+ SAFE_FREE(audio_track_cnt );
+ SAFE_FREE(video_bitrate );
+ SAFE_FREE(video_fps );
+ SAFE_FREE(video_width );
+ SAFE_FREE(video_height );
+ SAFE_FREE(video_track_cnt );
+ SAFE_FREE(video_thumbnail);
+
+ SAFE_FREE(artist);
+ SAFE_FREE(title);
+ SAFE_FREE(album);
+ SAFE_FREE(genre);
+ SAFE_FREE(author);
+ SAFE_FREE(copyright);
+ SAFE_FREE(date);
+ SAFE_FREE(description);
+ SAFE_FREE(artwork);
+ SAFE_FREE(artwork_mime);
+ SAFE_FREE(track_num);
+ SAFE_FREE(classification);
+ SAFE_FREE(rating);
+ SAFE_FREE(longitude);
+ SAFE_FREE(latitude);
+ SAFE_FREE(altitude);
+ SAFE_FREE(conductor);
+ SAFE_FREE(unsynclyrics);
+ SAFE_FREE(synclyrics_num);
+ SAFE_FREE(rec_date);
+
+ return true;
+
+}
+
+int main(int argc, char *argv[])
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_h metadata;
+ int idx = 0;
+ int cnt = argc -1;
+ LOGI("--- metadata extractor test start ---\n\n");
+
+ if(cnt < 1)
+ {
+ LOGI("type file path plz. [%d]\n", cnt);
+ return 0;
+ }
+
+ ret = metadata_extractor_create(&metadata);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ LOGE("Fail metadata_extractor_create [%d]\n", ret);
+ return 0;
+ }
+
+ for(idx = 0; idx < cnt; idx++)
+ {
+ LOGI("--------------------------------------------\n");
+ if (!_is_file_exist (argv[idx+1]))
+ {
+ LOGI("there is no file [%s]\n", argv[idx+1]);
+ goto exception;
+ }
+
+ ret = metadata_extractor_set_path(metadata, argv[idx+1]);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ LOGE("Fail metadata_extractor_set_path [%d]\n", ret);
+ goto exception;
+ }
+
+ __capi_metadata_extractor(metadata);
+ LOGI("--------------------------------------------\n");
+
+ }
+
+exception:
+ ret = metadata_extractor_destroy(metadata);
+ LOGI("metadata_extractor_destroy [%d]\n", ret);
+
+ LOGI("--- metadata extractor test end ---\n\n");
+
+ return 0;
+
+}
+
|