From 790ad61366ef777eec1fa85827d722a68e01099e Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Fri, 22 Jan 2016 15:01:05 +0900 Subject: [PATCH] player: add new error return value of push stream api Change-Id: I8e19d2548b65edf5fd4b2f4409a31a0fa2803e43 --- include/mobile/player.h | 15 +++++++++++---- include/wearable/player.h | 20 +++++++++++++------- packaging/legacy-capi-media-player.spec | 2 +- src/player.c | 7 +++++++ 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/include/mobile/player.h b/include/mobile/player.h index bec2e71..bbdefcc 100644 --- a/include/mobile/player.h +++ b/include/mobile/player.h @@ -84,6 +84,8 @@ typedef enum { PLAYER_ERROR_RESOURCE_LIMIT = PLAYER_ERROR_CLASS | 0x0c, /**< Resource limit */ PLAYER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ PLAYER_ERROR_SERVICE_DISCONNECTED = PLAYER_ERROR_CLASS | 0x0d, /**< Socket connection lost (Since 3.0) */ + PLAYER_ERROR_BUFFER_SPACE = TIZEN_ERROR_BUFFER_SPACE, /**< No buffer space available (Since 3.0)*/ + } player_error_e; /** @@ -915,6 +917,8 @@ int player_unset_media_packet_video_frame_decoded_cb(player_h player); * @brief Pushes elementary stream to decode audio or video * @since_tizen 2.4 * @remarks player_set_media_stream_info() should be called before using this API. + * @remarks The available buffer size can be set by calling player_set_media_stream_buffer_max_size() API. + * If there is no available buffer space, this api will return error since 3.0. * @param[in] player The handle to media player * @param[in] packet The media packet to decode * @return @c 0 on success, @@ -923,8 +927,10 @@ int player_unset_media_packet_video_frame_decoded_cb(player_h player); * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #PLAYER_ERROR_INVALID_STATE Invalid state * @retval #PLAYER_ERROR_NOT_SUPPORTED_FILE File not supported - * @pre The player state must be set to #PLAYER_STATE_IDLE at least. - * @see player_set_media_stream_info() + * @retval #PLAYER_ERROR_BUFFER_SPACE No buffer space available (since 3.0) + * @pre The player state must be set to #PLAYER_STATE_IDLE at least. + * @see player_set_media_stream_info() + * @see player_set_media_stream_buffer_max_size() */ int player_push_media_stream(player_h player, media_packet_h packet); @@ -1025,7 +1031,7 @@ int player_unset_media_stream_seek_cb(player_h player, player_stream_type_e type * @remarks If the buffer level over the max size, player_media_stream_buffer_status_cb() will be invoked with overflow status. * @param[in] player The handle to the media player * @param[in] type The type of target stream - * @param[in] max_size The max bytes of buffer + * @param[in] max_size The max bytes of buffer, it has to be bigger than zero. (default: 200000) * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful @@ -1063,7 +1069,7 @@ int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_ * @remarks If the buffer level drops below the percent value, player_media_stream_buffer_status_cb() will be invoked with underrun status. * @param[in] player The handle to the media player * @param[in] type The type of target stream - * @param[in] percent The minimum threshold(0~100) of buffer + * @param[in] percent The minimum threshold(0~100) of buffer (default: 0) * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful @@ -1972,3 +1978,4 @@ int player_select_track(player_h player, player_stream_type_e type, int index); #endif #endif /* __TIZEN_MEDIA_PLAYER_H__ */ + diff --git a/include/wearable/player.h b/include/wearable/player.h index 086216c..2409244 100644 --- a/include/wearable/player.h +++ b/include/wearable/player.h @@ -84,6 +84,8 @@ typedef enum { PLAYER_ERROR_RESOURCE_LIMIT = PLAYER_ERROR_CLASS | 0x0c, /**< Resource limit */ PLAYER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ PLAYER_ERROR_SERVICE_DISCONNECTED = PLAYER_ERROR_CLASS | 0x0d, /**< Socket connection lost (Since 3.0) */ + PLAYER_ERROR_BUFFER_SPACE = TIZEN_ERROR_BUFFER_SPACE, /**< No buffer space available (Since 3.0)*/ + } player_error_e; /** @@ -455,7 +457,7 @@ int player_prepare(player_h player); * @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] 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, @@ -599,8 +601,8 @@ int player_get_volume(player_h player, float *left, float *right); * @since_tizen 2.3.1 * @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(). - * @remarks If stream_info already exists by calling player_set_audio_policy_info(), - * It will return error. + * @remarks If stream_info already exists by calling sound_manager_create_stream_info(), + * It will return error since 3.0. * * @param[in] player The handle to the media player * @param[in] type The sound type @@ -914,6 +916,8 @@ int player_unset_media_packet_video_frame_decoded_cb(player_h player); * @brief Pushes elementary stream to decode audio or video * @since_tizen 2.4 * @remarks player_set_media_stream_info() should be called before using this API. + * @remarks The available buffer size can be set by calling player_set_media_stream_buffer_max_size() API. + * If there is no available buffer space, this api will return error since 3.0. * @param[in] player The handle to media player * @param[in] packet The media packet to decode * @return @c 0 on success, @@ -922,8 +926,10 @@ int player_unset_media_packet_video_frame_decoded_cb(player_h player); * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #PLAYER_ERROR_INVALID_STATE Invalid state * @retval #PLAYER_ERROR_NOT_SUPPORTED_FILE File not supported - * @pre The player state must be set to #PLAYER_STATE_IDLE at least. - * @see player_set_media_stream_info() + * @retval #PLAYER_ERROR_BUFFER_SPACE No buffer space available (since 3.0) + * @pre The player state must be set to #PLAYER_STATE_IDLE at least. + * @see player_set_media_stream_info() + * @see player_set_media_stream_buffer_max_size() */ int player_push_media_stream(player_h player, media_packet_h packet); @@ -1024,7 +1030,7 @@ int player_unset_media_stream_seek_cb(player_h player, player_stream_type_e type * @remarks If the buffer level over the max size, player_media_stream_buffer_status_cb() will be invoked with overflow status. * @param[in] player The handle to the media player * @param[in] type The type of target stream - * @param[in] max_size The max bytes of buffer + * @param[in] max_size The max bytes of buffer, it has to be bigger than zero. (default: 200000) * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful @@ -1062,7 +1068,7 @@ int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_ * @remarks If the buffer level drops below the percent value, player_media_stream_buffer_status_cb() will be invoked with underrun status. * @param[in] player The handle to the media player * @param[in] type The type of target stream - * @param[in] percent The minimum threshold(0~100) of buffer + * @param[in] percent The minimum threshold(0~100) of buffer (default: 0) * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful diff --git a/packaging/legacy-capi-media-player.spec b/packaging/legacy-capi-media-player.spec index cc08dcb..84164fd 100644 --- a/packaging/legacy-capi-media-player.spec +++ b/packaging/legacy-capi-media-player.spec @@ -3,7 +3,7 @@ Name: legacy-capi-media-player Summary: A Media Player library in Tizen Native API -Version: 0.2.7 +Version: 0.2.8 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/player.c b/src/player.c index 7eb6950..eab7b16 100644 --- a/src/player.c +++ b/src/player.c @@ -252,6 +252,13 @@ int __player_convert_error_code(int code, char *func_name) case MM_ERROR_PLAYER_PERMISSION_DENIED: ret = PLAYER_ERROR_PERMISSION_DENIED; msg = "PLAYER_ERROR_PERMISSION_DENIED"; + break; + case MM_ERROR_PLAYER_BUFFER_SPACE: + ret = PLAYER_ERROR_BUFFER_SPACE; + msg = "PLAYER_ERROR_BUFFER_SPACE"; + break; + default: + break; } LOGE("[%s] %s(0x%08x) : core fw error(0x%x)", func_name, msg, ret, code); return ret; -- 2.7.4