From: Hyunil Park Date: Fri, 9 Jan 2015 02:21:50 +0000 (+0900) Subject: Revert "Featuer Enhancement : A Media Player libray API is changed to Tizen2.3 version" X-Git-Tag: submit/tizen/20150109.055336~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8795d140ef3195849f9a3d6d4b8e1b85c4914df4;p=platform%2Fcore%2Fapi%2Fplayer.git Revert "Featuer Enhancement : A Media Player libray API is changed to Tizen2.3 version" This reverts commit e797c47808d78c9b802629505012faeb57a75824. Change-Id: I37d815cbd8b13afcc139e32f87f203022d3ff724 Signed-off-by: Hyunil Park --- diff --git a/AUTHORS b/AUTHORS index b01c60f..68b49ae 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,2 +1,2 @@ -Kangho Hur -Seungkeun Lee +Kangho Hur +Seungkeun Lee diff --git a/CMakeLists.txt b/CMakeLists.txt index 298b94b..4497476 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) -SET(dependents "libtbm capi-media-tool dlog mm-player capi-base-common capi-media-sound-manager gstreamer-1.0 evas ecore elementary") -SET(pc_dependents "libtbm capi-media-tool capi-base-common capi-media-sound-manager") +SET(dependents "dlog mm-player capi-base-common capi-media-sound-manager mm-ta") +SET(pc_dependents "capi-base-common capi-media-sound-manager") INCLUDE(FindPkgConfig) pkg_check_modules(${fw_name} REQUIRED ${dependents}) @@ -19,17 +19,24 @@ FOREACH(flag ${${fw_name}_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -SET(CMAKE_C_FLAGS "-I./include ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror") +SET(CMAKE_C_FLAGS "-I./include ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -Wno-error=unused-but-set-variable -DGST_EXT_TIME_ANALYSIS") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") IF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DTARGET") ENDIF("${ARCH}" STREQUAL "arm") +IF(WAYLAND_SUPPORT) + ADD_DEFINITIONS("-DHAVE_WAYLAND") +ENDIF(WAYLAND_SUPPORT) +IF(X11_SUPPORT) + ADD_DEFINITIONS("-DHAVE_X11") +ENDIF(X11_SUPPORT) + ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DTIZEN_DEBUG") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}") aux_source_directory(src SOURCES) ADD_LIBRARY(${fw_name} SHARED ${SOURCES}) @@ -43,7 +50,7 @@ SET_TARGET_PROPERTIES(${fw_name} CLEAN_DIRECT_OUTPUT 1 ) -INSTALL(TARGETS ${fw_name} DESTINATION lib) +INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR}) INSTALL( DIRECTORY ${INC_DIR}/ DESTINATION include/media FILES_MATCHING @@ -61,7 +68,7 @@ CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc @ONLY ) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) ADD_SUBDIRECTORY(test) @@ -69,10 +76,10 @@ IF(UNIX) ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution) ADD_CUSTOM_COMMAND( - DEPENDS clean + DEPENDS clean COMMENT "distribution clean" COMMAND find - ARGS . + ARGS . -not -name config.cmake -and \( -name tester.c -or -name Testing -or diff --git a/LICENSE.APLv2 b/LICENSE.APLv2 index bbe9d02..9c13a9b 100644 --- a/LICENSE.APLv2 +++ b/LICENSE.APLv2 @@ -202,5 +202,3 @@ Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. See the License for the specific language governing permissions and limitations under the License. - - diff --git a/capi-media-player.manifest b/capi-media-player.manifest deleted file mode 100644 index e3deed8..0000000 --- a/capi-media-player.manifest +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/capi-media-player.pc.in b/capi-media-player.pc.in index 5d02f8d..1997d91 100644 --- a/capi-media-player.pc.in +++ b/capi-media-player.pc.in @@ -3,7 +3,7 @@ prefix=@PREFIX@ exec_prefix=/usr -libdir=/usr/lib +libdir=@LIB_INSTALL_DIR@ includedir=/usr/include/media Name: @PC_NAME@ diff --git a/doc/images/capi_media_player_state_diagram.png b/doc/images/capi_media_player_state_diagram.png deleted file mode 100644 index 2d62d99..0000000 Binary files a/doc/images/capi_media_player_state_diagram.png and /dev/null differ diff --git a/doc/player_doc.h b/doc/player_doc.h deleted file mode 100644 index 534a2f5..0000000 --- a/doc/player_doc.h +++ /dev/null @@ -1,359 +0,0 @@ -/* - * 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_DOC_H__ -#define __TIZEN_MEDIA_PLAYER_DOC_H__ - - -/** - * @file player_doc.h - * @brief This file contains high level documentation on the Player API. - */ - -/** - * @ingroup CAPI_MEDIA_FRAMEWORK - * @defgroup CAPI_MEDIA_PLAYER_MODULE Player - * @brief The @ref CAPI_MEDIA_PLAYER_MODULE API provides functions for media playback and controlling media playback attributes. - * - * @section CAPI_MEDIA_PLAYER_MODULE_HEADER Required Header - * \#include - * - * @section CAPI_MEDIA_PLAYER_OVERVIEW Overview - * The Player API provides a way to play multimedia content. Content can be played from a file, from the network, or from memory. - * It gives the ability to start/stop/pause/mute, set the playback position (that is, seek), perform various status queries, and control the display. - * - * Additional functions allow registering notifications via callback functions for various state change events. - * - * This API also enables collaboration with the GUI service to present a video. - * - * @subsection CAPI_MEDIA_PLAYER_LIFE_CYCLE_STATE_DIAGRAM State Diagram - * Playback of multimedia content is controlled by a state machine. - * The following diagram shows the life cycle and states of the Player. - * - * @image html capi_media_player_state_diagram.png - * - * @subsection CAPI_MEDIA_PLAYER_LIFE_CYCLE_STATE_TRANSITIONS State Transitions - *
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
FUNCTIONPRE-STATEPOST-STATESYNC TYPE
player_create()NONEIDLESYNC
player_destroy()IDLENONESYNC
player_prepare()IDLEREADYSYNC
player_prepare_async()IDLEREADYASYNC
player_unprepare()READY, PLAYING or PAUSEDIDLESYNC
player_start()READY or PAUSEDPLAYINGSYNC
player_stop()PLAYINGREADYSYNC
player_pause()PLAYINGPAUSEDSYNC
- * - * @subsection CAPI_MEDIA_PLAYER_LIFE_CYCLE_STATE_DEPENDENT_FUNCTIONS State Dependent Function Calls - * The following table shows state-dependent function calls. - * It is forbidden to call the functions listed below in wrong states. - * Violation of this rule may result in unpredictable behavior. - *
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
FUNCTIONVALID STATESDESCRIPTION
player_create()ANY-
player_destroy()ANY-
player_prepare()IDLEThis function must be called after player_create()
player_unprepare()READY/PAUSED/PLAYINGThis function must be called after player_stop() or player_start() or player_pause()
player_start()READY/ PAUSEDThis function must be called after player_prepare()
player_stop()PLAYING/ PAUSEDThis function must be called after player_start() or player_pause()
player_pause()PLAYINGThis function must be called after player_start()
player_set_completed_cb()
player_set_interrupted_cb()
player_set_error_cb()
player_set_buffering_cb()
player_set_subtitle_updated_cb()
IDLE/ READY/ PLAYING/ PAUSEDThis function must be called after player_create()
player_unset_completed_cb()
player_unset_interrupted_cb()
player_unset_error_cb()
player_unset_buffering_cb()
player_unset_subtitle_updated_cb()
IDLE/ READY/ PLAYING/ PAUSEDThis function must be called after register callback functions such as player_set_completed_cb()
player_get_state()ANY-
player_set_uri()IDLEThis function must be called before player_prepare()
player_set_memory_buffer()IDLEThis function must be called before player_prepare()
player_set_subtitle_path()IDLEThis function must be called before player_prepare()
player_set_volume()IDLE/ READY/ PLAYING/ PAUSEDThis function must be called after player_create()
player_get_volume()IDLE/ READY/ PLAYING/ PAUSEDThis function must be called after player_create()
player_set_sound_type()IDLEThis function must be called after player_create()
player_set_mute()IDLE/ READY/ PLAYING/ PAUSEDThis function must be called after player_create()
player_is_muted()IDLE/ READY/ PLAYING/ PAUSEDThis function must be called after player_create()
player_set_looping()IDLE/ READY/ PLAYING/ PAUSEDThis function must be called after player_create()
player_is_looping()IDLE/ READY/ PLAYING/ PAUSEDThis function must be called after player_create()
player_get_duration()PLAYING/ PAUSEDThis function must be called after player_start()
player_set_display()IDLEThis function must be called before player_prepare()
player_set_display_mode()
player_set_display_visible()
IDLE/ READY/ PLAYING/ PAUSEDThis function must be called after player_create()
player_get_display_rotation()
player_is_display_visible()
IDLE/ READY/ PLAYING/ PAUSEDThis function must be called after player_create()
player_get_video_size()READY/ PLAYING/ PAUSEDThis function must be called after player_prepare()
- * - * @subsection CAPI_MEDIA_PLAYER_LIFE_CYCLE_ASYNCHRONOUS_OPERATIONS Asynchronous Operations - * All functions that change the player state are synchronous except player_prepare_async(), player_set_play_position(), and player_capture_video(). - * Thus the result is passed to the application via the callback mechanism. - * - * @subsection CAPI_MEDIA_PLAYER_LIFE_CYCLE_CALLBACK_OPERATIONS Callback(Event) Operations - *
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - - *
REGISTERUNREGISTERCALLBACKDESCRIPTION
player_set_completed_cb()player_unset_completed_cb()player_completed_cb()called when playback is completed
player_set_interrupted_cb()player_unset_interrupted_cb()player_interrupted_cb()called when playback is interrupted by #player_interrupted_code_e
player_set_error_cb()player_unset_error_cb()player_error_cb()called when an error has occurred
player_set_buffering_cb()player_unset_buffering_cb()player_buffering_cb()called during content buffering
player_set_progressive_download_message_cb()player_unset_progressive_download_message_cb()player_pd_message_cb()called when a progressive download starts or completes
player_set_subtitle_updated_cb()player_unset_subtitle_updated_cb()player_subtitle_updated_cb()called when a subtitle updates
player_set_media_packet_video_frame_decoded_cb()player_unset_media_packet_video_frame_decoded_cb()player_media_packet_video_decoded_cb()called when a video frame is decoded
- * - */ - - -/** - * @ingroup CAPI_MEDIA_PLAYER_MODULE - * @defgroup CAPI_MEDIA_PLAYER_DISPLAY_MODULE Display - * @brief The @ref CAPI_MEDIA_PLAYER_DISPLAY_MODULE API provides functions to control the display. - * @section CAPI_MEDIA_PLAYER_DISPLAY_MODULE_HEADER Required Header - * \#include - * - * @section CAPI_MEDIA_PLAYER_DISPLAY_MODULE_OVERVIEW Overview - * The API allows you to manage the display of the player. - * This API provides functions to set and get various display properties: - * - mode - * - rotation - * - visibility - * -*/ - -/** - * @ingroup CAPI_MEDIA_PLAYER_MODULE - * @defgroup CAPI_MEDIA_PLAYER_STREAM_INFO_MODULE Stream Information - * @brief The @ref CAPI_MEDIA_PLAYER_STREAM_INFO_MODULE API provides functions to get audio and video stream information, such as codec type, video width or height, bit rate, and so on. - * @section CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE_HEADER Required Header - * \#include - * - * @section CAPI_MEDIA_PLAYER_STREAM_INFO_MODULE_OVERVIEW Overview - * The Player stream information API allows you to get media stream information, including: - * - Content metadata, such as the tile, artist, album title and genre. - * - Audio stream information, such as audio codec type, sample rate, channels, and bit rate. - * - Video stream information, such as video codec type, video width and height. - * -*/ - -/** - * @ingroup CAPI_MEDIA_PLAYER_MODULE - * @defgroup CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE Audio Effect - * @brief The @ref CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE API provides functions to control the audio effect. - * @section CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE_HEADER Required Header - * \#include - * - * @section CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE_MODULE_OVERVIEW Overview - * The Audio effect API allows you to apply effects to the player: - * - Equalizer - * - * -*/ - -/** - * @ingroup CAPI_MEDIA_PLAYER_MODULE - * @defgroup CAPI_MEDIA_PLAYER_SUBTITLE_MODULE Subtitle - * @brief The @ref CAPI_MEDIA_PLAYER_SUBTITLE_MODULE API provides functions to control the subtitle. - * @section CAPI_MEDIA_PLAYER_SUBTITLE_MODULE_HEADER Required Header - * \#include - * - * -*/ - -#endif /* __TIZEN_MEDIA_PLAYER_DOC_H__ */ diff --git a/include/player.h b/include/player.h index 08f3656..d1a3e95 100644 --- a/include/player.h +++ b/include/player.h @@ -19,13 +19,12 @@ #include #include -#include #ifdef __cplusplus extern "C" { #endif -#define PLAYER_ERROR_CLASS TIZEN_ERROR_PLAYER | 0x20 +#define PLAYER_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x20 /** * @file player.h @@ -38,112 +37,104 @@ extern "C" { */ /** - * @brief The media player's type handle. - * @since_tizen 2.3 + * @brief Media player handle type. */ typedef struct player_s *player_h; /** - * @brief Enumeration for media player state. - * @since_tizen 2.3 + * @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_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 Enumeration for media player's error codes. - * @since_tizen 2.3 + * @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_FILE_NO_SPACE_ON_DEVICE = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE, /**< No space left on the device */ - PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ - 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, /**< File format not supported */ - 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_VIDEO_CAPTURE_FAILED = PLAYER_ERROR_CLASS | 0x07, /**< Video capture failed */ - PLAYER_ERROR_DRM_EXPIRED = PLAYER_ERROR_CLASS | 0x08, /**< Expired license */ - PLAYER_ERROR_DRM_NO_LICENSE = PLAYER_ERROR_CLASS | 0x09, /**< No license */ - PLAYER_ERROR_DRM_FUTURE_USE = PLAYER_ERROR_CLASS | 0x0a, /**< License for future use */ - PLAYER_ERROR_DRM_NOT_PERMITTED = PLAYER_ERROR_CLASS | 0x0b, /**< Format not permitted */ - PLAYER_ERROR_RESOURCE_LIMIT = PLAYER_ERROR_CLASS | 0x0c, /**< Resource limit */ - PLAYER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ + 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_FILE_NO_SPACE_ON_DEVICE = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE, /**< No space left on device */ + 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_VIDEO_CAPTURE_FAILED = PLAYER_ERROR_CLASS | 0x07, /**< Video capture failure */ + PLAYER_ERROR_DRM_EXPIRED = PLAYER_ERROR_CLASS | 0x08, /**< Expired license */ + PLAYER_ERROR_DRM_NO_LICENSE = PLAYER_ERROR_CLASS | 0x09, /**< No license */ + PLAYER_ERROR_DRM_FUTURE_USE = PLAYER_ERROR_CLASS | 0x0a, /**< License for future use */ + PLAYER_ERROR_DRM_NOT_PERMITTED = PLAYER_ERROR_CLASS | 0x0b /**< Not permitted format */ } player_error_e; /** - * @brief Enumeration for media player's interruption type. - * @since_tizen 2.3 + * @brief Enumerations of player interrupted type */ typedef enum { - PLAYER_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed */ - PLAYER_INTERRUPTED_BY_MEDIA, /**< Interrupted by a non-resumable media application */ - PLAYER_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call */ - PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones */ - PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by a resource conflict */ - PLAYER_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm */ - PLAYER_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency */ - PLAYER_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification */ + PLAYER_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed*/ + PLAYER_INTERRUPTED_BY_MEDIA, /**< Interrupted by non-resumable media application*/ + PLAYER_INTERRUPTED_BY_CALL, /**< Interrupted by incoming call*/ + PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphone*/ + PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by resource conflict*/ + PLAYER_INTERRUPTED_BY_ALARM, /**< Interrupted by alarm*/ + PLAYER_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by emergency*/ + PLAYER_INTERRUPTED_BY_RESUMABLE_MEDIA, /**< Interrupted by resumable media application*/ } player_interrupted_code_e; /** - * @brief Enumeration for progressive download message type. - * @since_tizen 2.3 + * @brief Enumerations of progressive download message type */ typedef enum { - PLAYER_PD_STARTED = 0, /**< Progressive download is started */ - PLAYER_PD_COMPLETED, /**< Progressive download is completed */ + PLAYER_PD_STARTED = 0, /**< Progressive download is started */ + PLAYER_PD_COMPLETED, /**< Progressive download is completed */ } player_pd_message_type_e; /** - * @brief Enumeration for display type. - * @since_tizen 2.3 + * @brief + * Enumerations of display type */ typedef enum { - PLAYER_DISPLAY_TYPE_OVERLAY = 0, /**< Overlay surface display */ - PLAYER_DISPLAY_TYPE_EVAS, /**< Evas image object surface display */ - PLAYER_DISPLAY_TYPE_NONE, /**< This disposes off buffers */ + PLAYER_DISPLAY_TYPE_X11 = 0, /**< X surface display */ + PLAYER_DISPLAY_TYPE_EVAS = 1, /**< Evas image object surface display */ } player_display_type_e; /** - * @brief Enumeration for audio latency mode. - * @since_tizen 2.3 + * @brief Enumerations of audio latency mode */ typedef enum { - AUDIO_LATENCY_MODE_LOW = 0, /**< Low audio latency mode */ - AUDIO_LATENCY_MODE_MID, /**< Middle audio latency mode */ - AUDIO_LATENCY_MODE_HIGH, /**< High audio latency mode */ + AUDIO_LATENCY_MODE_LOW = 0, /**< Low audio latency mode*/ + AUDIO_LATENCY_MODE_MID, /**< Middle audio latency mode*/ + AUDIO_LATENCY_MODE_HIGH, /**< High audio latency mode*/ } audio_latency_mode_e; /** - * @brief The player display handle. - * @since_tizen 2.3 + * @brief Player display handle + * */ typedef void* player_display_h; #ifndef GET_DISPLAY /** - * @brief Definition for a display handle from evas object. - * @since_tizen 2.3 + * @brief Gets a display handle from x window id or evas object */ -#define GET_DISPLAY(x) (void*)(x) +#include +#define GET_DISPLAY(x) ((void*)((intptr_t)(x))) #endif /** @@ -151,36 +142,35 @@ typedef void* player_display_h; */ /** - * @addtogroup CAPI_MEDIA_PLAYER_DISPLAY_MODULE + * @addtogroup CAPI_MEDIA_PLAYER_X11_DISPLAY_MODULE * @{ */ /** - * @brief Enumeration for display rotation type. - * @since_tizen 2.3 + * @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_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_e; /** - * @brief Enumeration for x surface display aspect ratio. - * @since_tizen 2.3 + * @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_ORIGIN_OR_LETTER, /**< Origin size (if surface size is larger than video size(width/height)) or Letter box (if video size(width/height) is larger than surface size) */ - PLAYER_DISPLAY_MODE_DST_ROI, /**< Dst ROI mode */ + 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_ORIGIN_OR_LETTER, /**< Origin size (if surface size is larger than video size(width/height)) or Letter box (if video size(width/height) is larger than surface size)*/ + PLAYER_DISPLAY_MODE_ROI, /**< ROI mode*/ } player_display_mode_e; + /** * @} */ @@ -191,74 +181,155 @@ typedef enum */ /** - * @brief Enumeration for media stream content information. - * @since_tizen 2.3 + * @brief Enumerations of media stream content information */ typedef enum { - PLAYER_CONTENT_INFO_ALBUM, /**< Album */ - PLAYER_CONTENT_INFO_ARTIST, /**< Artist */ - PLAYER_CONTENT_INFO_AUTHOR, /**< Author */ - PLAYER_CONTENT_INFO_GENRE, /**< Genre */ - PLAYER_CONTENT_INFO_TITLE, /**< Title */ - PLAYER_CONTENT_INFO_YEAR, /**< Year */ + PLAYER_CONTENT_INFO_ALBUM, /**< Album */ + PLAYER_CONTENT_INFO_ARTIST, /**< Artist */ + PLAYER_CONTENT_INFO_AUTHOR, /**< Author */ + PLAYER_CONTENT_INFO_GENRE, /**< Genre */ + PLAYER_CONTENT_INFO_TITLE, /**< Title */ + PLAYER_CONTENT_INFO_YEAR, /**< Year */ } player_content_info_e; +/** + * @brief Enumerations of media stream content information + */ +typedef enum +{ + PLAYER_TRACK_TYPE_AUDIO, /**< Audio Track */ + PLAYER_TRACK_TYPE_VIDEO, /**< Video Track */ + PLAYER_TRACK_TYPE_TEXT, /**< Text Track */ +} player_track_type_e; /** * @} */ +/** + * @addtogroup CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE + * @{ + */ + +/** + * @brief Enumerations of audio effect + */ +typedef enum{ + AUDIO_EFFECT_3D = 1, /**< 3D effect */ + AUDIO_EFFECT_BASS, /**< Bass effect */ + AUDIO_EFFECT_ROOM, /**< Room effect */ + AUDIO_EFFECT_REVERB, /**< Reverberation effect */ + AUDIO_EFFECT_CLARITY, /**< Clarity effect */ +} audio_effect_e; + +/** + * @brief Enumerations of preset audio effect + */ +typedef enum{ + AUDIO_EFFECT_PRESET_AUTO = 0, /**< Auto */ + AUDIO_EFFECT_PRESET_NONE, /**< None */ + AUDIO_EFFECT_PRESET_POP, /**< POP */ + AUDIO_EFFECT_PRESET_ROCK, /**< Rock */ + AUDIO_EFFECT_PRESET_DANCE, /**< Dance */ + AUDIO_EFFECT_PRESET_JAZZ, /**< Jazz */ + AUDIO_EFFECT_PRESET_CLASSIC, /**< Classic */ + AUDIO_EFFECT_PRESET_VOCAL, /**< Vocal */ + AUDIO_EFFECT_PRESET_BASS_BOOST, /**< Bass boost */ + AUDIO_EFFECT_PRESET_TREBLE_BOOST, /**< Treble boost */ + AUDIO_EFFECT_PRESET_MTHEATER, /**< Theater */ + AUDIO_EFFECT_PRESET_EXTERNALIZATION,/**< Externalization */ + AUDIO_EFFECT_PRESET_CAFE, /**< Cafe */ + AUDIO_EFFECT_PRESET_CONCERT_HALL, /**< Concert Hall */ + AUDIO_EFFECT_PRESET_VOICE, /**< Voice */ + AUDIO_EFFECT_PRESET_MOVIE, /**< Movie */ + AUDIO_EFFECT_PRESET_VIRTUAL_5_1, /**< Virtual 5.1 */ + AUDIO_EFFECT_PRESET_HIPHOP, /**< HipHop */ + AUDIO_EFFECT_PRESET_RNB, /**< R&B */ + AUDIO_EFFECT_PRESET_FLAT, /**< Flat */ +} audio_effect_preset_e; + +/** + * @brief Called once for each supported audio effect. + * @param[in] effect The audio effect + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. + * @pre player_audio_effect_foreach_supported_effect() will invoke this callback. + * @see player_audio_effect_foreach_supported_effect() + */ +typedef bool (*player_audio_effect_supported_effect_cb)(audio_effect_e effect, void *user_data); + +/** + * @brief Called once for each supported preset audio effect. + * @param[in] preset The preset audio effect + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. + * @pre player_audio_effect_foreach_supported_preset() will invoke this callback. + * @see player_audio_effect_foreach_supported_preset() + */ +typedef bool (*player_audio_effect_supported_preset_cb)(audio_effect_preset_e preset, void *user_data); + +/** + * @} + */ /** - * @addtogroup CAPI_MEDIA_PLAYER_SUBTITLE_MODULE + * @addtogroup CAPI_MEDIA_PLAYER_X11_DISPLAY_MODULE * @{ */ /** - * @brief Called when the subtitle is updated. - * @since_tizen 2.3 - * @param[in] duration The duration of the updated subtitle - * @param[in] text The text of the updated subtitle - * @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() + * @internal + * @brief Called when the media player needs updated xid. + * @remarks If current display type is not #PLAYER_DISPLAY_TYPE_X11, no operation is performed. + * @param[in] user_data The user data passed from the callback registration function + * @pre It will be invoked when player needs updated xid if you register this callback using player_set_x11_display_pixmap() + * @return The updated xid + * @see player_set_x11_display_pixmap() */ -typedef void (*player_subtitle_updated_cb)(unsigned long duration, char *text, void *user_data); +typedef unsigned int (*player_x11_pixmap_updated_cb)(void *user_data); + +/** + * @internal + * @brief Called when the media player needs to inform rendering error. + * @remarks If current display type is not #PLAYER_DISPLAY_TYPE_X11, no operation is performed. + * @param[in] pixmap_id The pixmap_id where the rendering error is occurred + * @param[in] user_data The user data passed from the callback registration function + * @see player_set_x11_display_pixmap_error_cb() + */ +typedef void (*player_x11_pixmap_error_cb)(unsigned int *pixmap_id, void *user_data); /** * @} */ + /** * @addtogroup CAPI_MEDIA_PLAYER_MODULE * @{ */ /** - * @brief Called when the media player is prepared. - * @since_tizen 2.3 - * @details It will be invoked when player has reached the begin of stream. + * @brief Called when the media player is prepared. + * @details It will be invoked when player has reached the begin of stream * @param[in] user_data The user data passed from the callback registration function - * @pre player_prepare_async() will cause this callback. - * @post The player state will be #PLAYER_STATE_READY. + * @pre player_prepare_async() will cause this callback + * @post The player state will be #PLAYER_STATE_READY * @see player_prepare_async() */ typedef void (*player_prepared_cb)(void *user_data); /** - * @brief Called when the media player is completed. - * @since_tizen 2.3 - * @details It will be invoked when player has reached the end of the stream. + * @brief Called when the media player is completed. + * @details It will be invoked when player has reached to the end of the stream. * @param[in] user_data The user data passed from the callback registration function - * @pre It will be invoked when the playback is completed if you register this callback using player_set_completed_cb(). + * @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 seek operation is completed. - * @since_tizen 2.3 + * @brief Called when the seek operation is completed. * @param[in] user_data The user data passed from the callback registration function * @see player_set_position() * @see player_set_position_ratio() @@ -266,8 +337,7 @@ typedef void (*player_completed_cb)(void *user_data); typedef void (*player_seek_completed_cb)(void *user_data); /** - * @brief Called when the media player is interrupted. - * @since_tizen 2.3 + * @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() @@ -276,9 +346,8 @@ typedef void (*player_seek_completed_cb)(void *user_data); typedef void (*player_interrupted_cb)(player_interrupted_code_e code, void *user_data); /** - * @brief Called when an error occurs in the media player. - * @since_tizen 2.3 - * @param[in] error_code The error code + * @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() @@ -287,8 +356,7 @@ typedef void (*player_interrupted_cb)(player_interrupted_code_e code, void *user typedef void (*player_error_cb)(int error_code, void *user_data); /** - * @brief Called when the buffering percentage of the media playback is updated. - * @since_tizen 2.3 + * @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 @@ -297,50 +365,69 @@ typedef void (*player_error_cb)(int error_code, void *user_data); */ typedef void (*player_buffering_cb)(int percent, void *user_data); + /** - * @brief Called when progressive download is started or completed. - * @since_tizen 2.3 - * @param[in] type The message type for progressive download + * @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 progressive download is started or completed. + * @param[in] type The message type of progressive download * @param[in] user_data The user data passed from the callback registration function * @see player_set_progressive_download_path() */ typedef void (*player_pd_message_cb)(player_pd_message_type_e type, void *user_data); /** - * @brief Called when the video is captured. - * @since_tizen 2.3 - * @remarks The color space format of the captured image is IMAGE_UTIL_COLORSPACE_RGB888. + * @brief Called when the video is captured. + * @remarks The color space format of the captured image is #IMAGE_UTIL_COLORSPACE_RGB888. * @param[in] data The captured image buffer - * @param[in] width The width of the captured image - * @param[in] height The height of the captured image - * @param[in] size The size of the captured image + * @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 Called to register for notifications about delivering media packet when every video frame is decoded. - * @since_tizen 2.3 - * - * @remarks This function is issued in the context of gstreamer so the UI update code should not be directly invoked.\n - * the packet should be released by media_packet_destroy() after use. \n - * Otherwises, decoder can't work more because it can't have enough buffer to fill decoded frame. - * - * @param[in] pkt Reference pointer to the media packet - * @param[in] user_data The user data passed from the callback registration function + * @brief Called when the video frame is decoded. + * @remarks The color space format of the captured image is #IMAGE_UTIL_COLORSPACE_RGB888. + * @param[in] data The decoded video frame data + * @param[in] width The width of video frame + * @param[in] height The height of video frame + * @param[in] size The size of video frame + * @param[in] user_data The user data passed from the callback registration function + * @see player_set_video_frame_decoded_cb() + * @see player_unset_video_frame_decoded_cb() */ -typedef void (*player_media_packet_video_decoded_cb)(media_packet_h pkt, void *user_data); +typedef void (*player_video_frame_decoded_cb)(unsigned char *data, int width, int height, unsigned int size, void *user_data); + +/** + * @brief Called when the audio frame is decoded. + * @param[in] data The decoded audio frame data + * @param[in] size The size of audio frame + * @param[in] user_data The user data passed from the callback registration function + * @see player_set_audio_frame_decoded_cb() + * @see player_unset_audio_frame_decoded_cb() + */ +typedef void (*player_audio_frame_decoded_cb)(unsigned char *data, unsigned int size, void *user_data); /** * @brief Creates a player handle for playing multimedia content. - * @since_tizen 2.3 - * @remarks You must release @a player by using player_destroy().\n - * 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. + * @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 the media player + * @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 @@ -350,17 +437,18 @@ typedef void (*player_media_packet_video_decoded_cb)(media_packet_h pkt, void *u */ int player_create(player_h *player); + /** * @brief Destroys the media player handle and releases all its resources. - * @since_tizen 2.3 + * * @remarks To completely shutdown player operation, call this function with a valid player handle from any player state. - * @param[in] player The handle to the media player to be destroyed - * @return @c 0 on success, - * otherwise a negative error value + * + * @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 must be set to #PLAYER_STATE_IDLE. + * @pre The player state should be #PLAYER_STATE_IDLE * @post The player state will be #PLAYER_STATE_NONE. * @see player_create() */ @@ -368,22 +456,16 @@ int player_destroy(player_h player); /** * @brief Prepares the media player for playback. - * @since_tizen 2.3 - * @remarks The mediastorage privilege(http://tizen.org/privilege/mediastorage) should be added if any video/audio files are used to play located in the internal storage. - * @remarks The externalstorage privilege(http://tizen.org/privilege/externalstorage) should be added if any video/audio files are used to play located in the external storage. - * @remarks The internet privilege(http://tizen.org/privilege/internet) should be added if any URLs are used to play from network. - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * @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 File not supported + * @retval #PLAYER_ERROR_NOT_SUPPORTED_FILE Not supported file * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state - * @retval #PLAYER_ERROR_PERMISSION_DENIED Permission denied - * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). After that, call player_set_uri() to load the media content you want to play. + * @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_prepare_async() * @see player_unprepare() @@ -393,25 +475,17 @@ int player_prepare(player_h player); /** * @brief Prepares the media player for playback, asynchronously. - * @since_tizen 2.3 - * @remarks The mediastorage privilege(http://tizen.org/privilege/mediastorage) should be added if any video/audio files are used to play located in the internal storage. - * @remarks The externalstorage privilege(http://tizen.org/privilege/externalstorage) should be added if any video/audio files are used to play located in the external storage. - * @remarks The internet privilege(http://tizen.org/privilege/internet) should be added if any URLs are used to play from network. - * @param[in] player The handle to the 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 @c 0 on success, - * otherwise a negative error value + * @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 File not supported + * @retval #PLAYER_ERROR_NOT_SUPPORTED_FILE Not supported file * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state - * @retval #PLAYER_ERROR_PERMISSION_DENIED Permission denied - * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). After that, call player_set_uri() to load the media content you want to play. - * @post It invokes player_prepared_cb() when playback is prepared. + * @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 It invokes player_prepared_cb() when playback is prepare. * @see player_prepare() * @see player_prepared_cb() * @see player_unprepare() @@ -420,43 +494,43 @@ int player_prepare(player_h player); int player_prepare_async (player_h player, player_prepared_cb callback, void* user_data); /** - * @brief Resets 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. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * @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 higher than #PLAYER_STATE_IDLE. + * @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 RSTP URI) to use. + * @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. - * @since_tizen 2.3 - * @remarks If you use HTTP or RSTP, 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(). + * @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. * - * @param[in] player The handle to the media player - * @param[in] uri The content location, such as the file path, the URI of the HTTP or RSTP stream you want to play + * @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(). * - * @return @c 0 on success, - * otherwise a negative error value + * @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 must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). + * @pre The player state should be #PLAYER_STATE_IDLE by player_create() or player_unprepare(). * @see player_set_memory_buffer() */ int player_set_uri(player_h player, const char * uri); @@ -464,51 +538,51 @@ 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. - * @since_tizen 2.3 - * @remarks If you provide an invalid data, you won't receive an error message until you call player_start(). + * @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 the media player + * + * @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 @c 0 on success, - * otherwise a negative error value + * @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 set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). + * @pre The player state should be #PLAYER_STATE_IDLE by player_create() 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. - * @since_tizen 2.3 - * @param[in] player The handle to the media player + * @param[in] player The handle to media player * @param[out] state The current state of the player - * @return @c 0 on success, - * otherwise a negative error value + * @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. - * @since_tizen 2.3 - * @details Setting this volume adjusts the player's instance volume, not the system volume. - * The valid range is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0. - * To change system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API. - * Finally, it does not support to set other value into each channel currently. * - * @param[in] player The handle to the media player - * @param[in] left The left volume scalar - * @param[in] right The right volume scalar - * @return @c 0 on success, - * otherwise a negative error value + * @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 @@ -516,18 +590,17 @@ int player_get_state(player_h player, player_state_e *state); */ int player_set_volume(player_h player, float left, float right); + /** * @brief Gets the player's current volume factor. - * @since_tizen 2.3 - * @details The range of @a left and @a right is from @c 0 to @c 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 the media player + * @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 @c 0 on success, - * otherwise a negative error value + * @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 @@ -536,73 +609,68 @@ int player_set_volume(player_h player, float left, float right); int player_get_volume(player_h player, float *left, float *right); /** - * @brief Sets the player's volume type. - * @since_tizen 2.3 - * @remarks The default sound type of the player is #SOUND_TYPE_MEDIA. - * To get the current sound type, use sound_manager_get_current_sound_type(). + * @brief Sets the player's sound type. * - * @param[in] player The handle to the media player + * @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 @c 0 on success, - * otherwise a negative error value + * @return 0 on success, otherwise a negative error value. * @retval #PLAYER_ERROR_NONE Successful * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter - * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create(). + * @pre The player state must be #PLAYER_STATE_IDLE by player_create(). * @see sound_manager_get_current_sound_type() */ int player_set_sound_type(player_h player, sound_type_e type); /** - * @brief Sets the audio latency mode. - * @since_tizen 2.3 - * @remarks The default audio latency mode of the player is #AUDIO_LATENCY_MODE_MID. - * To get the current audio latency mode, use player_get_audio_latency_mode(). - * If it's high mode, audio output interval can be increased so, it can keep more audio data to play. - * But, state transition like pause or resume can be more slower than default(mid) mode. + * @brief Set the latency mode of audio. * - * @param[in] player The handle to the media player - * @param[in] latency_mode The latency mode to be applied to the audio - * @return @c 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 #audio_latency_mode_e - * @see player_get_audio_latency_mode() + * @remarks + * The default audio latency mode of player is #AUDIO_LATENCY_MODE_MID. + * To get current audio latency mode, use player_get_audio_latency_mode(). + * + * @param[in] player The handle to media player. + * @param[in] latency_mode The latency mode to be applyed to audio. + * @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 #audio_latency_mode_e. + * @see player_get_audio_latency_mode(). */ int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_mode); /** - * @brief Gets the current audio latency mode. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[out] latency_mode The latency mode to get from the audio - * @return @c 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 #audio_latency_mode_e - * @see player_set_audio_latency_mode() + * @brief Get current latency mode of audio. + * @param[in] player The handle to media player. + * @param[out] latency_mode The latency mode to get from audio. + * @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 #audio_latency_mode_e. + * @see player_set_audio_latency_mode(). */ int player_get_audio_latency_mode(player_h player, audio_latency_mode_e *latency_mode); /** * @brief Starts or resumes playback. - * @since_tizen 2.3 + * * @details Plays current media content, or resumes play if paused. * - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * @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 player_prepare() must be called before calling this function. - * @pre The player state must be set to #PLAYER_STATE_READY by calling player_prepare() or set to #PLAYER_STATE_PAUSED by calling player_pause(). + * @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_completed_cb() when playback completes, if you set a callback with player_set_completed_cb(). * @post It invokes player_pd_message_cb() when progressive download starts or completes, if you set a download path with player_set_progressive_download_path() and a callback with player_set_progressive_download_message_cb(). @@ -618,18 +686,17 @@ int player_get_audio_latency_mode(player_h player, audio_latency_mode_e *latency */ int player_start(player_h player); + /** * @brief Stops playing media content. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * @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 set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause(). + * @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. * @post The downloading will be aborted if you use progressive download. * @see player_start() @@ -639,18 +706,17 @@ int player_stop(player_h player); /** * @brief Pauses the player. - * @since_tizen 2.3 - * @remarks You can resume playback using player_start(). * - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * @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 set to #PLAYER_STATE_PLAYING. + * @pre The player state must be #PLAYER_STATE_PLAYING. * @post The player state will be #PLAYER_STATE_READY. * @see player_start() */ @@ -658,52 +724,103 @@ int player_pause(player_h player); /** * @brief Sets the seek position for playback, asynchronously. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[in] millisecond The position in milliseconds from the start to the seek point - * @param[in] accurate If @c true the selected position is returned, but this might be considerably slow, - * otherwise @c false + * @param[in] player The handle to media player + * @param[in] millisecond The position in milliseconds from the start to seek to * @param[in] callback The callback function to register * @param[in] user_data The user data to be passed to the callback function - * @return @c 0 on success, - * otherwise a negative error value + * @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. * @post It invokes player_seek_completed_cb() when seek operation completes, if you set a callback. - * @see player_get_play_position() + * @see player_get_position() + * @see player_get_position_ratio() + * @see player_set_position_ratio() + */ +int player_set_position(player_h player, int millisecond, player_seek_completed_cb callback, void *user_data); + +/** + * @brief Sets the seek position for playback, asynchronously. + * @param[in] player The handle to media player + * @param[in] millisecond The position in milliseconds from the start to seek to + * @param[in] accurate if true, the position selected will be returned but, this might be considerably slow. + * @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_SEEK_FAILED Seek operation failure + * @pre The player state must be one of these: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @post It invokes player_seek_completed_cb() when seek operation completes, if you set a callback. + * @see player_get_position() + * @see player_get_position_ratio() + * @see player_set_position_ratio() + */ +int player_seek(player_h player, int millisecond, bool accurate, player_seek_completed_cb callback, void *user_data); + +/** + * @brief Sets the playback position specified by percent of media content played, asynchronously. + * @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) + * @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_SEEK_FAILED Seek operation failure + * @pre The player state must be one of these: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @post It invokes player_seek_completed_cb() when seek operation completes, if you set a callback. + * @see player_get_position() + * @see player_get_position_ratio() + * @see player_set_position() */ -int player_set_play_position(player_h player, int millisecond, bool accurate, player_seek_completed_cb callback, void *user_data); +int player_set_position_ratio(player_h player, int percent, player_seek_completed_cb callback, void *user_data); /** - * @brief Gets the current position in milliseconds. - * @since_tizen 2.3 - * @param[in] player The handle to the media player + * @brief Gets current position in milliseconds. + * @param[in] player The handle to media player * @param[out] millisecond The current position in milliseconds - * @return @c 0 on success, - * otherwise a negative error value + * @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_set_play_position() + * @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_play_position(player_h player, int *millisecond); +int player_get_position_ratio(player_h player, int *percent); /** * @brief Sets the player's mute status. - * @since_tizen 2.3 - * @details If the mute status is @c true, no sounds are played. - * If it is @c false, sounds are 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 the media player - * @param[in] muted The new mute status: (@c true = mute, @c false = not muted) - * @return @c 0 on success, - * otherwise a negative error value + * @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 @@ -714,14 +831,12 @@ int player_set_mute(player_h player, bool muted); /** * @brief Gets the player's mute status. - * @since_tizen 2.3 - * @details If the mute status is @c true, no sounds are played. - * If it is @c false, sounds are played at the previously set volume level. * - * @param[in] player The handle to the media player + * @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 @c 0 on success, - * otherwise a negative error value + * @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 @@ -732,14 +847,12 @@ int player_is_muted(player_h player, bool *muted); /** * @brief Sets the player's looping status. - * @since_tizen 2.3 - * @details If the looping status is @c true, playback automatically restarts upon finishing. - * If it is @c false, it won't. The default value is @c false. * - * @param[in] player The handle to the media player - * @param[in] looping The new looping status: (@c true = looping, @c false = non-looping ) - * @return @c 0 on success, - * otherwise a negative error value + * @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 @@ -749,16 +862,15 @@ int player_is_muted(player_h player, bool *muted); */ int player_set_looping(player_h player, bool looping); + /** * @brief Gets the player's looping status. - * @since_tizen 2.3 - * @details If the looping status is @c true, playback automatically restarts upon finishing. - * If it is @c false, it won't. * - * @param[in] player The handle to the media player + * @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 @c 0 on success, - * otherwise a negative error value + * @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 @@ -768,126 +880,272 @@ int player_set_looping(player_h player, bool 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(). + * @remarks The playback type should be local playback or http streaming playback. + * @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_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. - * @since_tizen 2.3 - * @remarks To get @a display to set, use #GET_DISPLAY(). - * @remarks To use the multiple surface display mode, use player_set_display() again with a different display type. - * @param[in] player The handle to the media player + * @remaks To get @a display to set, use #GET_DISPLAY(). + * @remaks To use multiple surface display mode, use player_set_display() again with different display type. + * @param[in] player The handle to media player * @param[in] type The display type * @param[in] display The handle to display - * @return @c 0 on success, - * otherwise a negative error value + * @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_display_rotation */ int player_set_display(player_h player, player_display_type_e type, player_display_h display); /** - * @} - */ - -/** - * @addtogroup CAPI_MEDIA_PLAYER_DISPLAY_MODULE - * @{ + * @brief Gets the availability of display mode change + * @remark The result can be changed by display setting. + * @param[in] player The handle to media player + * @param[out] changeable The cuurent availability of display mode change (@c true = changeable, @c false = non-changeable ) + * @return 0 on success, otherwise a negative error value. + * @retval #PLAYER_ERROR_NONE Successful + * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter + * @see player_set_display_mode() */ +int player_is_display_mode_changeable(player_h player, bool* changeable); /** - * @brief Sets the video display mode. - * @since_tizen 2.3 - * @remarks If no display is set, no operation is performed. - * @param[in] player The handle to the media player + * @brief Sets a video display mode + * @remarks If no display is not set, no operation is performed. + * @param[in] player The handle to media player * @param[in] mode The display mode - * @return @c 0 on success, - * otherwise a negative error value + * @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 - * @pre The player should support display mode changes. + * @pre The player should be supported display mode changing. (player_is_display_mode_changeable()) * @see player_get_display_mode() */ int player_set_display_mode(player_h player, player_display_mode_e mode); /** - * @brief Gets the video display mode. - * @since_tizen 2.3 - * @remarks If no display is set, no operation is performed. - * @param[in] player The handle to the media player + * @brief Gets the video display mode + * @remarks If no display is not set, no operation is performed. + * @param[in] player The handle to media player * @param[out] mode The current display mode - * @return @c 0 on success, - * otherwise a negative error value + * @return 0 on success, otherwise a negative error value. * @retval #PLAYER_ERROR_NONE Successful * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @see player_set_display_mode() */ int player_get_display_mode(player_h player, player_display_mode_e *mode); +/** + * @brief Sets the playback rate + * @details The default value is 1.0. + * @remarks #PLAYER_ERROR_INVALID_OPERATION occured if streaming playbak. + * @remarks No operation is performed, if @a rate is 0. + * @remarks The sound is muted, when playback rate is under 0.0 and over 2.0. + * @param[in] player The handle to media player + * @param[in] rate The playback rate (-5.0x ~ 5.0x) + * @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(). + * @pre The player state must be #PLAYER_STATE_READY by player_prepare() or #PLAYER_STATE_PLAYING by player_start() or #PLAYER_STATE_PAUSED by player_pause(). + */ +int player_set_playback_rate(player_h player, float rate); + +/** + * @} + */ + +/** + * @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 - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[in] visible The visibility of the display (@c true = visible, @c false = non-visible ) - * @return @c 0 on success, - * otherwise a negative error value + * @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_display_visible() + * @see player_is_x11_display_visible() */ -int player_set_display_visible(player_h player, bool visible); +int player_set_x11_display_visible(player_h player, bool visible); /** - * @brief Gets the visibility of the x surface video display. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[out] visible The current visibility of the display (@c true = visible, @c false = non-visible ) - * @return @c 0 on success, - * otherwise a negative error value + * @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_display_visible() + * @see player_set_x11_display_visible() */ -int player_is_display_visible(player_h player, bool* visible); +int player_is_x11_display_visible(player_h player, bool* visible); /** - * @brief Sets the rotation settings of the video surface display. - * @since_tizen 2.3 - * @details Use this function to change the video orientation to portrait mode. - * @param[in] player The handle to the media player - * @param[in] rotation The rotation of the display - * @return @c 0 on success, - * otherwise a negative error value + * @brief Sets the zoom level 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] level The level of zoom [1~9] + * @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 - * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature - * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE In case of using evasimagesink by PLAYER_DISPLAY_TYPE_EVAS - * @see player_set_display - * @see player_get_display_rotation() + * @see player_get_x11_display_zoom() */ -int player_set_display_rotation(player_h player, player_display_rotation_e rotation); +int player_set_x11_display_zoom(player_h player, int level); /** - * @brief Gets the rotation of the video surface display. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[out] rotation The current rotation of the display - * @return @c 0 on success, - * otherwise a negative error value + * @brief Gets a zoom level 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] level The level of zoom [1~9] + * @return 0 on success, otherwise a negative error value. * @retval #PLAYER_ERROR_NONE Successful * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter - * @see player_set_display_rotation() + * @see player_set_x11_display_zoom() */ -int player_get_display_rotation( player_h player, player_display_rotation_e *rotation); +int player_get_x11_display_zoom( player_h player, int *level); + +/** + * @internal + * @brief Registers a callback function to be invoked when player need updated xid. + * @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 player state must be either #PLAYER_STATE_IDLE by player_create() or #PLAYER_STATE_READY by player_prepare(). + * @post player_set_x11_display_pixmap() will be invoked + * @see player_set_x11_display_pixmap() + */ +int player_set_x11_display_pixmap (player_h player, player_x11_pixmap_updated_cb callback, void *user_data); + +/** + * @internal + * @brief Registers a callback function to be invoked when failure of rendering video frame happen. + * @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_STATE Invalid state + * @pre The player state must be either #PLAYER_STATE_IDLE by player_create() or #PLAYER_STATE_READY by player_prepare(). + * @post player_set_x11_display_pixmap_error_cb() will be invoked + * @see player_set_x11_display_pixmap_error_cb() + */ +int player_set_x11_display_pixmap_error_cb (player_h player, player_x11_pixmap_error_cb callback, void *user_data); + +/** + * @brief Sets information of ROI + * @remarks If current display mode is not #PLAYER_DISPLAY_MODE_ROI, #PLAYER_ERROR_INVALID_OPERATION will be returned. + * @param[in] player The handle to media player + * @param[in] x The x coordinate of ROI + * @param[in] y The y coordinate of ROI + * @param[in] w The width of ROI + * @param[in] h The height of ROI + * @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 + * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation + * @see player_get_x11_display_roi() + */ +int player_set_x11_display_roi (player_h player, int x, int y, int w, int h); + +/** + * @brief Gets information of ROI + * @remarks If current display mode is not #PLAYER_DISPLAY_MODE_ROI, #PLAYER_ERROR_INVALID_OPERATION will be returned. + * @param[in] player The handle to media player + * @param[out] x The x coordinate of ROI + * @param[out] y The y coordinate of ROI + * @param[out] w The width of ROI + * @param[out] h The height of ROI + * @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 + * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation + * @see player_set_x11_display_roi() + */ +int player_get_x11_display_roi (player_h player, int *x, int *y, int *w, int *h); /** * @} */ +/** + * @addtogroup CAPI_MEDIA_PLAYER_EVAS_DISPLAY_MODULE + * @{ + */ + +/** + * @brief Sets the evas surface video display scaling status. + * @remarks If current display type is not #PLAYER_DISPLAY_TYPE_EVAS, no operation is performed. + * @remarks If the scaling status is @c false, player_is_display_mode_changeable() always return @a false. + * @param[in] player The handle to media player + * @param[in] enable New evas surface video display scaling status: (@c true = scaling, @c false = not scaled) + * @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. + */ +int player_enable_evas_display_scaling(player_h player, bool enable); + +/** + * @} + */ /** * @addtogroup CAPI_MEDIA_PLAYER_STREAM_INFO_MODULE @@ -895,139 +1153,112 @@ int player_get_display_rotation( player_h player, player_display_rotation_e *rot */ /** - * @brief Gets the media content information. - * @since_tizen 2.3 - * @remarks You must release @a value using @c free(). - * @remarks The playback type should be local playback or HTTP streaming playback. - * @param[in] player The handle to the media player + * @brief Get the media content information + * @remarks @a value must be released with @c free() by you + * @remarks The playback type should be local playback or http streaming playback. + * @param[in] player The handle to media player * @param[in] key The key attribute name to get - * @param[out] value The value of the key attribute \n - * It can be an empty string if there is no content information. - * @return @c 0 on success, - * otherwise a negative error value + * @param[out] value The value of the key attribute. It can be empty string if there is no content information. + * @return 0 on success, otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #PLAYER_ERROR_OUT_OF_MEMORY Not enough memory is available * @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_PLAYING or #PLAYER_STATE_PAUSED. + * @pre The player state must be one of: #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. */ int player_get_content_info(player_h player, player_content_info_e key, char ** value); /** - * @brief Gets the audio and video codec information. - * @since_tizen 2.3 - * @remarks You must release @a audio_codec and @a video_codec using free(). - * @remarks The playback type should be local playback or HTTP streaming playback. - * @param[in] player The handle to the media player - * @param[out] audio_codec The name of the audio codec \n - * It can be @c NULL if there is no audio codec. - * @param[out] video_codec The name of the video codec \n - * It can be @c NULL if there is no video codec. - * @return @c 0 on success, - * otherwise a negative error value + * @brief Gets the audio and video codec information + * @remarks @a audio_codec and @a video_codec must be released with @c free() by you + * @remarks The playback type should be local playback or http streaming playback. + * @param[in] player The handle to media player + * @param[out] audio_codec The name of audio codec. It can be @c NULL if there is no audio codec. + * @param[out] video_codec The name of video codec. It can be @c NULL if there is no video codec. + * @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_PLAYING or #PLAYER_STATE_PAUSED. + * @pre The player state must be one of: #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. */ int player_get_codec_info(player_h player, char **audio_codec, char **video_codec); /** - * @brief Gets the audio stream information. - * @since_tizen 2.3 - * @remarks The playback type should be local playback or HTTP streaming playback. - * @param[in] player The handle to the media player - * @param[out] sample_rate The audio sample rate [Hz] \n - * Value can be invalid if there is no audio stream information. - * @param[out] channel The audio channel (1: mono, 2: stereo) \n - * Value can be invalid if there is no audio stream information. - * @param[out] bit_rate The audio bit rate [Hz] \n - * Value can be invalid if there is no audio stream information. - * @return @c 0 on success, - * otherwise a negative error value + * @brief Gets the audio stream information + * @remarks The playback type should be local playback or http streaming playback. + * @param[in] player The handle to media player + * @param[out] sample_rate The audio sample rate [Hz]. It can be invalid value if there is no audio stream information. + * @param[out] channel The audio channel (1: mono, 2: stereo). It can be invalid value if there is no audio stream information. + * @param[out] bit_rate The audio bit rate [Hz]. It can be invalid value if there is no audio stream information. + * @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_PLAYING or #PLAYER_STATE_PAUSED. + * @pre The player state must be one of: #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. */ int player_get_audio_stream_info(player_h player, int *sample_rate, int *channel, int *bit_rate); /** - * @brief Gets the video stream information. - * @since_tizen 2.3 - * @remarks The playback type should be local playback or HTTP streaming playback. - * @param[in] player The handle to the media player - * @param[out] fps The frame per second of the video \n - * It can be @c 0 if there is no video stream information. - * @param[out] bit_rate The video bit rate [Hz] \n - * It can be an invalid value if there is no video stream information. - * @return @c 0 on success, - * otherwise a negative error value + * @brief Gets the video stream information + * @remarks The playback type should be local playback or http streaming playback. + * @param[in] player The handle to media player + * @param[out] fps The frame per second of video. It can be 0 if there is no video stream information. + * @param[out] bit_rate The video bit rate [Hz]. It can be invalid value if there is no video stream information. + * @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_PLAYING or #PLAYER_STATE_PAUSED. + * @pre The player state must be one of: #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. */ int player_get_video_stream_info(player_h player, int *fps, int *bit_rate); /** * @brief Gets the video display's height and width. - * @since_tizen 2.3 - * @remarks The playback type should be local playback or HTTP streaming playback. - * @param[in] player The handle to the media player - * @param[out] width The width of the video \n - * Value can be invalid if there is no video or no display is set. - * @param[out] height The height of the video \n - * Value can be invalid value if there is no video or no display is set. - * @return @c 0 on success, - * otherwise a negative error value + * @remarks The playback type should be local playback or http streaming playback. + * @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 one of these: #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED. + * @pre The player state must be one of: #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. */ int player_get_video_size(player_h player, int *width, int *height); /** - * @brief Gets the album art in the media resource. - * @since_tizen 2.3 - * @remarks You must not release @a album_art. It will be released by framework when the player is destroyed. - * @param[in] player The handle to the media player - * @param[out] album_art The encoded artwork image - * @param[out] size The encoded artwork size - * @return @c 0 on success, - * otherwise a negative error value + * @brief Gets the album art in media resource + * @remarks Do not release @a album_art. It will be released by framework when player destroys. + * @param[in] player The handle to media player + * @param [out] artwork encoded artwork image + * @param [out] size encoded artwork size + * @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_PLAYING or #PLAYER_STATE_PAUSED. + * @pre The player state must be one of: #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. */ int player_get_album_art(player_h player, void **album_art, int *size); /** - * @brief Gets the total running time of the associated media. - * @since_tizen 2.3 - * @remarks The media source is associated with the player, using either player_set_uri() or player_set_memory_buffer(). - * @remarks The playback type should be local playback or HTTP streaming playback. - * @param[in] player The handle to the media player - * @param[out] duration The duration in milliseconds - * @return @c 0 on success, - * otherwise a negative error value + * @brief Gets the track count + * @param[in] player The handle to media player + * @param [in] type The track type + * @param [out] count The count of track + * @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_PLAYING or #PLAYER_STATE_PAUSED. - * @see player_set_uri() - * @see player_set_memory_buffer() + * @pre The player state must be one of these: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. */ -int player_get_duration(player_h player, int *duration); +int player_get_track_count(player_h player, player_track_type_e type, int *count); /** * @} @@ -1040,65 +1271,156 @@ int player_get_duration(player_h player, int *duration); */ /** - * @brief Gets the number of equalizer bands. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[out] count The number of equalizer bands - * @return @c 0 on success, - * otherwise a negative error value + * @brief Sets an audio effect value. + * @param[in] player The handle to media player + * @param[in] effect The audio effect type + * @param[in] value The value of given effect type + * @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_audio_effect_set_equalizer_band_level() - * @see player_audio_effect_set_equalizer_all_bands() + * @see player_audio_effect_get_value() + * @see player_audio_effect_clear() + * @see player_audio_effect_get_value_range() */ -int player_audio_effect_get_equalizer_bands_count (player_h player, int *count); +int player_audio_effect_set_value(player_h player, audio_effect_e effect, int value); /** - * @brief Sets the gain set for the given equalizer band. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[in] index The index of the equalizer band to be set - * @param[in] level The new gain in decibel that is set to the given band [dB] - * @return @c 0 on success, - * otherwise a negative error value + * @brief Gets an audio effect value. + * @param[in] player The handle to media player + * @param[in] effect The audio effect type + * @param[out] value The value of given effect type + * @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 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_audio_effect_set_value() + */ +int player_audio_effect_get_value(player_h player, audio_effect_e effect, int *value); + +/** + * @brief Clears audio effect. + * @param[in] player The handle to media player + * @param[in] effect The audio effect type + * @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_audio_effect_get_equalizer_bands_count() - * @see player_audio_effect_get_equalizer_level_range() - * @see player_audio_effect_get_equalizer_band_level() - * @see player_audio_effect_set_equalizer_all_bands() + * @see player_audio_effect_set_value() */ -int player_audio_effect_set_equalizer_band_level(player_h player, int index, int level); +int player_audio_effect_clear(player_h player, audio_effect_e effect); /** - * @brief Gets the gain set for the given equalizer band. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[in] index The index of the requested equalizer band - * @param[out] level The gain in decibel of the given band [dB] - * @return @c 0 on success, - * otherwise a negative error value + * @brief Gets the range of audio effect value. + * @param[in] player The handle to media player + * @param[in] effect The audio effect type + * @param[out] min The minumum value to be set + * @param[out] max The maximum value to be 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_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_audio_effect_set_value() + */ +int player_audio_effect_get_value_range(player_h player, audio_effect_e effect, int* min, int* max); + +/** + * @brief Checks whether the given effect is avaliable or not. + * @param[in] player The handle to media player + * @param[in] effect The audio effect to be checked + * @param[out] available @c true if the specified audio effect is available, else @c false + * @retval #PLAYER_ERROR_NONE Successful + * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter + * @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. + */ +int player_audio_effect_is_available(player_h player, audio_effect_e effect, bool *available); + +/** + * @brief Retrieves all supported audio effects by invoking callback function once for each supported audio effect. + * @param[in] player The handle to media player + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @retval #PLAYER_ERROR_NONE Successful + * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter + * @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. + * @post This function invokes player_audio_effect_supported_effect_cb() repeatly to retrieve each supported audio effect. + * @see player_audio_effect_set_value() + * @see player_audio_effect_get_value() + * @see player_audio_effect_foreach_supported_effect() + */ +int player_audio_effect_foreach_supported_effect(player_h player, player_audio_effect_supported_effect_cb callback, void *user_data); + +/** + * @brief Sets an preset audio effect. + * @remarks Audio effects or equalizer which is set be ignored. + * @param[in] player The handle to media player + * @param[in] preset The preset audio effect + * @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_audio_effect_preset_is_available() + * @see player_audio_effect_foreach_supported_preset() + */ +int player_audio_effect_set_preset(player_h player, audio_effect_preset_e preset); + +/** + * @brief Checks whether the given preset is avaliable or not. + * @param[in] player The handle to media player + * @param[in] preset The preset to be checked + * @param[out] available @c true if the specified preset is available, else @c false + * @retval #PLAYER_ERROR_NONE Successful + * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter + * @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. + */ +int player_audio_effect_preset_is_available(player_h player, audio_effect_preset_e preset, bool *available); + +/** + * @brief Retrieves all supported presets by invoking callback function once for each supported preset audio effect. + * @param[in] player The handle to media player + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @retval #PLAYER_ERROR_NONE Successful + * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter + * @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. + * @post This function invokes player_audio_effect_supported_preset_cb() repeatly to retrieve each supported preset audio effect. + * @see player_audio_effect_set_preset() + * @see player_audio_effect_supported_preset_cb() + */ +int player_audio_effect_foreach_supported_preset(player_h player, player_audio_effect_supported_preset_cb callback, void *user_data); + +/** + * @brief Gets the bands number of equalizer. + * @param[in] player The handle to media player + * @param[out] count The number of equalizer bands + * @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 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_audio_effect_set_equalizer_band_level() + * @see player_audio_effect_set_equalizer_all_bands() */ -int player_audio_effect_get_equalizer_band_level(player_h player, int index, int *level); +int player_audio_effect_get_equalizer_bands_count (player_h player, int *count); /** - * @brief Sets all bands of the equalizer. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[in] band_levels The list of band levels to be set + * @brief Sets the all bands of equalizer. + * @param[in] player The handle to media player + * @param[in] band_levels The list of band level to be set * @param[in] length The length of the band level - * @return @c 0 on success, - * otherwise a negative error value + * @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 @@ -1111,13 +1433,43 @@ int player_audio_effect_get_equalizer_band_level(player_h player, int index, int int player_audio_effect_set_equalizer_all_bands(player_h player, int *band_levels, int length); /** - * @brief Gets the valid band level range of the equalizer. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[out] min The minimum value to be set [dB] + * @brief Sets the gain set for the given equalizer band. + * @param[in] player The handle to media player + * @param[in] index The index of qualizer band to be set + * @param[in] level New gain in decibel that will be set to the given band.[dB] + * @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_audio_effect_get_equalizer_bands_count() + * @see player_audio_effect_get_equalizer_level_range() + * @see player_audio_effect_get_equalizer_band_level() + * @see player_audio_effect_set_equalizer_all_bands() + */ +int player_audio_effect_set_equalizer_band_level(player_h player, int index, int level); + +/** + * @brief Gets the gain set for the given equalizer band. + * @param[in] player The handle to media player + * @param[in] index The index of qualizer band which is requested + * @param[out] level The gain in decibel of the given band [dB] + * @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 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_audio_effect_set_equalizer_band_level() + */ +int player_audio_effect_get_equalizer_band_level(player_h player, int index, int *level); + +/** + * @brief Gets the valid band level range of equalizer. + * @param[in] player The handle to media player + * @param[out] min The minumum value to be set [dB] * @param[out] max The maximum value to be set [dB] - * @return @c 0 on success, - * otherwise a negative error value + * @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 player state @@ -1128,13 +1480,11 @@ int player_audio_effect_set_equalizer_all_bands(player_h player, int *band_level int player_audio_effect_get_equalizer_level_range(player_h player, int* min, int* max); /** - * @brief Gets the band frequency of the equalizer. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[in] index The index of the requested equalizer band + * @brief Gets the band frequency of equalizer. + * @param[in] player The handle to media player + * @param[in] index The index of qualizer band which is requested * @param[out] frequency The frequency of the given band [dB] - * @return @c 0 on success, - * otherwise a negative error value + * @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 player state @@ -1143,13 +1493,11 @@ int player_audio_effect_get_equalizer_level_range(player_h player, int* min, int int player_audio_effect_get_equalizer_band_frequency(player_h player, int index, int *frequency); /** - * @brief Gets the band frequency range of the equalizer. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[in] index The index of the requested equalizer band + * @brief Gets the band frequency range of equalizer. + * @param[in] player The handle to media player + * @param[in] index The index of qualizer band which is requested * @param[out] range The frequency range of the given band [dB] - * @return @c 0 on success, - * otherwise a negative error value + * @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 player state @@ -1159,8 +1507,8 @@ int player_audio_effect_get_equalizer_band_frequency_range(player_h player, int /** * @brief Clears the equalizer effect. - * @since_tizen 2.3 - * @param[in] player The handle to the media player + * @param[in] player The handle to media player + * @param[in] effect The audio effect type * @retval #PLAYER_ERROR_NONE Successful * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation @@ -1172,11 +1520,9 @@ int player_audio_effect_get_equalizer_band_frequency_range(player_h player, int int player_audio_effect_equalizer_clear(player_h player); /** - * @brief Checks whether the custom equalizer effect is available. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[out] available If @c true the specified audio effect is available, - * otherwise @c false + * @brief Checks whether the custom equilizer effect is avaliable or not. + * @param[in] player The handle to media player + * @param[out] available @c true if the specified audio effect is available, else @c false * @retval #PLAYER_ERROR_NONE Successful * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state @@ -1190,26 +1536,82 @@ int player_audio_effect_equalizer_is_available(player_h player, bool *available) * @} */ - /** * @addtogroup CAPI_MEDIA_PLAYER_MODULE * @{ */ +/** + * @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_create() or player_unprepare(). + */ +int player_set_subtitle_path(player_h player,const char *path); + +/** + * @brief Sets the seek position for subtitle. + * @remarks Only MicroDVD/SubViewer(*.sub), SAMI(*.smi), and SubRip(*.srt) subtitle formats are supported. + * @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_INVALID_STATE Invalid player state + * @pre The subtitle must be set by player_set_subtitle_path(). + * @pre The player state must be one of: #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + */ +int player_set_subtitle_position(player_h player, int millisecond); + +/** + * @brief Sets a path to download, progressively. + * @remarks Progressive download will be started when you invoke player_start(). + * @param[in] player The handle to media player + * @param[in] path The absolute path to download + * @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_create() or player_unprepare(). + * @see player_set_progressive_download_message_cb() + * @see player_unset_progressive_download_message_cb() + */ +int player_set_progressive_download_path(player_h player, const char *path); + +/** + * @brief Gets the staus of progressive download. + * @param[in] player The handle to media player + * @param[out] current The current download position (bytes) + * @param[out] total_size The total size of file (bytes) + * @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 progressive download path must be set by player_set_progressive_download_path(). + * @pre The player state must be either #PLAYER_STATE_PLAYING by player_start() or #PLAYER_STATE_PAUSED by player_pause(). + */ +int player_get_progressive_download_status(player_h player, unsigned long *current, unsigned long *total_size); + /** * @brief Captures the video frame, asynchronously. - * @since_tizen 2.3 - * @param[in] player The handle to the media player + * @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 @c 0 on success, - * otherwise a negative error value + * @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 - * Video type should be set using player_set_display() otherwises, audio stream is only processed even though video file is set. * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state - * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause(). + * @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() */ @@ -1217,66 +1619,58 @@ int player_capture_video(player_h player, player_video_captured_cb callback, voi /** * @brief Sets the cookie for streaming playback. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[in] cookie The cookie to set - * @param[in] size The size of the cookie - * @return @c 0 on success, - * otherwise a negative error value + * @param[in] player The handle to media player + * @param[in] cookie The cookie to set + * @param[in] size The size of cookie + * @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 set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). + * @pre The player state should be #PLAYER_STATE_IDLE by player_create() or player_unprepare(). * @see player_set_streaming_user_agent() */ int player_set_streaming_cookie(player_h player, const char *cookie, int size); /** - * @brief Sets the streaming user agent for playback. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[in] user_agent The user agent to set - * @param[in] size The size of the user agent - * @return @c 0 on success, - * otherwise a negative error value + * @brief Sets the user agent for streaming playback. + * @param[in] player The handle to media player + * @param[in] user_agent The user agent to set + * @param[in] size The size of user agent + * @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 set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). + * @pre The player state should be #PLAYER_STATE_IDLE by player_create() or player_unprepare(). * @see player_set_streaming_cookie() */ int player_set_streaming_user_agent(player_h player, const char *user_agent, int size); /** * @brief Gets the download progress for streaming playback. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[out] start The starting position in percentage [0, 100] - * @param[out] current The current position in percentage [0, 100] - * @return @c 0 on success, - * otherwise a negative error value + * @param[in] player The handle to media player + * @param[out] start The starting position in percent [0, 100] + * @param[out] current The current position in percent [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_INVALID_STATE Invalid player state - * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause(). + * @pre The player state must be either #PLAYER_STATE_PLAYING by player_start() or #PLAYER_STATE_PAUSED by player_pause(). */ int player_get_streaming_download_progress(player_h player, int *start, int *current); /** - * @brief Registers a callback function to be invoked when the playback is finished. - * @since_tizen 2.3 - * @param[in] player The handle to the media 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 @c 0 on success, - * otherwise a negative error value + * @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. + * @post player_completed_cb() will be invoked * @see player_unset_completed_cb() * @see player_completed_cb() * @see player_start() @@ -1284,11 +1678,9 @@ int player_get_streaming_download_progress(player_h player, int *start, int *cur int player_set_completed_cb(player_h player, player_completed_cb callback, void *user_data); /** - * @brief Unregisters the callback function. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * @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 @@ -1297,17 +1689,15 @@ int player_set_completed_cb(player_h player, player_completed_cb callback, void int player_unset_completed_cb(player_h player); /** - * @brief Registers a callback function to be invoked when the playback is interrupted or the interrupt is completed. - * @since_tizen 2.3 - * @param[in] player The handle to the media player + * @brief Registers a callback function to be invoked when the playback is interrupted or interrupt completed. + * @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 @c 0 on success, - * otherwise a negative error value + * @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. + * @post player_interrupted_cb() will be invoked * @see player_unset_interrupted_cb() * @see #player_interrupted_code_e * @see player_interrupted_cb() @@ -1316,10 +1706,8 @@ int player_set_interrupted_cb(player_h player, player_interrupted_cb callback, v /** * @brief Unregisters the callback function. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * @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 @@ -1328,17 +1716,15 @@ int player_set_interrupted_cb(player_h player, player_interrupted_cb callback, v int player_unset_interrupted_cb(player_h player); /** - * @brief Registers a callback function to be invoked when an error occurs. - * @since_tizen 2.3 - * @param[in] player The handle to the media 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 @c 0 on success, - * otherwise a negative error value + * @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. + * @post player_error_cb() will be invoked * @see player_unset_error_cb() * @see player_error_cb() */ @@ -1346,10 +1732,9 @@ int player_set_error_cb(player_h player, player_error_cb callback, void *user_da /** * @brief Unregisters the callback function. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * + * @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 @@ -1359,17 +1744,15 @@ 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. - * @since_tizen 2.3 - * @remarks The media resource should be streamed over the network. - * @param[in] player The handle to the media player + * @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 @c 0 on success, - * otherwise a negative error value + * @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. + * @post player_buffering_cb() will be invoked * @see player_unset_buffering_cb() * @see player_set_uri() * @see player_buffering_cb() @@ -1378,10 +1761,8 @@ int player_set_buffering_cb(player_h player, player_buffering_cb callback, void /** * @brief Unregisters the callback function. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * @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 @@ -1390,53 +1771,16 @@ int player_set_buffering_cb(player_h player, player_buffering_cb callback, void int player_unset_buffering_cb(player_h player); /** - * @brief Sets a path to download, progressively. - * @since_tizen 2.3 - * @remarks Progressive download will be started when you invoke player_start(). - * @param[in] player The handle to the media player - * @param[in] path The absolute path to download - * @return @c 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 set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). - * @see player_set_progressive_download_message_cb() - * @see player_unset_progressive_download_message_cb() - */ -int player_set_progressive_download_path(player_h player, const char *path); - -/** - * @brief Gets the status of progressive download. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @param[out] current The current download position (bytes) - * @param[out] total_size The total size of the file (bytes) - * @return @c 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 progressive download path must be set by calling player_set_progressive_download_path(). - * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause(). - */ -int player_get_progressive_download_status(player_h player, unsigned long *current, unsigned long *total_size); - -/** - * @brief Registers a callback function to be invoked when progressive download is started or completed. - * @since_tizen 2.3 - * @param[in] player The handle to the media player + * @brief Registers a callback function to be invoked when progressive download is starts or completes. + * @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 @c 0 on success, - * otherwise a negative error value + * @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 path to download must be set by calling player_set_progressive_download_path(). - * @post player_pd_message_cb() will be invoked. + * @pre The path to download must be set by player_set_progressive_download_path(). + * @post player_pd_message_cb() will be invoked * @see player_unset_progressive_download_message_cb() * @see player_set_progressive_download_path() */ @@ -1444,10 +1788,8 @@ int player_set_progressive_download_message_cb(player_h player, player_pd_messag /** * @brief Unregisters the callback function. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * @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 @@ -1456,60 +1798,16 @@ int player_set_progressive_download_message_cb(player_h player, player_pd_messag int player_unset_progressive_download_message_cb(player_h player); /** - * @brief Sets the playback rate. - * @since_tizen 2.3 - * @details The default value is @c 1.0. - * @remarks #PLAYER_ERROR_INVALID_OPERATION occurs when streaming playback. - * @remarks No operation is performed, if @a rate is @c 0. - * @remarks The sound is muted, when playback rate is under @c 0.0 and over @c 2.0. - * @param[in] player The handle to the media player - * @param[in] rate The playback rate (-5.0x ~ 5.0x) - * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation - * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state - * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling player_start(). - * @pre The player state must be set to #PLAYER_STATE_READY by calling player_prepare() or set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause(). - */ -int player_set_playback_rate(player_h player, float rate); - -/** - * @} - */ - -/** - * @addtogroup CAPI_MEDIA_PLAYER_SUBTITLE_MODULE - * @{ - */ - -/** - * @brief Sets a subtitle path. - * @since_tizen 2.3 - * @remarks Only MicroDVD/SubViewer(*.sub), SAMI(*.smi), and SubRip(*.srt) subtitle formats are supported. - * @param[in] player The handle to the media player - * @param[in] path The absolute path of the subtitle file, it can be @c NULL in the #PLAYER_STATE_IDLE state. - * @return @c 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. - * @pre The path value can be @c NULL for reset when the player state is set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). - */ -int player_set_subtitle_path(player_h player,const char *path); - -/** - * @brief Registers a callback function to be invoked when a subtitle updates. - * @since_tizen 2.3 - * @param[in] player The handle to the media 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 @c 0 on success, - * otherwise a negative error value + * @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 subtitle must be set by calling player_set_subtitle_path(). - * @post player_subtitle_updated_cb() will be invoked. + * @pre The subtitle 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() @@ -1518,10 +1816,8 @@ int player_set_subtitle_updated_cb(player_h player, player_subtitle_updated_cb c /** * @brief Unregisters the callback function. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * @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 @@ -1530,56 +1826,60 @@ int player_set_subtitle_updated_cb(player_h player, player_subtitle_updated_cb c int player_unset_subtitle_updated_cb(player_h player); /** - * @internal - * @brief Sets the seek position for the subtitle. - * @since_tizen 2.3 - * @remarks Only MicroDVD/SubViewer(*.sub), SAMI(*.smi), and SubRip(*.srt) subtitle formats are supported. - * @param[in] player The handle to the media player - * @param[in] millisecond The position in milliseconds from the start to the seek point - * @return @c 0 on success, - * otherwise a negative error value + * @brief Registers a callback function to be invoked when video frame is decoded. + * @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 subtitle must be set by calling player_set_subtitle_path(). - * @pre The player state must be one of these: #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED. + * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare(). + * @post player_video_frame_decoded_cb() will be invoked + * @see player_unset_video_frame_decoded_cb() + * @see player_video_frame_decoded_cb() */ -int player_set_subtitle_position_offset(player_h player, int millisecond); +int player_set_video_frame_decoded_cb(player_h player, player_video_frame_decoded_cb callback, void *user_data); /** - * @brief Registers a media packet video callback function to be called once per frame. - * @since_tizen 2.3 - * @remarks This function should be called before preparing. \n - * A registered callback is called on the internal thread of the player. \n - * A video frame can be retrieved using a registered callback as a media packet.\n - * The callback function holds the same buffer that will be drawn on the display device.\n - * So if you change the media packet in a registerd callback, it will be displayed on the device\n - * and the media packet is available until it's destroyed by media_packet_destroy(). - * @param[in] player The handle to the media player - * @param[in] callback The callback function to be registered - * @param[in] user_data The user data to be passed to the callback function - * @return @c 0 on success, - * otherwise a negative error value + * @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_STATE Invalid state - * @pre The player's state should be #PLAYER_STATE_IDLE. And, #PLAYER_DISPLAY_TYPE_NONE should be set by calling player_set_display. - * @see player_unset_media_packet_video_frame_decoded_cb + * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation + * @see player_set_video_frame_decoded_cb() */ -int player_set_media_packet_video_frame_decoded_cb(player_h player, player_media_packet_video_decoded_cb callback, void *user_data); +int player_unset_video_frame_decoded_cb(player_h player); + +/** + * @brief Registers a callback function to be invoked when audio frame is decoded. + * @param[in] player The handle to media player + * @param[in] start The start position to decode. + * @param[in] end The end position to decode. + * @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 player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare(). + * @post player_audio_frame_decoded_cb() will be invoked + * @see player_unset_audio_frame_decoded_cb() + * @see player_audio_frame_decoded_cb() + */ +int player_set_audio_frame_decoded_cb(player_h player, int start, int end, player_audio_frame_decoded_cb callback, void *user_data); /** * @brief Unregisters the callback function. - * @since_tizen 2.3 - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value + * @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 - * @see player_set_media_packet_video_frame_decoded_cb() + * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation + * @see player_set_audio_frame_decoded_cb() */ -int player_unset_media_packet_video_frame_decoded_cb(player_h player); +int player_unset_audio_frame_decoded_cb(player_h player); /** * @} diff --git a/include/player_private.h b/include/player_private.h index 93501cd..39e7bee 100644 --- a/include/player_private.h +++ b/include/player_private.h @@ -23,28 +23,6 @@ extern "C" { #endif -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "TIZEN_N_PLAYER" - -#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") - -#define PLAYER_RANGE_ARG_CHECK(arg, min, max) \ - PLAYER_CHECK_CONDITION(arg <= max,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER") \ - PLAYER_CHECK_CONDITION(arg >= min,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER") - typedef enum { _PLAYER_EVENT_TYPE_PREPARE, _PLAYER_EVENT_TYPE_COMPLETE, @@ -54,17 +32,13 @@ typedef enum { _PLAYER_EVENT_TYPE_SUBTITLE, _PLAYER_EVENT_TYPE_CAPTURE, _PLAYER_EVENT_TYPE_SEEK, - _PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME, + _PLAYER_EVENT_TYPE_VIDEO_FRAME, _PLAYER_EVENT_TYPE_AUDIO_FRAME, _PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR, _PLAYER_EVENT_TYPE_PD, _PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT, _PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET, _PLAYER_EVENT_TYPE_MISSED_PLUGIN, -#ifdef _PLAYER_FOR_PRODUCT - _PLAYER_EVENT_TYPE_IMAGE_BUFFER, - _PLAYER_EVENT_TYPE_SELECTED_SUBTITLE_LANGUAGE, -#endif _PLAYER_EVENT_TYPE_NUM }_player_event_e; @@ -80,15 +54,8 @@ typedef struct _player_s{ bool is_display_visible; bool is_progressive_download; pthread_t prepare_async_thread; - GHashTable *ecore_jobs; - player_error_e error_code; - bool is_doing_jobs; - media_format_h pkt_fmt; } player_s; -int __player_convert_error_code(int code, char* func_name); -bool __player_state_validate(player_s * handle, player_state_e threshold); - #ifdef __cplusplus } #endif diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index c780c43..52e0f75 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -1,23 +1,30 @@ +%bcond_with wayland +%bcond_with x + Name: capi-media-player Summary: A Media Player library in Tizen Native API -Version: 0.1.58 -Release: 0 +Version: 0.1.1 +Release: 1 Group: Multimedia/API License: Apache-2.0 Source0: %{name}-%{version}.tar.gz +Source1001: capi-media-player.manifest BuildRequires: cmake BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(mm-player) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-media-sound-manager) -BuildRequires: pkgconfig(gstreamer-1.0) +BuildRequires: pkgconfig(mm-ta) BuildRequires: pkgconfig(appcore-efl) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(evas) +%if %{with x} BuildRequires: pkgconfig(ecore-x) -BuildRequires: pkgconfig(capi-media-tool) -BuildRequires: pkgconfig(libtbm) +%endif +%if %{with wayland} +BuildRequires: pkgconfig(ecore-wayland) +%endif Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig @@ -25,26 +32,33 @@ Requires(postun): /sbin/ldconfig %description A Media Player library in Tizen Native API. + %package devel Summary: A Media Player library in Tizen Native API (Development) -Group: Multimedia/API +Group: Development/Multimedia Requires: %{name} = %{version}-%{release} %description devel %devel_desc + %prep %setup -q +cp %{SOURCE1001} . %build -%if 0%{?sec_build_binary_debug_enable} -export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" -#export CFLAGS+=" -D_USE_X_DIRECT_" -export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" -export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" -%endif MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \ +%if %{with wayland} + -DWAYLAND_SUPPORT=On \ +%else + -DWAYLAND_SUPPORT=Off \ +%endif +%if %{with x} + -DX11_SUPPORT=On +%else + -DX11_SUPPORT=Off +%endif make %{?jobs:-j%jobs} @@ -52,25 +66,26 @@ make %{?jobs:-j%jobs} %install rm -rf %{buildroot} mkdir -p %{buildroot}/usr/share/license -mkdir -p %{buildroot}/opt/usr/devel +mkdir -p %{buildroot}/usr/bin cp LICENSE.APLv2 %{buildroot}/usr/share/license/%{name} -cp test/player_test %{buildroot}/opt/usr/devel - +cp test/player_test %{buildroot}/usr/bin %make_install -%post -/sbin/ldconfig +%post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files +%manifest %{name}.manifest +%license LICENSE.APLv2 %manifest capi-media-player.manifest %{_libdir}/libcapi-media-player.so.* %{_datadir}/license/%{name} -/opt/usr/devel/* +%{_bindir}/* %files devel +%manifest %{name}.manifest %{_includedir}/media/*.h %{_libdir}/pkgconfig/*.pc %{_libdir}/libcapi-media-player.so diff --git a/src/player.c b/src/player.c index a496e11..97036c0 100644 --- a/src/player.c +++ b/src/player.c @@ -25,60 +25,34 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include - -#define __JOB_KEY_PREPARED "prepared" -#define __JOB_KEY_ERROR "error" -#define __JOB_KEY_SEEK_DONE "seek_done" -#define __JOB_KEY_EOS "eos" - -#define __RELEASEIF_PREPARE_THREAD(thread_id) \ - do { \ - if (thread_id) \ - { \ - pthread_join(thread_id, NULL); \ - thread_id = 0; \ - LOGI("prepare thread released\n"); \ - } \ - }while(0) - -#define __DELETE_ECORE_ITEM(ecore_job) \ - do { \ - if (ecore_job) \ - { \ - ecore_job_del(ecore_job); \ - ecore_job = NULL; \ - } \ - }while(0) - -#define __ADD_ECORE_JOB(handle, key, job_callback) \ - do \ - { \ - Ecore_Job *job = NULL; \ - job = ecore_job_add(job_callback, (void *)handle); \ - LOGI("adding %s job - %p\n", key, job); \ - g_hash_table_insert(handle->ecore_jobs, g_strdup(key), job); \ - \ - } while(0) - -#define __REMOVE_ECORE_JOB(handle, job_key) \ - do \ - { \ - LOGI("%s done so, remove\n", job_key); \ - g_hash_table_remove(handle->ecore_jobs, job_key); \ - handle->is_doing_jobs = FALSE; \ - } while(0) +#include + +#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 __player_convert_error_code(int code, char* func_name) +static int __convert_error_code(int code, char* func_name) { int ret = PLAYER_ERROR_INVALID_OPERATION; char* msg="PLAYER_ERROR_INVALID_OPERATION"; @@ -111,14 +85,14 @@ int __player_convert_error_code(int code, char* func_name) case MM_ERROR_PLAYER_INVALID_STREAM: case MM_ERROR_PLAYER_STREAMING_FAIL: case MM_ERROR_PLAYER_NO_OP: + case MM_ERROR_NOT_SUPPORT_API: ret = PLAYER_ERROR_INVALID_OPERATION; msg = "PLAYER_ERROR_INVALID_OPERATION"; break; case MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS: - case MM_ERROR_NOT_SUPPORT_API: case MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER: - ret =PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE; - msg = "PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE"; + ret = PLAYER_ERROR_INVALID_OPERATION; + msg = "PLAYER_ERROR_INVALID_OPERATION (NOT SUPPORTED AUDIO EFFECT)"; break; case MM_ERROR_PLAYER_NO_FREE_SPACE: ret = PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE; @@ -199,181 +173,18 @@ int __player_convert_error_code(int code, char* func_name) ret = PLAYER_ERROR_DRM_FUTURE_USE; msg = "PLAYER_ERROR_DRM_FUTURE_USE"; break; - case MM_ERROR_PLAYER_DRM_OUTPUT_PROTECTION: - ret = PLAYER_ERROR_DRM_NOT_PERMITTED; - msg = "PLAYER_ERROR_DRM_NOT_PERMITTED"; - break; - case MM_ERROR_PLAYER_RESOURCE_LIMIT: - ret = PLAYER_ERROR_RESOURCE_LIMIT; - msg = "PLAYER_ERROR_RESOURCE_LIMIT"; - break; - case MM_ERROR_PLAYER_PERMISSION_DENIED: - ret = PLAYER_ERROR_PERMISSION_DENIED; - msg = "PLAYER_ERROR_PERMISSION_DENIED"; } LOGE("[%s] %s(0x%08x) : core fw error(0x%x)",func_name,msg, ret, code); return ret; } -int _player_get_tbm_surface_format(int in_format, uint32_t *out_format) -{ - if (in_format <= MM_PIXEL_FORMAT_INVALID || - in_format >= MM_PIXEL_FORMAT_NUM || - out_format == NULL) { - LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format); - return PLAYER_ERROR_INVALID_PARAMETER; - } - - switch (in_format) { - case MM_PIXEL_FORMAT_NV12: - case MM_PIXEL_FORMAT_NV12T: - *out_format = TBM_FORMAT_NV12; - break; - case MM_PIXEL_FORMAT_NV16: - *out_format = TBM_FORMAT_NV16; - break; - case MM_PIXEL_FORMAT_NV21: - *out_format = TBM_FORMAT_NV21; - break; - case MM_PIXEL_FORMAT_YUYV: - *out_format = TBM_FORMAT_YUYV; - break; - case MM_PIXEL_FORMAT_UYVY: - case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY: - *out_format = TBM_FORMAT_UYVY; - break; - case MM_PIXEL_FORMAT_422P: - *out_format = TBM_FORMAT_YUV422; - break; - case MM_PIXEL_FORMAT_I420: - *out_format = TBM_FORMAT_YUV420; - break; - case MM_PIXEL_FORMAT_YV12: - *out_format = TBM_FORMAT_YVU420; - break; - case MM_PIXEL_FORMAT_RGB565: - *out_format = TBM_FORMAT_RGB565; - break; - case MM_PIXEL_FORMAT_RGB888: - *out_format = TBM_FORMAT_RGB888; - break; - case MM_PIXEL_FORMAT_RGBA: - *out_format = TBM_FORMAT_RGBA8888; - break; - case MM_PIXEL_FORMAT_ARGB: - *out_format = TBM_FORMAT_ARGB8888; - break; - default: - LOGE("invalid in_format %d", in_format); - return PLAYER_ERROR_INVALID_PARAMETER; - } - - return PLAYER_ERROR_NONE; -} - -int _player_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype) -{ - if (in_format <= MM_PIXEL_FORMAT_INVALID || - in_format >= MM_PIXEL_FORMAT_NUM || - mimetype == NULL) { - LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype); - return PLAYER_ERROR_INVALID_PARAMETER; - } - - switch (in_format) { - case MM_PIXEL_FORMAT_NV12: - case MM_PIXEL_FORMAT_NV12T: - *mimetype = MEDIA_FORMAT_NV12; - break; - case MM_PIXEL_FORMAT_NV16: - *mimetype = MEDIA_FORMAT_NV16; - break; - case MM_PIXEL_FORMAT_NV21: - *mimetype = MEDIA_FORMAT_NV21; - break; - case MM_PIXEL_FORMAT_YUYV: - *mimetype = MEDIA_FORMAT_YUYV; - break; - case MM_PIXEL_FORMAT_UYVY: - case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY: - *mimetype = MEDIA_FORMAT_UYVY; - break; - case MM_PIXEL_FORMAT_422P: - *mimetype = MEDIA_FORMAT_422P; - break; - case MM_PIXEL_FORMAT_I420: - *mimetype = MEDIA_FORMAT_I420; - break; - case MM_PIXEL_FORMAT_YV12: - *mimetype = MEDIA_FORMAT_YV12; - break; - case MM_PIXEL_FORMAT_RGB565: - *mimetype = MEDIA_FORMAT_RGB565; - break; - case MM_PIXEL_FORMAT_RGB888: - *mimetype = MEDIA_FORMAT_RGB888; - break; - case MM_PIXEL_FORMAT_RGBA: - *mimetype = MEDIA_FORMAT_RGBA; - break; - case MM_PIXEL_FORMAT_ARGB: - *mimetype = MEDIA_FORMAT_ARGB; - break; - default: - LOGE("invalid in_format %d", in_format); - return PLAYER_ERROR_INVALID_PARAMETER; - } - - return PLAYER_ERROR_NONE; -} - -int _player_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data) -{ - int ret = 0; - void *internal_buffer = NULL; - tbm_surface_h tsurf = NULL; - - if (pkt == NULL || user_data == NULL) { - LOGE("invalid parameter buffer %p, user_data %p", pkt, user_data); - return MEDIA_PACKET_FINALIZE; - } - - ret = media_packet_get_extra(pkt, &internal_buffer); - if (ret != MEDIA_PACKET_ERROR_NONE) { - LOGE("media_packet_get_extra failed 0x%x", ret); - return MEDIA_PACKET_FINALIZE; - } - - /*LOGD("pointer gst buffer %p, ret 0x%x", internal_buffer, ret);*/ - - if (internal_buffer) { - gst_buffer_unref((GstBuffer *)internal_buffer); - internal_buffer = NULL; - } - - ret = media_packet_get_tbm_surface(pkt, &tsurf); - if (ret != MEDIA_PACKET_ERROR_NONE) { - LOGE("media_packet_get_tbm_surface failed 0x%x", ret); - return MEDIA_PACKET_FINALIZE; - } - - if (tsurf) { - tbm_surface_destroy(tsurf); - tsurf = NULL; - } - - return MEDIA_PACKET_FINALIZE; -} - static player_interrupted_code_e __convert_interrupted_code(int code) { player_interrupted_code_e ret = PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT; switch(code) { - case MM_MSG_CODE_INTERRUPTED_BY_CALL_END: case MM_MSG_CODE_INTERRUPTED_BY_ALARM_END: case MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_END: - case MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_END: ret = PLAYER_INTERRUPTED_COMPLETED; break; case MM_MSG_CODE_INTERRUPTED_BY_MEDIA: @@ -389,12 +200,12 @@ static player_interrupted_code_e __convert_interrupted_code(int code) case MM_MSG_CODE_INTERRUPTED_BY_ALARM_START: ret = PLAYER_INTERRUPTED_BY_ALARM; break; - case MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_START: - ret = PLAYER_INTERRUPTED_BY_NOTIFICATION; - break; case MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_START: ret = PLAYER_INTERRUPTED_BY_EMERGENCY; break; + case MM_MSG_CODE_INTERRUPTED_BY_RESUMABLE_MEDIA: + ret = PLAYER_INTERRUPTED_BY_RESUMABLE_MEDIA; + break; case MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT: default : ret = PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT; @@ -412,7 +223,7 @@ static player_state_e __convert_player_state(MMPlayerStateType state) return state +1; } -bool __player_state_validate(player_s * handle, player_state_e threshold) +static bool __player_state_validate(player_s * handle, player_state_e threshold) { if (handle->state < threshold) return FALSE; @@ -440,71 +251,29 @@ static int __unset_callback(_player_event_e type, player_h player) return PLAYER_ERROR_NONE; } -static void __job_prepared_cb(void *user_data) -{ - player_s * handle = (player_s*)user_data; - LOGI("Start"); - handle->is_doing_jobs = TRUE; - handle->state = PLAYER_STATE_READY; - ((player_prepared_cb)handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE])(handle->user_data[_PLAYER_EVENT_TYPE_PREPARE]); - handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE] = NULL; - handle->user_data[_PLAYER_EVENT_TYPE_PREPARE] = NULL; - __REMOVE_ECORE_JOB(handle, __JOB_KEY_PREPARED); - LOGI("End"); -} - -static void __job_error_cb(void *user_data) -{ - player_s * handle = (player_s*)user_data; - LOGI("Start"); - handle->is_doing_jobs = TRUE; - ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(handle->error_code,handle->user_data[_PLAYER_EVENT_TYPE_ERROR]); - __REMOVE_ECORE_JOB(handle, __JOB_KEY_ERROR); - LOGI("End"); -} - -static void __job_seek_done_cb(void *user_data) -{ - player_s * handle = (player_s*)user_data; - LOGI("Start"); - handle->is_doing_jobs = TRUE; - ((player_seek_completed_cb)handle->user_cb[_PLAYER_EVENT_TYPE_SEEK])(handle->user_data[_PLAYER_EVENT_TYPE_SEEK]); - handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = NULL; - handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = NULL; - __REMOVE_ECORE_JOB(handle, __JOB_KEY_SEEK_DONE); - LOGI("End"); -} - -static void __job_eos_cb(void *user_data) -{ - player_s * handle = (player_s*)user_data; - LOGI("Start"); - handle->is_doing_jobs = TRUE; - ((player_completed_cb)handle->user_cb[_PLAYER_EVENT_TYPE_COMPLETE])(handle->user_data[_PLAYER_EVENT_TYPE_COMPLETE]); - __REMOVE_ECORE_JOB(handle, __JOB_KEY_EOS); - LOGI("End"); -} - static int __msg_callback(int message, void *param, void *user_data) { player_s * handle = (player_s*)user_data; MMMessageParamType *msg = (MMMessageParamType*)param; - LOGW("[%s] Got message type : 0x%x" ,__FUNCTION__, message); + LOGE("[%s] Start : Got message type : 0x%x" ,__FUNCTION__, message); player_error_e err_code = PLAYER_ERROR_NONE; switch(message) { case MM_MESSAGE_ERROR: //0x01 - err_code = __player_convert_error_code(msg->code,(char*)__FUNCTION__); + err_code = __convert_error_code(msg->code,(char*)__FUNCTION__); break; case MM_MESSAGE_STATE_CHANGED: //0x03 - LOGI("STATE CHANGED INTERNALLY - from : %d, to : %d (CAPI State : %d)", msg->state.previous, msg->state.current, handle->state); + LOGE("STATE CHANGED INTERNALLY - from : %d, to : %d (CAPI State : %d)", msg->state.previous, msg->state.current, handle->state); if ((handle->is_progressive_download && msg->state.previous == MM_PLAYER_STATE_NULL && msg->state.current == MM_PLAYER_STATE_READY) || (msg->state.previous == MM_PLAYER_STATE_READY && msg->state.current == MM_PLAYER_STATE_PAUSED)) { if(handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE]) // asyc && prepared cb has been set { - LOGI("[%s] Prepared! [current state : %d]", __FUNCTION__, handle->state); - __ADD_ECORE_JOB(handle, __JOB_KEY_PREPARED, __job_prepared_cb); + LOGE("[%s] Prepared! [current state : %d]", __FUNCTION__, handle->state); + handle->state = PLAYER_STATE_READY; + ((player_prepared_cb)handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE])(handle->user_data[_PLAYER_EVENT_TYPE_PREPARE]); + handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE] = NULL; + handle->user_data[_PLAYER_EVENT_TYPE_PREPARE] = NULL; } } break; @@ -515,12 +284,13 @@ static int __msg_callback(int message, void *param, void *user_data) } break; case MM_MESSAGE_BEGIN_OF_STREAM: //0x104 - LOGI("[%s] Ready to streaming information (BOS) [current state : %d]", __FUNCTION__, handle->state); + MMTA_ACUM_ITEM_END("[CAPI] player_start ~ BOS", 0); + LOGE("[%s] Ready to streaming information (BOS) [current state : %d]", __FUNCTION__, handle->state); break; case MM_MESSAGE_END_OF_STREAM://0x105 if( handle->user_cb[_PLAYER_EVENT_TYPE_COMPLETE] ) { - __ADD_ECORE_JOB(handle, __JOB_KEY_EOS, __job_eos_cb); + ((player_completed_cb)handle->user_cb[_PLAYER_EVENT_TYPE_COMPLETE])(handle->user_data[_PLAYER_EVENT_TYPE_COMPLETE]); } break; case MM_MESSAGE_BUFFERING: //0x103 @@ -541,7 +311,7 @@ static int __msg_callback(int message, void *param, void *user_data) } break; case MM_MESSAGE_CONNECTION_TIMEOUT: //0x102 - LOGI("[%s] PLAYER_ERROR_CONNECTION_FAILED (0x%08x) : CONNECTION_TIMEOUT" ,__FUNCTION__, PLAYER_ERROR_CONNECTION_FAILED); + LOGE("[%s] PLAYER_ERROR_CONNECTION_FAILED (0x%08x) : CONNECTION_TIMEOUT" ,__FUNCTION__, PLAYER_ERROR_CONNECTION_FAILED); err_code = PLAYER_ERROR_CONNECTION_FAILED; break; case MM_MESSAGE_UPDATE_SUBTITLE: //0x109 @@ -551,7 +321,7 @@ static int __msg_callback(int message, void *param, void *user_data) } break; case MM_MESSAGE_VIDEO_NOT_CAPTURED: //0x113 - LOGI("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x)",__FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED); + LOGE("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x)",__FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED); if( handle->user_cb[_PLAYER_EVENT_TYPE_ERROR] ) { ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(PLAYER_ERROR_VIDEO_CAPTURE_FAILED,handle->user_data[_PLAYER_EVENT_TYPE_ERROR]); @@ -571,30 +341,6 @@ static int __msg_callback(int message, void *param, void *user_data) else { MMPlayerVideoCapture* capture = (MMPlayerVideoCapture *)msg->data; - - switch ( msg->captured_frame.orientation ) - { - case 0: - case 180: - { - /* use video resolution from above */ - } - break; - case 90: - case 270: - { - /* use calculated size during rotation */ - w = msg->captured_frame.width; - h = msg->captured_frame.height; - } - break; - default: - break; - } - - LOGI("[%s] captured image width : %d height : %d", __FUNCTION__, w, h); - - /* call application callback */ ((player_video_captured_cb)handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE])(capture->data, w, h, capture->size, handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE]); if (capture->data) @@ -608,22 +354,32 @@ static int __msg_callback(int message, void *param, void *user_data) } break; case MM_MESSAGE_FILE_NOT_SUPPORTED: //0x10f - LOGI("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_SUPPORTED" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE); + LOGE("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_SUPPORTED" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE); err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE; break; case MM_MESSAGE_FILE_NOT_FOUND: //0x110 - LOGI("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_FOUND" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE); + LOGE("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_FOUND" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE); err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE; break; case MM_MESSAGE_SEEK_COMPLETED: //0x114 if (handle->display_type != ((int)MM_DISPLAY_SURFACE_NULL) && handle->state == PLAYER_STATE_READY) { if(handle->is_display_visible) - mm_player_set_attribute(handle->mm_handle, NULL,"display_visible" , 1, (char*)NULL); + { + int ret = MM_ERROR_NONE; + ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_visible" , 1, (char*)NULL); + if(ret != MM_ERROR_NONE) + { + LOGW("[%s] Failed to set display visible (0x%x)" ,__FUNCTION__, ret); + } + + } } if( handle->user_cb[_PLAYER_EVENT_TYPE_SEEK]) { - __ADD_ECORE_JOB(handle, __JOB_KEY_SEEK_DONE, __job_seek_done_cb); + ((player_seek_completed_cb)handle->user_cb[_PLAYER_EVENT_TYPE_SEEK])(handle->user_data[_PLAYER_EVENT_TYPE_SEEK]); + handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = NULL; + handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = NULL; } break; case MM_MESSAGE_UNKNOWN: //0x00 @@ -643,143 +399,47 @@ static int __msg_callback(int message, void *param, void *user_data) if(err_code != PLAYER_ERROR_NONE && handle->user_cb[_PLAYER_EVENT_TYPE_ERROR]) { - handle->error_code = err_code; - __ADD_ECORE_JOB(handle, __JOB_KEY_ERROR, __job_error_cb); + ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(err_code,handle->user_data[_PLAYER_EVENT_TYPE_ERROR]); } - LOGW("[%s] End", __FUNCTION__); + LOGE("[%s] End", __FUNCTION__); return 1; } -#if 0 // //is blocked temporary to avoid build error until libmm-player is updated -static bool __video_stream_callback(void *stream, void *user_data) + +static bool __video_stream_callback(void *stream, int stream_size, void *user_data, int width, int height) { player_s * handle = (player_s*)user_data; - MMPlayerVideoStreamDataType *video_stream = (MMPlayerVideoStreamDataType *)stream; - - if (handle->user_cb[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]) // media packet and zero-copy - { - media_packet_h pkt = NULL; - tbm_surface_h tsurf = NULL; - uint32_t bo_format = 0; - int i; - int bo_num; - int ret = 0; - media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12; - bool make_pkt_fmt = false; - - /* create tbm surface */ - for (i = 0, bo_num = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++) { - if (video_stream->bo[i]) { - bo_num++; - } - } - - /* get tbm surface format */ - ret = _player_get_tbm_surface_format(video_stream->format, &bo_format); - ret |= _player_get_media_packet_mimetype(video_stream->format, &mimetype); - - if (bo_num > 0 && ret == PLAYER_ERROR_NONE) { - tsurf = tbm_surface_internal_create_with_bos(video_stream->width, video_stream->height, bo_format, (tbm_bo *)video_stream->bo, bo_num); - /*LOGD("tbm surface %p", tsurf);*/ - } else if (bo_num == 0) { - int plane_idx = 0; - tbm_surface_info_s tsuri; - unsigned char *ptr = video_stream->data; - - if (!ptr) return TRUE; - - tsurf = tbm_surface_create(video_stream->width, video_stream->height, bo_format); - if (tsurf) { - /* map surface to set data */ - if (tbm_surface_map (tsurf, TBM_SURF_OPTION_READ|TBM_SURF_OPTION_WRITE, &tsuri)) { - LOGE("tbm_surface_map failed"); - return TRUE; - } - - for ( plane_idx = 0; plane_idx < tsuri.num_planes; plane_idx++ ) { - memcpy(tsuri.planes[plane_idx].ptr, ptr, tsuri.planes[plane_idx].size); - ptr += tsuri.planes[plane_idx].size; - } - } else { - LOGW("tbm_surface_create failed"); - } - } - - if (tsurf) { - /* check media packet format */ - if (handle->pkt_fmt) { - int pkt_fmt_width = 0; - int pkt_fmt_height = 0; - media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12; - - media_format_get_video_info(handle->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL); - if (pkt_fmt_mimetype != mimetype || - pkt_fmt_width != video_stream->width || - pkt_fmt_height != video_stream->height) { - LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d", - pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, video_stream->width, video_stream->height); - media_format_unref(handle->pkt_fmt); - handle->pkt_fmt = NULL; - make_pkt_fmt = true; - } - } else { - make_pkt_fmt = true; - } - - /* create packet format */ - if (make_pkt_fmt) { - LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, video_stream->width, video_stream->height); - ret = media_format_create(&handle->pkt_fmt); - if (ret == MEDIA_FORMAT_ERROR_NONE) { - ret = media_format_set_video_mime(handle->pkt_fmt, mimetype); - ret |= media_format_set_video_width(handle->pkt_fmt, video_stream->width); - ret |= media_format_set_video_height(handle->pkt_fmt, video_stream->height); - LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret); - } else { - LOGW("media_format_create failed"); - } - } - - /* create media packet */ - ret = media_packet_create_from_tbm_surface(handle->pkt_fmt, tsurf, (media_packet_finalize_cb)_player_media_packet_finalize, (void *)handle, &pkt); - if (ret != MEDIA_PACKET_ERROR_NONE) { - LOGE("media_packet_create_from_tbm_surface failed"); - - tbm_surface_destroy(tsurf); - tsurf = NULL; - } - } else { - LOGE("failed to create tbm surface %dx%d, format %d, bo_num %d", video_stream->width, video_stream->height, video_stream->format, bo_num); - } - - if (pkt) { - /*LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);*/ - - /* set internal buffer */ - if (video_stream->internal_buffer) - ret = media_packet_set_extra(pkt, video_stream->internal_buffer); - - if (ret != MEDIA_PACKET_ERROR_NONE) { - LOGE("media_packet_set_extra failed"); - - media_packet_destroy(pkt); - pkt = NULL; - } else { - /* increase ref count of gst buffer */ - if (video_stream->internal_buffer) - gst_buffer_ref((GstBuffer *)video_stream->internal_buffer); - - /* call media packet callback */ - ((player_media_packet_video_decoded_cb)handle->user_cb[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME])(pkt, handle->user_data[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]); + if( handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME]) + { + if(handle->state==PLAYER_STATE_PLAYING) + ((player_video_frame_decoded_cb)handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME])((unsigned char *)stream, width, height, stream_size, handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_FRAME]); + else + LOGE("[%s] Skip stream - current state : %d", __FUNCTION__,handle->state); + } + return TRUE; +} - if (bo_num == 0) - tbm_surface_unmap(tsurf); - } - } +static bool __audio_stream_callback(void *stream, int stream_size, void *user_data) +{ + player_s * handle = (player_s*)user_data; + if( handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME] ) + { + if(handle->state==PLAYER_STATE_PLAYING) + ((player_audio_frame_decoded_cb)handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME])((unsigned char *)stream, stream_size, handle->user_data[_PLAYER_EVENT_TYPE_AUDIO_FRAME]); + else + LOGE("[%s] Skip stream - current state : %d", __FUNCTION__,handle->state); } + return TRUE; +} +static bool __video_frame_render_error_callback(void *param, void *user_data) +{ + player_s * handle = (player_s*)user_data; + if( handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR]) + { + ((player_x11_pixmap_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR])((unsigned int *)param, handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR]); + } return TRUE; } -#endif static int __pd_message_callback(int message, void *param, void *user_data) { @@ -803,36 +463,64 @@ static int __pd_message_callback(int message, void *param, void *user_data) } return 0; } -static void __job_key_to_remove(gpointer key) + +static bool __supported_audio_effect_type (int filter, int type, void *user_data) { - LOGI("%s",key); - g_free(key); + player_s * handle = (player_s*)user_data; + if(filter != MM_AUDIO_EFFECT_TYPE_CUSTOM || type == MM_AUDIO_EFFECT_CUSTOM_EQ) + { + LOGI("[%s] Skip invalid filter: %d or type : %d",__FUNCTION__, filter, type); + return TRUE; + } + + if( handle->user_cb[_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT] ) + { + return ((player_audio_effect_supported_effect_cb)handle->user_cb[_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT])(type, handle->user_data[_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT]); + } + return FALSE; } -static void __job_value_to_destroy(gpointer value) +static bool __supported_audio_effect_preset (int filter, int type, void *user_data) { - Ecore_Job *job = (Ecore_Job *)value; - LOGI("%p", job); - __DELETE_ECORE_ITEM(job); + player_s * handle = (player_s*)user_data; + if(filter != MM_AUDIO_EFFECT_TYPE_PRESET) + { + LOGI("[%s] Skip invalid filter: %d or type : %d",__FUNCTION__, filter, type); + return TRUE; + } + + if( handle->user_cb[_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET] ) + { + return ((player_audio_effect_supported_effect_cb)handle->user_cb[_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET])(type, handle->user_data[_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET]); + } + return FALSE; } + /* * Public Implementation */ int player_create (player_h *player) { + LOGE("[%s] Start", __FUNCTION__); PLAYER_INSTANCE_CHECK(player); + MMTA_INIT(); + MMTA_ACUM_ITEM_BEGIN("[CoreAPI] player_create", 0); player_s * handle; handle = (player_s*)malloc( sizeof(player_s)); - if (handle != NULL) + if (handle != NULL) + { + LOGE("[%s] Start, %p", __FUNCTION__, handle); memset(handle, 0 , sizeof(player_s)); + } else { LOGE("[%s] PLAYER_ERROR_OUT_OF_MEMORY(0x%08x)" ,__FUNCTION__,PLAYER_ERROR_OUT_OF_MEMORY); return PLAYER_ERROR_OUT_OF_MEMORY; } int ret = mm_player_create(&handle->mm_handle); + MMTA_ACUM_ITEM_END("[CoreAPI] player_create", 0); if( ret != MM_ERROR_NONE) { LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)" ,__FUNCTION__,PLAYER_ERROR_INVALID_OPERATION); @@ -848,38 +536,26 @@ int player_create (player_h *player) handle->display_type = MM_DISPLAY_SURFACE_NULL; // means DISPLAY_TYPE_NONE(3) handle->is_stopped=false; handle->is_display_visible=true; - handle->ecore_jobs = g_hash_table_new_full(g_str_hash, g_str_equal, __job_key_to_remove, __job_value_to_destroy); - LOGI("[%s] new handle : %p", __FUNCTION__, *player); + LOGE("[%s] End, new handle : %p", __FUNCTION__, *player); return PLAYER_ERROR_NONE; } } int player_destroy (player_h player) { - LOGI("[%s] Start, handle to destroy : %p", __FUNCTION__, player); + LOGE("[%s] Start, handle to destroy : %p", __FUNCTION__, player); PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; - if (handle->is_doing_jobs) - { - LOGE("jobs not completed. can't do destroy"); - return PLAYER_ERROR_INVALID_OPERATION; - } - - g_hash_table_remove_all(handle->ecore_jobs); - g_hash_table_unref(handle->ecore_jobs); - - __RELEASEIF_PREPARE_THREAD(handle->prepare_async_thread); - - int ret = mm_player_destroy(handle->mm_handle); + MMTA_ACUM_ITEM_SHOW_RESULT_TO(MMTA_SHOW_FILE); + MMTA_RELEASE(); - if (handle->pkt_fmt) { - media_format_unref(handle->pkt_fmt); - handle->pkt_fmt = NULL; + if (handle->prepare_async_thread) + { + pthread_join(handle->prepare_async_thread, NULL); + handle->prepare_async_thread = 0; } - LOGI("[%s] Done mm_player_destroy", __FUNCTION__); - - if (ret != MM_ERROR_NONE) + 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; @@ -889,7 +565,7 @@ int player_destroy (player_h player) handle->state = PLAYER_STATE_NONE; free(handle); handle= NULL; - LOGI("[%s] End", __FUNCTION__); + LOGE("[%s] End", __FUNCTION__); return PLAYER_ERROR_NONE; } } @@ -899,37 +575,24 @@ __prepare_async_thread_func(void *data) { player_s *handle = data; int ret = MM_ERROR_NONE; - LOGI("[%s]", __FUNCTION__); + LOGE("[%s] Start", __FUNCTION__); ret = mm_player_pause(handle->mm_handle); - if(ret != MM_ERROR_NONE) + if(ret != MM_ERROR_NONE) // MM_MESSAGE_ERROR should be posted through __msg_callback { LOGE("[%s] Failed to pause - core fw error(0x%x)", __FUNCTION__, ret); - /*MM_MESSAGE_ERROR will not be posted as player_prepare(sync API) works with return value - of mm_player_pause So in case of async API we post the error message to application from here*/ - MMMessageParamType msg_param; - msg_param.code = ret; - __msg_callback(MM_MESSAGE_ERROR, (void *)&msg_param, (void *)handle); - - ret = mm_player_unrealize(handle->mm_handle); - if (ret != MM_ERROR_NONE) - LOGE("[%s] Failed to unrealize - 0x%x", __FUNCTION__,ret); } - LOGI("[%s], done", __FUNCTION__); + LOGE("[%s] End", __FUNCTION__); return NULL; } int player_prepare_async (player_h player, player_prepared_cb callback, void* user_data) { - LOGI("[%s] Start", __FUNCTION__); + LOGE("[%s] Start", __FUNCTION__); PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE); - int ret; - bool visible; - bool value; - if(handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE]) { LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION (0x%08x) : preparing... we can't do any more " ,__FUNCTION__, PLAYER_ERROR_INVALID_OPERATION); @@ -937,11 +600,12 @@ int player_prepare_async (player_h player, player_prepared_cb callback, void* us } else { - //LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_PREPARE); + LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_PREPARE); handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE] = callback; handle->user_data[_PLAYER_EVENT_TYPE_PREPARE] = user_data; } + int ret; ret = mm_player_set_message_callback(handle->mm_handle, __msg_callback, (void*)handle); if(ret != MM_ERROR_NONE) { @@ -958,32 +622,24 @@ int player_prepare_async (player_h player, player_prepared_cb callback, void* us } else { - ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_visible" ,&visible, (char*)NULL); - if(ret != MM_ERROR_NONE) - { - return __player_convert_error_code(ret,(char*)__FUNCTION__); - } - if(!visible) - { - value = FALSE; - } - else - { - value = TRUE; - } + ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_visible", 0, (char*)NULL); + if(ret != MM_ERROR_NONE) + { + LOGW("[%s] Failed to set display visible (0x%x)" ,__FUNCTION__, ret); + } + } - ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", value, (char*)NULL); - if(ret != MM_ERROR_NONE) - { - return __player_convert_error_code(ret,(char*)__FUNCTION__); - } + ret = mm_player_set_attribute(handle->mm_handle, NULL, "profile_prepare_async", 1, (char*)NULL); + if(ret != MM_ERROR_NONE) + { + LOGE("[%s] Failed to set profile_async_start '1' (0x%x)" ,__FUNCTION__, ret); } ret = mm_player_realize(handle->mm_handle); if(ret != MM_ERROR_NONE) { LOGE("[%s] Failed to realize - 0x%x", __FUNCTION__, ret); - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } if (!handle->is_progressive_download) @@ -998,20 +654,19 @@ int player_prepare_async (player_h player, player_prepared_cb callback, void* us } } - LOGI("[%s] End", __FUNCTION__); + LOGE("[%s] End", __FUNCTION__); return PLAYER_ERROR_NONE; } int player_prepare (player_h player) { - LOGI("[%s] Start", __FUNCTION__); + LOGE("[%s] Start", __FUNCTION__); PLAYER_INSTANCE_CHECK(player); + MMTA_ACUM_ITEM_BEGIN("[CoreAPI] player_prepare", 0); player_s * handle = (player_s *) player; PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE); int ret; - bool visible; - bool value; ret = mm_player_set_message_callback(handle->mm_handle, __msg_callback, (void*)handle); if(ret != MM_ERROR_NONE) { @@ -1028,22 +683,7 @@ int player_prepare (player_h player) } else { - ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_visible" ,&visible, (char*)NULL); - if(ret != MM_ERROR_NONE) - { - return __player_convert_error_code(ret,(char*)__FUNCTION__); - } - if(!visible) - { - value = FALSE; - } - else - { - value = TRUE; - } - - mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", value, (char*)NULL); - + ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_visible" , 0, (char*)NULL); if(ret != MM_ERROR_NONE) { LOGW("[%s] Failed to set display display_visible '0' (0x%x)" ,__FUNCTION__, ret); @@ -1054,150 +694,70 @@ int player_prepare (player_h player) if(ret != MM_ERROR_NONE) { LOGE("[%s] Failed to realize - 0x%x", __FUNCTION__,ret); - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } if (!handle->is_progressive_download) ret = mm_player_pause(handle->mm_handle); + MMTA_ACUM_ITEM_END("[CoreAPI] player_prepare", 0); if(ret != MM_ERROR_NONE) { - int uret; - uret = mm_player_unrealize(handle->mm_handle); - if (uret != MM_ERROR_NONE) - LOGE("[%s] Failed to unrealize - 0x%x", __FUNCTION__,uret); - LOGE("[%s] Failed to pause - 0x%x", __FUNCTION__,ret); - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { handle->state = PLAYER_STATE_READY; - LOGI("[%s] End", __FUNCTION__); + LOGE("[%s] End", __FUNCTION__); return PLAYER_ERROR_NONE; } } int player_unprepare (player_h player) { - LOGI("[%s] Start", __FUNCTION__); + LOGE("[%s] Start", __FUNCTION__); PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; - - if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) + 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; } - __RELEASEIF_PREPARE_THREAD(handle->prepare_async_thread); - int ret = mm_player_unrealize(handle->mm_handle); - if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { - if (handle->user_cb[_PLAYER_EVENT_TYPE_SEEK]) - { - handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = NULL; - handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = NULL; - } - - if (handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE]) - { - handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE] = NULL; - handle->user_data[_PLAYER_EVENT_TYPE_PREPARE] = NULL; - } - handle->state = PLAYER_STATE_IDLE; handle->display_type = MM_DISPLAY_SURFACE_NULL; // means DISPLAY_TYPE_NONE(3) handle->is_set_pixmap_cb = false; handle->is_stopped=false; handle->is_display_visible=true; handle->is_progressive_download=false; - LOGI("[%s] End", __FUNCTION__); + LOGE("[%s] End", __FUNCTION__); return PLAYER_ERROR_NONE; } } int player_set_uri (player_h player, const char *uri) { -#if 0//is blocked temporary to avoid build error until libmm-player is updated. - 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_uri(handle->mm_handle, uri); - - if(ret != MM_ERROR_NONE) - { - return __player_convert_error_code(ret,(char*)__FUNCTION__); - } - else -#endif - return PLAYER_ERROR_NONE; -} - -int player_set_next_uri (player_h player, const char *uri) -{ -#if 0 //is blocked temporary to avoid build error until libmm-player is updated. - PLAYER_INSTANCE_CHECK(player); - player_s * handle = (player_s *) player; - if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) - { - 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_set_next_uri(handle->mm_handle, uri); - - if(ret != MM_ERROR_NONE) - { - return __player_convert_error_code(ret,(char*)__FUNCTION__); - } - else -#endif - return PLAYER_ERROR_NONE; -} - -int player_get_next_uri (player_h player, char **uri) -{ -#if 0 //is blocked temporary to avoid build error until libmm-player is updated. - - PLAYER_INSTANCE_CHECK(player); - player_s * handle = (player_s *) player; - char* next_uri = NULL; - - if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) - { - 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_get_next_uri(handle->mm_handle, &next_uri); + int uri_length = strlen(uri); + int ret = mm_player_set_attribute(handle->mm_handle, NULL,MM_PLAYER_CONTENT_URI , uri, uri_length, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else - { - *uri = NULL; - if(next_uri != NULL) - { - *uri = strdup(next_uri); - free(next_uri); - } - - next_uri = NULL; return PLAYER_ERROR_NONE; - } -#endif - return PLAYER_ERROR_NONE; //is blocked temporary to avoid build error until libmm-player is updated. } int player_set_memory_buffer (player_h player, const void *data, int size) @@ -1214,7 +774,7 @@ int player_set_memory_buffer (player_h player, const void *data, int 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 __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else return PLAYER_ERROR_NONE; @@ -1228,7 +788,7 @@ int player_get_state (player_h player, player_state_e *state) *state = handle->state; MMPlayerStateType currentStat = MM_PLAYER_STATE_NULL; mm_player_get_state(handle->mm_handle, ¤tStat); - //LOGI("[%s] State : %d (FW state : %d)", __FUNCTION__,handle->state, currentStat); + LOGI("[%s] State : %d (FW state : %d)", __FUNCTION__,handle->state, currentStat); return PLAYER_ERROR_NONE; } @@ -1244,7 +804,7 @@ int player_set_volume (player_h player, float left, float right) int ret = mm_player_set_volume(handle->mm_handle,&vol); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1262,7 +822,7 @@ int player_get_volume (player_h player, float *left, float *right) int ret = mm_player_get_volume(handle->mm_handle,&vol); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1286,7 +846,7 @@ int player_set_sound_type(player_h player, sound_type_e type) int ret = mm_player_set_attribute(handle->mm_handle, NULL,"sound_volume_type" , type, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else return PLAYER_ERROR_NONE; @@ -1297,9 +857,9 @@ int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_ PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; - int ret = mm_player_set_attribute(handle->mm_handle, NULL,"sound_latency_mode" , latency_mode, (char*)NULL); + int ret = mm_player_set_attribute(handle->mm_handle, NULL,"audio_latency_mode" , latency_mode, (char*)NULL); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); else return PLAYER_ERROR_NONE; } @@ -1310,26 +870,29 @@ int player_get_audio_latency_mode(player_h player, audio_latency_mode_e *latency PLAYER_NULL_ARG_CHECK(latency_mode); player_s * handle = (player_s *) player; - int ret = mm_player_get_attribute(handle->mm_handle, NULL,"sound_latency_mode" , latency_mode, (char*)NULL); + int ret = mm_player_get_attribute(handle->mm_handle, NULL,"audio_latency_mode" , latency_mode, (char*)NULL); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); else return PLAYER_ERROR_NONE; } int player_start (player_h player) { - LOGI("[%s] Start", __FUNCTION__); + LOGE("[%s] Start", __FUNCTION__); PLAYER_INSTANCE_CHECK(player); + MMTA_ACUM_ITEM_BEGIN("[CAPI] player_start only", 0); + MMTA_ACUM_ITEM_BEGIN("[CAPI] player_start ~ BOS", 0); player_s * handle = (player_s *) player; int ret; if ( handle->state ==PLAYER_STATE_READY || handle->state ==PLAYER_STATE_PAUSED) { - if(handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY || handle->display_type == PLAYER_DISPLAY_TYPE_EVAS) + if(handle->display_type == PLAYER_DISPLAY_TYPE_X11 || handle->display_type == PLAYER_DISPLAY_TYPE_EVAS) { if(handle->is_display_visible) { ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_visible" , 1, (char*)NULL); + LOGE("[%s] show video display : %d",__FUNCTION__, ret); } } @@ -1342,7 +905,7 @@ int player_start (player_h player) } ret = mm_player_start(handle->mm_handle); - LOGI("[%s] stop -> start() ",__FUNCTION__); + LOGE("[%s] stop -> start() ",__FUNCTION__); } else { @@ -1360,48 +923,43 @@ int player_start (player_h player) if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { handle->is_stopped = FALSE; handle->state = PLAYER_STATE_PLAYING; - LOGI("[%s] End", __FUNCTION__); + LOGE("[%s] End", __FUNCTION__); return PLAYER_ERROR_NONE; } } int player_stop (player_h player) { - LOGI("[%s] Start", __FUNCTION__); + LOGE("[%s] Start", __FUNCTION__); 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(handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY || handle->display_type == PLAYER_DISPLAY_TYPE_EVAS) - { - ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_visible" , 0, (char*)NULL); - } - if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } - else + if(handle->display_type == PLAYER_DISPLAY_TYPE_X11 || handle->display_type == PLAYER_DISPLAY_TYPE_EVAS) { - if (handle->user_cb[_PLAYER_EVENT_TYPE_SEEK]) + ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_visible" , 0, (char*)NULL); + if(ret != MM_ERROR_NONE) { - handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = NULL; - handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = NULL; + return __convert_error_code(ret,(char*)__FUNCTION__); } - - handle->state = PLAYER_STATE_READY; - handle->is_stopped = TRUE; - LOGI("[%s] End", __FUNCTION__); - return PLAYER_ERROR_NONE; + LOGE("[%s] show video display : %d",__FUNCTION__, ret); } + + handle->state = PLAYER_STATE_READY; + handle->is_stopped = TRUE; + LOGE("[%s] End", __FUNCTION__); + return PLAYER_ERROR_NONE; } else { @@ -1412,7 +970,7 @@ int player_stop (player_h player) int player_pause (player_h player) { - LOGI("[%s] Start", __FUNCTION__); + LOGE("[%s] Start", __FUNCTION__); PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; PLAYER_STATE_CHECK(handle,PLAYER_STATE_PLAYING); @@ -1420,12 +978,12 @@ int player_pause (player_h player) int ret = mm_player_pause(handle->mm_handle); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { handle->state = PLAYER_STATE_PAUSED; - LOGI("[%s] End", __FUNCTION__); + LOGE("[%s] End", __FUNCTION__); return PLAYER_ERROR_NONE; } } @@ -1434,6 +992,7 @@ int player_set_position (player_h player, int millisecond, player_seek_completed { PLAYER_INSTANCE_CHECK(player); PLAYER_CHECK_CONDITION(millisecond>=0 ,PLAYER_ERROR_INVALID_PARAMETER ,"PLAYER_ERROR_INVALID_PARAMETER" ); + player_s * handle = (player_s *) player; if (!__player_state_validate(handle, PLAYER_STATE_READY)) { @@ -1448,22 +1007,20 @@ int player_set_position (player_h player, int millisecond, player_seek_completed } else { - LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_SEEK); + LOGE("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_SEEK); handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = callback; handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = user_data; } int ret = mm_player_set_attribute(handle->mm_handle, NULL, "accurate_seek", 1, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } ret = mm_player_set_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME, millisecond); if(ret != MM_ERROR_NONE) { - handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = NULL; - handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = NULL; - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1471,7 +1028,7 @@ int player_set_position (player_h player, int millisecond, player_seek_completed } } -int player_set_play_position (player_h player, int millisecond, bool accurate, player_seek_completed_cb callback, void *user_data) +int player_seek (player_h player, int millisecond, bool accurate, player_seek_completed_cb callback, void *user_data) { PLAYER_INSTANCE_CHECK(player); PLAYER_CHECK_CONDITION(millisecond>=0 ,PLAYER_ERROR_INVALID_PARAMETER ,"PLAYER_ERROR_INVALID_PARAMETER" ); @@ -1489,7 +1046,7 @@ int player_set_play_position (player_h player, int millisecond, bool accurate, p } else { - LOGI("[%s] Event type : %d, pos : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_SEEK, millisecond); + LOGE("[%s] Event type : %d, pos : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_SEEK, millisecond); handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = callback; handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = user_data; } @@ -1497,14 +1054,12 @@ int player_set_play_position (player_h player, int millisecond, bool accurate, p int ret = mm_player_set_attribute(handle->mm_handle, NULL, "accurate_seek", accurated, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } ret = mm_player_set_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME, millisecond); if(ret != MM_ERROR_NONE) { - handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = NULL; - handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = NULL; - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1512,30 +1067,82 @@ int player_set_play_position (player_h player, int millisecond, bool accurate, p } } -int player_get_play_position (player_h player, int *millisecond) +int player_set_position_ratio (player_h player, int percent, player_seek_completed_cb callback, void *user_data) { PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(millisecond); + PLAYER_CHECK_CONDITION(percent>=0 && percent <= 100 ,PLAYER_ERROR_INVALID_PARAMETER ,"PLAYER_ERROR_INVALID_PARAMETER" ); + player_s * handle = (player_s *) player; - if (!__player_state_validate(handle, PLAYER_STATE_READY)) + if(handle->user_cb[_PLAYER_EVENT_TYPE_SEEK]) { - LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state); - return PLAYER_ERROR_INVALID_STATE; + LOGE("[%s] PLAYER_ERROR_SEEK_FAILED (0x%08x) : seeking... we can't do any more " ,__FUNCTION__, PLAYER_ERROR_SEEK_FAILED); + return PLAYER_ERROR_SEEK_FAILED; } - int pos; - int ret = mm_player_get_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME , &pos); + else + { + LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_SEEK); + handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = callback; + handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = user_data; + } + + int ret = mm_player_set_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_PERCENT , percent); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { - *millisecond = pos; return PLAYER_ERROR_NONE; } } -int player_set_mute (player_h player, bool muted) +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(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, 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(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, 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; @@ -1543,7 +1150,7 @@ int player_set_mute (player_h player, bool muted) int ret = mm_player_set_mute(handle->mm_handle, muted); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1561,7 +1168,7 @@ int player_is_muted (player_h player, bool *muted) int ret = mm_player_get_mute(handle->mm_handle, &_mute); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1596,7 +1203,7 @@ int player_set_looping (player_h player, bool looping) if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1618,7 +1225,7 @@ int player_is_looping (player_h player, bool *looping) int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_PLAYBACK_COUNT , &count, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1648,12 +1255,12 @@ int player_get_duration (player_h player, 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 __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { *duration = _duration; - //LOGI("[%s] duration : %d",__FUNCTION__,_duration); + LOGI("[%s] duration : %d",__FUNCTION__,_duration); return PLAYER_ERROR_NONE; } } @@ -1662,9 +1269,6 @@ int player_set_display(player_h player, player_display_type_e type, player_displ { PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; - Evas_Object *obj = NULL; - const char *object_type = NULL; - void *set_handle = NULL; int ret; if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) @@ -1673,12 +1277,6 @@ int player_set_display(player_h player, player_display_type_e type, player_displ return PLAYER_ERROR_INVALID_STATE; } - if (type != PLAYER_DISPLAY_TYPE_NONE && display == NULL) - { - LOGE("display type[%d] is not NONE, but display handle is NULL", type); - return PLAYER_ERROR_INVALID_PARAMETER; - } - if (handle->is_set_pixmap_cb) { if (handle->state < PLAYER_STATE_READY) @@ -1694,57 +1292,12 @@ int player_set_display(player_h player, player_display_type_e type, player_displ } } - void* temp = NULL; - if (type == PLAYER_DISPLAY_TYPE_NONE) - { - /* NULL surface */ - handle->display_handle = 0; - handle->display_type = (int)MM_DISPLAY_SURFACE_NULL; - set_handle = NULL; - } - else - { - /* get handle from overlay or evas surface */ - obj = (Evas_Object *)display; - object_type = evas_object_type_get(obj); - if (object_type) - { - temp = handle->display_handle; - if (type == PLAYER_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) - { - /* x window overlay surface */ - LOGI("overlay surface type"); - handle->display_handle = (void *)elm_win_xwindow_get(obj); - set_handle = &(handle->display_handle); - } - else if (type == PLAYER_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) - { - /* evas object surface */ - LOGI("evas surface type"); - handle->display_handle = display; - set_handle = display; - } - else - { - LOGE("invalid surface type"); - return PLAYER_ERROR_INVALID_PARAMETER; - } - } - else - { - LOGE("falied to get evas object type from %p", obj); - return PLAYER_ERROR_INVALID_PARAMETER; - } - } - - /* set display handle */ + void* temp; if (handle->display_type == (int)MM_DISPLAY_SURFACE_NULL || type == handle->display_type) // first time or same type { - ret = mm_player_set_attribute(handle->mm_handle, NULL, - "display_surface_type", type, - "display_overlay", set_handle, - sizeof(display), (char*)NULL); - + temp = handle->display_handle; + handle->display_handle = display; + 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) { handle->display_handle = temp; @@ -1752,19 +1305,17 @@ int player_set_display(player_h player, player_display_type_e type, player_displ } else { - if (type != PLAYER_DISPLAY_TYPE_NONE) - { - handle->display_type = type; - LOGI("[%s] video display has been changed- type :%d, addr : 0x%x", - __FUNCTION__,handle->display_type, handle->display_handle); - } - else - LOGI("NULL surface"); + handle->display_type = type; + LOGE("[%s] video display has been changed- type :%d, addr : 0x%x",__FUNCTION__,handle->display_type, handle->display_handle); } + LOGE("[%s] video display has been updated - type :%d",__FUNCTION__,type); } else //changing surface case { - ret = mm_player_change_videosink(handle->mm_handle, type, set_handle); + temp = handle->display_handle; + handle->display_handle = display; + + ret = mm_player_change_videosink(handle->mm_handle, type, type == PLAYER_DISPLAY_TYPE_X11 ? &handle->display_handle : display); if (ret != MM_ERROR_NONE) { handle->display_handle = temp; @@ -1781,32 +1332,62 @@ int player_set_display(player_h player, player_display_type_e type, player_displ else { handle->display_type = type; - LOGI("[%s] video display has been changed- type :%d, addr : 0x%x", - __FUNCTION__,handle->display_type, handle->display_handle); + LOGE("[%s] video display has been changed- type :%d, addr : 0x%x",__FUNCTION__,handle->display_type, handle->display_handle); } } if(ret != MM_ERROR_NONE) { handle->display_type = MM_DISPLAY_SURFACE_NULL; - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { + LOGE("[%s] End",__FUNCTION__); return PLAYER_ERROR_NONE; } } +int player_is_display_mode_changeable(player_h player, bool* changeable) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(changeable); + player_s * handle = (player_s *) player; + switch(handle->display_type) + { + case PLAYER_DISPLAY_TYPE_X11: + *changeable = TRUE; + break; + case PLAYER_DISPLAY_TYPE_EVAS: + { + char *sink_name = NULL; + int length; + int scaling; + int ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_evas_surface_sink" ,&sink_name, &length, "display_evas_do_scaling", &scaling, (char*)NULL); + if(ret != MM_ERROR_NONE) + *changeable = FALSE; + if (!strncmp(sink_name,"evaspixmapsink",length) && scaling==1) + { + *changeable = TRUE; + } + break; + } + default: + *changeable = FALSE; + break; + } + return PLAYER_ERROR_NONE; +} + int player_set_display_mode(player_h player, player_display_mode_e mode) { PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; - LOGI("[%s] mode:%d", __FUNCTION__, mode); int ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_method" , mode, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else return PLAYER_ERROR_NONE; @@ -1820,7 +1401,7 @@ int player_get_display_mode(player_h player, player_display_mode_e *mode) int ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_method" ,mode, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1830,7 +1411,7 @@ int player_get_display_mode(player_h player, player_display_mode_e *mode) int player_set_playback_rate(player_h player, float rate) { - LOGI("[%s] rate : %0.1f", __FUNCTION__, rate); + LOGE("[%s] rate : %0.1f", __FUNCTION__, rate); PLAYER_INSTANCE_CHECK(player); PLAYER_CHECK_CONDITION(rate>=-5.0 && rate <= 5.0 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" ); player_s * handle = (player_s *) player; @@ -1855,13 +1436,13 @@ int player_set_playback_rate(player_h player, float rate) ret = PLAYER_ERROR_INVALID_OPERATION; break; default: - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } return ret; } -int player_set_display_rotation(player_h player, player_display_rotation_e rotation) +int player_set_x11_display_rotation(player_h player, player_display_rotation_e rotation) { PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; @@ -1869,13 +1450,13 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat int ret = mm_player_set_attribute(handle->mm_handle, NULL,MM_PLAYER_VIDEO_ROTATION , rotation, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else return PLAYER_ERROR_NONE; } -int player_get_display_rotation( player_h player, player_display_rotation_e *rotation) +int player_get_x11_display_rotation( player_h player, player_display_rotation_e *rotation) { PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(rotation); @@ -1883,7 +1464,7 @@ int player_get_display_rotation( player_h player, player_display_rotation_e *rot int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_VIDEO_ROTATION ,rotation, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1891,7 +1472,7 @@ int player_get_display_rotation( player_h player, player_display_rotation_e *rot } } -int player_set_display_visible(player_h player, bool visible) +int player_set_x11_display_visible(player_h player, bool visible) { PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; @@ -1905,7 +1486,7 @@ int player_set_display_visible(player_h player, bool visible) int ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_visible" , value, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1914,7 +1495,7 @@ int player_set_display_visible(player_h player, bool visible) } } -int player_is_display_visible(player_h player, bool* visible) +int player_is_x11_display_visible(player_h player, bool* visible) { PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(visible); @@ -1923,7 +1504,7 @@ int player_is_display_visible(player_h player, bool* visible) int ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_visible" ,&count, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -1940,6 +1521,202 @@ int player_is_display_visible(player_h player, bool* visible) } } +int player_set_x11_display_zoom(player_h player, int level) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_CHECK_CONDITION(level>0 && level < 10 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" ); + + player_s * handle = (player_s *) player; + int ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_zoom" , level, (char*)NULL); + if(ret != MM_ERROR_NONE) + { + return __convert_error_code(ret,(char*)__FUNCTION__); + } + else + return PLAYER_ERROR_NONE; +} + +int player_get_x11_display_zoom( player_h player, int *level) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(level); + player_s * handle = (player_s *) player; + int _level; + int ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_zoom" , &_level, (char*)NULL); + if(ret != MM_ERROR_NONE) + { + *level=-1; + return __convert_error_code(ret,(char*)__FUNCTION__); + } + else + { + *level = _level; + return PLAYER_ERROR_NONE; + } +} + +int player_set_x11_display_pixmap (player_h player, player_x11_pixmap_updated_cb callback, void *user_data) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(callback); + player_s * handle = (player_s *) player; + + if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) + { + LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state); + return PLAYER_ERROR_INVALID_STATE; + } + + if (!handle->is_set_pixmap_cb && handle->display_type != ((int)MM_DISPLAY_SURFACE_NULL)) + { + LOGE("[%s] player_set_display() was set, try it again after calling player_unprepare()" ,__FUNCTION__,PLAYER_ERROR_INVALID_OPERATION); + LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)" ,__FUNCTION__,PLAYER_ERROR_INVALID_OPERATION); + return PLAYER_ERROR_INVALID_OPERATION; + } + + int ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_surface_type", MM_DISPLAY_SURFACE_X_EXT, "display_overlay" , callback , sizeof(callback), "display_overlay_user_data", user_data, sizeof(user_data), (char*)NULL); + if(ret != MM_ERROR_NONE) + { + return __convert_error_code(ret,(char*)__FUNCTION__); + } + else + { + handle->is_set_pixmap_cb = true; + handle->display_type = MM_DISPLAY_SURFACE_X; + handle->display_handle = callback; + LOGE("[%s] video display has been changed- type :%d, pixmap_callback addr : 0x%x",__FUNCTION__,handle->display_type, handle->display_handle); + return PLAYER_ERROR_NONE; + } + +} + +int player_set_x11_display_pixmap_error_cb (player_h player, player_x11_pixmap_error_cb callback, void *user_data) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(callback); + player_s * handle = (player_s *) player; + + if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) + { + 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_set_video_frame_render_error_callback(handle->mm_handle, __video_frame_render_error_callback, (void*)handle); + if(ret != MM_ERROR_NONE) + { + return __convert_error_code(ret,(char*)__FUNCTION__); + } + else + { + LOGE("[%s] set pixmap_error_cb(0x%08x) and user_data(0x%8x)" ,__FUNCTION__, callback, user_data); + handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR] = callback; + handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR] = user_data; + LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR); + return PLAYER_ERROR_NONE; + } +} + +int player_set_x11_display_roi (player_h player, int x, int y, int w, int h) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_CHECK_CONDITION(x >= 0 && y >= 0 && w >= 0 && h >= 0,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" ); + + player_display_mode_e 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__); + } + if (mode != PLAYER_DISPLAY_MODE_ROI) + { + ret = MM_ERROR_PLAYER_INTERNAL; + return __convert_error_code(ret,(char*)__FUNCTION__); + } + + ret = mm_player_set_attribute(handle->mm_handle, NULL, + "display_roi_x", x, + "display_roi_y", y, + "display_roi_width", w, + "display_roi_height", h, + (char*)NULL); + if(ret != MM_ERROR_NONE) + { + return __convert_error_code(ret,(char*)__FUNCTION__); + } + else + { + return PLAYER_ERROR_NONE; + } +} + +int player_get_x11_display_roi (player_h player, int *x, int *y, int *w, int *h) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(x); + PLAYER_NULL_ARG_CHECK(y); + PLAYER_NULL_ARG_CHECK(w); + PLAYER_NULL_ARG_CHECK(h); + + player_display_mode_e mode; + player_s * handle = (player_s *) player; + int _x = 0; + int _y = 0; + int _w = 0; + int _h = 0; + + 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__); + } + if (mode != PLAYER_DISPLAY_MODE_ROI) + { + ret = MM_ERROR_PLAYER_INTERNAL; + return __convert_error_code(ret,(char*)__FUNCTION__); + } + + ret = mm_player_get_attribute(handle->mm_handle, NULL, + "display_roi_x", &_x, + "display_roi_y", &_y, + "display_roi_width", &_w, + "display_roi_height", &_h, + (char*)NULL); + if(ret != MM_ERROR_NONE) + { + *x = _x = 0; + *y = _y = 0; + *w = _w = 0; + *h = _h = 0; + return __convert_error_code(ret,(char*)__FUNCTION__); + } + else + { + *x = _x; + *y = _y; + *w = _w; + *h = _h; + return PLAYER_ERROR_NONE; + } +} + +int player_enable_evas_display_scaling(player_h player, bool enable) +{ + PLAYER_INSTANCE_CHECK(player); + player_s * handle = (player_s *) player; + + int scaling = enable?1:0; + int ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_evas_do_scaling" , scaling, (char*)NULL); + if(ret != MM_ERROR_NONE) + { + return __convert_error_code(ret,(char*)__FUNCTION__); + } + else + return PLAYER_ERROR_NONE; +} + int player_get_content_info(player_h player, player_content_info_e key, char ** value) { PLAYER_INSTANCE_CHECK(player); @@ -1982,7 +1759,7 @@ int player_get_content_info(player_h player, player_content_info_e key, char ** int ret = mm_player_get_attribute(handle->mm_handle, NULL,attr ,&val, &val_len, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -2021,7 +1798,7 @@ int player_get_codec_info(player_h player, char **audio_codec, char **video_code int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_AUDIO_CODEC,&audio,&audio_len,MM_PLAYER_VIDEO_CODEC,&video,&video_len,(char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -2056,7 +1833,7 @@ int player_get_audio_stream_info(player_h player, int *sample_rate, int *channel int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_AUDIO_SAMPLERATE,sample_rate,MM_PLAYER_AUDIO_CHANNEL,channel,MM_PLAYER_AUDIO_BITRATE,bit_rate,(char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } return PLAYER_ERROR_NONE; } @@ -2075,7 +1852,7 @@ int player_get_video_stream_info(player_h player, int *fps, int *bit_rate) int ret = mm_player_get_attribute(handle->mm_handle, NULL,"content_video_fps",fps,"content_video_bitrate",bit_rate,(char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } return PLAYER_ERROR_NONE; } @@ -2096,13 +1873,13 @@ int player_get_video_size (player_h player, int *width, int *height) 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 __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { *width = w; *height = h; - LOGI("[%s] width : %d, height : %d",__FUNCTION__,w, h); + LOGE("[%s] width : %d, height : %d",__FUNCTION__,w, h); return PLAYER_ERROR_NONE; } } @@ -2121,11 +1898,155 @@ int player_get_album_art(player_h player, void **album_art, int *size) int ret = mm_player_get_attribute(handle->mm_handle, NULL,"tag_album_cover",album_art,size,(char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); + } + return PLAYER_ERROR_NONE; +} + +int player_get_track_count(player_h player, player_track_type_e type, int *count) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(count); + 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_get_track_count(handle->mm_handle, type, count); + if(ret != MM_ERROR_NONE) + { + return __convert_error_code(ret,(char*)__FUNCTION__); + } + return PLAYER_ERROR_NONE; +} + +int player_audio_effect_set_value(player_h player, audio_effect_e effect, int value) +{ + PLAYER_INSTANCE_CHECK(player); + player_s * handle = (player_s *) player; + int ret = mm_player_audio_effect_custom_set_level(handle->mm_handle,effect,0,value); + if(ret != MM_ERROR_NONE) + { + return __convert_error_code(ret,(char*)__FUNCTION__); + } + else + { + ret = mm_player_audio_effect_custom_apply(handle->mm_handle); + return (ret==MM_ERROR_NONE)?PLAYER_ERROR_NONE:__convert_error_code(ret,(char*)__FUNCTION__); + } +} + +int player_audio_effect_get_value(player_h player, audio_effect_e effect, int *value) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(value); + player_s * handle = (player_s *) player; + int ret = mm_player_audio_effect_custom_get_level(handle->mm_handle,effect,0,value); + if(ret != MM_ERROR_NONE) + return __convert_error_code(ret,(char*)__FUNCTION__); + else + return PLAYER_ERROR_NONE; +} + +int player_audio_effect_clear(player_h player, audio_effect_e effect) +{ + PLAYER_INSTANCE_CHECK(player); + player_s * handle = (player_s *) player; + int ret = mm_player_audio_effect_custom_clear_ext_all(handle->mm_handle); + if(ret != MM_ERROR_NONE) + { + return __convert_error_code(ret,(char*)__FUNCTION__); + } + else + { + ret = mm_player_audio_effect_custom_apply(handle->mm_handle); + return (ret==MM_ERROR_NONE)?PLAYER_ERROR_NONE:__convert_error_code(ret,(char*)__FUNCTION__); } +} + +int player_audio_effect_get_value_range(player_h player, audio_effect_e effect, int* min, int* max) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(min); + PLAYER_NULL_ARG_CHECK(max); + player_s * handle = (player_s *) player; + int ret = mm_player_audio_effect_custom_get_level_range(handle->mm_handle, effect, min, max); + if(ret != MM_ERROR_NONE) + return __convert_error_code(ret,(char*)__FUNCTION__); + else + return PLAYER_ERROR_NONE; +} + +int player_audio_effect_is_available(player_h player, audio_effect_e effect, bool *available) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(available); + player_s * handle = (player_s *) player; + int ret = mm_player_is_supported_custom_effect_type(handle->mm_handle, effect); + if(ret != MM_ERROR_NONE) + *available = FALSE; + else + *available = TRUE; return PLAYER_ERROR_NONE; } +int player_audio_effect_foreach_supported_effect(player_h player, player_audio_effect_supported_effect_cb callback, void *user_data) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(callback); + player_s * handle = (player_s *) player; + + LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT); + handle->user_cb[_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT] = callback; + handle->user_data[_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT] = user_data; + int ret = mm_player_get_foreach_present_supported_effect_type(handle->mm_handle, MM_AUDIO_EFFECT_TYPE_CUSTOM, __supported_audio_effect_type, (void*)handle); + if(ret != MM_ERROR_NONE) + return __convert_error_code(ret,(char*)__FUNCTION__); + else + return PLAYER_ERROR_NONE; +} + +int player_audio_effect_set_preset(player_h player, audio_effect_preset_e preset) +{ + PLAYER_INSTANCE_CHECK(player); + player_s * handle = (player_s *) player; + int ret = mm_player_audio_effect_preset_apply(handle->mm_handle, preset); + if(ret != MM_ERROR_NONE) + return __convert_error_code(ret,(char*)__FUNCTION__); + else + return PLAYER_ERROR_NONE; +} + +int player_audio_effect_preset_is_available(player_h player, audio_effect_preset_e preset, bool *available) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(available); + player_s * handle = (player_s *) player; + int ret = mm_player_is_supported_preset_effect_type(handle->mm_handle, preset); + if(ret != MM_ERROR_NONE) + *available = FALSE; + else + *available = TRUE; + return PLAYER_ERROR_NONE; +} + +int player_audio_effect_foreach_supported_preset(player_h player, player_audio_effect_supported_preset_cb callback, void *user_data) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(callback); + player_s * handle = (player_s *) player; + + LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET); + handle->user_cb[_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET] = callback; + handle->user_data[_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET] = user_data; + int ret = mm_player_get_foreach_present_supported_effect_type(handle->mm_handle, MM_AUDIO_EFFECT_TYPE_PRESET, __supported_audio_effect_preset, (void*)handle); + if(ret != MM_ERROR_NONE) + return __convert_error_code(ret,(char*)__FUNCTION__); + else + return PLAYER_ERROR_NONE; +} + int player_audio_effect_get_equalizer_bands_count (player_h player, int *count) { PLAYER_INSTANCE_CHECK(player); @@ -2133,7 +2054,7 @@ int player_audio_effect_get_equalizer_bands_count (player_h player, int *count) player_s * handle = (player_s *) player; int ret = mm_player_audio_effect_custom_get_eq_bands_number(handle->mm_handle, count); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); else return PLAYER_ERROR_NONE; } @@ -2146,12 +2067,12 @@ int player_audio_effect_set_equalizer_all_bands(player_h player, int *band_level int ret = mm_player_audio_effect_custom_set_level_eq_from_list(handle->mm_handle, band_levels, length); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { ret = mm_player_audio_effect_custom_apply(handle->mm_handle); - return (ret==MM_ERROR_NONE)?PLAYER_ERROR_NONE:__player_convert_error_code(ret,(char*)__FUNCTION__); + return (ret==MM_ERROR_NONE)?PLAYER_ERROR_NONE:__convert_error_code(ret,(char*)__FUNCTION__); } } @@ -2162,12 +2083,12 @@ int player_audio_effect_set_equalizer_band_level(player_h player, int index, int int ret = mm_player_audio_effect_custom_set_level(handle->mm_handle,MM_AUDIO_EFFECT_CUSTOM_EQ, index, level); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { ret = mm_player_audio_effect_custom_apply(handle->mm_handle); - return (ret==MM_ERROR_NONE)?PLAYER_ERROR_NONE:__player_convert_error_code(ret,(char*)__FUNCTION__); + return (ret==MM_ERROR_NONE)?PLAYER_ERROR_NONE:__convert_error_code(ret,(char*)__FUNCTION__); } } @@ -2178,7 +2099,7 @@ int player_audio_effect_get_equalizer_band_level(player_h player, int index, int player_s * handle = (player_s *) player; int ret = mm_player_audio_effect_custom_get_level(handle->mm_handle,MM_AUDIO_EFFECT_CUSTOM_EQ, index, level); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); else return PLAYER_ERROR_NONE; } @@ -2191,7 +2112,7 @@ int player_audio_effect_get_equalizer_level_range(player_h player, int* min, int player_s * handle = (player_s *) player; int ret = mm_player_audio_effect_custom_get_level_range(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, min, max); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); else return PLAYER_ERROR_NONE; } @@ -2203,7 +2124,7 @@ int player_audio_effect_get_equalizer_band_frequency(player_h player, int index, player_s * handle = (player_s *) player; int ret = mm_player_audio_effect_custom_get_eq_bands_freq(handle->mm_handle, index, frequency); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); else return PLAYER_ERROR_NONE; } @@ -2215,7 +2136,7 @@ int player_audio_effect_get_equalizer_band_frequency_range(player_h player, int player_s * handle = (player_s *) player; int ret = mm_player_audio_effect_custom_get_eq_bands_width(handle->mm_handle, index, range); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); else return PLAYER_ERROR_NONE; } @@ -2227,12 +2148,12 @@ int player_audio_effect_equalizer_clear(player_h player) int ret = mm_player_audio_effect_custom_clear_eq_all(handle->mm_handle); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { ret = mm_player_audio_effect_custom_apply(handle->mm_handle); - return (ret==MM_ERROR_NONE)?PLAYER_ERROR_NONE:__player_convert_error_code(ret,(char*)__FUNCTION__); + return (ret==MM_ERROR_NONE)?PLAYER_ERROR_NONE:__convert_error_code(ret,(char*)__FUNCTION__); } } @@ -2251,29 +2172,24 @@ int player_audio_effect_equalizer_is_available(player_h player, bool *available) int player_set_subtitle_path(player_h player,const char* path) { -#if 0 //is blocked temporary to avoid build error until libmm-player is updated. PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(path); player_s * handle = (player_s *) player; + PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE); - if ((path == NULL) && (handle->state != PLAYER_STATE_IDLE)) - { - return PLAYER_ERROR_INVALID_PARAMETER; - } - - int ret = mm_player_set_external_subtitle_path(handle->mm_handle, path); + int ret = mm_player_set_attribute(handle->mm_handle, NULL,"subtitle_uri" , path, strlen(path), (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else -#endif return PLAYER_ERROR_NONE; } -int player_set_subtitle_position_offset(player_h player, int millisecond) +int player_set_subtitle_position(player_h player, int millisecond) { PLAYER_INSTANCE_CHECK(player); -//PLAYER_CHECK_CONDITION(millisecond>=0 ,PLAYER_ERROR_INVALID_PARAMETER ,"PLAYER_ERROR_INVALID_PARAMETER" ); + PLAYER_CHECK_CONDITION(millisecond>=0 ,PLAYER_ERROR_INVALID_PARAMETER ,"PLAYER_ERROR_INVALID_PARAMETER" ); player_s * handle = (player_s *) player; if (!__player_state_validate(handle, PLAYER_STATE_PLAYING)) { @@ -2284,7 +2200,7 @@ int player_set_subtitle_position_offset(player_h player, int millisecond) int ret = mm_player_adjust_subtitle_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME, millisecond); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else return PLAYER_ERROR_NONE; @@ -2297,10 +2213,10 @@ int player_set_progressive_download_path(player_h player, const char *path) player_s * handle = (player_s *) player; PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE); - int ret = mm_player_set_attribute(handle->mm_handle, NULL, "pd_mode", MM_PLAYER_PD_MODE_URI, "pd_location", path, strlen(path), (char*)NULL); + int ret = mm_player_set_attribute(handle->mm_handle, NULL,"pd_mode", MM_PLAYER_PD_MODE_URI, "pd_location", path, strlen(path), (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -2326,7 +2242,7 @@ int player_get_progressive_download_status(player_h player, unsigned long *curre int ret = mm_player_get_pd_status(handle->mm_handle, &_current, &_total); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -2349,12 +2265,12 @@ int player_capture_video(player_h player, player_video_captured_cb callback, voi } else { - LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_CAPTURE); + LOGE("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_CAPTURE); handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] = callback; handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE] = user_data; } - if(handle->state >= PLAYER_STATE_READY) + if(handle->state == PLAYER_STATE_PAUSED || handle->state == PLAYER_STATE_PLAYING ) { int ret = mm_player_do_video_capture(handle->mm_handle); if(ret==MM_ERROR_PLAYER_NO_OP) @@ -2368,7 +2284,7 @@ int player_capture_video(player_h player, player_video_captured_cb callback, voi { handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] = NULL; handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE] = NULL; - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else return PLAYER_ERROR_NONE; @@ -2393,7 +2309,7 @@ int player_set_streaming_cookie(player_h player, const char *cookie, int size) int ret = mm_player_set_attribute(handle->mm_handle, NULL,"streaming_cookie", cookie, size, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else return PLAYER_ERROR_NONE; @@ -2410,7 +2326,7 @@ int player_set_streaming_user_agent(player_h player, const char *user_agent, int int ret = mm_player_set_attribute(handle->mm_handle, NULL,"streaming_user_agent", user_agent, size, (char*)NULL); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else return PLAYER_ERROR_NONE; @@ -2432,7 +2348,7 @@ int player_get_streaming_download_progress(player_h player, int *start, int *cur int ret = mm_player_get_buffer_position(handle->mm_handle,MM_PLAYER_POS_FORMAT_PERCENT,&_start,&_current); if(ret != MM_ERROR_NONE) { - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); } else { @@ -2492,97 +2408,121 @@ int player_unset_subtitle_updated_cb (player_h player) return __unset_callback(_PLAYER_EVENT_TYPE_SUBTITLE,player); } -int player_set_progressive_download_message_cb(player_h player, player_pd_message_cb callback, void *user_data) +int player_set_video_frame_decoded_cb(player_h player, player_video_frame_decoded_cb callback, void *user_data) { PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); player_s * handle = (player_s *) player; - if (handle->state != PLAYER_STATE_IDLE && handle->state != PLAYER_STATE_READY) + if (handle->state != PLAYER_STATE_IDLE ) { 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_set_pd_message_callback(handle->mm_handle, __pd_message_callback, (void*)handle); + int ret = mm_player_set_video_stream_callback(handle->mm_handle, __video_stream_callback, (void*)handle); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); - handle->user_cb[_PLAYER_EVENT_TYPE_PD] = callback; - handle->user_data[_PLAYER_EVENT_TYPE_PD] = user_data; - LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_PD); + handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = callback; + handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = user_data; + LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_VIDEO_FRAME); return PLAYER_ERROR_NONE; } -int player_unset_progressive_download_message_cb(player_h player) +int player_unset_video_frame_decoded_cb(player_h player) { PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; - - handle->user_cb[_PLAYER_EVENT_TYPE_PD] = NULL; - handle->user_data[_PLAYER_EVENT_TYPE_PD] = NULL; - LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_PD); - - int ret = mm_player_set_pd_message_callback(handle->mm_handle, NULL, NULL); + handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = NULL; + handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = NULL; + LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_VIDEO_FRAME); + int ret = mm_player_set_video_stream_callback(handle->mm_handle, NULL, NULL); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); else return PLAYER_ERROR_NONE; } -int player_ignore_session(player_h player) +int player_set_audio_frame_decoded_cb(player_h player, int start, int end, player_audio_frame_decoded_cb callback, void *user_data) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(callback); + PLAYER_CHECK_CONDITION(start>=0 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" ); + PLAYER_CHECK_CONDITION(end>=start ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" ); + player_s * handle = (player_s *) player; + if (handle->state != PLAYER_STATE_IDLE) + { + 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_set_attribute(handle->mm_handle, NULL, "pcm_extraction",TRUE, "pcm_extraction_start_msec", start, "pcm_extraction_end_msec", end, NULL); + if(ret != MM_ERROR_NONE) + return __convert_error_code(ret,(char*)__FUNCTION__); + + ret = mm_player_set_audio_stream_callback(handle->mm_handle, __audio_stream_callback, (void*)handle); + if(ret != MM_ERROR_NONE) + return __convert_error_code(ret,(char*)__FUNCTION__); + + handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = callback; + handle->user_data[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = user_data; + LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_AUDIO_FRAME); + return PLAYER_ERROR_NONE; +} + +int player_unset_audio_frame_decoded_cb(player_h player) { -#if 0 //is blocked temporary to avoid build error until libmm-player is updated. PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; - PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE); - int ret = mm_player_ignore_session(handle->mm_handle); + handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = NULL; + handle->user_data[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = NULL; + LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_AUDIO_FRAME); + + int ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_extraction",FALSE, NULL); + if(ret != MM_ERROR_NONE) + return __convert_error_code(ret,(char*)__FUNCTION__); + + ret = mm_player_set_audio_stream_callback(handle->mm_handle, NULL, NULL); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); else -#endif return PLAYER_ERROR_NONE; } -int player_set_media_packet_video_frame_decoded_cb(player_h player, player_media_packet_video_decoded_cb callback, void *user_data) +int player_set_progressive_download_message_cb(player_h player, player_pd_message_cb callback, void *user_data) { -#if 0 //is blocked temporary to avoid build error until libmm-player is updated. PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); - player_s * handle = (player_s *) player; - if (handle->state != PLAYER_STATE_IDLE) + if (handle->state != PLAYER_STATE_IDLE && handle->state != 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; } - mm_player_enable_media_packet_video_stream(handle->mm_handle, TRUE); - - int ret = mm_player_set_video_stream_callback(handle->mm_handle, __video_stream_callback, (void*)handle); + int ret = mm_player_set_pd_message_callback(handle->mm_handle, __pd_message_callback, (void*)handle); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); - handle->user_cb[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = callback; - handle->user_data[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = user_data; - LOGI("Event type : %d ", _PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME); -#endif + handle->user_cb[_PLAYER_EVENT_TYPE_PD] = callback; + handle->user_data[_PLAYER_EVENT_TYPE_PD] = user_data; + LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_PD); return PLAYER_ERROR_NONE; } -int player_unset_media_packet_video_frame_decoded_cb(player_h player) +int player_unset_progressive_download_message_cb(player_h player) { -#if 0 //is blocked temporary to avoid build error until libmm-player is updated. PLAYER_INSTANCE_CHECK(player); player_s * handle = (player_s *) player; - handle->user_cb[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = NULL; - handle->user_data[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = NULL; - LOGI("Event type : %d ", _PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME); - int ret = mm_player_set_video_stream_callback(handle->mm_handle, NULL, NULL); + handle->user_cb[_PLAYER_EVENT_TYPE_PD] = NULL; + handle->user_data[_PLAYER_EVENT_TYPE_PD] = NULL; + LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_PD); + + int ret = mm_player_set_pd_message_callback(handle->mm_handle, NULL, NULL); if(ret != MM_ERROR_NONE) - return __player_convert_error_code(ret,(char*)__FUNCTION__); + return __convert_error_code(ret,(char*)__FUNCTION__); else -#endif return PLAYER_ERROR_NONE; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 461b088..1df3198 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,14 +4,30 @@ SET(fw_test "${fw_name}-test") INCLUDE_DIRECTORIES(../include) link_directories(${CMAKE_SOURCE_DIR}/../) +IF(X11_SUPPORT) + SET(WIN_PKG "ecore-x") +ENDIF(X11_SUPPORT) +IF(WAYLAND_SUPPORT) + SET(WIN_PKG "${WIN_PKG} ecore-wayland") +ENDIF(WAYLAND_SUPPORT) INCLUDE(FindPkgConfig) -pkg_check_modules(${fw_test} REQUIRED mm-player appcore-efl elementary ecore evas ecore-x capi-media-sound-manager) +pkg_check_modules(${fw_test} REQUIRED mm-player appcore-efl elementary ecore evas capi-media-sound-manager ${WIN_PKG}) + + FOREACH(flag ${${fw_test}_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +IF(WAYLAND_SUPPORT) + ADD_DEFINITIONS("-DHAVE_WAYLAND") +ENDIF(WAYLAND_SUPPORT) + +IF(X11_SUPPORT) + ADD_DEFINITIONS("-DHAVE_X11") +ENDIF(X11_SUPPORT) + aux_source_directory(. sources) FOREACH(src ${sources}) GET_FILENAME_COMPONENT(src_name ${src} NAME_WE) diff --git a/test/player_media_packet_test.c b/test/player_media_packet_test.c deleted file mode 100644 index f4bb7d5..0000000 --- a/test/player_media_packet_test.c +++ /dev/null @@ -1,449 +0,0 @@ -/* - * Copyright (c) 2014 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 -#include -#include -#include -#include -#include - -#define KEY_END "XF86Stop" -#define MEDIA_FILE_PATH "/opt/usr/media/Color.mp4" -#ifdef PACKAGE -#undef PACKAGE -#endif -#define PACKAGE "player_test" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "PLAYER_TEST" - -static int app_create(void *data); -static int app_reset(bundle *b, void *data); -static int app_resume(void *data); -static int app_pause(void *data); -static int app_terminate(void *data); - -struct appcore_ops ops = { - .create = app_create, - .terminate = app_terminate, - .pause = app_pause, - .resume = app_resume, - .reset = app_reset, -}; - -typedef struct appdata { - Evas_Object *win; - Evas_Object *img; - media_packet_h packet; - Ecore_Pipe *pipe; - player_h player_handle; - GList *packet_list; - GMutex buffer_lock; - int w, h; -} appdata_s; -#if 0 //is blocked temporary to avoid build error until dependency package is updated. -static void -win_delete_request_cb(void *data , Evas_Object *obj , void *event_info) -{ - elm_exit(); -} - -static Eina_Bool -keydown_cb(void *data , int type , void *event) -{ - //appdata_s *ad = data; - Ecore_Event_Key *ev = event; - - LOGD("start"); - - if (!strcmp(ev->keyname, KEY_END)) { - /* Let window go to hide state. */ - //elm_win_lower(ad->win); - LOGD("elm exit"); - elm_exit(); - - return ECORE_CALLBACK_DONE; - } - - LOGD("done"); - - return ECORE_CALLBACK_PASS_ON; -} - -static void -create_base_gui(appdata_s *ad) -{ - /* Enable GLES Backened */ - elm_config_preferred_engine_set("opengl_x11"); - - /* Window */ - ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE); - elm_win_wm_desktop_layout_support_set(ad->win, EINA_TRUE); - elm_win_autodel_set(ad->win, EINA_TRUE); -#if 0 - if (elm_win_wm_rotation_supported_get(ad->win)) { - int rots[4] = { 0, 90, 180, 270 }; - elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4); - } -#endif - evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, ad); - - Evas *e = evas_object_evas_get(ad->win); - - elm_win_screen_size_get(ad->win, NULL, NULL, &ad->w, &ad->h); - LOGD("surface size (%d x %d)\n", ad->w, ad->h); - - /* Image Object */ - ad->img = evas_object_image_filled_add(e); - evas_object_image_size_set(ad->img, ad->w, ad->h); - evas_object_size_hint_weight_set(ad->img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(ad->img); - - elm_win_resize_object_add(ad->win, ad->img); - - /* Show window after base gui is set up */ - evas_object_show(ad->win); -} - -static void -_media_packet_video_decoded_cb(media_packet_h packet, void *user_data) -{ - /* This callback function would be called on different thread */ - appdata_s *ad = user_data; - - if (ad == NULL) { - LOGE("appdata is NULL"); - return; - } - - g_mutex_lock(&ad->buffer_lock); - - if (ad->pipe == NULL) { - media_packet_destroy(packet); - LOGW("release media packet immediately"); - return; - } - - /* add packet list */ - ad->packet_list = g_list_prepend(ad->packet_list, (gpointer)packet); - - LOGD("packet %p", packet); - - /* Send packet to main thread */ - ecore_pipe_write(ad->pipe, &packet, sizeof(media_packet_h)); - - g_mutex_unlock(&ad->buffer_lock); - - return; -} -static void -pipe_cb(void *data, void *buf, unsigned int len) -{ - - /* Now, we get a player surface to be set here. */ - appdata_s *ad = data; - tbm_surface_h surface; - Evas_Native_Surface surf; - int ret; - GList *last_item = NULL; - - LOGD("start"); - - g_mutex_lock(&ad->buffer_lock); - - /* Destroy previous packet */ - if (ad->packet) { - ret = media_packet_destroy(ad->packet); - if (ret != MEDIA_PACKET_ERROR_NONE) { - LOGE("Failed to destroy media packet. ret (%d)", ret); - } - ad->packet = NULL; - } - - /* remove packet from list */ - last_item = g_list_last(ad->packet_list); - if (last_item) { - /* Get new packet */ - ad->packet = (media_packet_h)last_item->data;; - ad->packet_list = g_list_remove(ad->packet_list, ad->packet); - LOGD("ad->packet %p", ad->packet); - } - - if (ad->packet == NULL) { - LOGW("NULL packet"); - g_mutex_unlock(&ad->buffer_lock); - return; - } - - ret = media_packet_get_tbm_surface(ad->packet, &surface); - if (ret != MEDIA_PACKET_ERROR_NONE) { - LOGE("Failed to get surface from media packet. ret(0x%x)", ret); - - media_packet_destroy(ad->packet); - ad->packet = NULL; - - g_mutex_unlock(&ad->buffer_lock); - - return; - } - - LOGD("surface %p", surface); - - g_mutex_unlock(&ad->buffer_lock); - - /* Set tbm surface to image native surface */ - memset(&surf, 0x0, sizeof(surf)); - surf.version = EVAS_NATIVE_SURFACE_VERSION; - surf.type = EVAS_NATIVE_SURFACE_TBM; - surf.data.tizen.buffer = surface; - surf.data.tizen.rot = 270; - evas_object_image_native_surface_set(ad->img, &surf); - - /* Set dirty image region to be redrawn */ - evas_object_image_data_update_add(ad->img, 0, 0, ad->w, ad->h); - - LOGD("done"); - - return; -} -#endif -static int app_create(void *data) -{ -#if 0 //is blocked temporary to avoid build error until dependency package is updated. - /* Hook to take necessary actions before main event loop starts - Initialize UI resources and application's data - If this function returns true, the main loop of application starts - If this function returns false, the application is terminated */ - appdata_s *ad = data; - - LOGD("start"); - - create_base_gui(ad); - ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, keydown_cb, NULL); - - g_mutex_init(&ad->buffer_lock); - - LOGD("done"); -#endif - return 0; -} - -static int app_pause(void *data) -{ -#if 0 //is blocked temporary to avoid build error until dependency package is updated. - - /* Take necessary actions when application becomes invisible. */ - appdata_s *ad = (appdata_s *)data; - GList *list = NULL; - media_packet_h packet = NULL; - int ret = PLAYER_ERROR_NONE; - - LOGD("start"); - - if (ad == NULL) { - LOGE("appdata is NULL"); - return -1; - } - - if (ad->player_handle == NULL) { - printf("player_handle is NULL"); - return -1; - } - - /* stop render last set frame */ - evas_object_image_native_surface_set(ad->img, NULL); - - g_mutex_lock(&ad->buffer_lock); - - /* remove ecore pipe */ - ecore_pipe_del(ad->pipe); - ad->pipe = NULL; - - /* remove packet list */ - list = ad->packet_list; - while (list) { - packet = list->data; - list = g_list_next(list); - - if (!packet) { - LOGW("packet is NULL"); - } else { - LOGD("destroy packet %p", packet); - media_packet_destroy(packet); - packet = NULL; - ad->packet_list = g_list_remove(ad->packet_list, packet); - } - } - - if (ad->packet_list) { - g_list_free(ad->packet_list); - ad->packet_list = NULL; - } - - /* Destroy previous packet */ - if (ad->packet) { - LOGD("destroy packet %p", ad->packet); - ret = media_packet_destroy(ad->packet); - if (ret != MEDIA_PACKET_ERROR_NONE) { - LOGE("Failed to destroy media packet. ret (%d)", ret); - } - ad->packet = NULL; - } - - g_mutex_unlock(&ad->buffer_lock); - - ret = player_unprepare(ad->player_handle); - if (ret != PLAYER_ERROR_NONE) { - printf("player_unprepare failed : 0x%x", ret); - return false; - } - - ret = player_destroy(ad->player_handle); - if (ret != PLAYER_ERROR_NONE) { - printf("player_destroy failed : 0x%x", ret); - return false; - } - - ad->player_handle = NULL; - - LOGD("done"); -#endif - - return 0; -} - -static int app_resume(void *data) -{ - LOGD("start"); - - LOGD("done"); - - return 0; -} - -static int app_reset(bundle *b, void *data) -{ -#if 0 //is blocked temporary to avoid build error until dependency package is updated. - - /* Take necessary actions when application becomes visible. */ - appdata_s *ad = (appdata_s *)data; - int ret = PLAYER_ERROR_NONE; - - LOGD("start"); - - if (ad == NULL) { - LOGE("appdata is NULL"); - return -1; - } - - /* create ecore pipe */ - ad->pipe = ecore_pipe_add(pipe_cb, ad); - - ret = player_create(&ad->player_handle); - if (ret != PLAYER_ERROR_NONE) { - LOGE("player_create failed : 0x%x", ret); - return -1; - } - - ret = player_set_media_packet_video_frame_decoded_cb(ad->player_handle, _media_packet_video_decoded_cb, ad); - if (ret != PLAYER_ERROR_NONE) { - LOGE("player_set_media_packet_video_frame_decoded_cb failed : 0x%x", ret); - goto FAILED; - } - - ret = player_set_display(ad->player_handle, PLAYER_DISPLAY_TYPE_NONE, NULL); - if (ret != PLAYER_ERROR_NONE) { - LOGE("player_set_display failed : 0x%x", ret); - goto FAILED; - } - - ret = player_set_uri(ad->player_handle, MEDIA_FILE_PATH); - if (ret != PLAYER_ERROR_NONE) { - LOGE("player_set_uri failed : 0x%x", ret); - goto FAILED; - } - - ret = player_prepare(ad->player_handle); - if (ret != PLAYER_ERROR_NONE) { - LOGE("player prepare failed : 0x%x", ret); - goto FAILED; - } - - ret = player_start(ad->player_handle); - if (ret != PLAYER_ERROR_NONE) { - LOGE("player start failed : 0x%x", ret); - goto FAILED; - } - - LOGD("done"); - - return 0; - -FAILED: - if (ad->player_handle) { - player_destroy(ad->player_handle); - ad->player_handle = NULL; - } - - return -1; -#endif - return 0; //temp return value -} - -static int app_terminate(void *data) -{ - /* Release all resources. */ - appdata_s *ad = (appdata_s *)data; - - LOGD("start"); - - if (ad == NULL) { - LOGE("appdata is NULL"); - return -1; - } - - app_pause(data); - - g_mutex_clear(&ad->buffer_lock); - - LOGD("done"); - - return 0; -} - -int main(int argc, char *argv[]) -{ - int ret = 0; - static appdata_s ad = {0,}; - - LOGD("start"); - - memset(&ad, 0x0, sizeof(appdata_s)); - - LOGD("call appcore_efl_main"); - - ops.data = &ad; - - ret = appcore_efl_main(PACKAGE, &argc, &argv, &ops); - - LOGD("appcore_efl_main() ret = 0x%x", ret); - - return ret; -} - diff --git a/test/player_test.c b/test/player_test.c index 6ea5792..176c567 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -13,89 +13,62 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include #include #include #include #include + +#ifdef HAVE_X11 #include -//#define _USE_X_DIRECT_ -#ifdef _USE_X_DIRECT_ -#include #endif +#ifdef HAVE_WAYLAND +#include +#include +#endif + + #define PACKAGE "player_test" -#define MAX_STRING_LEN 2048 +#define MAX_STRING_LEN 2048 #define MMTS_SAMPLELIST_INI_DEFAULT_PATH "/opt/etc/mmts_filelist.ini" -#define PLAYER_TEST_DUMP_PATH_PREFIX "/opt/usr/media/dump_pcm_" #define INI_SAMPLE_LIST_MAX 9 -#define DEFAULT_HTTP_TIMEOUT -1 - char g_uri[MAX_STRING_LEN]; char g_subtitle_uri[MAX_STRING_LEN]; -FILE *g_pcm_fd; + enum { CURRENT_STATUS_MAINMENU, - CURRENT_STATUS_HANDLE_NUM, CURRENT_STATUS_FILENAME, CURRENT_STATUS_VOLUME, - CURRENT_STATUS_SOUND_TYPE, CURRENT_STATUS_MUTE, - CURRENT_STATUS_POSITION_TIME, + CURRENT_STATUS_REAL_POSITION_TIME, + CURRENT_STATUS_KEY_FRAME_POSITION_TIME, + CURRENT_STATUS_POSITION_PERCENT, CURRENT_STATUS_LOOPING, - CURRENT_STATUS_DISPLAY_SURFACE_CHANGE, CURRENT_STATUS_DISPLAY_MODE, CURRENT_STATUS_DISPLAY_ROTATION, CURRENT_STATUS_DISPLAY_VISIBLE, - CURRENT_STATUS_DISPLAY_ROI_MODE, - CURRENT_STATUS_DISPLAY_DST_ROI, - CURRENT_STATUS_DISPLAY_SRC_CROP, - CURRENT_STATUS_SUBTITLE_FILENAME, + CURRENT_STATUS_DISPLAY_ROI, + CURRENT_STATUS_SUBTITLE_FILENAME }; -#define MAX_HANDLE 20 - -/* for video display */ -#ifdef _USE_X_DIRECT_ -Window g_xid; -Display *g_dpy; -GC g_gc; -#else -Evas_Object* g_xid; -#endif -Evas_Object* g_eo_win; -Evas_Object* g_eo[MAX_HANDLE] = {0}; -int g_current_surface_type = PLAYER_DISPLAY_TYPE_OVERLAY; - struct appdata { - + Evas *evas; + Ecore_Evas *ee; Evas_Object *win; - Evas_Object *bg; - Evas_Object *rect; Evas_Object *layout_main; /* layout widget based on EDJ */ + #ifdef HAVE_X11 Ecore_X_Window xid; + #elif HAVE_WAYLAND + unsigned int xid; + #endif /* add more variables here */ }; -static Evas_Object *create_bg(Evas_Object *pParent) -{ - if(!pParent) { - return NULL; - } - - Evas_Object *pObj = NULL; - - pObj = elm_bg_add(pParent); - evas_object_size_hint_weight_set(pObj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(pParent, pObj); - evas_object_color_set(pObj, 0, 0, 0, 0); - evas_object_show(pObj); - return pObj; -} - static void win_del(void *data, Evas_Object *obj, void *event) { elm_exit(); @@ -103,7 +76,8 @@ static void win_del(void *data, Evas_Object *obj, void *event) static Evas_Object* create_win(const char *name) { - Evas_Object *eo = NULL; + Evas_Object *eo; + int w, h; printf ("[%s][%d] name=%s\n", __func__, __LINE__, name); @@ -112,115 +86,58 @@ static Evas_Object* create_win(const char *name) elm_win_title_set(eo, name); elm_win_borderless_set(eo, EINA_TRUE); evas_object_smart_callback_add(eo, "delete,request",win_del, NULL); - elm_win_autodel_set(eo, EINA_TRUE); + #ifdef HAVE_X11 + Ecore_X_Window xwin; + xwin = elm_win_xwindow_get(eo); + if (xwin != 0) + ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); + else { + #endif + #ifdef HAVE_WAYLAND + Ecore_Wl_Window *wlwin; + wlwin = elm_win_wl_window_get(eo); + if (wlwin != NULL) + ecore_wl_screen_size_get(&w, &h); + #endif + #ifdef HAVE_X11 + } + #endif + evas_object_resize(eo, w, h); } - return eo; -} -static Evas_Object *create_image_object(Evas_Object *eo_parent) -{ - if(!eo_parent) { - return NULL; - } - Evas *evas = evas_object_evas_get(eo_parent); - Evas_Object *eo = NULL; - - eo = evas_object_image_add(evas); - - return eo; -} - -static Evas_Object *create_render_rect(Evas_Object *pParent) -{ - if(!pParent) { - return NULL; - } - - Evas *pEvas = evas_object_evas_get(pParent); - Evas_Object *pObj = evas_object_rectangle_add(pEvas); - if(pObj == NULL) { - return NULL; - } - - evas_object_size_hint_weight_set(pObj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_color_set(pObj, 0, 0, 0, 0); - evas_object_render_op_set(pObj, EVAS_RENDER_COPY); - evas_object_show(pObj); - elm_win_resize_object_add(pParent, pObj); - - return pObj; + return eo; } static int app_create(void *data) { - struct appdata *ad = data; - Evas_Object *win = NULL; - - /* use gl backend */ - elm_config_preferred_engine_set("opengl_x11"); - - /* create window */ - win = create_win(PACKAGE); - if (win == NULL) - return -1; - ad->win = win; - g_eo_win = win; - ad->bg = create_bg(ad->win); - ad->rect = create_render_rect(ad->win); - g_xid = g_eo_win; - /* Create evas image object for EVAS surface */ - g_eo[0] = create_image_object(ad->win); - evas_object_image_size_set(g_eo[0], 500, 500); - evas_object_image_fill_set(g_eo[0], 0, 0, 500, 500); - evas_object_resize(g_eo[0], 500, 500); - - elm_win_activate(win); - evas_object_show(win); - - return 0; + 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; - int i = 0; + struct appdata *ad = data; - for (i = 0 ; i < MAX_HANDLE; i++) - { - if (g_eo[i]) - { - evas_object_del(g_eo[i]); - g_eo[i] = NULL; - } - } - if (g_eo_win) { - evas_object_del(g_eo_win); - g_eo_win = NULL; - } - ad->win = NULL; -#ifdef _USE_X_DIRECT_ - if(g_dpy) - { - if(g_gc) - XFreeGC (g_dpy, g_gc); - if(g_xid) - XDestroyWindow (g_dpy, g_xid); - XCloseDisplay (g_dpy); - g_xid = 0; - g_dpy = NULL; - } -#endif - return 0; + if (ad->win) + evas_object_del(ad->win); + + return 0; } struct appcore_ops ops = { - .create = app_create, - .terminate = app_terminate, + .create = app_create, + .terminate = app_terminate, }; struct appdata ad; -static player_h g_player[MAX_HANDLE] = {0}; -int g_handle_num = 1; +static player_h g_player = 0; int g_menu_state = CURRENT_STATUS_MAINMENU; char g_file_list[9][256]; gboolean quit_pushing; @@ -250,29 +167,19 @@ static void completed_cb(void *user_data) g_print("[Player_Test] completed_cb!!!!\n"); } -static void error_cb(int code, void *user_data) -{ - g_print("[Player_Test] error_cb!!!! code : %d\n", code); -} - -static void interrupted_cb(player_interrupted_code_e code, void *user_data) +static void audio_frame_decoded_cb(unsigned char *data, unsigned int size, void *user_data) { - g_print("[Player_Test] interrupted_cb!!!! code : %d\n", code); + int pos=0; + player_get_position(g_player, &pos); + g_print("[Player_Test] audio_frame_decoded_cb [size: %d] --- current pos : %d!!!!\n", size, pos); } -#if 0 -static void audio_frame_decoded_cb(unsigned char *data, unsigned int size, void *user_data) +void video_frame_decoded_cb(unsigned char *data, int width, int height, unsigned int size, void *user_data) { int pos=0; - - if (data && g_pcm_fd) - { - fwrite(data, 1, size, g_pcm_fd); - } - player_get_play_position(g_player[0], &pos); - g_print("[Player_Test] audio_frame_decoded_cb [size: %d] --- current pos : %d!!!!\n", size, pos); + player_get_position(g_player, &pos); + g_print("[Player_Test] video_frame_decoded_cb!!!! width: %d, height : %d, size :%d ---- current pos: %d \n",width, height,size,pos); } -#endif static void subtitle_updated_cb(unsigned long duration, char *text, void *user_data) { @@ -284,87 +191,22 @@ static void video_captured_cb(unsigned char *data, int width, int height,unsigne g_print("[Player_Test] video_captured_cb!!!! width: %d, height : %d, size : %d \n",width, height,size); } -int _save(unsigned char * src, int length) -{ //unlink(CAPTUERD_IMAGE_SAVE_PATH); - FILE* fp; - char filename[256] = {0,}; - static int WRITE_COUNT = 0; - - //gchar *filename = CAPTUERD_IMAGE_SAVE_PATH; - sprintf (filename, "ALBUM_ART_IMAGE_%d", WRITE_COUNT); - WRITE_COUNT++; - fp=fopen(filename, "w+"); - if(fp==NULL) - { - g_print("file open error!!\n"); - return FALSE; - } - else - { - g_print("open success\n"); - if(fwrite(src, 1, length, fp )!=1) - { - g_print("file write error!!\n"); - fclose(fp); - return FALSE; - } - g_print("write success(%s)\n", filename); - fclose(fp); - } - - return TRUE; -} - -static void reset_display() -{ - int i = 0; - - /* delete evas window, if it is */ - for (i = 0 ; i < MAX_HANDLE; i++) - { - if (g_eo[i]) - { - evas_object_del(g_eo[i]); - g_eo[i] = NULL; - } - } - -#ifdef _USE_X_DIRECT_ - /* delete x window, if it is */ - if(g_dpy) - { - if(g_gc) - XFreeGC (g_dpy, g_gc); - if(g_xid) - XDestroyWindow (g_dpy, g_xid); - XCloseDisplay (g_dpy); - g_xid = 0; - g_dpy = NULL; - } -#endif -} - static void input_filename(char *filename) { int len = strlen(filename); - int i = 0; if ( len < 0 || len > MAX_STRING_LEN ) return; - - for (i = 0; i < g_handle_num; i++) + if(g_player!=NULL) { - if(g_player[i]!=NULL) - { - player_unprepare(g_player[i]); - player_destroy(g_player[i]); - } - g_player[i] = 0; + player_unprepare(g_player); + player_destroy(g_player); + } + g_player = 0; - if ( player_create(&g_player[i]) != PLAYER_ERROR_NONE ) - { - g_print("player create is failed\n"); - } + if ( player_create(&g_player) != PLAYER_ERROR_NONE ) + { + g_print("player create is failed\n"); } strncpy (g_uri, filename,len); @@ -386,42 +228,21 @@ static void input_filename(char *filename) g_sprintf(uri, "mem://ext=%s,size=%d", ext ? ext : "", file_size); g_print("[uri] = %s\n", uri); - mm_player_set_attribute(g_player[0], + 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[0], filename); + //player_set_uri(g_player, filename); #endif /* APPSRC_TEST */ int ret; player_state_e state; - for (i = 0; i < g_handle_num; i++) - { - ret = player_get_state(g_player[i], &state); - g_print("player_get_state returned [%d]", ret); - g_print("1. After player_create() - Current State : %d \n", state); - } + ret = player_get_state(g_player, &state); + g_print("1. After player_create() - Current State : %d \n", state); } -#if 0 -// use this API instead of player_set_uri -static void player_set_memory_buffer_test() -{ - if(!g_uri) - g_print("g_uri is NULL\n"); - GMappedFile *file; - gsize file_size; - guint8* g_media_mem = NULL; - file = g_mapped_file_new (g_uri, FALSE, NULL); - file_size = g_mapped_file_get_length (file); - g_media_mem = (guint8 *) g_mapped_file_get_contents (file); - - int ret = player_set_memory_buffer(g_player[0], (void*)g_media_mem, file_size); - g_print("player_set_memory_buffer ret : %d\n", ret); -} -#endif static void _player_prepare(bool async) { int ret = FALSE; @@ -430,270 +251,90 @@ static void _player_prepare(bool async) if ( slen > 0 && slen < MAX_STRING_LEN ) { g_print("0. set subtile path() (size : %d) - %s \n", slen, g_subtitle_uri); - player_set_subtitle_path(g_player[0],g_subtitle_uri); - player_set_subtitle_updated_cb(g_player[0], subtitle_updated_cb, (void*)g_player[0]); - } - if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) - { - player_set_display(g_player[0], g_current_surface_type, GET_DISPLAY(g_xid)); - player_set_buffering_cb(g_player[0], buffering_cb, (void*)g_player[0]); - player_set_completed_cb(g_player[0], completed_cb, (void*)g_player[0]); - player_set_interrupted_cb(g_player[0], interrupted_cb, (void*)g_player[0]); - player_set_error_cb(g_player[0], error_cb, (void*)g_player[0]); - player_set_uri(g_player[0], g_uri); - //player_set_memory_buffer_test(); - } - else - { - int i = 0; - for (i = 0; i < g_handle_num; i++) - { - player_set_display(g_player[i], g_current_surface_type, g_eo[i]); - player_set_buffering_cb(g_player[i], buffering_cb, (void*)g_player[i]); - player_set_completed_cb(g_player[i], completed_cb, (void*)g_player[i]); - player_set_interrupted_cb(g_player[i], interrupted_cb, (void*)g_player[i]); - player_set_error_cb(g_player[i], error_cb, (void*)g_player[i]); - player_set_uri(g_player[i], g_uri); - //player_set_memory_buffer_test(); - } + player_set_subtitle_path(g_player,g_subtitle_uri); + player_set_subtitle_updated_cb(g_player, subtitle_updated_cb, (void*)g_player); } + #ifdef HAVE_X11 + player_set_display(g_player,PLAYER_DISPLAY_TYPE_X11,GET_DISPLAY(ad.xid)); + #elif HAVE_WAYLAND + player_set_display(g_player,PLAYER_DISPLAY_TYPE_EVAS,GET_DISPLAY(ad.xid)); + #endif + - if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) + player_set_buffering_cb(g_player, buffering_cb, (void*)g_player); + player_set_completed_cb(g_player, completed_cb, (void*)g_player); + player_set_uri(g_player, g_uri); + + if ( async ) { - if ( async ) - { - ret = player_prepare_async(g_player[0], prepared_cb, (void*) g_player[0]); - } - else - ret = player_prepare(g_player[0]); + ret = player_prepare_async(g_player, prepared_cb, (void*) g_player); } else - { - int i = 0; - for (i = 0; i < g_handle_num; i++) - { - if ( async ) - { - ret = player_prepare_async(g_player[i], prepared_cb, (void*) g_player[i]); - } - else - ret = player_prepare(g_player[i]); - } - } + ret = player_prepare(g_player); if ( ret != PLAYER_ERROR_NONE ) { g_print("prepare is failed (errno = %d) \n", ret); } player_state_e state; - if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) - { - ret = player_get_state(g_player[0], &state); - g_print("After player_prepare() - Current State : %d \n", state); - } - else - { - int i = 0; - for (i = 0; i < g_handle_num; i++) - { - ret = player_get_state(g_player[i], &state); - g_print("After player_prepare() - Current State : %d \n", state); - } - } - + ret = player_get_state(g_player, &state); + g_print("After player_prepare() - Current State : %d \n", state); } static void _player_unprepare() { int ret = FALSE; - int i = 0; - if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) - { - ret = player_unprepare(g_player[0]); - if ( ret != PLAYER_ERROR_NONE ) - { - g_print("unprepare is failed (errno = %d) \n", ret); - } - ret = player_unset_subtitle_updated_cb(g_player[0]); - g_print("player_unset_subtitle_updated_cb ret %d\n", ret); - - ret = player_unset_buffering_cb(g_player[0]); - g_print("player_unset_buffering_cb ret %d\n", ret); - - ret = player_unset_completed_cb(g_player[0]); - g_print("player_unset_completed_cb ret %d\n", ret); - - ret = player_unset_interrupted_cb(g_player[0]); - g_print("player_unset_interrupted_cb ret %d\n", ret); - - ret = player_unset_error_cb(g_player[0]); - g_print("player_unset_error_cb ret %d\n", ret); - - } - else + ret = player_unprepare(g_player); + if ( ret != PLAYER_ERROR_NONE ) { - for (i = 0; i < g_handle_num ; i++) - { - if(g_player[i]!=NULL) - { - ret = player_unprepare(g_player[i]); - if ( ret != PLAYER_ERROR_NONE ) - { - g_print("unprepare is failed (errno = %d) \n", ret); - } - ret = player_unset_subtitle_updated_cb(g_player[i]); - g_print("player_unset_subtitle_updated_cb [%d] ret %d\n", i, ret); - - ret = player_unset_buffering_cb(g_player[i]); - g_print("player_unset_buffering_cb [%d] ret %d\n", i, ret); - - ret = player_unset_completed_cb(g_player[i]); - g_print("player_unset_completed_cb [%d] ret %d\n", i, ret); - - ret = player_unset_interrupted_cb(g_player[i]); - g_print("player_unset_interrupted_cb [%d] ret %d\n", i, ret); - - ret = player_unset_error_cb(g_player[i]); - g_print("player_unset_error_cb [%d] ret %d\n", i, ret); - } - } + g_print("unprepare is failed (errno = %d) \n", ret); } - reset_display(); memset(g_subtitle_uri, 0 , sizeof(g_subtitle_uri)); player_state_e state; - if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) - { - ret = player_get_state(g_player[0], &state); - g_print(" After player_unprepare() - Current State : %d \n", state); - } - else - { - for (i = 0; i < g_handle_num ; i++) - { - ret = player_get_state(g_player[i], &state); - g_print(" After player_unprepare() - Current State : %d \n", state); - } - } -} - -static void _player_destroy() -{ - int i = 0; - if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) - { - player_unprepare(g_player[0]); - for (i = 0; i < g_handle_num ; i++) - { - player_destroy(g_player[i]); - g_player[i] = 0; - } - } - else - { - for (i = 0; i < g_handle_num ; i++) - { - if(g_player[i]!=NULL) - { - player_unprepare(g_player[i]); - player_destroy(g_player[i]); - g_player[i] = 0; - } - } - } + ret = player_get_state(g_player, &state); + g_print(" After player_unprepare() - Current State : %d \n", state); } static void _player_play() { int bRet = FALSE; - int i = 0; - if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) - { - bRet = player_start(g_player[0]); - g_print("player_start returned [%d]", bRet); - } - else - { - for (i = 0; i < g_handle_num ; i++) - { - bRet = player_start(g_player[i]); - g_print("player_start returned [%d]", bRet); - } - } + bRet = player_start(g_player); } static void _player_stop() { int bRet = FALSE; - int i = 0; - if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) - { - bRet = player_stop(g_player[0]); - g_print("player_stop returned [%d]", bRet); - } - else - { - for (i = 0; i < g_handle_num ; i++) - { - bRet = player_stop(g_player[i]); - g_print("player_stop returned [%d]", bRet); - } - } + bRet = player_stop(g_player); } static void _player_resume() { int bRet = FALSE; - int i = 0; - if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) - { - bRet = player_start(g_player[0]); - g_print("player_start returned [%d]", bRet); - } - else - { - for (i = 0; i < g_handle_num ; i++) - { - bRet = player_start(g_player[i]); - g_print("player_start returned [%d]", bRet); - } - } + bRet = player_start(g_player); } static void _player_pause() { int bRet = FALSE; - int i = 0; - if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) - { - bRet = player_pause(g_player[0]); - g_print("player_pause returned [%d]", bRet); - } - else - { - for (i = 0; i < g_handle_num ; i++) - { - bRet = player_pause(g_player[i]); - g_print("player_pause returned [%d]", bRet); - } - } + bRet = player_pause(g_player); } static void _player_state() { player_state_e state; - player_get_state(g_player[0], &state); + player_get_state(g_player, &state); g_print(" ==> [Player_Test] Current Player State : %d\n", state); } static void _player_set_progressive_download() { - player_set_progressive_download_path(g_player[0], "/opt/test.pd"); - player_set_progressive_download_message_cb(g_player[0], progress_down_cb, (void*)g_player[0]); + player_set_progressive_download_path(g_player, "/opt/test.pd"); + player_set_progressive_download_message_cb(g_player, progress_down_cb, (void*)g_player); } static void set_volume(float volume) { - if ( player_set_volume(g_player[0], volume, volume) != PLAYER_ERROR_NONE ) + if ( player_set_volume(g_player, volume, volume) != PLAYER_ERROR_NONE ) { g_print("failed to set volume\n"); } @@ -701,13 +342,13 @@ static void set_volume(float volume) static void get_volume(float* left, float* right) { - player_get_volume(g_player[0], left, 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[0], mute) != PLAYER_ERROR_NONE ) + if ( player_set_mute(g_player, mute) != PLAYER_ERROR_NONE ) { g_print("failed to set_mute\n"); } @@ -715,41 +356,44 @@ static void set_mute(bool mute) static void get_mute(bool *mute) { - player_is_muted(g_player[0], mute); + player_is_muted(g_player, mute); g_print(" ==> [Player_Test] mute = %d\n", *mute); } -static void set_sound_type(sound_type_e type) -{ - if ( player_set_sound_type(g_player[0], type) != PLAYER_ERROR_NONE ) - { - g_print("failed to set sound type(%d)\n", type); - } - else - g_print("set sound type(%d) success", type); -} - static void get_position() { int position = 0; + int percent = 0; int ret; - ret = player_get_play_position(g_player[0], &position); - g_print(" ==> [Player_Test] player_get_play_position()%d return : %d\n", ret, position); + 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) +static void set_position(int position, bool flag) { - if ( player_set_play_position(g_player[0], position, TRUE, seek_completed_cb, g_player[0]) != PLAYER_ERROR_NONE ) + if ( player_seek(g_player, position, flag, seek_completed_cb, g_player) != 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, seek_completed_cb, g_player) != 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[0], &duration); + 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); } @@ -758,21 +402,20 @@ static void get_stream_info() { int w = 0; int h = 0; - char *value = NULL; - player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_ALBUM, &value); + player_get_content_info(g_player, PLAYER_CONTENT_INFO_ALBUM, &value); g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_ALBUM: [%s ] \n",value); - player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_ARTIST, &value); + player_get_content_info(g_player, PLAYER_CONTENT_INFO_ARTIST, &value); g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_ARTIST: [%s ] \n",value); - player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_AUTHOR, &value); + player_get_content_info(g_player, PLAYER_CONTENT_INFO_AUTHOR, &value); g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_AUTHOR: [%s ] \n",value); - player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_GENRE, &value); + player_get_content_info(g_player, PLAYER_CONTENT_INFO_GENRE, &value); g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_GENRE: [%s ] \n",value); - player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_TITLE, &value); + player_get_content_info(g_player, PLAYER_CONTENT_INFO_TITLE, &value); g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_TITLE: [%s ] \n",value); void *album; int size; - player_get_album_art(g_player[0], &album, &size); + player_get_album_art(g_player, &album, &size); g_print(" ==> [Player_Test] Album art : [ data : %p, size : %d ]\n", (unsigned int *)album, size); if(value!=NULL) { @@ -783,16 +426,12 @@ static void get_stream_info() int sample_rate; int channel; int bit_rate; - int fps, v_bit_rate; - player_get_audio_stream_info(g_player[0], &sample_rate, &channel, &bit_rate); + player_get_audio_stream_info(g_player, &sample_rate, &channel, &bit_rate); g_print(" ==> [Player_Test] Sample Rate: [%d ] , Channel: [%d ] , Bit Rate: [%d ] \n",sample_rate,channel,bit_rate); - player_get_video_stream_info(g_player[0], &fps, &v_bit_rate); - g_print(" ==> [Player_Test] fps: [%d ] , Bit Rate: [%d ] \n",fps,v_bit_rate); - char *audio_codec = NULL; char *video_codec = NULL; - player_get_codec_info(g_player[0], &audio_codec, &video_codec); + player_get_codec_info(g_player, &audio_codec, &video_codec); if(audio_codec!=NULL) { g_print(" ==> [Player_Test] Audio Codec: [%s ] \n",audio_codec); @@ -805,130 +444,27 @@ static void get_stream_info() free(video_codec); video_codec = NULL; } - player_get_video_size(g_player[0], &w, &h); + 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 (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) + if ( player_set_looping(g_player, looping) != PLAYER_ERROR_NONE ) { - if ( player_set_looping(g_player[0], looping) != PLAYER_ERROR_NONE ) - { - g_print("failed to set_looping\n"); - } - } - else - { - int i = 0; - for (i = 0; i < g_handle_num; i++) - { - if ( player_set_looping(g_player[i], looping) != PLAYER_ERROR_NONE ) - { - g_print("failed to set_looping\n"); - } - } + g_print("failed to set_looping\n"); } } static void get_looping(bool *looping) { - player_is_looping(g_player[0], looping); + player_is_looping(g_player, looping); g_print(" ==> [Player_Test] looping = %d\n", *looping); } -static void change_surface(int option) -{ - player_display_type_e surface_type = 0; - int ret = PLAYER_ERROR_NONE; - - switch (option) - { - case 0: /* X surface */ - surface_type = PLAYER_DISPLAY_TYPE_OVERLAY; - g_print("change surface type to X\n"); - break; - case 1: /* EVAS surface */ - surface_type = PLAYER_DISPLAY_TYPE_EVAS; - g_print("change surface type to EVAS\n"); - break; - default: - g_print("invalid surface type\n"); - return; - } - - if (surface_type == g_current_surface_type) - { - g_print("same with the previous surface type(%d)\n", g_current_surface_type); - return; - } - else - { - player_state_e player_state = PLAYER_STATE_NONE; - ret = player_get_state(g_player[0], &player_state); - if (ret) - { - g_print("failed to player_get_state(), ret(0x%x)\n", ret); - } - /* state check */ - if (player_state == PLAYER_STATE_NONE || player_state == PLAYER_STATE_IDLE ) - { - reset_display(); - - if (surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) - { -#ifdef _USE_X_DIRECT_ - /* Create xwindow for X surface */ - if(!g_dpy) - { - g_dpy = XOpenDisplay (NULL); - g_xid = create_window (g_dpy, 0, 0, 500, 500); - g_gc = XCreateGC (g_dpy, g_xid, 0, 0); - } - g_print("create x window dpy(%p), gc(%x), xid(%d)\n", g_dpy, (unsigned int)g_gc, (int)g_xid); - XImage *xim = make_transparent_image (g_dpy, 500, 500); - XPutImage (g_dpy, g_xid, g_gc, xim, 0, 0, 0, 0, 500, 500); - XSync (g_dpy, False); -#else - g_xid = g_eo_win; -#endif - ret = player_set_display(g_player[0], surface_type, GET_DISPLAY(g_xid)); - } - else - { - int i = 0; - for (i = 0; i < g_handle_num ; i++) - { - /* Create evas image object for EVAS surface */ - if (!g_eo[i]) - { - g_eo[i] = create_image_object(g_eo_win); - evas_object_image_size_set(g_eo[i], 500, 500); - evas_object_image_fill_set(g_eo[i], 0, 0, 500, 500); - evas_object_resize(g_eo[i], 500, 500); - evas_object_move(g_eo[i], i*20, i*20); - } - ret = player_set_display(g_player[i], surface_type, g_eo[i]); - } - } - if (ret) - { - g_print("failed to set display, surface_type(%d)\n", surface_type); - return; - } - g_current_surface_type = surface_type; - } - else - { - g_print("could not change surface type, current_state(%d)\n", player_state); - } - } - return; -} - static void set_display_mode(int mode) { - if ( player_set_display_mode(g_player[0], mode) != PLAYER_ERROR_NONE ) + if ( player_set_display_mode(g_player, mode) != PLAYER_ERROR_NONE ) { g_print("failed to player_set_display_mode\n"); } @@ -937,13 +473,13 @@ static void set_display_mode(int mode) static void get_display_mode() { player_display_mode_e mode; - player_get_display_mode(g_player[0], &mode); + player_get_display_mode(g_player, &mode); g_print(" ==> [Player_Test] Display mode: [%d ] \n",mode); } static void set_display_rotation(int rotation) { - if ( player_set_display_rotation(g_player[0], rotation) != PLAYER_ERROR_NONE ) + if ( player_set_x11_display_rotation(g_player, rotation) != PLAYER_ERROR_NONE ) { g_print("failed to set_display_rotation\n"); } @@ -952,14 +488,14 @@ static void set_display_rotation(int rotation) static void get_display_rotation() { player_display_rotation_e rotation = 0; - player_get_display_rotation(g_player[0], &rotation); + 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_display_visible(g_player[0], visible) != PLAYER_ERROR_NONE ) + if ( player_set_x11_display_visible(g_player, visible) != PLAYER_ERROR_NONE ) { g_print("failed to player_set_x11_display_visible\n"); } @@ -967,91 +503,32 @@ static void set_display_visible(bool visible) static void get_display_visible(bool *visible) { - player_is_display_visible(g_player[0], visible); + player_is_x11_display_visible(g_player, visible); g_print(" ==> [Player_Test] X11 Display Visible = %d\n", *visible); } -static void set_display_dst_roi(int x, int y, int w, int h) +static void set_display_roi(int x, int y, int w, int h) { -#if 0 - if ( player_set_x11_display_dst_roi(g_player[0], x, y, w, h) != PLAYER_ERROR_NONE ) + if ( player_set_x11_display_roi(g_player, x, y, w, h) != PLAYER_ERROR_NONE ) { - g_print("failed to player_set_x11_display_dst_roi\n"); + g_print("failed to player_set_x11_display_roi\n"); } else { - g_print(" ==> [Player_Test] set X11 Display DST ROI (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h); + g_print(" ==> [Player_Test] set X11 Display ROI (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h); } -#endif } -static void get_display_dst_roi() +static void get_display_roi() { -#if 0 int x = 0; int y = 0; int w = 0; int h = 0; - - if ( player_get_x11_display_dst_roi(g_player[0], &x, &y, &w, &h) != PLAYER_ERROR_NONE ) + if ( player_get_x11_display_roi(g_player, &x, &y, &w, &h) != PLAYER_ERROR_NONE ) { - g_print("failed to player_get_x11_display_dst_roi\n"); + g_print("failed to player_get_x11_display_roi\n"); } else { - g_print(" ==> [Player_Test] got X11 Display DST ROI (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h); + g_print(" ==> [Player_Test] got X11 Display ROI (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h); } -#endif -} - -static void set_display_roi_mode(int mode) -{ -#if 0 - if ( player_set_x11_display_roi_mode(g_player[0], (player_display_roi_mode_e)mode) != PLAYER_ERROR_NONE ) - { - g_print("failed to player_set_x11_display_roi_mode\n"); - } else { - g_print(" ==> [Player_Test] set X11 Display ROI mode (%d)\n", mode); - } -#endif -} - -static void get_display_roi_mode() -{ -#if 0 - player_display_roi_mode_e mode; - if ( player_get_x11_display_roi_mode(g_player[0], &mode) != PLAYER_ERROR_NONE ) - { - g_print("failed to player_get_x11_display_roi_mode\n"); - } else { - g_print(" ==> [Player_Test] got X11 Display ROI mode (%d)\n", mode); - } -#endif -} - -static void set_display_src_crop(int x, int y, int w, int h) -{ -#if 0 - if ( player_set_x11_display_src_crop(g_player[0], x, y, w, h) != PLAYER_ERROR_NONE ) - { - g_print("failed to player_set_x11_display_src_crop\n"); - } else { - g_print(" ==> [Player_Test] set X11 Display SRC CROP (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h); - } -#endif -} - -static void get_display_src_crop() -{ -#if 0 - int x = 0; - int y = 0; - int w = 0; - int h = 0; - - if ( player_get_x11_display_src_crop(g_player[0], &x, &y, &w, &h) != PLAYER_ERROR_NONE ) - { - g_print("failed to player_get_x11_display_src_crop\n"); - } else { - g_print(" ==> [Player_Test] got X11 Display SRC CROP (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h); - } -#endif } static void input_subtitle_filename(char *subtitle_filename) @@ -1063,12 +540,11 @@ static void input_subtitle_filename(char *subtitle_filename) strncpy (g_subtitle_uri, subtitle_filename,len); g_print("subtitle uri is set to %s\n", g_subtitle_uri); - player_set_subtitle_path (g_player[0], g_subtitle_uri); } static void capture_video() { - if( player_capture_video(g_player[0],video_captured_cb,NULL)!=PLAYER_ERROR_NONE) + if( player_capture_video(g_player,video_captured_cb,NULL)!=PLAYER_ERROR_NONE) { g_print("failed to player_capture_video\n"); } @@ -1076,47 +552,29 @@ static void capture_video() static void decoding_audio() { -#if 0 int ret; - char *suffix, *dump_path; - GDateTime *time = g_date_time_new_now_local(); - - suffix = g_date_time_format(time, "%Y%m%d_%H%M%S.pcm"); - dump_path = g_strjoin(NULL, PLAYER_TEST_DUMP_PATH_PREFIX, suffix, NULL); - g_pcm_fd = fopen(dump_path, "w+"); - g_free(dump_path); - g_free(suffix); - g_date_time_unref(time); - if(!g_pcm_fd) { - g_print("Can not create debug dump file"); - } - - ret =player_set_audio_frame_decoded_cb(g_player[0], 0, 0,audio_frame_decoded_cb, (void*)g_player[0]); + ret =player_set_audio_frame_decoded_cb(g_player, 0,0,audio_frame_decoded_cb, (void*)g_player); if ( ret != PLAYER_ERROR_NONE ) { g_print("player_set_audio_frame_decoded_cb is failed (errno = %d) \n", ret); } -#endif } -void quit_program() +static void decoding_video() { - int i = 0; - - if(g_pcm_fd) + int ret; + ret =player_set_video_frame_decoded_cb(g_player, video_frame_decoded_cb, (void*)g_player); + if ( ret != PLAYER_ERROR_NONE ) { - fclose(g_pcm_fd); + g_print("player_set_video_frame_decoded_cb is failed (errno = %d) \n", ret); } +} - for (i = 0; i < g_handle_num; i++) - { - if(g_player[i]!=NULL) - { - player_unprepare(g_player[i]); - player_destroy(g_player[i]); - g_player[i] = 0; - } - } +void quit_program() +{ + player_unprepare(g_player); + player_destroy(g_player); + g_player = 0; elm_exit(); } @@ -1193,7 +651,7 @@ void _interpret_main_menu(char *cmd) } else if (strncmp(cmd, "f", 1) == 0) { - g_menu_state = CURRENT_STATUS_VOLUME; + g_menu_state = CURRENT_STATUS_VOLUME; } else if (strncmp(cmd, "g", 1) == 0) { @@ -1201,13 +659,9 @@ void _interpret_main_menu(char *cmd) float right; get_volume(&left, &right); } - else if (strncmp(cmd, "z", 1) == 0) - { - g_menu_state = CURRENT_STATUS_SOUND_TYPE; - } else if (strncmp(cmd, "h", 1) == 0 ) { - g_menu_state = CURRENT_STATUS_MUTE; + g_menu_state = CURRENT_STATUS_MUTE; } else if (strncmp(cmd, "i", 1) == 0 ) { @@ -1216,19 +670,23 @@ void _interpret_main_menu(char *cmd) } else if (strncmp(cmd, "j", 1) == 0 ) { - g_menu_state = CURRENT_STATUS_POSITION_TIME; + g_menu_state = CURRENT_STATUS_REAL_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(); + get_position(); } else if (strncmp(cmd, "m", 1) == 0 ) { - get_duration(); + get_duration(); } else if (strncmp(cmd, "n", 1) == 0 ) { - get_stream_info(); + get_stream_info(); } else if (strncmp(cmd, "o", 1) == 0 ) { @@ -1236,8 +694,8 @@ void _interpret_main_menu(char *cmd) } else if (strncmp(cmd, "p", 1) == 0 ) { - bool looping; - get_looping(&looping); + bool looping; + get_looping(&looping); } else if (strncmp(cmd, "r", 1) == 0 ) { @@ -1266,33 +724,17 @@ void _interpret_main_menu(char *cmd) } else if (strncmp(cmd, "x", 1) == 0 ) { - g_menu_state = CURRENT_STATUS_DISPLAY_DST_ROI; + g_menu_state = CURRENT_STATUS_DISPLAY_ROI; } else if (strncmp(cmd, "y", 1) == 0 ) { - get_display_dst_roi(); - } - else if (strncmp(cmd, "M", 1) == 0 ) - { - g_menu_state = CURRENT_STATUS_DISPLAY_ROI_MODE; - } - else if (strncmp(cmd, "N", 1) == 0 ) - { - get_display_roi_mode(); - } - else if (strncmp(cmd, "F", 1) == 0 ) - { - g_menu_state = CURRENT_STATUS_DISPLAY_SRC_CROP; - } - else if (strncmp(cmd, "G", 1) == 0 ) - { - get_display_src_crop(); + get_display_roi(); } else if (strncmp(cmd, "A", 1) == 0 ) { g_menu_state = CURRENT_STATUS_SUBTITLE_FILENAME; } - else if (strncmp(cmd, "C", 1) == 0 ) + else if (strncmp(cmd, "C", 1) == 0 ) { capture_video(); } @@ -1300,14 +742,18 @@ void _interpret_main_menu(char *cmd) { decoding_audio(); } + else if (strncmp(cmd, "E", 1) == 0 ) + { + decoding_video(); + } else if (strncmp(cmd, "q", 1) == 0) { - quit_pushing = TRUE; - quit_program(); + quit_pushing = TRUE; + quit_program(); } else { - g_print("unknown menu \n"); + g_print("unknown menu \n"); } } else if(len == 2) @@ -1316,7 +762,7 @@ void _interpret_main_menu(char *cmd) { _player_prepare(FALSE); // sync } - else if (strncmp(cmd, "pa", 2) == 0) + else if (strncmp(cmd, "pa", 2) == 0) { _player_prepare(TRUE); // async } @@ -1324,28 +770,20 @@ void _interpret_main_menu(char *cmd) { _player_unprepare(); } - else if (strncmp(cmd, "dt", 2) == 0) - { - _player_destroy(); - } else if (strncmp(cmd, "sp", 2) == 0) { _player_set_progressive_download(); } - else if (strncmp(cmd, "ds", 2) == 0 ) - { - g_menu_state = CURRENT_STATUS_DISPLAY_SURFACE_CHANGE; - } - else if (strncmp(cmd, "nb", 2) == 0 ) + else if (strncmp(cmd, "jj", 2) == 0 ) { - g_menu_state = CURRENT_STATUS_HANDLE_NUM; + g_menu_state = CURRENT_STATUS_KEY_FRAME_POSITION_TIME; } - else + else { - g_print("unknown menu \n"); + g_print("unknown menu \n"); } } - else + else { g_print("unknown menu \n"); } @@ -1358,8 +796,8 @@ void display_sub_basic() g_print("=========================================================================================\n"); g_print(" Player Test (press q to quit) \n"); g_print("-----------------------------------------------------------------------------------------\n"); - g_print("*. Sample List in [%s] \t", MMTS_SAMPLELIST_INI_DEFAULT_PATH); - g_print("nb. num. of handles \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) @@ -1373,29 +811,31 @@ void display_sub_basic() g_print("c. Stop \t"); g_print("d. Resume\t"); g_print("e. Pause \t"); - g_print("un. Unprepare \t"); - g_print("dt. Destroy \n"); - g_print("[State] S. Player State \n"); + g_print("un. Unprepare \n"); + g_print("[State] S. Player State \n"); g_print("[ volume ] f. Set Volume\t"); - g_print("g. Get Volume\t"); - g_print("z. Set Sound type\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"); + g_print("[position] j. Set Position (T, accurate)\t"); + g_print("[position] jj. Set Position (T, key frame)\t"); + g_print("k. Set Position (%%)\t"); g_print("l. Get Position\n"); g_print("[duration] m. Get Duration\n"); g_print("[Stream Info] n. Get stream info (Video Size, codec, audio stream info, and tag info)\n"); g_print("[Looping] o. Set Looping\t"); g_print("p. Get Looping\n"); - g_print("[display] v. Set display visible\t"); - g_print("w. Get display visible\n"); - g_print("[display] ds. Change display surface type\n"); g_print("[x display] r. Set display mode\t"); - g_print("s. Get display mode\n"); - g_print("[x display] t. Set display Rotation\t"); - g_print("[Track] tl. Get Track language info(single only)\n"); - g_print("[subtitle] A. Set(or change) subtitle path\n"); + 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\t"); + g_print("x. Set ROI\t"); + g_print("y. Get ROI\n"); + g_print("[subtitle] A. Set subtitle path\n"); g_print("[Video Capture] C. Capture \n"); + g_print("[Audio Frame Decode] D. Decoding Audio Frame E. Decoding Video Frame \n"); g_print("[etc] sp. Set Progressive Download\n"); g_print("\n"); g_print("=========================================================================================\n"); @@ -1407,10 +847,6 @@ static void displaymenu() { display_sub_basic(); } - else if (g_menu_state == CURRENT_STATUS_HANDLE_NUM) - { - g_print("*** input number of handles.(recommended only for EVAS surface)\n"); - } else if (g_menu_state == CURRENT_STATUS_FILENAME) { g_print("*** input mediapath.\n"); @@ -1419,30 +855,28 @@ static void displaymenu() { g_print("*** input volume value.(0~1.0)\n"); } - else if (g_menu_state == CURRENT_STATUS_SOUND_TYPE) - { - g_print("*** input sound type.(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:FIXED)\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) + else if (g_menu_state == CURRENT_STATUS_REAL_POSITION_TIME + || g_menu_state == CURRENT_STATUS_KEY_FRAME_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_SURFACE_CHANGE) { - g_print("*** input display surface type.(0: X surface, 1: EVAS surface) \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, 4: ORIGIN_OR_LETTER, 5: ROI) \n"); + 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) + 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"); } @@ -1450,23 +884,15 @@ static void displaymenu() { g_print("*** input display visible value.(0: HIDE, 1: SHOW) \n"); } - else if (g_menu_state == CURRENT_STATUS_DISPLAY_ROI_MODE) + else if (g_menu_state == CURRENT_STATUS_DISPLAY_ROI) { - g_print("*** input display roi mode.(0: FULL_SCREEN, 1: LETTER BOX)\n"); + g_print("*** input display roi value sequencially.(x, y, w, h)\n"); } - else if (g_menu_state == CURRENT_STATUS_DISPLAY_DST_ROI) - { - g_print("*** input display roi value sequentially.(x, y, w, h)\n"); - } - else if (g_menu_state == CURRENT_STATUS_DISPLAY_SRC_CROP) - { - g_print("*** input display source crop value sequentially.(x, y, w, h)\n"); - } - else if (g_menu_state == CURRENT_STATUS_SUBTITLE_FILENAME) + else if (g_menu_state == CURRENT_STATUS_SUBTITLE_FILENAME) { g_print(" *** input subtitle file path.\n"); } - else + else { g_print("*** unknown status.\n"); quit_program(); @@ -1500,20 +926,6 @@ static void interpret (char *cmd) _interpret_main_menu(cmd); } break; - case CURRENT_STATUS_HANDLE_NUM: - { - int num_handle = atoi(cmd); - if (0 >= num_handle || num_handle > MAX_HANDLE) - { - g_print("not supported this number for handles(%d)\n", num_handle); - } - else - { - g_handle_num = num_handle; - } - reset_menu_state(); - } - break; case CURRENT_STATUS_FILENAME: { input_filename(cmd); @@ -1527,38 +939,38 @@ static void interpret (char *cmd) reset_menu_state(); } break; - case CURRENT_STATUS_SOUND_TYPE: + case CURRENT_STATUS_MUTE: { - int type = atoi(cmd); - set_sound_type(type); + int mute = atoi(cmd); + set_mute(mute); reset_menu_state(); } break; - case CURRENT_STATUS_MUTE: + case CURRENT_STATUS_REAL_POSITION_TIME: { - int mute = atoi(cmd); - set_mute(mute); + long position = atol(cmd); + set_position(position, 1); reset_menu_state(); } break; - case CURRENT_STATUS_POSITION_TIME: + case CURRENT_STATUS_KEY_FRAME_POSITION_TIME: { long position = atol(cmd); - set_position(position); + set_position(position, 0); reset_menu_state(); } break; - case CURRENT_STATUS_LOOPING: + case CURRENT_STATUS_POSITION_PERCENT: { - int looping = atoi(cmd); - set_looping(looping); + long percent = atol(cmd); + set_position_ratio(percent); reset_menu_state(); } break; - case CURRENT_STATUS_DISPLAY_SURFACE_CHANGE: + case CURRENT_STATUS_LOOPING: { - int type = atoi(cmd); - change_surface(type); + int looping = atoi(cmd); + set_looping(looping); reset_menu_state(); } break; @@ -1569,7 +981,7 @@ static void interpret (char *cmd) reset_menu_state(); } break; - case CURRENT_STATUS_DISPLAY_ROTATION: + case CURRENT_STATUS_DISPLAY_ROTATION: { int rotation = atoi(cmd); set_display_rotation(rotation); @@ -1583,7 +995,7 @@ static void interpret (char *cmd) reset_menu_state(); } break; - case CURRENT_STATUS_DISPLAY_DST_ROI: + case CURRENT_STATUS_DISPLAY_ROI: { int value = atoi(cmd); static int roi_x = 0; @@ -1607,7 +1019,7 @@ static void interpret (char *cmd) case 3: cnt = 0; roi_h = value; - set_display_dst_roi(roi_x, roi_y, roi_w, roi_h); + set_display_roi(roi_x, roi_y, roi_w, roi_h); roi_x = roi_y = roi_w = roi_h = 0; reset_menu_state(); break; @@ -1616,53 +1028,13 @@ static void interpret (char *cmd) } } break; - case CURRENT_STATUS_DISPLAY_SRC_CROP: - { - int value = atoi(cmd); - static int crop_x = 0; - static int crop_y = 0; - static int crop_w = 0; - static int crop_h = 0; - static int crop_cnt = 0; - switch (crop_cnt) { - case 0: - crop_x = value; - crop_cnt++; - break; - case 1: - crop_y = value; - crop_cnt++; - break; - case 2: - crop_w = value; - crop_cnt++; - break; - case 3: - crop_cnt = 0; - crop_h = value; - set_display_src_crop(crop_x, crop_y, crop_w, crop_h); - crop_x = crop_y = crop_w = crop_h = 0; - reset_menu_state(); - break; - default: - break; - } - } - break; - case CURRENT_STATUS_DISPLAY_ROI_MODE: - { - int value = atoi(cmd); - set_display_roi_mode(value); - reset_menu_state(); - } - break; - case CURRENT_STATUS_SUBTITLE_FILENAME: + case CURRENT_STATUS_SUBTITLE_FILENAME: { input_subtitle_filename(cmd); reset_menu_state(); } break; - } + } g_timeout_add(100, timeout_menu_display, 0); } @@ -1693,3 +1065,4 @@ int main(int argc, char *argv[]) return appcore_efl_main(PACKAGE, &argc, &argv, &ops); } +