From: Eunhae Choi Date: Thu, 24 Aug 2017 05:52:56 +0000 (+0900) Subject: add new internal api for 360 X-Git-Tag: submit/tizen/20170906.061717~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c1e9ef8cf598e1bb9f22cc86e16911b347fc2325;p=platform%2Fcore%2Fapi%2Fplayer.git add new internal api for 360 Change-Id: I0f54e52c04cc8640b74fdc91a0c6710a5f94f417 --- diff --git a/include/player_internal.h b/include/player_internal.h index f4a536d..5efe8cc 100644 --- a/include/player_internal.h +++ b/include/player_internal.h @@ -531,7 +531,6 @@ int player_enable_media_packet_video_frame_decoded_cb(player_h player, bool enab /** * @brief Sets the streaming buffering time * @since_tizen 4.0 - * @remarks The player state have to be #PLAYER_STATE_IDLE to apply the buffer_ms. * @param[in] player The handle to the media player * @param[in] buffer_ms The buffer time to start playback * @param[in] rebuffer_ms The buffer time during playback if player enter pause state for buffering. @@ -541,7 +540,7 @@ int player_enable_media_packet_video_frame_decoded_cb(player_h player, bool enab * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #PLAYER_ERROR_INVALID_STATE Invalid state * @if WEARABLE @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature @endif - * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @pre The player state must be #PLAYER_STATE_IDLE. * @see player_get_streaming_buffering_time() */ int player_set_streaming_buffering_time (player_h player, int buffer_ms, int rebuffer_ms); @@ -564,6 +563,147 @@ int player_set_streaming_buffering_time (player_h player, int buffer_ms, int reb */ int player_get_streaming_buffering_time (player_h player, int *buffer_ms, int *rebuffer_ms); +/** + * @brief Enables 360 video mode + * @since_tizen 4.0 + * @details If it is @c true, the content will be displayed with 360 video mode. + * If it is @c false, the content will be displayed with full panorama mode. The default value is @c true. + * @param[in] player The handle to the media player + * @param[in] enable The 360 video display status : (@c true = display with 360 video mode, @c false = display with full panorama mode) + * @return @c 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 one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @see player_360_is_enabled() + * @see player_360_set_direction_of_view() + */ +int player_360_set_enable(player_h player, bool enable); + +/** + * @brief Gets the 360 video display status. + * @since_tizen 4.0 + * @param[in] player The handle to the media player + * @param[out] enabled The 360 video display status : (@c true = display with 360 video mode, @c false = display with full panorama mode) + * @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 #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @see player_360_set_enable() + */ +int player_360_is_enabled(player_h player, bool *enabled); + +/** + * @brief Sets the 360 video direction of view. + * @since_tizen 4.0 + * @details This function is to set the vertical and lateral axis value. + * @param[in] player The handle to the media player + * @param[in] yaw The vertical axis value + * @param[in] pitch The lateral axis value + * @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: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @see player_is_audio_only() + */ +int player_360_set_direction_of_view(player_h player, float yaw, float pitch); + +/** + * @brief Gets the 360 video direction of view. + * @since_tizen 4.0 + * @details This function is to get the vertical and lateral axis value. + * @param[in] player The handle to the media player + * @param[out] yaw The vertical axis value + * @param[out] pitch The lateral axis value + * @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 #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @see player_is_audio_only() + */ +int player_360_get_direction_of_view(player_h player, float *yaw, float *pitch); + +/** + * @brief Sets the zoom level of 360 video. + * @since_tizen 4.0 + * @details The zoom means scaling of the flat image cutted from the panorama. + * The valid range is from [TBD]. Default value is 1.0. + * @param[in] player The handle to the media player + * @param[in] level The zoom level + * @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 #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @see player_360_get_zoom() + */ +int player_360_set_zoom(player_h player, float level); + +/** + * @brief Gets the current zoom level of 360 video. + * @since_tizen 4.0 + * @details The zoom means scaling of the flat image cutted from the panorama. + * The valid range is from [TBD]. Default value is 1.0. + * @param[in] player The handle to the media player + * @param[out] level The zoom level + * @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 #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @see player_360_set_zoom() + */ +int player_360_get_zoom(player_h player, float *level); + +/** + * @brief Sets the field of view information of 360 video. + * @since_tizen 4.0 + * @details This function is to set the field of view to decide the output frame size. + * @param[in] player The handle to the media player + * @param[in] horizontal_degrees The horizontal degrees to display (The default value is [TBD]) + * @param[in] vertical_degrees The vertical degrees to display (The default value is [TBD]) + * @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 #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @see player_360_get_field_of_view() + */ +int player_360_set_field_of_view(player_h player, int horizontal_degrees, int vertical_degrees); + +/** + * @brief Gets the field of view information of 360 video. + * @since_tizen 4.0 + * @details This function is to get the field of view information. + * @param[in] player The handle to the media player + * @param[out] horizontal_degrees The horizontal degrees to display (The default value is [TBD]) + * @param[out] vertical_degrees The vertical degrees to display (The default value is [TBD]) + * @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 #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @see player_360_set_field_of_view() + */ +int player_360_get_field_of_view(player_h player, int *horizontal_degrees, int *vertical_degrees); + /** * @} */ diff --git a/src/player.c b/src/player.c index 55766bf..5267058 100644 --- a/src/player.c +++ b/src/player.c @@ -4420,7 +4420,6 @@ int player_set_streaming_buffering_time(player_h player, int buffer_ms, int rebu LOGD("LEAVE 0x%X", ret); return ret; - } int player_get_streaming_buffering_time(player_h player, int *buffer_ms, int *rebuffer_ms) @@ -4454,5 +4453,192 @@ int player_get_streaming_buffering_time(player_h player, int *buffer_ms, int *re LOGD("LEAVE 0x%X", ret); return ret; +} + +int player_360_set_enable(player_h player, bool enable) +{ + PLAYER_INSTANCE_CHECK(player); + int ret = PLAYER_ERROR_NONE; + muse_player_api_e api = MUSE_PLAYER_API_360_SET_ENABLE; + player_cli_s *pc = (player_cli_s *) player; + char *ret_buf = NULL; + int val = (int)enable; + + LOGD("ENTER %d", enable); + + player_msg_send1(api, pc, ret_buf, ret, INT, val); + g_free(ret_buf); + + LOGD("LEAVE 0x%X", ret); + return ret; +} + +int player_360_is_enabled(player_h player, bool *enabled) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(enabled); + int ret = PLAYER_ERROR_NONE; + muse_player_api_e api = MUSE_PLAYER_API_360_IS_ENABLED; + player_cli_s *pc = (player_cli_s *) player; + char *ret_buf = NULL; + int val = 0; + + LOGD("ENTER"); + + player_msg_send(api, pc, ret_buf, ret); + if (ret == PLAYER_ERROR_NONE) { + player_msg_get(val, ret_buf); + *enabled = val; + } + g_free(ret_buf); + + LOGD("LEAVE 0x%X", ret); + return ret; +} + +int player_360_set_direction_of_view(player_h player, float yaw, float pitch) +{ + PLAYER_INSTANCE_CHECK(player); + int ret = PLAYER_ERROR_NONE; + muse_player_api_e api = MUSE_PLAYER_API_360_SET_DIRECTION_OF_VIEW; + player_cli_s *pc = (player_cli_s *) player; + char *ret_buf = NULL; + + LOGD("ENTER %f %f", yaw, pitch); + + player_msg_send2(api, pc, ret_buf, ret, DOUBLE, yaw, DOUBLE, pitch); + g_free(ret_buf); + + LOGD("LEAVE 0x%X", ret); + return ret; +} + +int player_360_get_direction_of_view(player_h player, float *yaw, float *pitch) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(yaw && pitch); + int ret = PLAYER_ERROR_NONE; + muse_player_api_e api = MUSE_PLAYER_API_360_GET_DIRECTION_OF_VIEW; + player_cli_s *pc = (player_cli_s *) player; + double yaw_val = -1; + double pitch_val = -1; + char *ret_buf = NULL; + + LOGD("ENTER"); + + player_msg_send(api, pc, ret_buf, ret); + + if (ret == PLAYER_ERROR_NONE) { + bool ret_val = TRUE; + player_msg_get2(ret_buf, yaw_val, DOUBLE, pitch_val, DOUBLE, ret_val); + if (ret_val) { + *yaw = (float)yaw_val; + *pitch = (float)pitch_val; + } else { + LOGE("failed to get value from msg"); + ret = PLAYER_ERROR_INVALID_OPERATION; + } + } + + g_free(ret_buf); + + LOGD("LEAVE 0x%X", ret); + return ret; +} +int player_360_set_zoom(player_h player, float level) +{ + PLAYER_INSTANCE_CHECK(player); + int ret = PLAYER_ERROR_NONE; + muse_player_api_e api = MUSE_PLAYER_API_360_SET_ZOOM; + player_cli_s *pc = (player_cli_s *) player; + char *ret_buf = NULL; + + LOGD("ENTER %f", level); + + player_msg_send1(api, pc, ret_buf, ret, DOUBLE, level); + g_free(ret_buf); + + LOGD("LEAVE 0x%X", ret); + return ret; +} + +int player_360_get_zoom(player_h player, float *level) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(level); + int ret = PLAYER_ERROR_NONE; + muse_player_api_e api = MUSE_PLAYER_API_360_GET_ZOOM; + player_cli_s *pc = (player_cli_s *) player; + double zoom = -1; + char *ret_buf = NULL; + + LOGD("ENTER"); + + player_msg_send(api, pc, ret_buf, ret); + + if (ret == PLAYER_ERROR_NONE) { + if (player_msg_get_type(zoom, ret_buf, DOUBLE)) { + *level = (float)zoom; + } else { + LOGE("failed to get value from msg"); + ret = PLAYER_ERROR_INVALID_OPERATION; + } + } + + g_free(ret_buf); + + LOGD("LEAVE 0x%X", ret); + return ret; + +} + +int player_360_set_field_of_view(player_h player, int horizontal_degrees, int vertical_degrees) +{ + PLAYER_INSTANCE_CHECK(player); + int ret = PLAYER_ERROR_NONE; + muse_player_api_e api = MUSE_PLAYER_API_360_SET_FIELD_OF_VIEW; + player_cli_s *pc = (player_cli_s *) player; + char *ret_buf = NULL; + + LOGD("ENTER %d %d", horizontal_degrees, vertical_degrees); + + player_msg_send2(api, pc, ret_buf, ret, INT, horizontal_degrees, INT, vertical_degrees); + g_free(ret_buf); + + LOGD("LEAVE 0x%X", ret); + return ret; +} + +int player_360_get_field_of_view(player_h player, int *horizontal_degrees, int *vertical_degrees) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(horizontal_degrees && vertical_degrees); + int ret = PLAYER_ERROR_NONE; + muse_player_api_e api = MUSE_PLAYER_API_360_GET_FIELD_OF_VIEW; + player_cli_s *pc = (player_cli_s *) player; + int h_val = -1; + int v_val = -1; + char *ret_buf = NULL; + + LOGD("ENTER"); + + player_msg_send(api, pc, ret_buf, ret); + + if (ret == PLAYER_ERROR_NONE) { + bool ret_val = TRUE; + player_msg_get2(ret_buf, h_val, INT, v_val, INT, ret_val); + if (ret_val) { + *horizontal_degrees = h_val; + *vertical_degrees = v_val; + } else { + LOGE("failed to get value from msg"); + ret = PLAYER_ERROR_INVALID_OPERATION; + } + } + + g_free(ret_buf); + + LOGD("LEAVE 0x%X", ret); + return ret; }