--- /dev/null
+CMakeCache.txt
+*/CMakeFiles/*
+*.cmake
+CMakeFiles*
+*.a
+*.so
+Testing
+cmake.depends
+cmake.check_depends
+cmake.check_cache
+core
+core.*
+gmon.out
+install_manifest.txt
+*~
+.kdev_include_paths
+src.kdev4
+.cproject
+.project
+tet_captured
+tet_lock
+*.pc
+Makefile
+*-test
+*-test_*
+*tester.c
--- /dev/null
+Kangho Hur <kanho.hur@samsung.com>
+Seungkeun Lee <sngn.lee@samsung.com>
--- /dev/null
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-media-player")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(dependents "dlog mm-player capi-base-common capi-media-sound-manager")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-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/media
+ 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}/media)
+
+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)
+
--- /dev/null
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+ Apache License\r
+ Version 2.0, January 2004\r
+ http://www.apache.org/licenses/\r
+\r
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+ 1. Definitions.\r
+\r
+ "License" shall mean the terms and conditions for use, reproduction,\r
+ and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+ "Licensor" shall mean the copyright owner or entity authorized by\r
+ the copyright owner that is granting the License.\r
+\r
+ "Legal Entity" shall mean the union of the acting entity and all\r
+ other entities that control, are controlled by, or are under common\r
+ control with that entity. For the purposes of this definition,\r
+ "control" means (i) the power, direct or indirect, to cause the\r
+ direction or management of such entity, whether by contract or\r
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+ outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+ "You" (or "Your") shall mean an individual or Legal Entity\r
+ exercising permissions granted by this License.\r
+\r
+ "Source" form shall mean the preferred form for making modifications,\r
+ including but not limited to software source code, documentation\r
+ source, and configuration files.\r
+\r
+ "Object" form shall mean any form resulting from mechanical\r
+ transformation or translation of a Source form, including but\r
+ not limited to compiled object code, generated documentation,\r
+ and conversions to other media types.\r
+\r
+ "Work" shall mean the work of authorship, whether in Source or\r
+ Object form, made available under the License, as indicated by a\r
+ copyright notice that is included in or attached to the work\r
+ (an example is provided in the Appendix below).\r
+\r
+ "Derivative Works" shall mean any work, whether in Source or Object\r
+ form, that is based on (or derived from) the Work and for which the\r
+ editorial revisions, annotations, elaborations, or other modifications\r
+ represent, as a whole, an original work of authorship. For the purposes\r
+ of this License, Derivative Works shall not include works that remain\r
+ separable from, or merely link (or bind by name) to the interfaces of,\r
+ the Work and Derivative Works thereof.\r
+\r
+ "Contribution" shall mean any work of authorship, including\r
+ the original version of the Work and any modifications or additions\r
+ to that Work or Derivative Works thereof, that is intentionally\r
+ submitted to Licensor for inclusion in the Work by the copyright owner\r
+ or by an individual or Legal Entity authorized to submit on behalf of\r
+ the copyright owner. For the purposes of this definition, "submitted"\r
+ means any form of electronic, verbal, or written communication sent\r
+ to the Licensor or its representatives, including but not limited to\r
+ communication on electronic mailing lists, source code control systems,\r
+ and issue tracking systems that are managed by, or on behalf of, the\r
+ Licensor for the purpose of discussing and improving the Work, but\r
+ excluding communication that is conspicuously marked or otherwise\r
+ designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+ "Contributor" shall mean Licensor and any individual or Legal Entity\r
+ on behalf of whom a Contribution has been received by Licensor and\r
+ subsequently incorporated within the Work.\r
+\r
+ 2. Grant of Copyright License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ copyright license to reproduce, prepare Derivative Works of,\r
+ publicly display, publicly perform, sublicense, and distribute the\r
+ Work and such Derivative Works in Source or Object form.\r
+\r
+ 3. Grant of Patent License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ (except as stated in this section) patent license to make, have made,\r
+ use, offer to sell, sell, import, and otherwise transfer the Work,\r
+ where such license applies only to those patent claims licensable\r
+ by such Contributor that are necessarily infringed by their\r
+ Contribution(s) alone or by combination of their Contribution(s)\r
+ with the Work to which such Contribution(s) was submitted. If You\r
+ institute patent litigation against any entity (including a\r
+ cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+ or a Contribution incorporated within the Work constitutes direct\r
+ or contributory patent infringement, then any patent licenses\r
+ granted to You under this License for that Work shall terminate\r
+ as of the date such litigation is filed.\r
+\r
+ 4. Redistribution. You may reproduce and distribute copies of the\r
+ Work or Derivative Works thereof in any medium, with or without\r
+ modifications, and in Source or Object form, provided that You\r
+ meet the following conditions:\r
+\r
+ (a) You must give any other recipients of the Work or\r
+ Derivative Works a copy of this License; and\r
+\r
+ (b) You must cause any modified files to carry prominent notices\r
+ stating that You changed the files; and\r
+\r
+ (c) You must retain, in the Source form of any Derivative Works\r
+ that You distribute, all copyright, patent, trademark, and\r
+ attribution notices from the Source form of the Work,\r
+ excluding those notices that do not pertain to any part of\r
+ the Derivative Works; and\r
+\r
+ (d) If the Work includes a "NOTICE" text file as part of its\r
+ distribution, then any Derivative Works that You distribute must\r
+ include a readable copy of the attribution notices contained\r
+ within such NOTICE file, excluding those notices that do not\r
+ pertain to any part of the Derivative Works, in at least one\r
+ of the following places: within a NOTICE text file distributed\r
+ as part of the Derivative Works; within the Source form or\r
+ documentation, if provided along with the Derivative Works; or,\r
+ within a display generated by the Derivative Works, if and\r
+ wherever such third-party notices normally appear. The contents\r
+ of the NOTICE file are for informational purposes only and\r
+ do not modify the License. You may add Your own attribution\r
+ notices within Derivative Works that You distribute, alongside\r
+ or as an addendum to the NOTICE text from the Work, provided\r
+ that such additional attribution notices cannot be construed\r
+ as modifying the License.\r
+\r
+ You may add Your own copyright statement to Your modifications and\r
+ may provide additional or different license terms and conditions\r
+ for use, reproduction, or distribution of Your modifications, or\r
+ for any such Derivative Works as a whole, provided Your use,\r
+ reproduction, and distribution of the Work otherwise complies with\r
+ the conditions stated in this License.\r
+\r
+ 5. Submission of Contributions. Unless You explicitly state otherwise,\r
+ any Contribution intentionally submitted for inclusion in the Work\r
+ by You to the Licensor shall be under the terms and conditions of\r
+ this License, without any additional terms or conditions.\r
+ Notwithstanding the above, nothing herein shall supersede or modify\r
+ the terms of any separate license agreement you may have executed\r
+ with Licensor regarding such Contributions.\r
+\r
+ 6. Trademarks. This License does not grant permission to use the trade\r
+ names, trademarks, service marks, or product names of the Licensor,\r
+ except as required for reasonable and customary use in describing the\r
+ origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+ 7. Disclaimer of Warranty. Unless required by applicable law or\r
+ agreed to in writing, Licensor provides the Work (and each\r
+ Contributor provides its Contributions) on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+ implied, including, without limitation, any warranties or conditions\r
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+ PARTICULAR PURPOSE. You are solely responsible for determining the\r
+ appropriateness of using or redistributing the Work and assume any\r
+ risks associated with Your exercise of permissions under this License.\r
+\r
+ 8. Limitation of Liability. In no event and under no legal theory,\r
+ whether in tort (including negligence), contract, or otherwise,\r
+ unless required by applicable law (such as deliberate and grossly\r
+ negligent acts) or agreed to in writing, shall any Contributor be\r
+ liable to You for damages, including any direct, indirect, special,\r
+ incidental, or consequential damages of any character arising as a\r
+ result of this License or out of the use or inability to use the\r
+ Work (including but not limited to damages for loss of goodwill,\r
+ work stoppage, computer failure or malfunction, or any and all\r
+ other commercial damages or losses), even if such Contributor\r
+ has been advised of the possibility of such damages.\r
+\r
+ 9. Accepting Warranty or Additional Liability. While redistributing\r
+ the Work or Derivative Works thereof, You may choose to offer,\r
+ and charge a fee for, acceptance of support, warranty, indemnity,\r
+ or other liability obligations and/or rights consistent with this\r
+ License. However, in accepting such obligations, You may act only\r
+ on Your own behalf and on Your sole responsibility, not on behalf\r
+ of any other Contributor, and only if You agree to indemnify,\r
+ defend, and hold each Contributor harmless for any liability\r
+ incurred by, or claims asserted against, such Contributor by reason\r
+ of your accepting any such warranty or additional liability.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ APPENDIX: How to apply the Apache License to your work.\r
+\r
+ To apply the Apache License to your work, attach the following\r
+ boilerplate notice, with the fields enclosed by brackets "[]"\r
+ replaced with your own identifying information. (Don't include\r
+ the brackets!) The text should be enclosed in the appropriate\r
+ comment syntax for the file format. We also recommend that a\r
+ file or class name and description of purpose be included on the\r
+ same "printed page" as the copyright notice for easier\r
+ identification within third-party archives.\r
+\r
+ Copyright [yyyy] [name of copyright owner]\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+\r
+\r
--- /dev/null
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/media
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir} @PC_CFLAGS@
+
--- /dev/null
+/usr/include/*
+/usr/include/*/*
+/usr/lib/pkgconfig/*.pc
+
--- /dev/null
+/usr/lib/lib*.so*
--- /dev/null
+capi-media-player (0.1.0-5) unstable; urgency=low
+
+ * Initial release.
+
+ -- Kangho Hur <kangho.hur@samsung.com> Wed, 07 Dec 2011 12:54:23 +0900
--- /dev/null
+
+Source: capi-media-player
+Section: libs
+Priority: extra
+Maintainer: Kangho Hur <kangho.hur@samsung.com>, Seungkeun Lee <sngn.lee@samsung.com>
+Build-Depends: debhelper (>= 5), dlog-dev, libmm-player-dev, libmm-player-internal-dev, capi-base-common-dev, capi-media-sound-manager-dev
+
+Package: capi-media-player
+Architecture: any
+Depends: ${shilbs:Depends}, ${misc:Depends}
+Description: A Media Player library in Tizen Native API
+
+Package: capi-media-player-dev
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-player (= ${Source-Version}), dlog-dev, libmm-player-dev, libmm-player-internal-dev, capi-base-common-dev
+Description: A Media Player library in Tizen Native API (DEV)
+
+Package: capi-media-player-dbg
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-player (= ${Source-Version})
+Description: A Media Player library in Tizen Native API (DBG)
+
--- /dev/null
+#!/usr/bin/make -f
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+CMAKE_ROOT_DIR ?= $(CURDIR)
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake ..
+ touch configure-stamp
+
+
+build: build-stamp
+build-stamp: configure-stamp
+ dh_testdir
+ cd $(CMAKE_BUILD_DIR) && $(MAKE)
+ touch $@
+
+clean:
+ cd $(CMAKE_ROOT_DIR)
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+ rm -f `find . -name *.pc`
+ rm -rf $(CMAKE_BUILD_DIR)
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+binary-indep: build install
+
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ dh_installexamples
+ dh_install --sourcedir=debian/tmp
+ dh_installman
+ dh_link
+ dh_strip --dbg-package=capi-media-player-dbg
+ dh_fixperms
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
+
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __TIZEN_MEDIA_PLAYER_H__
+#define __TIZEN_MEDIA_PLAYER_H__
+
+#include <tizen.h>
+#include <sound_manager.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PLAYER_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x20
+
+/**
+ * @file player.h
+ * @brief This file contains the media player API.
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_PLAYER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Media player handle type.
+ */
+typedef struct player_s *player_h;
+
+/**
+ * @brief Enumerations of media player state
+ */
+typedef enum
+{
+ PLAYER_STATE_NONE, /**< Player is not created */
+ PLAYER_STATE_IDLE, /**< Player is created, but not prepared */
+ PLAYER_STATE_READY, /**< Player is ready to play media */
+ PLAYER_STATE_PLAYING, /**< Player is playing media */
+ PLAYER_STATE_PAUSED, /**< Player is paused while playing media */
+} player_state_e;
+
+
+
+/**
+ * @brief Error codes for media player
+ */
+typedef enum
+{
+ PLAYER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ PLAYER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ PLAYER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ PLAYER_ERROR_NO_SUCH_FILE = TIZEN_ERROR_NO_SUCH_FILE, /**< No such file or directory */
+ PLAYER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
+ PLAYER_ERROR_SEEK_FAILED = PLAYER_ERROR_CLASS | 0x01 , /**< Seek operation failure */
+ PLAYER_ERROR_INVALID_STATE = PLAYER_ERROR_CLASS | 0x02 , /**< Invalid state */
+ PLAYER_ERROR_NOT_SUPPORTED_FILE = PLAYER_ERROR_CLASS | 0x03 , /**< Not supported file format */
+ PLAYER_ERROR_INVALID_URI = PLAYER_ERROR_CLASS | 0x04 , /**< Invalid URI */
+ PLAYER_ERROR_SOUND_POLICY = PLAYER_ERROR_CLASS | 0x05 , /**< Sound policy error */
+ PLAYER_ERROR_CONNECTION_FAILED = PLAYER_ERROR_CLASS | 0x06 /**< Streaming connection failed */
+} player_error_e;
+
+/**
+ * @brief Enumerations of player interrupted type
+ */
+typedef enum
+{
+ PLAYER_INTERRUPTED_BY_OTHER_APP = 0, /**< Interrupted by another application*/
+ PLAYER_INTERRUPTED_BY_CALL_START, /**< Interrupted by incoming call*/
+ PLAYER_INTERRUPTED_BY_CALL_END, /**< Interrupted by call ending*/
+ PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphone*/
+ PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by resource conflict*/
+ PLAYER_INTERRUPTED_BY_ALARM_START, /**< Interrupted by alarm starting*/
+ PLAYER_INTERRUPTED_BY_ALARM_END, /**< Interrupted by alarm ending*/
+} player_interrupted_code_e;
+
+/**
+ * @brief
+ * Enumerations of display type
+ */
+typedef enum
+{
+ PLAYER_DISPLAY_TYPE_X11 = 0, /**< X surface display */
+ PLAYER_DISPLAY_TYPE_EVAS = 1, /**< Evas image object surface display */
+ PLAYER_DISPLAY_TYPE_NONE = 3 /**< This just disposes of buffers */
+} player_display_type_e;
+
+/**
+ * @brief Player display handle
+ *
+ */
+typedef void* player_display_h;
+
+#ifndef GET_DISPLAY
+/**
+ * @brief Gets a display handle from x window id or evas object
+ */
+#define GET_DISPLAY(x) (void*)(x)
+#endif
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_PLAYER_X11_DISPLAY_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumerations of x surface display rotation type.
+ */
+typedef enum
+{
+ PLAYER_DISPLAY_ROTATION_NONE, /**< Display is not rotated */
+ PLAYER_DISPLAY_ROTATION_90, /**< Display is rotated 90 degrees */
+ PLAYER_DISPLAY_ROTATION_180, /**< Display is rotated 180 degrees */
+ PLAYER_DISPLAY_ROTATION_270, /**< Display is rotated 270 degrees */
+ PLAYER_DISPLAY_ROTATION_FLIP_HORZ, /**< flip display horizontally */
+ PLAYER_DISPLAY_ROTATION_FLIP_VERT, /**< flip display vertically */
+} player_display_rotation_e;
+
+/**
+ * @brief Enumerations of x surface display aspect ratio
+ */
+typedef enum
+{
+ PLAYER_DISPLAY_MODE_LETTER_BOX = 0, /**< Letter box*/
+ PLAYER_DISPLAY_MODE_ORIGIN_SIZE, /**< Origin size*/
+ PLAYER_DISPLAY_MODE_FULL_SCREEN, /**< full-screen*/
+ PLAYER_DISPLAY_MODE_CROPPED_FULL, /**< Cropped full-screen*/
+} player_display_mode_e;
+
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_PLAYER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Called when the media player is started.
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre player_start() will cause this callback if you register this callback using player_set_started_cb()
+ * @see player_start()
+ * @see player_set_started_cb()
+ * @see player_unset_started_cb()
+ */
+typedef void (*player_started_cb)(void *user_data);
+
+/**
+ * @brief Called when the media player is completed.
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre It will be invoked when playback completed if you register this callback using player_set_completed_cb()
+ * @see player_set_completed_cb()
+ * @see player_unset_completed_cb()
+ */
+typedef void (*player_completed_cb)(void *user_data);
+
+
+/**
+ * @brief Called when the media player is paused.
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre player_pause() will cause this callback if you register this callback using player_set_paused_cb()
+ * @see player_pause()
+ * @see player_set_paused_cb()
+ * @see player_unset_paused_cb()
+ */
+typedef void (*player_paused_cb)(void *user_data);
+
+/**
+ * @brief Called when the media player is interrupted.
+ * @param[in] error_code The interrupted error code
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see player_set_interrupted_cb()
+ * @see player_unset_interrupted_cb()
+ */
+typedef void (*player_interrupted_cb)(player_interrupted_code_e code, void *user_data);
+
+/**
+ * @brief Called when the media player occured error.
+ * @param[in] error_code Error code
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see player_set_error_cb()
+ * @see player_unset_error_cb()
+ * @see #player_error_e
+ */
+typedef void (*player_error_cb)(int error_code, void *user_data);
+
+/**
+ * @brief Called when the buffering percentage of media playback is updated.
+ * @details If the buffer is full, it will return 100%.
+ * @param[in] percent The percentage of buffering completed (0~100)
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see player_set_buffering_cb()
+ * @see player_unset_buffering_cb()
+ */
+typedef void (*player_buffering_cb)(int percent, void *user_data);
+
+
+/**
+ * @brief Called when the subtitle is updated.
+ * @param[in] duration The duration of subtitle updated
+ * @param[in] text The text of subtitle updated
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see player_set_subtitle_updated_cb()
+ * @see player_unset_subtitle_updated_cb()
+ */
+typedef void (*player_subtitle_updated_cb)(unsigned long duration, char *text, void *user_data);
+
+/**
+ * @brief Called when the video is captured.
+ * @remarks The color space format of the captured image is #IMAGE_UTIL_COLORSPACE_RGB888.
+ * @remarks @a data must be released with @c free() by you.
+ * @param[in] data The captured image buffer
+ * @param[in] width The width of captured image
+ * @param[in] height The height of captured image
+ * @param[in] size The size of captured image
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see player_capture_video()
+ */
+typedef void (*player_video_captured_cb)(unsigned char *data, int width, int height, unsigned int size, void *user_data);
+
+/**
+ * @brief Creates a player handle for playing multimedia content.
+ * @remarks @a player must be released player_destroy() by you.
+ * @remarks
+ * Although you can create multiple player handles at the same time,
+ * the player cannot guarantee proper operation because of limited resources, such as
+ * audio or display device.
+ *
+ * @param[out] player A new handle to media player
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @post The player state will be #PLAYER_STATE_IDLE.
+ * @see player_destroy()
+ */
+int player_create(player_h *player);
+
+
+/**
+ * @brief Destroys the media player handle and releases all its resources.
+ *
+ * @remarks To completely shutdown player operation, call this function with a valid player handle from any player state.
+ *
+ * @param[in] player The handle to media player to be destroyed
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The player state should be #PLAYER_STATE_IDLE
+ * @post The player state will be #PLAYER_STATE_NONE.
+ * @see player_create()
+ */
+int player_destroy(player_h player);
+
+
+/**
+ * @brief Prepares the media player for playback.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_URI Invalid URI
+ * @retval #PLAYER_ERROR_NO_SUCH_FILE File not found
+ * @retval #PLAYER_ERROR_NOT_SUPPORTED_FILE Not supported file
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state should be #PLAYER_STATE_IDLE by player_create() or player_unprepare().. After that, call player_set_uri() to load the media content you want to play.
+ * @post The player state will be #PLAYER_STATE_READY.
+ * @see player_unprepare()
+ * @see player_set_uri()
+ */
+int player_prepare(player_h player);
+
+/**
+ * @brief Reset the media player.
+ * @details
+ * The most recently used media is reset and no longer associated with the player.
+ * Playback is no longer possible. If you want to use the player again, you will have to set the data URI and call
+ * player_prepare() again.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state should be #PLAYER_STATE_READY by player_prepare() or player_stop().
+ * @post The player state will be #PLAYER_STATE_IDLE.
+ * @see player_prepare()
+ */
+int player_unprepare(player_h player);
+
+/**
+ * @brief Sets the data source (file-path, http or rtsp URI) to use.
+ *
+ * @details
+ * Associates media contents, referred to by the URI, with the player.
+ * If the function call is successful, subsequent calls to player_prepare() and player_start() will start playing the media.
+ *
+ * @remarks
+ * If you use http or rtsp, URI should start with "http://" or "rtsp://". The default protocol is "file://".
+ * If you provide an invalid URI, you won't receive an error message until you call player_start().
+ *
+ * @param[in] player The handle to media player
+ * @param[in] uri Specifies the content location, such as the file path, the URI of the http or rtsp stream you want to play
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state should be #PLAYER_STATE_IDLE by player_prepare() or player_unprepare().
+ * @see player_set_memory_buffer()
+ */
+int player_set_uri(player_h player, const char * uri);
+
+/**
+ * @brief Sets memory as the data source.
+ *
+ * @details
+ * Associates media content, cached in memory, with the player. Unlike the case of player_set_uri(), the media resides in memory.
+ * If the function call is successful, subsequent calls to player_prepare() and player_start() will start playing the media.
+ *
+ * @remarks
+ * If you provide an invalid data, you won't receive an error message until you call player_start().
+ *
+ *
+ * @param[in] player The handle to media player
+ * @param[in] data The memory pointer of media data
+ * @param[in] size The size of media data
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state should be #PLAYER_STATE_IDLE by player_prepare() or player_unprepare().
+ * @see player_set_uri()
+ */
+int player_set_memory_buffer(player_h player, const void * data, int size);
+
+/**
+ * @brief Gets the player's current state.
+ * @param[in] player The handle to media player
+ * @param[out] state The current state of the player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see #player_state_e
+ */
+int player_get_state(player_h player, player_state_e *state);
+
+
+/**
+ * @brief Sets the player's volume.
+ *
+ * @details
+ * The range of @a left and @c right is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0.
+ * Setting this volume adjusts the player volume, not the system volume.
+ * To change system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API.
+ *
+ * @param[in] player The handle to media player
+ * @param[in] left Left volume scalar
+ * @param[in] right Right volume scalar
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_get_volume()
+ */
+int player_set_volume(player_h player, float left, float right);
+
+
+/**
+ * @brief Gets the player's current volume factor.
+ *
+ * @details The range of @a left and @a right is from 0 to 1.0, inclusive (1.0 = 100%). This function gets the player volume, not the system volume.
+ * To get the system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API.
+ *
+ * @param[in] player The handle to media player
+ * @param[out] left The current left volume scalar
+ * @param[out] right The current right volume scalar
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_volume()
+ */
+int player_get_volume(player_h player, float *left, float *right);
+
+/**
+ * @brief Sets the player's sound type.
+ *
+ * @remarks
+ * The default sound type of player is #SOUND_TYPE_MEDIA.
+ * To get current sound type, use the sound_manager_get_current_sound_type().
+ *
+ * @param[in] player The handle to media player
+ * @param[in] type The sound type
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see sound_manager_get_current_sound_type()
+ */
+int player_set_sound_type(player_h player, sound_type_e type);
+
+/**
+ * @brief Starts or resumes playback, asynchronously.
+ *
+ * @details Plays current media content, or resumes play if paused.
+ *
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @retval #PLAYER_ERROR_CONNECTION_FAILED Network connection failed
+ * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error
+ * @pre Call player_prepare() before calling this function.
+ * @pre The player state must be #PLAYER_STATE_READY by player_prepare() or #PLAYER_STATE_PAUSED by player_pause().
+ * @post The player state will be #PLAYER_STATE_PLAYING.
+ * @post It invokes player_started_cb() when playback starts, if you set a callback with player_set_started_cb().
+ * @post It invokes player_completed_cb() when playback completes, if you set a callback with player_set_completed_cb().
+ * @see player_prepare()
+ * @see player_stop()
+ * @see player_pause()
+ * @see player_set_started_cb()
+ * @see player_started_cb()
+ * @see player_set_completed_cb()
+ * @see player_completed_cb()
+ */
+int player_start(player_h player);
+
+
+/**
+ * @brief Stops playing media content.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid state
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error
+ * @pre The player state must be either #PLAYER_STATE_PLAYING by player_start() or #PLAYER_STATE_PAUSED by player_pause().
+ * @post The player state will be #PLAYER_STATE_READY.
+ * @see player_start()
+ * @see player_pause()
+ */
+int player_stop(player_h player);
+
+/**
+ * @brief Pauses the player, asynchronously.
+ *
+ * @remarks Playback can be resumed with player_start().
+ *
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid state
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error
+ * @pre The player state must be #PLAYER_STATE_PLAYING.
+ * @post The player state will be #PLAYER_STATE_READY.
+ * @post It invokes player_paused_cb() when playback is pauses, if you set a callback with player_set_paused_cb().
+ * @see player_start()
+ * @see player_set_paused_cb()
+ * @see player_unset_paused_cb()
+ * @see player_paused_cb()
+ */
+int player_pause(player_h player);
+
+/**
+ * @brief Sets the seek position for playback.
+ * @param[in] player The handle to media player
+ * @param[in] millisecond The position in milliseconds from the start to seek to
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_SEEK_FAILED Seek operation failure
+ * @pre The player state must be one of these: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_get_position()
+ * @see player_get_position_ratio()
+ * @see player_set_position_ratio()
+ */
+int player_set_position(player_h player, int millisecond);
+
+
+/**
+ * @brief Sets the playback position specified by percent of media content played.
+ * @param[in] player The handle to media player
+ * @param[in] percent The position in percentage from the start to seek to. \n The position is relative to content. (length, 0 = beginning, 100 = end)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_SEEK_FAILED Seek operation failure
+ * @pre The player state must be one of these: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_get_position()
+ * @see player_get_position_ratio()
+ * @see player_set_position()
+ */
+int player_set_position_ratio(player_h player, int percent);
+
+/**
+ * @brief Gets current position in milliseconds.
+ * @param[in] player The handle to media player
+ * @param[out] millisecond The current position in milliseconds
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_SEEK_FAILED Seek operation failure
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_get_position_ratio()
+ * @see player_set_position()
+ * @see player_set_position_ratio()
+ */
+
+int player_get_position(player_h player, int *millisecond);
+
+/**
+ * @brief Gets the playback position specified by percent of media content played.
+ * @param[in] player The handle to media player
+ * @param[out] percent The current position in percentage [0, 100]
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_SEEK_FAILED Seek operation failure
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_get_position()
+ * @see player_set_position()
+ * @see player_set_position_ratio()
+ */
+int player_get_position_ratio(player_h player, int *percent);
+
+/**
+ * @brief Sets the player's mute status.
+ *
+ * @details If the mute status is @c true, no sounds will be played. If @c false, sounds will be played at the previously set volume level. Until this function is called, by default the player is not muted.
+ *
+ * @param[in] player The handle to media player
+ * @param[in] muted New mute status: (@c true = mute, @c false = not muted)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_is_muted()
+ */
+int player_set_mute(player_h player, bool muted);
+
+/**
+ * @brief Gets the player's mute status.
+ *
+ * @details If the mute status is @c true, no sounds are played. If @c false, sounds are played at previously set volume level.
+ *
+ * @param[in] player The handle to media player
+ * @param[out] muted The current mute status: (@c true = mute, @c false = not muted)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_set_mute()
+ */
+int player_is_muted(player_h player, bool *muted);
+
+/**
+ * @brief Sets the player's looping status.
+ *
+ * @details If the looping status is @c true, playback will automatically restart upon finishing. If @c false, it won't. The default value is false.
+ *
+ * @param[in] player The handle to media player
+ * @param[in] looping New looping status: (@c true = looping, @c false = non-looping )
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_is_looping()
+ */
+int player_set_looping(player_h player, bool looping);
+
+
+/**
+ * @brief Gets the player's looping status.
+ *
+ * @details If the looping status is @c true, playback will automatically restart upon finishing. If @c false, it won't.
+ *
+ * @param[in] player The handle to media player
+ * @param[out] looping The looping status: (@c true = looping, @c false = non-looping )
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_set_looping()
+ */
+int player_is_looping(player_h player, bool *looping);
+
+/**
+ * @brief Gets the total running time of the associated media.
+ * @remarks The media source is associated with the player, using either player_set_uri() or player_set_memory_buffer().
+ * @param[in] player The handle to media player
+ * @param[out] duration The duration is in milliseconds
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_get_position()
+ * @see player_set_uri()
+ * @see player_set_memory_buffer()
+ */
+int player_get_duration(player_h player, int *duration);
+
+/**
+ * @brief Sets the video display.
+ * @param[in] player The handle to media player
+ * @param[in] type The display type
+ * @param[in] display The handle to display
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be #PLAYER_STATE_IDLE by player_prepare() or player_unprepare().
+ */
+int player_set_display(player_h player, player_display_type_e type, player_display_h display);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_PLAYER_X11_DISPLAY_MODULE
+ * @{
+ */
+
+/**
+ * @brief Sets the rotation settings of the x surface video display
+ * @details Use this function to change the video orientation to portrait mode.
+ * @remarks If current display type is not #PLAYER_DISPLAY_TYPE_X11, no operation is performed.
+ * @param[in] player The handle to media player
+ * @param[in] rotation The rotation of display
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
+ * @see player_get_x11_display_rotation()
+ */
+int player_set_x11_display_rotation(player_h player, player_display_rotation_e rotation);
+
+/**
+ * @brief Gets a rotation of the x surface video display
+ * @remarks If current display type is not #PLAYER_DISPLAY_TYPE_X11, no operation is performed.
+ * @param[in] player The handle to media player
+ * @param[out] rotation The current rotation of display
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see player_set_x11_display_rotation()
+ */
+int player_get_x11_display_rotation( player_h player, player_display_rotation_e *rotation);
+
+/**
+ * @brief Sets the visibility of the x surface video display
+ * @remarks If current display type is not #PLAYER_DISPLAY_TYPE_X11, no operation is performed.
+ * @param[in] player The handle to media player
+ * @param[in] rotation The visibility of display (@c true = visible, @c false = non-visible )
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
+ * @see player_is_x11_display_visible()
+ */
+int player_set_x11_display_visible(player_h player, bool visible);
+
+/**
+ * @brief Gets a visibility of the x surface video display
+ * @remarks If current display type is not #PLAYER_DISPLAY_TYPE_X11, no operation is performed.
+ * @param[in] player The handle to media player
+ * @param[out] visible The current visibility of display (@c true = visible, @c false = non-visible )
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see player_set_x11_display_visible()
+ */
+int player_is_x11_display_visible(player_h player, bool* visible);
+
+/**
+ * @brief Sets a x surface video display mode
+ * @remarks If current display type is not #PLAYER_DISPLAY_TYPE_X11, no operation is performed.
+ * @param[in] player The handle to media player
+ * @param[in] mode The display mode
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
+ * @see player_get_x11_display_mode()
+ */
+int player_set_x11_display_mode(player_h player, player_display_mode_e mode);
+
+/**
+ * @brief Gets the x surface video display mode
+ * @remarks If current display type is not #PLAYER_DISPLAY_TYPE_X11, no operation is performed.
+ * @param[in] player The handle to media player
+ * @param[out] mode The current display mode
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see player_set_x11_display_mode()
+ */
+int player_get_x11_display_mode(player_h player, player_display_mode_e *mode);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_PLAYER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Gets the video display's height and width.
+ * @param[in] player The handle to media player
+ * @param[out] width The width of video. It can be invalid value if there is no video, no display was set.
+ * @param[out] height The height of video. It can be invalid value if there is no video, no display was set.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be #PLAYER_STATE_READY by player_prepare() .
+ */
+int player_get_video_size(player_h player, int *width, int *height);
+
+/**
+ * @brief Sets a subtitle path.
+ * @remarks Only MicroDVD/SubViewer(*.sub), SAMI(*.smi), and SubRip(*.srt) subtitle formats are supported.
+ * @param[in] player The handle to media player
+ * @param[in] path The absolute path of the subtitle file
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state should be #PLAYER_STATE_IDLE by player_prepare() or player_unprepare().
+ */
+int player_set_subtitle_path(player_h player, char* path);
+
+/**
+ * @brief Captures the video frame, asynchronously.
+ * @param[in] player The handle to media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be #PLAYER_STATE_PLAYING by player_start() or #PLAYER_STATE_PAUSED by player_pause().
+ * @post It invokes player_video_captured_cb() when capture completes, if you set a callback.
+ * @see player_video_captured_cb()
+ */
+int player_capture_video(player_h player, player_video_captured_cb callback, void *user_data);
+
+/**
+ * @brief Registers a callback function to be invoked when the playback starts.
+ * @param[in] player The handle to media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @post player_started_cb() will be invoked
+ * @see player_unset_started_cb()
+ * @see player_started_cb()
+ * @see player_start()
+ */
+int player_set_started_cb(player_h player, player_started_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_started_cb()
+ */
+int player_unset_started_cb(player_h player);
+
+/**
+ * @brief Registers a callback function to be invoked when the playback finishes.
+ * @param[in] player The handle to media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @post player_completed_cb() will be invoked
+ * @see player_unset_completed_cb()
+ * @see player_completed_cb()
+ * @see player_start()
+ */
+int player_set_completed_cb(player_h player, player_completed_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_completed_cb()
+ */
+int player_unset_completed_cb(player_h player);
+
+/**
+ * @brief Registers a callback function to be invoked when the playback is paused.
+ * @param[in] player The handle to media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @post player_paused_cb() will be invoked
+ * @see player_unset_paused_cb()
+ * @see player_paused_cb()
+ * @see player_pause()
+ */
+int player_set_paused_cb(player_h player, player_paused_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_paused_cb()
+ */
+int player_unset_paused_cb(player_h player);
+
+
+/**
+ * @brief Registers a callback function to be invoked when the playback is interrupted.
+ * @param[in] player The handle to media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @post player_interrupted_cb() will be invoked
+ * @see player_unset_interrupted_cb()
+ * @see #player_interrupted_code_e
+ * @see player_interrupted_cb()
+ */
+int player_set_interrupted_cb(player_h player, player_interrupted_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_interrupted_cb()
+ */
+int player_unset_interrupted_cb(player_h player);
+
+/**
+ * @brief Registers a callback function to be invoked when error occured.
+ * @param[in] player The handle to media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @post player_error_cb() will be invoked
+ * @see player_unset_error_cb()
+ * @see player_error_cb()
+ */
+int player_set_error_cb(player_h player, player_error_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ *
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_error_cb()
+ */
+int player_unset_error_cb(player_h player);
+
+/**
+ * @brief Registers a callback function to be invoked when there is a change in the buffering status of a media stream.
+ * @remarks The media resource should be streamed over the network.
+ * @param[in] player The handle to media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @post player_buffering_cb() will be invoked
+ * @see player_unset_buffering_cb()
+ * @see player_set_uri()
+ * @see player_buffering_cb()
+ */
+int player_set_buffering_cb(player_h player, player_buffering_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_buffering_cb()
+ */
+int player_unset_buffering_cb(player_h player);
+
+/**
+ * @brief Registers a callback function to be invoked when subtitle updates.
+ * @param[in] player The handle to media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The subtile must be set by player_set_subtitle_path().
+ * @post player_subtitle_updated_cb() will be invoked
+ * @see player_unset_subtitle_updated_cb()
+ * @see player_subtitle_updated_cb()
+ * @see player_set_subtitle_path()
+ */
+int player_set_subtilte_updated_cb(player_h player, player_subtitle_updated_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_subtitle_updated_cb()
+ */
+int player_unset_subtilte_updated_cb(player_h player);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_MEDIA_PLAYER_H__ */
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __TIZEN_MEDIA_PLAYER_PRIVATE_H__
+#define __TIZEN_MEDIA_PLAYER_PRIVATE_H__
+#include <player.h>
+#include <mm_player.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ _PLAYER_EVENT_TYPE_BEGIN,
+ _PLAYER_EVENT_TYPE_COMPLETE,
+ _PLAYER_EVENT_TYPE_PAUSE,
+ _PLAYER_EVENT_TYPE_INTERRUPT,
+ _PLAYER_EVENT_TYPE_ERROR,
+ _PLAYER_EVENT_TYPE_BUFFERING,
+ _PLAYER_EVENT_TYPE_SUBTITLE,
+ _PLAYER_EVENT_TYPE_CAPTURE,
+ _PLAYER_EVENT_TYPE_NUM
+}_player_event_e;
+
+typedef struct _player_s{
+ MMHandleType mm_handle;
+ const void* user_cb[_PLAYER_EVENT_TYPE_NUM];
+ void* user_data[_PLAYER_EVENT_TYPE_NUM];
+ void* display_handle;
+ player_display_type_e display_type;
+ int state;
+} player_s;
+
+int mm_player_msg_callback(int message, void *param, void *user_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__TIZEN_MEDIA_PLAYER_PRIVATE_H__
+
+
+
--- /dev/null
+Name: capi-media-player
+Summary: A Media Player library in Tizen Native API
+Version: 0.0.1
+Release: 1
+Group: TO_BE/FILLED_IN
+License: TO BE FILLED IN
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(mm-player)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-media-sound-manager)
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+
+
+%package devel
+Summary: A Media Player library in Tizen Native API (Development)
+Group: TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+
+%prep
+%setup -q
+
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=/usr
+
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%{_libdir}/libcapi-media-player.so
+
+%files devel
+%{_includedir}/media/*.h
+%{_libdir}/pkgconfig/*.pc
+
+
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mm.h>
+#include <mm_player.h>
+#include <mm_player_internal.h>
+#include <mm_types.h>
+#include <player.h>
+#include <player_private.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_PLAYER"
+
+/*
+* Internal Macros
+*/
+
+#define PLAYER_CHECK_CONDITION(condition,error,msg) \
+ if(condition) {} else \
+ { LOGE("[%s] %s(0x%08x)",__FUNCTION__, msg,error); return error;}; \
+
+
+#define PLAYER_INSTANCE_CHECK(player) \
+ PLAYER_CHECK_CONDITION(player != NULL, PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER")
+
+#define PLAYER_STATE_CHECK(player,expected_state) \
+ PLAYER_CHECK_CONDITION(player->state == expected_state,PLAYER_ERROR_INVALID_STATE,"PLAYER_ERROR_INVALID_STATE")
+
+#define PLAYER_NULL_ARG_CHECK(arg) \
+ PLAYER_CHECK_CONDITION(arg != NULL,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER")
+
+/*
+* Internal Implementation
+*/
+int _convert_error_code(int code, char* func_name)
+{
+ int ret = PLAYER_ERROR_NONE;
+ char* msg="PLAYER_ERROR_NONE";
+ switch(code)
+ {
+ case MM_ERROR_NONE:
+ ret = PLAYER_ERROR_NONE;
+ msg = "PLAYER_ERROR_NONE";
+ break;
+ case MM_ERROR_PLAYER_CODEC_NOT_FOUND:
+ case MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND:
+ case MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND:
+ case MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_AUDIO:
+ case MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_VIDEO:
+ case MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_MEDIA_TYPE:
+ case MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT:
+ ret = PLAYER_ERROR_NOT_SUPPORTED_FILE;
+ msg = "PLAYER_ERROR_NOT_SUPPORTED_FILE";
+ break;
+ case MM_ERROR_PLAYER_INVALID_STATE:
+ case MM_ERROR_PLAYER_NOT_INITIALIZED:
+ ret = PLAYER_ERROR_INVALID_STATE;
+ msg = "PLAYER_ERROR_INVALID_STATE";
+ break;
+ case MM_ERROR_PLAYER_INTERNAL:
+ case MM_ERROR_PLAYER_INVALID_STREAM:
+ case MM_ERROR_PLAYER_STREAMING_FAIL:
+ case MM_ERROR_PLAYER_NO_OP:
+ ret = PLAYER_ERROR_INVALID_OPERATION;
+ msg = "PLAYER_ERROR_INVALID_OPERATION";
+ break;
+ case MM_ERROR_PLAYER_NO_FREE_SPACE:
+ ret = PLAYER_ERROR_OUT_OF_MEMORY;
+ msg = "PLAYER_ERROR_OUT_OF_MEMORY";
+ break;
+ case MM_ERROR_PLAYER_FILE_NOT_FOUND:
+ ret = PLAYER_ERROR_NO_SUCH_FILE;
+ msg = "PLAYER_ERROR_NO_SUCH_FILE";
+ break;
+ case MM_ERROR_PLAYER_SEEK:
+ ret = PLAYER_ERROR_SEEK_FAILED;
+ msg = "PLAYER_ERROR_SEEK_FAILED";
+ break;
+ case MM_ERROR_PLAYER_INVALID_URI:
+ case MM_ERROR_PLAYER_STREAMING_INVALID_URL:
+ ret = PLAYER_ERROR_INVALID_URI;
+ msg = "PLAYER_ERROR_INVALID_URI";
+ break;
+ case MM_ERROR_PLAYER_STREAMING_CONNECTION_FAIL:
+ case MM_ERROR_PLAYER_STREAMING_DNS_FAIL :
+ case MM_ERROR_PLAYER_STREAMING_SERVER_DISCONNECTED:
+ case MM_ERROR_PLAYER_STREAMING_INVALID_PROTOCOL:
+ case MM_ERROR_PLAYER_STREAMING_UNEXPECTED_MSG:
+ case MM_ERROR_PLAYER_STREAMING_OUT_OF_MEMORIES:
+ case MM_ERROR_PLAYER_STREAMING_RTSP_TIMEOUT:
+ case MM_ERROR_PLAYER_STREAMING_BAD_REQUEST:
+ case MM_ERROR_PLAYER_STREAMING_NOT_AUTHORIZED:
+ case MM_ERROR_PLAYER_STREAMING_PAYMENT_REQUIRED:
+ case MM_ERROR_PLAYER_STREAMING_FORBIDDEN:
+ case MM_ERROR_PLAYER_STREAMING_CONTENT_NOT_FOUND:
+ case MM_ERROR_PLAYER_STREAMING_METHOD_NOT_ALLOWED:
+ case MM_ERROR_PLAYER_STREAMING_NOT_ACCEPTABLE:
+ case MM_ERROR_PLAYER_STREAMING_PROXY_AUTHENTICATION_REQUIRED:
+ case MM_ERROR_PLAYER_STREAMING_SERVER_TIMEOUT:
+ case MM_ERROR_PLAYER_STREAMING_GONE:
+ case MM_ERROR_PLAYER_STREAMING_LENGTH_REQUIRED:
+ case MM_ERROR_PLAYER_STREAMING_PRECONDITION_FAILED:
+ case MM_ERROR_PLAYER_STREAMING_REQUEST_ENTITY_TOO_LARGE:
+ case MM_ERROR_PLAYER_STREAMING_REQUEST_URI_TOO_LARGE:
+ case MM_ERROR_PLAYER_STREAMING_PARAMETER_NOT_UNDERSTOOD:
+ case MM_ERROR_PLAYER_STREAMING_CONFERENCE_NOT_FOUND:
+ case MM_ERROR_PLAYER_STREAMING_NOT_ENOUGH_BANDWIDTH:
+ case MM_ERROR_PLAYER_STREAMING_NO_SESSION_ID:
+ case MM_ERROR_PLAYER_STREAMING_METHOD_NOT_VALID_IN_THIS_STATE:
+ case MM_ERROR_PLAYER_STREAMING_HEADER_FIELD_NOT_VALID_FOR_SOURCE:
+ case MM_ERROR_PLAYER_STREAMING_INVALID_RANGE:
+ case MM_ERROR_PLAYER_STREAMING_PARAMETER_IS_READONLY:
+ case MM_ERROR_PLAYER_STREAMING_AGGREGATE_OP_NOT_ALLOWED:
+ case MM_ERROR_PLAYER_STREAMING_ONLY_AGGREGATE_OP_ALLOWED:
+ case MM_ERROR_PLAYER_STREAMING_BAD_TRANSPORT:
+ case MM_ERROR_PLAYER_STREAMING_DESTINATION_UNREACHABLE:
+ case MM_ERROR_PLAYER_STREAMING_INTERNAL_SERVER_ERROR:
+ case MM_ERROR_PLAYER_STREAMING_NOT_IMPLEMENTED:
+ case MM_ERROR_PLAYER_STREAMING_BAD_GATEWAY:
+ case MM_ERROR_PLAYER_STREAMING_SERVICE_UNAVAILABLE:
+ case MM_ERROR_PLAYER_STREAMING_GATEWAY_TIME_OUT:
+ case MM_ERROR_PLAYER_STREAMING_OPTION_NOT_SUPPORTED:
+ ret = PLAYER_ERROR_CONNECTION_FAILED;
+ msg = "PLAYER_ERROR_CONNECTION_FAILED";
+ break;
+ case MM_ERROR_POLICY_BLOCKED:
+ case MM_ERROR_POLICY_INTERRUPTED:
+ case MM_ERROR_POLICY_INTERNAL:
+ case MM_ERROR_POLICY_DUPLICATED:
+ ret = PLAYER_ERROR_SOUND_POLICY;
+ msg = "PLAYER_ERROR_SOUND_POLICY";
+ break;
+ }
+ LOGE("[%s] %s(0x%08x) : core fw error(0x%x)",func_name,msg, ret, code);
+ return ret;
+}
+
+player_state_e _convert_player_state(MMPlayerStateType state)
+{
+ if(state == MM_PLAYER_STATE_NONE)
+ return PLAYER_STATE_NONE;
+ else
+ return state +1;
+}
+
+bool _player_state_validate(player_s * handle, player_state_e threshold)
+{
+ if (handle->state < threshold)
+ return FALSE;
+ return TRUE;
+}
+
+int _set_callback(_player_event_e type, player_h player, void* callback, void *user_data)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(callback);
+ player_s * handle = (player_s *) player;
+ handle->user_cb[type] = callback;
+ handle->user_data[type] = user_data;
+ LOGI("[%s] Event type : %d ",__FUNCTION__, type);
+ return PLAYER_ERROR_NONE;
+}
+
+int _unset_callback(_player_event_e type, player_h player)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ handle->user_cb[type] = NULL;
+ handle->user_data[type] = NULL;
+ LOGI("[%s] Event type : %d ",__FUNCTION__, type);
+ return PLAYER_ERROR_NONE;
+}
+
+player_state_e _get_current_state(player_s * handle)
+{
+ return handle->state;
+}
+
+int _msg_callback(int message, void *param, void *user_data)
+{
+ player_s * handle = (player_s*)user_data;
+ MMMessageParamType *msg = (MMMessageParamType*)param;
+ LOGI("[%s] Got message type : 0x%x" ,__FUNCTION__, message);
+ switch(message)
+ {
+ case MM_MESSAGE_ERROR: //0x01
+ if( handle->user_cb[_PLAYER_EVENT_TYPE_ERROR] )
+ {
+ ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(_convert_error_code(msg->code,(char*)__FUNCTION__),handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
+ }
+ break;
+ case MM_MESSAGE_STATE_CHANGED: //0x03
+ handle->state = _convert_player_state(msg->state.current);
+ if(handle->state == PLAYER_STATE_PAUSED && handle->user_cb[_PLAYER_EVENT_TYPE_PAUSE] )
+ {
+ ((player_paused_cb)handle->user_cb[_PLAYER_EVENT_TYPE_PAUSE])(handle->user_data[_PLAYER_EVENT_TYPE_PAUSE]);
+ }
+ break;
+ case MM_MESSAGE_BEGIN_OF_STREAM: //0x104
+ if( handle->user_cb[_PLAYER_EVENT_TYPE_BEGIN] )
+ {
+ ((player_started_cb)handle->user_cb[_PLAYER_EVENT_TYPE_BEGIN])(handle->user_data[_PLAYER_EVENT_TYPE_BEGIN]);
+ }
+ break;
+ case MM_MESSAGE_END_OF_STREAM://0x105
+ if( handle->user_cb[_PLAYER_EVENT_TYPE_COMPLETE] )
+ {
+ ((player_completed_cb)handle->user_cb[_PLAYER_EVENT_TYPE_COMPLETE])(handle->user_data[_PLAYER_EVENT_TYPE_COMPLETE]);
+ }
+ break;
+ case MM_MESSAGE_BUFFERING: //0x103
+ if( handle->user_cb[_PLAYER_EVENT_TYPE_BUFFERING] )
+ {
+ ((player_buffering_cb)handle->user_cb[_PLAYER_EVENT_TYPE_BUFFERING])(msg->connection.buffering,handle->user_data[_PLAYER_EVENT_TYPE_BUFFERING]);
+ }
+ break;
+ case MM_MESSAGE_STATE_INTERRUPTED: //0x04
+ if( handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT] )
+ {
+ ((player_interrupted_cb)handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT])(msg->code,handle->user_data[_PLAYER_EVENT_TYPE_INTERRUPT]);
+ }
+ break;
+ case MM_MESSAGE_UPDATE_SUBTITLE: //0x109
+ if( handle->user_cb[_PLAYER_EVENT_TYPE_SUBTITLE] )
+ {
+ ((player_subtitle_updated_cb)handle->user_cb[_PLAYER_EVENT_TYPE_SUBTITLE])(msg->subtitle.duration, (char*)msg->data,handle->user_data[_PLAYER_EVENT_TYPE_SUBTITLE]);
+ }
+ break;
+ case MM_MESSAGE_VIDEO_CAPTURED: //0x110
+ if( handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] )
+ {
+ int w;
+ int h;
+ int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_VIDEO_WIDTH ,&w, MM_PLAYER_VIDEO_HEIGHT, &h, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ w=0;
+ h=0;
+ LOGI("[%s] Failed to get video size on video captured : 0x%x" ,__FUNCTION__, ret);
+ }
+ MMPlayerVideoCapture* capture = (MMPlayerVideoCapture *)msg->data;
+ ((player_video_captured_cb)handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE])(capture->data, w, h, capture->size, handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE]);
+ }
+ break;
+ case MM_MESSAGE_UNKNOWN: //0x00
+ case MM_MESSAGE_WARNING: //0x02
+ case MM_MESSAGE_READY_TO_RESUME: //0x05
+ case MM_MESSAGE_CONNECTING: //0x100
+ case MM_MESSAGE_CONNECTED: //0x101
+ case MM_MESSAGE_CONNECTION_TIMEOUT: //0x102
+ case MM_MESSAGE_BLUETOOTH_ON: //0x106
+ case MM_MESSAGE_BLUETOOTH_OFF: //0x107
+ case MM_MESSAGE_RESUMED_BY_REW: //0x108
+ case MM_MESSAGE_RTP_SENDER_REPORT: //0x10a
+ case MM_MESSAGE_RTP_RECEIVER_REPORT: //0x10b
+ case MM_MESSAGE_RTP_SESSION_STATUS: //0x10c
+ case MM_MESSAGE_SENDER_STATE: //0x10d
+ case MM_MESSAGE_RECEIVER_STATE: //0x10e
+ case MM_MESSAGE_FILE_NOT_SUPPORTED: //0x10f
+ case MM_MESSAGE_FILE_NOT_FOUND: //0x110
+ case MM_MESSAGE_DRM_NOT_AUTHORIZED: //0x111
+ case MM_MESSAGE_VIDEO_NOT_CAPTURED: //0x113
+ case MM_MESSAGE_SEEK_COMPLETED: //0x114
+ default:
+ break;
+ }
+
+ return 1;
+}
+
+/*
+* Public Implementation
+*/
+
+int player_create (player_h *player)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle;
+ handle = (player_s*)malloc( sizeof(player_s));
+ if (handle != NULL)
+ memset(handle, 0 , sizeof(player_s));
+ else
+ {
+ LOGE("[%s] PLAYER_ERROR_OUT_OF_MEMORY" ,__FUNCTION__,PLAYER_ERROR_OUT_OF_MEMORY);
+ return PLAYER_ERROR_OUT_OF_MEMORY;
+ }
+ int ret = mm_player_create(&handle->mm_handle);
+ if( ret != MM_ERROR_NONE)
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)" ,__FUNCTION__,PLAYER_ERROR_INVALID_OPERATION);
+ handle->state = PLAYER_STATE_NONE;
+ free(handle);
+ handle=NULL;
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+ else
+ {
+ *player = (player_h)handle;
+ handle->state = PLAYER_STATE_IDLE;
+ handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+
+int player_destroy (player_h player)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ if (mm_player_destroy(handle->mm_handle)!= MM_ERROR_NONE)
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)" ,__FUNCTION__,PLAYER_ERROR_INVALID_OPERATION);
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+ else
+ {
+ handle->state = PLAYER_STATE_NONE;
+ free(handle);
+ handle= NULL;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_prepare (player_h player)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+
+ int ret;
+ ret = mm_player_set_message_callback(handle->mm_handle, _msg_callback, (void*)handle);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGW("[%s] Failed to set message callback function (0x%x)" ,__FUNCTION__, ret);
+ }
+ ret = mm_player_realize(handle->mm_handle);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ handle->state = PLAYER_STATE_READY;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_unprepare (player_h player)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ if (!_player_state_validate(handle, PLAYER_STATE_READY))
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+
+ int ret = mm_player_unrealize(handle->mm_handle);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ handle->state = PLAYER_STATE_IDLE;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_uri (player_h player, const char *uri)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(uri);
+ player_s * handle = (player_s *) player;
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL,MM_PLAYER_CONTENT_URI , uri, strlen(uri), (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ return PLAYER_ERROR_NONE;
+}
+
+int player_set_memory_buffer (player_h player, const void *data, int size)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(data);
+ PLAYER_CHECK_CONDITION(size>=0,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+ player_s * handle = (player_s *) player;
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+
+ char uri[PATH_MAX] ;
+
+ snprintf(uri, sizeof(uri),"mem:///ext=%s,size=%d","", size);
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL,MM_PLAYER_CONTENT_URI, uri, strlen(uri), MM_PLAYER_MEMORY_SRC, data,size,(char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ return PLAYER_ERROR_NONE;
+}
+
+int player_get_state (player_h player, player_state_e *state)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(state);
+ player_s * handle = (player_s *) player;
+ MMPlayerStateType currentStat = MM_PLAYER_STATE_NULL;
+ int ret = mm_player_get_state(handle->mm_handle, ¤tStat);
+ if(ret != MM_ERROR_NONE)
+ {
+ *state = handle->state;
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ handle->state = _convert_player_state(currentStat);
+ *state = handle->state;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_volume (player_h player, float left, float right)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_CHECK_CONDITION(left>=0 && left <= 1.0 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+ PLAYER_CHECK_CONDITION(right>=0 && right <= 1.0 ,PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER" );
+ player_s * handle = (player_s *) player;
+ MMPlayerVolumeType vol;
+ vol.level[MM_VOLUME_CHANNEL_LEFT] = left;
+ vol.level[MM_VOLUME_CHANNEL_RIGHT] = right;
+ int ret = mm_player_set_volume(handle->mm_handle,&vol);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_get_volume (player_h player, float *left, float *right)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(left);
+ PLAYER_NULL_ARG_CHECK(right);
+ player_s * handle = (player_s *) player;
+ MMPlayerVolumeType vol;
+ int ret = mm_player_get_volume(handle->mm_handle,&vol);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ *left = vol.level[MM_VOLUME_CHANNEL_LEFT];
+ *right = vol.level[MM_VOLUME_CHANNEL_RIGHT];
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_sound_type(player_h player, sound_type_e type)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL,"sound_volume_type" , type, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ return PLAYER_ERROR_NONE;
+}
+
+int player_start (player_h player)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ int ret;
+ if (handle->state == PLAYER_STATE_READY )
+ {
+ ret = mm_player_start(handle->mm_handle);
+ }
+ else if ( handle->state == PLAYER_STATE_PAUSED)
+ {
+ ret = mm_player_resume(handle->mm_handle);
+ }
+ else
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ handle->state = PLAYER_STATE_PLAYING;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_stop (player_h player)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ if (handle->state == PLAYER_STATE_PLAYING || handle->state == PLAYER_STATE_PAUSED)
+ {
+ int ret = mm_player_stop(handle->mm_handle);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ handle->state = PLAYER_STATE_READY;
+ return PLAYER_ERROR_NONE;
+ }
+ }
+ else
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+}
+
+int player_pause (player_h player)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_PLAYING);
+
+ int ret = mm_player_pause(handle->mm_handle);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ handle->state = PLAYER_STATE_PAUSED;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_position (player_h player, int millisecond)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_CHECK_CONDITION(millisecond>=0 ,PLAYER_ERROR_INVALID_PARAMETER ,"PLAYER_ERROR_INVALID_PARAMETER" );
+ player_s * handle = (player_s *) player;
+
+ int ret = mm_player_set_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME, millisecond);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+
+int player_set_position_ratio (player_h player, int percent)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_CHECK_CONDITION(percent>=0 && percent <= 100 ,PLAYER_ERROR_INVALID_PARAMETER ,"PLAYER_ERROR_INVALID_PARAMETER" );
+ player_s * handle = (player_s *) player;
+
+ int ret = mm_player_set_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_PERCENT , percent);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+
+int player_get_position (player_h player, int *millisecond)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(millisecond);
+ player_s * handle = (player_s *) player;
+ if (!_player_state_validate(handle, PLAYER_STATE_READY))
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+ int pos;
+ int ret = mm_player_get_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME , &pos);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ *millisecond = pos;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_get_position_ratio (player_h player,int *percent)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(percent);
+ player_s * handle = (player_s *) player;
+ if (!_player_state_validate(handle, PLAYER_STATE_READY))
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+ int pos;
+ int ret = mm_player_get_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_PERCENT, &pos);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ *percent=pos;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_mute (player_h player, bool muted)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+
+ int ret = mm_player_set_mute(handle->mm_handle, muted);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_is_muted (player_h player, bool *muted)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(muted);
+ player_s * handle = (player_s *) player;
+
+ int _mute;
+ int ret = mm_player_get_mute(handle->mm_handle, &_mute);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ if(_mute)
+ {
+ *muted = TRUE;
+ }
+ else
+ {
+ *muted = FALSE;
+ }
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_looping (player_h player, bool looping)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ if (!_player_state_validate(handle, PLAYER_STATE_IDLE))
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+
+ int value = 0;
+ if(looping==TRUE)
+ {
+ value = -1;
+ }
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL,MM_PLAYER_PLAYBACK_COUNT , value, (char*)NULL);
+
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_is_looping (player_h player, bool *looping)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(looping);
+ player_s * handle = (player_s *) player;
+ if (!_player_state_validate(handle, PLAYER_STATE_IDLE))
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+ int count;
+ int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_PLAYBACK_COUNT , &count, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ if(count==-1)
+ {
+ *looping = TRUE;
+ }
+ else
+ {
+ *looping = FALSE;
+ }
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_get_duration (player_h player, int *duration)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(duration);
+ player_s * handle = (player_s *) player;
+ if (!_player_state_validate(handle, PLAYER_STATE_PLAYING))
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+ int _duration;
+ int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_CONTENT_DURATION, &_duration, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ *duration = _duration;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_display(player_h player, player_display_type_e type, player_display_h display)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+
+ handle->display_handle = display;
+ handle->display_type = type;
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_surface_type", type, "display_overlay" , type == PLAYER_DISPLAY_TYPE_X11 ? &handle->display_handle : display, sizeof(display), (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ return PLAYER_ERROR_NONE;
+}
+
+int player_set_x11_display_rotation(player_h player, player_display_rotation_e rotation)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL,MM_PLAYER_VIDEO_ROTATION , rotation, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ return PLAYER_ERROR_NONE;
+}
+
+int player_get_x11_display_rotation( player_h player, player_display_rotation_e *rotation)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(rotation);
+ player_s * handle = (player_s *) player;
+ int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_VIDEO_ROTATION ,rotation, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_x11_display_visible(player_h player, bool visible)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+
+ int value = 0;
+ if(visible==TRUE)
+ {
+ value = 1;
+ }
+
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_visible" , value, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ return PLAYER_ERROR_NONE;
+}
+
+int player_is_x11_display_visible(player_h player, bool* visible)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(visible);
+ player_s * handle = (player_s *) player;
+ int count;
+ int ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_visible" ,&count, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ if(count==0)
+ {
+ *visible = FALSE;
+ }
+ else
+ {
+ *visible = TRUE;
+ }
+
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+
+int player_set_x11_display_mode(player_h player, player_display_mode_e mode)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_method" , mode, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ return PLAYER_ERROR_NONE;
+}
+
+int player_get_x11_display_mode(player_h player, player_display_mode_e *mode)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(mode);
+ player_s * handle = (player_s *) player;
+ int ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_method" ,mode, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_get_video_size (player_h player, int *width, int *height)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(width);
+ PLAYER_NULL_ARG_CHECK(height);
+ player_s * handle = (player_s *) player;
+ if (!_player_state_validate(handle, PLAYER_STATE_READY))
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+ int w;
+ int h;
+ int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_VIDEO_WIDTH ,&w, MM_PLAYER_VIDEO_HEIGHT, &h, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ *width = w;
+ *height = h;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_subtitle_path(player_h player, char* path)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(path);
+ player_s * handle = (player_s *) player;
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL,"subtitle_uri" , path, strlen(path),"subtitle_silent", 0, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ return PLAYER_ERROR_NONE;
+}
+
+int player_capture_video(player_h player, player_video_captured_cb callback, void *user_data)
+{
+ int ret =_set_callback(_PLAYER_EVENT_TYPE_CAPTURE,player,callback,user_data);
+ if(ret != PLAYER_ERROR_NONE)
+ return ret;
+
+ player_s * handle = (player_s *) player;
+ if(handle->state == PLAYER_STATE_PAUSED || handle->state == PLAYER_STATE_PLAYING )
+ {
+ ret = mm_player_do_video_capture(handle->mm_handle);
+ if(ret != MM_ERROR_NONE)
+ {
+ return _convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ return PLAYER_ERROR_NONE;
+ }
+ else
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+}
+
+int player_set_started_cb (player_h player, player_started_cb callback, void *user_data)
+{
+ return _set_callback(_PLAYER_EVENT_TYPE_BEGIN,player,callback,user_data);
+}
+
+int player_unset_started_cb (player_h player)
+{
+ return _unset_callback(_PLAYER_EVENT_TYPE_BEGIN,player);
+}
+
+int player_set_completed_cb (player_h player, player_completed_cb callback, void *user_data)
+{
+ return _set_callback(_PLAYER_EVENT_TYPE_COMPLETE,player,callback,user_data);
+}
+
+int player_unset_completed_cb (player_h player)
+{
+ return _unset_callback(_PLAYER_EVENT_TYPE_COMPLETE,player);
+}
+
+int player_set_paused_cb (player_h player, player_paused_cb callback, void *user_data)
+{
+ return _set_callback(_PLAYER_EVENT_TYPE_PAUSE,player,callback,user_data);
+}
+
+int player_unset_paused_cb (player_h player)
+{
+ return _unset_callback(_PLAYER_EVENT_TYPE_PAUSE,player);
+}
+
+int player_set_interrupted_cb (player_h player, player_interrupted_cb callback, void *user_data)
+{
+ return _set_callback(_PLAYER_EVENT_TYPE_INTERRUPT,player,callback,user_data);
+}
+
+int player_unset_interrupted_cb (player_h player)
+{
+ return _unset_callback(_PLAYER_EVENT_TYPE_INTERRUPT,player);
+}
+
+int player_set_error_cb (player_h player, player_error_cb callback, void *user_data)
+{
+ return _set_callback(_PLAYER_EVENT_TYPE_ERROR,player,callback,user_data);
+}
+
+int player_unset_error_cb (player_h player)
+{
+ return _unset_callback(_PLAYER_EVENT_TYPE_ERROR,player);
+}
+
+int player_set_buffering_cb (player_h player, player_buffering_cb callback, void *user_data)
+{
+ return _set_callback(_PLAYER_EVENT_TYPE_BUFFERING,player,callback,user_data);
+}
+
+int player_unset_buffering_cb (player_h player)
+{
+ return _unset_callback(_PLAYER_EVENT_TYPE_BUFFERING,player);
+}
+
+
+int player_set_subtilte_updated_cb(player_h player, player_subtitle_updated_cb callback, void* user_data )
+{
+ return _set_callback(_PLAYER_EVENT_TYPE_SUBTITLE,player,callback,user_data);
+}
+
+int player_unset_subtilte_updated_cb (player_h player)
+{
+ return _unset_callback(_PLAYER_EVENT_TYPE_SUBTITLE,player);
+}
+
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_test "${fw_name}-test")
+
+INCLUDE_DIRECTORIES(../include)
+link_directories(${CMAKE_SOURCE_DIR}/../)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_test} REQUIRED mm-player appcore-efl elementary ecore evas ecore-x capi-media-sound-manager)
+FOREACH(flag ${${fw_test}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
+
+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} capi-media-player ${${fw_test}_LDFLAGS})
+ENDFOREACH()
+
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <player.h>
+#include <pthread.h>
+#include <glib.h>
+#include <dlfcn.h>
+#include <appcore-efl.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+#define PACKAGE "player_test"
+#define MAX_STRING_LEN 2048
+#define MMTS_SAMPLELIST_INI_DEFAULT_PATH "/opt/etc/mmts_filelist.ini"
+#define INI_SAMPLE_LIST_MAX 9
+char g_subtitle_uri[MAX_STRING_LEN];
+
+enum
+{
+ CURRENT_STATUS_MAINMENU,
+ CURRENT_STATUS_FILENAME,
+ CURRENT_STATUS_VOLUME,
+ CURRENT_STATUS_MUTE,
+ CURRENT_STATUS_POSITION_TIME,
+ CURRENT_STATUS_POSITION_PERCENT,
+ CURRENT_STATUS_LOOPING,
+ CURRENT_STATUS_DISPLAY_MODE,
+ CURRENT_STATUS_DISPLAY_ROTATION,
+ CURRENT_STATUS_DISPLAY_VISIBLE,
+ CURRENT_STATUS_SUBTITLE_FILENAME
+};
+
+struct appdata
+{
+ Evas *evas;
+ Ecore_Evas *ee;
+ Evas_Object *win;
+
+ Evas_Object *layout_main; /* layout widget based on EDJ */
+ Ecore_X_Window xid;
+ /* add more variables here */
+};
+
+static void win_del(void *data, Evas_Object *obj, void *event)
+{
+ elm_exit();
+}
+
+static Evas_Object* create_win(const char *name)
+{
+ Evas_Object *eo;
+ int w, h;
+
+ printf ("[%s][%d] name=%s\n", __func__, __LINE__, name);
+
+ eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (eo) {
+ elm_win_title_set(eo, name);
+ elm_win_borderless_set(eo, EINA_TRUE);
+ evas_object_smart_callback_add(eo, "delete,request",win_del, NULL);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(),&w, &h);
+ evas_object_resize(eo, w, h);
+ }
+
+ return eo;
+}
+
+static int app_create(void *data)
+{
+ struct appdata *ad = data;
+ Evas_Object *win;
+ /* create window */
+ win = create_win(PACKAGE);
+ if (win == NULL)
+ return -1;
+ ad->win = win;
+ evas_object_show(win);
+ return 0;
+}
+
+static int app_terminate(void *data)
+{
+ struct appdata *ad = data;
+
+ if (ad->win)
+ evas_object_del(ad->win);
+
+ return 0;
+}
+
+struct appcore_ops ops = {
+ .create = app_create,
+ .terminate = app_terminate,
+};
+
+struct appdata ad;
+static player_h g_player = 0;
+int g_menu_state = CURRENT_STATUS_MAINMENU;
+char g_file_list[9][256];
+gboolean quit_pushing;
+
+static void paused_cb(void *user_data)
+{
+ g_print("[Player_Test] paused_cb!!!!\n");
+}
+
+static void started_cb(void *user_data)
+{
+ g_print("[Player_Test] started_cb!!!!\n");
+}
+
+static void buffering_cb(int percent, void *user_data)
+{
+ g_print("[Player_Test] buffering_cb!!!! percent : %d\n", percent);
+}
+
+
+
+static void completed_cb(void *user_data)
+{
+ g_print("[Player_Test] completed_cb!!!!\n");
+}
+
+static void subtitle_updated_cb(unsigned long duration, char *text, void *user_data)
+{
+ g_print("[Player_Test] subtitle_updated_cb!!!! [%ld] %s\n",duration, text);
+}
+
+static void video_captured_cb(unsigned char *data, int width, int height,unsigned int size, void *user_data)
+{
+ g_print("[Player_Test] video_captured_cb!!!! width: %d, height : %d, size : %d \n",width, height,size);
+ if (data)
+ {
+ g_free(data);
+ data = NULL;
+ }
+}
+
+static void input_filename(char *filename)
+{
+ int len = strlen(filename);
+
+ if ( len < 0 || len > MAX_STRING_LEN )
+ return;
+ if(g_player!=NULL)
+ {
+ player_unprepare(g_player);
+ player_destroy(g_player);
+ }
+ g_player = 0;
+
+ if ( player_create(&g_player) != PLAYER_ERROR_NONE )
+ {
+ g_print("player create is failed\n");
+ }
+
+
+#if 0 //ned(APPSRC_TEST)
+ gchar uri[100];
+ gchar *ext;
+ gsize file_size;
+ GMappedFile *file;
+ GError *error = NULL;
+ guint8* g_media_mem = NULL;
+
+ ext = filename;
+
+ file = g_mapped_file_new (ext, FALSE, &error);
+ file_size = g_mapped_file_get_length (file);
+ g_media_mem = (guint8 *) g_mapped_file_get_contents (file);
+
+ g_sprintf(uri, "mem://ext=%s,size=%d", ext ? ext : "", file_size);
+ g_print("[uri] = %s\n", uri);
+
+ mm_player_set_attribute(g_player,
+ &g_err_name,
+ "profile_uri", uri, strlen(uri),
+ "profile_user_param", g_media_mem, file_size
+ NULL);
+#else
+ player_set_uri(g_player, filename);
+#endif /* APPSRC_TEST */
+
+ int slen = strlen(g_subtitle_uri);
+
+ if ( slen > 0 && slen < MAX_STRING_LEN )
+ {
+ g_print("0. set subtile path() - %s \n", g_subtitle_uri);
+ player_set_subtitle_path(g_player,g_subtitle_uri);
+ player_set_subtilte_updated_cb(g_player, subtitle_updated_cb, (void*)g_player);
+ }
+ player_set_display(g_player,PLAYER_DISPLAY_TYPE_X11,GET_DISPLAY(ad.xid));
+
+ player_set_paused_cb(g_player, paused_cb, (void*)g_player);
+ player_set_started_cb(g_player, started_cb, (void*)g_player);
+ player_set_buffering_cb(g_player, buffering_cb, (void*)g_player);
+ player_set_completed_cb(g_player, completed_cb, (void*)g_player);
+
+ int ret;
+ player_state_e state;
+ ret = player_get_state(g_player, &state);
+ g_print("1. After player_create() - Current State : %d \n", state);
+
+ ret = player_prepare(g_player);
+ if ( ret != PLAYER_ERROR_NONE )
+ {
+ g_print("prepare is failed (errno = %d) \n", ret);
+ }
+
+ ret = player_get_state(g_player, &state);
+ g_print("2. After player_prepare() - Current State : %d \n", state);
+}
+
+
+
+static void _player_play()
+{
+ int bRet = FALSE;
+ bRet = player_start(g_player);
+}
+
+static void _player_stop()
+{
+ int bRet = FALSE;
+ bRet = player_stop(g_player);
+}
+
+static void _player_resume()
+{
+ int bRet = FALSE;
+ bRet = player_start(g_player);
+}
+
+static void _player_pause()
+{
+ int bRet = FALSE;
+ bRet = player_pause(g_player);
+}
+
+static void _player_state()
+{
+ player_state_e state;
+ player_get_state(g_player, &state);
+ g_print(" ==> [Player_Test] Current Player State : %d\n", state);
+}
+
+
+static void set_volume(float volume)
+{
+ if ( player_set_volume(g_player, volume, volume) != PLAYER_ERROR_NONE )
+ {
+ g_print("failed to set volume\n");
+ }
+}
+
+static void get_volume(float* left, float* right)
+{
+ player_get_volume(g_player, left, right);
+ g_print(" ==> [Player_Test] volume - left : %f, right : %f\n", *left, *right);
+}
+
+static void set_mute(bool mute)
+{
+ if ( player_set_mute(g_player, mute) != PLAYER_ERROR_NONE )
+ {
+ g_print("failed to set_mute\n");
+ }
+}
+
+static void get_mute(bool *mute)
+{
+ player_is_muted(g_player, mute);
+ g_print(" ==> [Player_Test] mute = %d\n", *mute);
+}
+
+static void get_position()
+{
+ int position = 0;
+ int percent = 0;
+ int ret;
+ ret = player_get_position(g_player, &position);
+ g_print(" ==> [Player_Test] player_get_position() return : %d\n",ret);
+ ret = player_get_position_ratio(g_player, &percent);
+ g_print(" ==> [Player_Test] player_get_position_ratio() return : %d\n",ret);
+ g_print(" ==> [Player_Test] Pos: [%d ] msec\n", position);
+ g_print(" ==> [Player_Test] Pos: [%d] percent\n", percent);
+}
+
+static void set_position(int position)
+{
+ if ( player_set_position(g_player, position) != PLAYER_ERROR_NONE )
+ {
+ g_print("failed to set position\n");
+ }
+}
+
+static void set_position_ratio(int percent)
+{
+ if ( player_set_position_ratio(g_player, percent) != PLAYER_ERROR_NONE )
+ {
+ g_print("failed to set position ratio\n");
+ }
+}
+
+static void get_duration()
+{
+ int duration = 0;
+ int ret;
+ ret = player_get_duration(g_player, &duration);
+ g_print(" ==> [Player_Test] player_get_duration() return : %d\n",ret);
+ g_print(" ==> [Player_Test] Duration: [%d ] msec\n",duration);
+}
+
+static void get_video_size()
+{
+ int w = 0;
+ int h = 0;
+ player_get_video_size(g_player, &w, &h);
+ g_print(" ==> [Player_Test] Width: [%d ] , Height: [%d ] \n",w,h);
+}
+
+static void set_looping(bool looping)
+{
+ if ( player_set_looping(g_player, looping) != PLAYER_ERROR_NONE )
+ {
+ g_print("failed to set_looping\n");
+ }
+}
+
+static void get_looping(bool *looping)
+{
+ player_is_looping(g_player, looping);
+ g_print(" ==> [Player_Test] looping = %d\n", *looping);
+}
+
+static void set_display_mode(int mode)
+{
+ if ( player_set_x11_display_mode(g_player, mode) != PLAYER_ERROR_NONE )
+ {
+ g_print("failed to player_set_x11_display_mode\n");
+ }
+}
+
+static void get_display_mode()
+{
+ player_display_mode_e mode;
+ player_get_x11_display_mode(g_player, &mode);
+ g_print(" ==> [Player_Test] X11 Display mode: [%d ] \n",mode);
+}
+
+static void set_display_rotation(int rotation)
+{
+ if ( player_set_x11_display_rotation(g_player, rotation) != PLAYER_ERROR_NONE )
+ {
+ g_print("failed to set_display_rotation\n");
+ }
+}
+
+static void get_display_rotation()
+{
+ player_display_rotation_e rotation = 0;
+ player_get_x11_display_rotation(g_player, &rotation);
+ g_print(" ==> [Player_Test] X11 Display rotation: [%d ] \n",rotation);
+}
+
+
+static void set_display_visible(bool visible)
+{
+ if ( player_set_x11_display_visible(g_player, visible) != PLAYER_ERROR_NONE )
+ {
+ g_print("failed to player_set_x11_display_visible\n");
+ }
+}
+
+static void get_display_visible(bool *visible)
+{
+ player_is_x11_display_visible(g_player, visible);
+ g_print(" ==> [Player_Test] X11 Display Visible = %d\n", *visible);
+}
+
+static void input_subtitle_filename(char *subtitle_filename)
+{
+ int len = strlen(subtitle_filename);
+
+ if ( len < 1 || len > MAX_STRING_LEN )
+ return;
+
+ strncpy (g_subtitle_uri, subtitle_filename,len);
+ g_print("subtitle uri is set to %s\n", g_subtitle_uri);
+}
+
+static void capture_video()
+{
+ if( player_capture_video(g_player,video_captured_cb,NULL)!=PLAYER_ERROR_NONE)
+ {
+ g_print("failed to player_capture_video\n");
+ }
+}
+
+void quit_program()
+{
+ player_unprepare(g_player);
+ player_destroy(g_player);
+ g_player = 0;
+ elm_exit();
+}
+
+void play_with_ini(char *file_path)
+{
+ input_filename(file_path);
+ _player_play();
+}
+
+void _interpret_main_menu(char *cmd)
+{
+ if ( strlen(cmd) == 1 )
+ {
+ if (strncmp(cmd, "a", 1) == 0)
+ {
+ g_menu_state = CURRENT_STATUS_FILENAME;
+ }
+ else if (strncmp(cmd, "1", 1) == 0)
+ {
+ play_with_ini(g_file_list[0]);
+ }
+ else if (strncmp(cmd, "2", 1) == 0)
+ {
+ play_with_ini(g_file_list[1]);
+ }
+ else if (strncmp(cmd, "3", 1) == 0)
+ {
+ play_with_ini(g_file_list[2]);
+ }
+ else if (strncmp(cmd, "4", 1) == 0)
+ {
+ play_with_ini(g_file_list[3]);
+ }
+ else if (strncmp(cmd, "5", 1) == 0)
+ {
+ play_with_ini(g_file_list[4]);
+ }
+ else if (strncmp(cmd, "6", 1) == 0)
+ {
+ play_with_ini(g_file_list[5]);
+ }
+ else if (strncmp(cmd, "7", 1) == 0)
+ {
+ play_with_ini(g_file_list[6]);
+ }
+ else if (strncmp(cmd, "8", 1) == 0)
+ {
+ play_with_ini(g_file_list[7]);
+ }
+ else if (strncmp(cmd, "9", 1) == 0)
+ {
+ play_with_ini(g_file_list[8]);
+ }
+ else if (strncmp(cmd, "b", 1) == 0)
+ {
+ _player_play();
+ }
+ else if (strncmp(cmd, "c", 1) == 0)
+ {
+ _player_stop();
+ }
+ else if (strncmp(cmd, "d", 1) == 0)
+ {
+ _player_resume();
+ }
+ else if (strncmp(cmd, "e", 1) == 0)
+ {
+ _player_pause();
+ }
+ else if (strncmp(cmd, "S", 1) == 0)
+ {
+ _player_state();
+ }
+ else if (strncmp(cmd, "f", 1) == 0)
+ {
+ g_menu_state = CURRENT_STATUS_VOLUME;
+ }
+ else if (strncmp(cmd, "g", 1) == 0)
+ {
+ float left;
+ float right;
+ get_volume(&left, &right);
+ }
+ else if (strncmp(cmd, "h", 1) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_MUTE;
+ }
+ else if (strncmp(cmd, "i", 1) == 0 )
+ {
+ bool mute;
+ get_mute(&mute);
+ }
+ else if (strncmp(cmd, "j", 1) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_POSITION_TIME;
+ }
+ else if (strncmp(cmd, "k", 1) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_POSITION_PERCENT;
+ }
+ else if (strncmp(cmd, "l", 1) == 0 )
+ {
+ get_position();
+ }
+ else if (strncmp(cmd, "m", 1) == 0 )
+ {
+ get_duration();
+ }
+ else if (strncmp(cmd, "n", 1) == 0 )
+ {
+ get_video_size();
+ }
+ else if (strncmp(cmd, "o", 1) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_LOOPING;
+ }
+ else if (strncmp(cmd, "p", 1) == 0 )
+ {
+ bool looping;
+ get_looping(&looping);
+ }
+ else if (strncmp(cmd, "r", 1) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_DISPLAY_MODE;
+ }
+ else if (strncmp(cmd, "s", 1) == 0 )
+ {
+ get_display_mode();
+ }
+ else if (strncmp(cmd, "t", 1) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_DISPLAY_ROTATION;
+ }
+ else if (strncmp(cmd, "u", 1) == 0 )
+ {
+ get_display_rotation();
+ }
+ else if (strncmp(cmd, "v", 1) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_DISPLAY_VISIBLE;
+ }
+ else if (strncmp(cmd, "w", 1) == 0 )
+ {
+ bool visible;
+ get_display_visible(&visible);
+ }
+ else if (strncmp(cmd, "A", 1) == 0 )
+ {
+ g_menu_state=CURRENT_STATUS_SUBTITLE_FILENAME;
+ }
+ else if (strncmp(cmd, "C", 1) == 0 )
+ {
+ capture_video();
+ }
+ else if (strncmp(cmd, "q", 1) == 0)
+ {
+ quit_pushing = TRUE;
+ quit_program();
+ }
+ else
+ {
+ g_print("unknown menu \n");
+ }
+ }
+ else
+ {
+ g_print("unknown menu \n");
+ }
+}
+
+void display_sub_basic()
+{
+ int idx;
+ g_print("\n");
+ g_print("=========================================================================================\n");
+ g_print(" Player Test (press q to quit) \n");
+ g_print("-----------------------------------------------------------------------------------------\n");
+ g_print("*. Sample List in [%s]\n", MMTS_SAMPLELIST_INI_DEFAULT_PATH);
+
+ for( idx = 1; idx <= INI_SAMPLE_LIST_MAX ; idx++ )
+ {
+ if (strlen (g_file_list[idx-1]) > 0)
+ g_print("%d. Play [%s]\n", idx, g_file_list[idx-1]);
+ }
+ g_print("-----------------------------------------------------------------------------------------\n");
+ g_print("[playback] a. Initialize Media\t");
+ g_print("b. Play \t");
+ g_print("c. Stop \t");
+ g_print("d. Resume\t");
+ g_print("e. Pause \t");
+ g_print("S. Player State \n");
+ g_print("[ volume ] f. Set Volume\t");
+ g_print("g. Get Volume\n");
+ g_print("[ mute ] h. Set Mute\t");
+ g_print("i. Get Mute\n");
+ g_print("[position] j. Set Position (T)\t");
+ g_print("k. Set Position (%%)\t");
+ g_print("l. Get Position\n");
+ g_print("[duration] m. Get Duration\n");
+ g_print("[video size] n. Get Video Size\n");
+ g_print("[Looping] o. Set Looping\t");
+ g_print("p. Get Looping\n");
+ g_print("[x display] r. Set display mode\t");
+ g_print("s. Get display mode\t");
+ g_print("t. Set display Rotation\t");
+ g_print("u. Get display Rotation\n");
+ g_print("[x display] v. Set display visible\t");
+ g_print("w. Get display visible\n");
+ g_print("[subtitle] A. Set subtitle path\n");
+ g_print("[Video Capture] C. Capture \n");
+ g_print("\n");
+ g_print("=========================================================================================\n");
+}
+
+static void displaymenu()
+{
+ if (g_menu_state == CURRENT_STATUS_MAINMENU)
+ {
+ display_sub_basic();
+ }
+ else if (g_menu_state == CURRENT_STATUS_FILENAME)
+ {
+ g_print("*** input mediapath.\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_VOLUME)
+ {
+ g_print("*** input volume value.(0~1.0)\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_MUTE)
+ {
+ g_print("*** input mute value.(0: Not Mute, 1: Mute) \n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_POSITION_TIME)
+ {
+ g_print("*** input position value(msec)\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_POSITION_PERCENT)
+ {
+ g_print("*** input position percent(%%)\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_LOOPING)
+ {
+ g_print("*** input looping value.(0: Not Looping, 1: Looping) \n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_DISPLAY_MODE)
+ {
+ g_print("*** input display mode value.(0: LETTER BOX, 1: ORIGIN SIZE, 2: FULL_SCREEN, 3: CROPPED_FULL) \n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_DISPLAY_ROTATION)
+ {
+ g_print("*** input display rotation value.(0: NONE, 1: 90, 2: 180, 3: 270, 4:F LIP_HORZ, 5: FLIP_VERT ) \n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_DISPLAY_VISIBLE)
+ {
+ g_print("*** input display visible value.(0: HIDE, 1: SHOW) \n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SUBTITLE_FILENAME)
+ {
+ g_print(" *** input subtitle file path.\n");
+ }
+ else
+ {
+ g_print("*** unknown status.\n");
+ quit_program();
+ }
+ g_print(" >>> ");
+}
+
+gboolean timeout_menu_display(void* data)
+{
+ displaymenu();
+ return FALSE;
+}
+
+gboolean timeout_quit_program(void* data)
+{
+ quit_program();
+ return FALSE;
+}
+
+void reset_menu_state(void)
+{
+ g_menu_state = CURRENT_STATUS_MAINMENU;
+}
+
+static void interpret (char *cmd)
+{
+ switch (g_menu_state)
+ {
+ case CURRENT_STATUS_MAINMENU:
+ {
+ _interpret_main_menu(cmd);
+ }
+ break;
+ case CURRENT_STATUS_FILENAME:
+ {
+ input_filename(cmd);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_VOLUME:
+ {
+ float level = atof(cmd);
+ set_volume(level);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_MUTE:
+ {
+ int mute = atoi(cmd);
+ set_mute(mute);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_POSITION_TIME:
+ {
+ long position = atol(cmd);
+ set_position(position);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_POSITION_PERCENT:
+ {
+ long percent = atol(cmd);
+ set_position_ratio(percent);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_LOOPING:
+ {
+ int looping = atoi(cmd);
+ set_looping(looping);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_DISPLAY_MODE:
+ {
+ int mode = atoi(cmd);
+ set_display_mode(mode);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_DISPLAY_ROTATION:
+ {
+ int rotation = atoi(cmd);
+ set_display_rotation(rotation);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_DISPLAY_VISIBLE:
+ {
+ int visible = atoi(cmd);
+ set_display_visible(visible);
+ reset_menu_state();
+ }
+ case CURRENT_STATUS_SUBTITLE_FILENAME:
+ {
+ input_subtitle_filename(cmd);
+ reset_menu_state();
+ }
+ break;
+ }
+ g_timeout_add(100, timeout_menu_display, 0);
+}
+
+gboolean input (GIOChannel *channel)
+{
+ char buf[MAX_STRING_LEN + 3];
+ gsize read;
+
+ g_io_channel_read(channel, buf, MAX_STRING_LEN, &read);
+ buf[read] = '\0';
+ g_strstrip(buf);
+ interpret (buf);
+ return TRUE;
+}
+
+int main(int argc, char *argv[])
+{
+ GIOChannel *stdin_channel;
+ stdin_channel = g_io_channel_unix_new(0);
+ g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc)input, NULL);
+ displaymenu();
+ memset(&ad, 0x0, sizeof(struct appdata));
+ ops.data = &ad;
+
+ return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
+}
+