From 177f43f59a40f7226bacb43030c2475e1b5b37fa Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Tue, 5 Jun 2018 14:48:16 +0900 Subject: [PATCH] [ACR-1239] Add new 360 api to set zoom with fov Change-Id: I4a6fb04eaecf413309cee2e59f934b25252b1131 --- include/player.h | 102 ++++++++++++------ src/player.c | 23 ++++ test/player_test.c | 311 +++++++++++++++++++++++++++-------------------------- 3 files changed, 250 insertions(+), 186 deletions(-) diff --git a/include/player.h b/include/player.h index 775fd0b..e560a33 100644 --- a/include/player.h +++ b/include/player.h @@ -757,7 +757,7 @@ int player_get_audio_latency_mode(player_h player, audio_latency_mode_e *latency * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif * @remarks Sound can be mixed with other sounds if you don't control the stream focus in sound-manager module since 3.0.\n * You can refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE. - * @remarks Even if you don't set visible to true by calling player_set_display_visible, the video will be shown on #PLAYER_STATE_PLAYING state. + * @remarks Even if you don't set visible to true by calling player_set_display_visible(), the video will be shown on #PLAYER_STATE_PLAYING state. * * @param[in] player The handle to the media player * @return @c 0 on success, @@ -825,13 +825,13 @@ int player_pause(player_h player); * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif * @remarks This function will trigger the seeking operation on player instance. * Normally application need to wait for player_seek_completed_cb() before calling it again. - * Otherwise it will return PLAYER_ERROR_SEEK_FAILED. + * Otherwise it will return #PLAYER_ERROR_SEEK_FAILED. * Please note that if application is playing external media data via player_set_media_stream_info(), * then consecutive calling of this function will always success and no need to wait for player_seek_completed_cb() * before next calling of this function.(since_tizen 3.0) - * @remarks Even if you don't set visible to true by calling player_set_display_visible, + * @remarks Even if you don't set visible to true by calling player_set_display_visible(), * the video will be shown when the _seek_completed cb is invoked. - * @remarks In case of non-seekable content, it will return PLAYER_ERROR_INVALID_OPERATION. + * @remarks In case of non-seekable content, it will return #PLAYER_ERROR_INVALID_OPERATION. * If application ignore this error, player will keep playing without changing play position. * @param[in] player The handle to the media player * @param[in] millisecond The position in milliseconds from the start to the seek point @@ -955,10 +955,10 @@ int player_is_looping(player_h player, bool *looping); * @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_display_type_e - * @see player_set_display_mode - * @see player_set_display_roi_area - * @see player_set_display_visible - * @see player_set_display_rotation + * @see player_set_display_mode() + * @see player_set_display_roi_area() + * @see player_set_display_visible() + * @see player_set_display_rotation() * @see ecore_thread_main_loop_begin() * @see ecore_thread_main_loop_end() */ @@ -984,7 +984,7 @@ int player_set_display(player_h player, player_display_type_e type, player_displ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #PLAYER_ERROR_INVALID_STATE Invalid state * @pre The player's state must be #PLAYER_STATE_IDLE. And, #PLAYER_DISPLAY_TYPE_NONE must be set by calling player_set_display(). - * @see player_unset_media_packet_video_frame_decoded_cb + * @see player_unset_media_packet_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); @@ -1249,7 +1249,7 @@ int player_set_display_roi_area(player_h player, int x, int y, int width, int he * @brief Sets the visibility of the video display. * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif * @remarks If no display is set, no operation is performed. - * @remarks If you set visible before calling player_set_display, it will be applied on #PLAYER_STATE_READY state. + * @remarks If you set visible before calling player_set_display(), it will be applied on #PLAYER_STATE_READY state. * @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, @@ -1290,7 +1290,7 @@ int player_is_display_visible(player_h player, bool* visible); * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation * @see #player_display_rotation_e - * @see player_set_display + * @see player_set_display() * @see player_get_display_rotation() */ int player_set_display_rotation(player_h player, player_display_rotation_e rotation); @@ -1305,7 +1305,7 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat * @retval #PLAYER_ERROR_NONE Successful * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation - * @see #player_display_rotation_e + * @see #player_display_rotation_e * @see player_set_display_rotation() */ int player_get_display_rotation(player_h player, player_display_rotation_e *rotation); @@ -2084,7 +2084,7 @@ int player_unset_video_stream_changed_cb(player_h player); * @details Index starts from 0. * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif * @param[in] player The handle to the media player - * @param[in] type The type of target stream which is PLAYER_STREAM_TYPE_AUDIO or PLAYER_STREAM_TYPE_TEXT + * @param[in] type The type of target stream which is #PLAYER_STREAM_TYPE_AUDIO or #PLAYER_STREAM_TYPE_TEXT * @param[out] index The index of track * @return @c 0 on success, * otherwise a negative error value @@ -2101,7 +2101,7 @@ int player_get_current_track(player_h player, player_stream_type_e type, int *in * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif * @remarks @a code must be released with @c free() by caller * @param[in] player The handle to the media player - * @param[in] type The type of target stream which is PLAYER_STREAM_TYPE_AUDIO or PLAYER_STREAM_TYPE_TEXT + * @param[in] type The type of target stream which is #PLAYER_STREAM_TYPE_AUDIO or #PLAYER_STREAM_TYPE_TEXT * @param[in] index The index of track * @param[out] code A language code in ISO 639-1. "und" will be returned if the language is undefined. * @return @c 0 on success, @@ -2118,7 +2118,7 @@ int player_get_track_language_code(player_h player, player_stream_type_e type, i * @brief Gets the track count. * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif * @param[in] player The handle to the media player - * @param[in] type The type of target stream which is PLAYER_STREAM_TYPE_AUDIO or PLAYER_STREAM_TYPE_TEXT + * @param[in] type The type of target stream which is #PLAYER_STREAM_TYPE_AUDIO or #PLAYER_STREAM_TYPE_TEXT * @param[out] count The number of track * @return @c 0 on success, * otherwise a negative error value @@ -2134,7 +2134,7 @@ int player_get_track_count(player_h player, player_stream_type_e type, int *coun * @brief Selects a track to play. * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif * @param[in] player The handle to the media player - * @param[in] type The type of target stream which is PLAYER_STREAM_TYPE_AUDIO or PLAYER_STREAM_TYPE_TEXT + * @param[in] type The type of target stream which is #PLAYER_STREAM_TYPE_AUDIO or #PLAYER_STREAM_TYPE_TEXT * @param[in] index The index of track * @return @c 0 on success, * otherwise a negative error value @@ -2170,7 +2170,7 @@ int player_select_track(player_h player, player_stream_type_e type, int index); * @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_adaptive_variant_cb + * @see player_adaptive_variant_cb() */ int player_foreach_adaptive_variant(player_h player, player_adaptive_variant_cb callback, void *user_data); @@ -2183,8 +2183,8 @@ int player_foreach_adaptive_variant(player_h player, player_adaptive_variant_cb * @remarks If there is no affordable stream for the condition, the minimum bandwidth stream will be selected. * @param[in] player The handle to the media player * @param[in] bandwidth The max bandwidth limit of the stream variant (default: -1) - * @param[in] width The max width limit of the stream variant (deafult: -1) - * @param[in] height The max height limit of the stream variant (deafult: -1) + * @param[in] width The max width limit of the stream variant (default: -1) + * @param[in] height The max height limit of the stream variant (default: -1) * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful @@ -2201,8 +2201,8 @@ int player_set_max_adaptive_variant_limit(player_h player, int bandwidth, int wi * @remarks This function is used for adaptive streaming(hls/mpeg dash) only. * @param[in] player The handle to the media player * @param[out] bandwidth The max bandwidth limit of the stream variant (default: -1) - * @param[out] width The max width limit of the stream variant (deafult: -1) - * @param[out] height The max height limit of the stream variant (deafult: -1) + * @param[out] width The max width limit of the stream variant (default: -1) + * @param[out] height The max height limit of the stream variant (default: -1) * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful @@ -2297,9 +2297,10 @@ int player_is_replaygain_enabled(player_h player, bool *enabled); /** * @brief Sets the streaming buffering time. * @since_tizen 4.0 - * @param[in] player The handle to the media player - * @param[in] prebuffer_ms The buffer time to start playback - * @param[in] rebuffer_ms The buffer time during playback if player enter pause state for buffering. + * @param[in] player The handle to the media player + * @param[in] prebuffer_ms The time duration of buffering data that must be prerolled to start playback. + * @param[in] rebuffer_ms The time duration of buffering data that must be prerolled to resume playback + * if player enters pause state for buffering. * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful @@ -2314,9 +2315,10 @@ int player_set_streaming_buffering_time(player_h player, int prebuffer_ms, int r /** * @brief Gets the streaming buffering time. * @since_tizen 4.0 - * @param[in] player The handle to the media player - * @param[in] prebuffer_ms The buffer time to start playback - * @param[in] rebuffer_ms The buffer time during playback if player enter pause state for buffering. + * @param[in] player The handle to the media player + * @param[out] prebuffer_ms The time duration of buffering data that must be prerolled to start playback. + * @param[out] rebuffer_ms The time duration of buffering data that must be prerolled to resume playback + * if player enters pause state for buffering. * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful @@ -2445,7 +2447,7 @@ int player_360_get_direction_of_view(player_h player, float *yaw, float *pitch); /** * @brief Sets the zoom level of 360 video. - * @details The zoom means scaling of the flat image cutted from the panorama. + * @details The zoom means scaling of the flat image cut from the panorama. * The valid range is from 1.0 to 10.0, where 1.0 is the actual image and * values above are zoom-in factor. Default value is 1.0 - no zoom. * @since_tizen 5.0 @@ -2453,7 +2455,8 @@ int player_360_get_direction_of_view(player_h player, float *yaw, float *pitch); * %http://tizen.org/feature/multimedia.player.spherical_video\n * %http://tizen.org/feature/opengles.version.2_0\n * @param[in] player The handle to the media player - * @param[in] level The zoom level + * @param[in] level The zoom level\n + * Valid range is 1.0~10.0. Default value is 1.0. * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful @@ -2495,10 +2498,10 @@ int player_360_get_zoom(player_h player, float *level); * %http://tizen.org/feature/multimedia.player.spherical_video\n * %http://tizen.org/feature/opengles.version.2_0\n * @param[in] player The handle to the media player - * @param[in] horizontal_degrees The horizontal field of view to display in degrees. - * Valid range is 1-360 degrees. Default value is 120 degrees. - * @param[in] vertical_degrees The vertical field of view to display in degrees. - * Valid range is 1-180 degrees. Default value is 67 degrees. + * @param[in] horizontal_degrees The horizontal field of view to display in degrees\n + * Valid range is 1~360 degrees. Default value is 120 degrees. + * @param[in] vertical_degrees The vertical field of view to display in degrees\n + * Valid range is 1~180 degrees. Default value is 67 degrees. * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful @@ -2532,6 +2535,39 @@ int player_360_set_field_of_view(player_h player, int horizontal_degrees, int ve int player_360_get_field_of_view(player_h player, int *horizontal_degrees, int *vertical_degrees); /** + * @brief Sets the zoom level with field of view information of 360 video. + * @details This function is provided to reduce the distortion of zoom operation. + * The zoom means scaling of the flat image cut from the panorama + * which is decided by the field of view data. + * The zoom level valid range is from 1.0 to 10.0, where 1.0 is the actual image and + * values above are zoom-in factor. Default value is 1.0 - no zoom. + * @since_tizen 5.0 + * @remarks The degree values above the default ones extend the field of view to significantly + * distorted areas and will not be useful in most cases. + * @remarks This function is related to the following features:\n + * %http://tizen.org/feature/multimedia.player.spherical_video\n + * %http://tizen.org/feature/opengles.version.2_0\n + * @param[in] player The handle to the media player + * @param[in] level The zoom level\n + * Valid range is 1.0~10.0. Default value is 1.0. + * @param[in] horizontal_degrees The horizontal field of view to display in degrees\n + * Valid range is 1~360 degrees. Default value is 120 degrees. + * @param[in] vertical_degrees The vertical field of view to display in degrees\n + * Valid range is 1~180 degrees. Default value is 67 degrees. + * @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_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature + * @see player_360_set_zoom() + * @see player_360_get_zoom() + * @see player_360_set_field_of_view() + * @see player_360_get_field_of_view() + */ +int player_360_set_zoom_with_field_of_view(player_h player, float level, int horizontal_degrees, int vertical_degrees); + +/** * @} */ diff --git a/src/player.c b/src/player.c index 2cfbe39..b984e7e 100644 --- a/src/player.c +++ b/src/player.c @@ -5097,6 +5097,29 @@ int player_360_get_field_of_view(player_h player, int *horizontal_degrees, int * return ret; } +int player_360_set_zoom_with_field_of_view(player_h player, float level, int horizontal_degrees, int vertical_degrees) +{ + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); + + PLAYER_INSTANCE_CHECK(player); + int ret = PLAYER_ERROR_NONE; + muse_player_api_e api = MUSE_PLAYER_API_360_SET_ZOOM_WITH_FIELD_OF_VIEW; + player_cli_s *pc = (player_cli_s *) player; + char *ret_buf = NULL; + + LOGD("ENTER %f %d %d", level, horizontal_degrees, vertical_degrees); + + PLAYER_SEND_MSG(api, pc, ret_buf, ret, + MUSE_TYPE_DOUBLE, "level", (double)level, + MUSE_TYPE_INT, "horizontal_degrees", horizontal_degrees, + MUSE_TYPE_INT, "vertical_degrees", vertical_degrees); + + g_free(ret_buf); + LOGD("LEAVE 0x%X", ret); + return ret; +} + int player_set_replaygain_enabled(player_h player, bool enabled) { PLAYER_INSTANCE_CHECK(player); diff --git a/test/player_test.c b/test/player_test.c index 751884b..f04f49f 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -60,17 +60,6 @@ typedef enum { TIZEN_PROFILE_COMMON = 0x10, } tizen_profile_t; -typedef struct { - int bandwidth; - int width; - int height; -} adaptive_variant_info_t; - -typedef struct { - int buffer_ms; - int rebuffer_ms; -} buffer_size_t; - #ifdef USE_EVENT_HANDLER static void event_handler_cb(enum libinput_event_type ev_t, int x, int y, void * data, float e[3]); static void event_handler_set_dov_fov(); @@ -171,21 +160,14 @@ enum { CURRENT_STATUS_VIDEO360_SET_FOV, CURRENT_STATUS_VIDEO360_SET_FOV1, CURRENT_STATUS_VIDEO360_SET_ZOOM, + CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV, + CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV1, + CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV2, CURRENT_STATUS_AUDIO_CODEC_TYPE, CURRENT_STATUS_VIDEO_CODEC_TYPE, CURRENT_STATUS_REPLAYGAIN_ENABLE, }; -typedef struct { - int pos; - bool accurate; -} player_seek_pos_t; - -typedef struct { - int a_codec_type; - int v_codec_type; -} player_codec_type_t; - #define MAX_HANDLE 20 /* for video display */ @@ -197,8 +179,6 @@ static Evas_Object *selected_win_id; static Evas_Object *g_eo[MAX_HANDLE] = { 0, }; static int g_current_surface_type = -1; -static adaptive_variant_info_t max_limit = {-1, -1, -1}; -static buffer_size_t buff_size = {-1, -1}; typedef struct { Evas_Object *win; @@ -211,8 +191,7 @@ typedef struct { static appdata ad; static player_h g_player[MAX_HANDLE] = { 0, }; -static player_seek_pos_t seek_info = {0}; -static player_codec_type_t codec_type = {0}; + int g_handle_num = 1; int g_menu_state = CURRENT_STATUS_MAINMENU; gboolean quit_pushing; @@ -1466,13 +1445,13 @@ static void get_variant_limit() g_print(" ==> [Player_Test]get [b]%d, [w]%d, [h]%d\n", bandwidth, width, height); } -static void set_variant_limit() +static void set_variant_limit(int bandwidth, int width, int height) { - g_print(" ==> [Player_Test]set [b]%d, [w]%d, [h]%d\n", max_limit.bandwidth, max_limit.width, max_limit.height); - player_set_max_adaptive_variant_limit(g_player[0], max_limit.bandwidth, max_limit.width, max_limit.height); + g_print(" ==> [Player_Test]set [b]%d, [w]%d, [h]%d\n", bandwidth, width, height); + player_set_max_adaptive_variant_limit(g_player[0], bandwidth, width, height); } -static void set_buffer_size() +static void set_buffer_size(int prebuffer, int rebuffer) { int ret = 0; int buffer_ms = 0, rebuffer_ms = 0; @@ -1483,9 +1462,9 @@ static void set_buffer_size() else g_print("current buffer size %d ms / %d ms\n", buffer_ms, rebuffer_ms); - g_print("new buffer size %d ms / %d ms\n", buff_size.buffer_ms, buff_size.rebuffer_ms); + g_print("new buffer size %d ms / %d ms\n", prebuffer, rebuffer); - player_set_streaming_buffering_time(g_player[0], buff_size.buffer_ms, buff_size.rebuffer_ms); + player_set_streaming_buffering_time(g_player[0], prebuffer, rebuffer); } static void get_position() @@ -1522,15 +1501,15 @@ static void get_duration() g_print(" ==> [Player_Test] Duration: [%d ] msec\n", duration); } -static void set_codec_type(void) +static void set_codec_type(int a_codec_type, int v_codec_type) { int ret; - ret = player_set_codec_type(g_player[0], PLAYER_STREAM_TYPE_AUDIO, codec_type.a_codec_type); - g_print(" ==> [Player_Test] audio codec type (%d) return: %d\n", codec_type.a_codec_type, ret); + ret = player_set_codec_type(g_player[0], PLAYER_STREAM_TYPE_AUDIO, a_codec_type); + g_print(" ==> [Player_Test] audio codec type (%d) return: %d\n", a_codec_type, ret); - ret = player_set_codec_type(g_player[0], PLAYER_STREAM_TYPE_VIDEO, codec_type.v_codec_type); - g_print(" ==> [Player_Test] video codec type (%d) return: %d\n", codec_type.v_codec_type, ret); + ret = player_set_codec_type(g_player[0], PLAYER_STREAM_TYPE_VIDEO, v_codec_type); + g_print(" ==> [Player_Test] video codec type (%d) return: %d\n", v_codec_type, ret); } @@ -1956,22 +1935,29 @@ static void video360_is_spherical(void) static void video360_set_enable(bool enable) { + bool enabled = false; + #ifdef USE_EVENT_HANDLER event_handler_set_dov_fov(); #endif if (player_360_set_enabled(g_player[0], enable) != PLAYER_ERROR_NONE) g_print("failed to %s video 360 mode\n", enable ? "enable" : "disable"); + + if (player_360_is_enabled(g_player[0], &enabled) != PLAYER_ERROR_NONE) + g_print("failed to get video 360 mode status\n"); + else + g_print(" ==> [Player_Test] Video 360 mode = %s\n", enabled ? "enabled" : "disabled"); } -static void video360_get_enable() +static void video360_get_fov() { - bool enable; + int hfov, vfov; - if (player_360_is_enabled(g_player[0], &enable) != PLAYER_ERROR_NONE) - g_print("failed to get video 360 mode status\n"); + if (player_360_get_field_of_view(g_player[0], &hfov, &vfov) != PLAYER_ERROR_NONE) + g_print("failed to get video 360 field of view\n"); else - g_print(" ==> [Player_Test] Video 360 mode = %s\n", enable ? "enabled" : "disabled"); + g_print(" ==> [Player_Test] Video 360 FOV = %dx%d deg.\n", hfov, vfov); } static void video360_set_fov(int hfov, int vfov) @@ -1985,16 +1971,18 @@ static void video360_set_fov(int hfov, int vfov) #endif if (player_360_set_field_of_view(g_player[0], hfov, vfov) != PLAYER_ERROR_NONE) g_print("failed to set video 360 field of view\n"); + + video360_get_fov(); } -static void video360_get_fov() +static void video360_get_dov() { - int hfov, vfov; + float yaw, pitch; - if (player_360_get_field_of_view(g_player[0], &hfov, &vfov) != PLAYER_ERROR_NONE) - g_print("failed to get video 360 field of view\n"); + if (player_360_get_direction_of_view(g_player[0], &yaw, &pitch) != PLAYER_ERROR_NONE) + g_print("failed to get video 360 direction of view\n"); else - g_print(" ==> [Player_Test] Video 360 FOV = %dx%d deg.\n", hfov, vfov); + g_print(" ==> [Player_Test] Video 360 DOV yaw = %d, pitch = %d deg.\n", (int)(yaw * 180.0f / M_PI), (int)(pitch * 180.0f / M_PI)); } static void video360_set_dov(int yaw_deg, int pitch_deg) @@ -2008,34 +1996,45 @@ static void video360_set_dov(int yaw_deg, int pitch_deg) #ifdef USE_EVENT_HANDLER mm_navevent_handler_set_angles(event_handler, angles); #endif + if (player_360_set_direction_of_view(g_player[0], angles[0], angles[1]) != PLAYER_ERROR_NONE) g_print("failed to set video 360 direction of view\n"); + + video360_get_dov(); } -static void video360_get_dov() +static void video360_get_zoom() { - float yaw, pitch; + float zoom; - if (player_360_get_direction_of_view(g_player[0], &yaw, &pitch) != PLAYER_ERROR_NONE) - g_print("failed to get video 360 direction of view\n"); + if (player_360_get_zoom(g_player[0], &zoom) != PLAYER_ERROR_NONE) + g_print("failed to get video 360 zoom\n"); else - g_print(" ==> [Player_Test] Video 360 DOV yaw = %d, pitch = %d deg.\n", (int)(yaw * 180.0f / M_PI), (int)(pitch * 180.0f / M_PI)); + g_print(" ==> [Player_Test] Video 360 zoom = %f\n", zoom); } static void video360_set_zoom(float zoom) { if (player_360_set_zoom(g_player[0], zoom) != PLAYER_ERROR_NONE) g_print("failed to set video 360 zoom\n"); + + video360_get_zoom(); } -static void video360_get_zoom() +static void video360_set_zoom_with_fov(float zoom, int hfov, int vfov) { - float zoom; +#ifdef USE_EVENT_HANDLER + mm_navevent_handler_size_s fov; - if (player_360_get_zoom(g_player[0], &zoom) != PLAYER_ERROR_NONE) - g_print("failed to get video 360 zoom\n"); - else - g_print(" ==> [Player_Test] Video 360 zoom = %f\n", zoom); + fov.width = hfov; + fov.height = vfov; + mm_navevent_handler_set_fov_size(event_handler, fov); +#endif + if (player_360_set_zoom_with_field_of_view(g_player[0], zoom, hfov, vfov) != PLAYER_ERROR_NONE) + g_print("failed to set video 360 zoom with field of view\n"); + + video360_get_fov(); + video360_get_zoom(); } static void set_replaygain_enabled(bool enabled) @@ -2260,6 +2259,16 @@ void _interpret_main_menu(char *cmd) g_menu_state = CURRENT_STATUS_AUDIO_CODEC_TYPE; } else if (strncmp(cmd, "C2", 2) == 0) { get_codec_type(); + } else if (!strncmp(cmd, "si", 2)) { + video360_is_spherical(); + } else if (!strncmp(cmd, "se", 2)) { + g_menu_state = CURRENT_STATUS_VIDEO360_SET_ENABLE; + } else if (!strncmp(cmd, "sd", 2)) { + g_menu_state = CURRENT_STATUS_VIDEO360_SET_DOV; + } else if (!strncmp(cmd, "sf", 2)) { + g_menu_state = CURRENT_STATUS_VIDEO360_SET_FOV; + } else if (!strncmp(cmd, "sz", 2)) { + g_menu_state = CURRENT_STATUS_VIDEO360_SET_ZOOM; } else { g_print("unknown menu \n"); } @@ -2271,30 +2280,11 @@ void _interpret_main_menu(char *cmd) } else if (strncmp(cmd, "rgg", 3) == 0) { bool enable; is_replaygain_enabled(&enable); + } else if (!strncmp(cmd, "szz", 3)) { + g_menu_state = CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV; } else { g_print("unknown menu \n"); } - } else if (len == 4) { - if (!strncmp(cmd, "v3sp", 4)) - video360_is_spherical(); - else if (!strncmp(cmd, "v3se", 4)) - g_menu_state = CURRENT_STATUS_VIDEO360_SET_ENABLE; - else if (!strncmp(cmd, "v3ge", 4)) - video360_get_enable(); - else if (!strncmp(cmd, "v3sd", 4)) - g_menu_state = CURRENT_STATUS_VIDEO360_SET_DOV; - else if (!strncmp(cmd, "v3gd", 4)) - video360_get_dov(); - else if (!strncmp(cmd, "v3sf", 4)) - g_menu_state = CURRENT_STATUS_VIDEO360_SET_FOV; - else if (!strncmp(cmd, "v3gf", 4)) - video360_get_fov(); - else if (!strncmp(cmd, "v3sz", 4)) - g_menu_state = CURRENT_STATUS_VIDEO360_SET_ZOOM; - else if (!strncmp(cmd, "v3gz", 4)) - video360_get_zoom(); - else - g_print("unknown menu \n"); } else g_print("unknown menu \n"); } @@ -2354,15 +2344,12 @@ void display_sub_basic() g_print("X4. set audio_cb with async \n"); g_print("[video_frame_decoded_cb] ep. enable tbm surface pool\n"); g_print("[buffering] bf. set new buffering size\n"); - g_print("[Video 360] v3sp. check spherical info\t"); - g_print("v3se. Set Enable\t"); - g_print("v3ge. Get Enable\n"); - g_print("[Video 360] v3sd. Set Direction Of View\t"); - g_print("v3gd. Get Direction Of View\n"); - g_print("[Video 360] v3sf. Set Field Of View\t"); - g_print("v3gf. Get Field Of View\n"); - g_print("[Video 360] v3sz. Set Zoom\t\t"); - g_print("v3gz. Get Zoom\n"); + g_print("[Video 360] si. check spherical info\t"); + g_print("se. Set Enable\n"); + g_print("[Video 360] sd. Set Direction Of View\t"); + g_print("sf. Set Field Of View\n"); + g_print("[Video 360] sz. Set Zoom\t\t"); + g_print("szz. Set Zoom with FOV\n"); g_print("[Replaygain] rgs. Set Replaygain\t\t"); g_print("rgg. Get replaygain\n"); g_print("[etc] sp. Set Progressive Download\t"); @@ -2452,6 +2439,12 @@ static void displaymenu() g_print("*** input vertical field of view angle (1~180 deg.)\n"); } else if (g_menu_state == CURRENT_STATUS_VIDEO360_SET_ZOOM) { g_print("*** input zoom factor.(1.0~10.0, where 1.0 - no zoom, actual image) \n"); + } else if (g_menu_state == CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV) { + g_print("*** input zoom factor.(1.0~10.0, where 1.0 - no zoom, actual image) \n"); + } else if (g_menu_state == CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV1) { + g_print("*** input horizontal field of view angle (1~360 deg.)\n"); + } else if (g_menu_state == CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV2) { + g_print("*** input vertical field of view angle (1~180 deg.)\n"); } else if (g_menu_state == CURRENT_STATUS_AUDIO_CODEC_TYPE) { g_print("*** set audio codec type (1: HW, 2: SW) \n"); } else if (g_menu_state == CURRENT_STATUS_VIDEO_CODEC_TYPE) { @@ -2484,7 +2477,8 @@ void reset_menu_state(void) static void interpret(char *cmd) { - static int value1, value2; + static int value1 = 0, value2 = 0, value3 = 0; + static float fval = 0.0; switch (g_menu_state) { case CURRENT_STATUS_MAINMENU: @@ -2494,11 +2488,11 @@ static void interpret(char *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); + value1 = atoi(cmd); + if (0 >= value1 || value1 > MAX_HANDLE) + g_print("not supported this number for handles(%d)\n", value1); else - g_handle_num = num_handle; + g_handle_num = value1; reset_menu_state(); } @@ -2511,69 +2505,68 @@ static void interpret(char *cmd) break; case CURRENT_STATUS_VOLUME: { - float level = atof(cmd); - set_volume(level); + fval = atof(cmd); + set_volume(fval); reset_menu_state(); } break; case CURRENT_STATUS_SOUND_STREAM_INFO: { - int type = atoi(cmd); - set_sound_stream_info(type); + value1 = atoi(cmd); + set_sound_stream_info(value1); reset_menu_state(); } break; case CURRENT_STATUS_MUTE: { - int mute = atoi(cmd); - set_mute(mute); + value1 = atoi(cmd); + set_mute(value1); reset_menu_state(); } break; case CURRENT_STATUS_POSITION_TIME: { - seek_info.pos = atoi(cmd); + value1 = atoi(cmd); g_menu_state = CURRENT_STATUS_POSITION_ACCURATE; } break; case CURRENT_STATUS_POSITION_ACCURATE: { - seek_info.accurate = (atoi(cmd) != 0) ? (true) : (false); - set_position(seek_info.pos, seek_info.accurate); + set_position(value1, ((atoi(cmd) != 0) ? (true) : (false))); reset_menu_state(); } break; case CURRENT_STATUS_LOOPING: { - int looping = atoi(cmd); - set_looping(looping); + value1 = atoi(cmd); + set_looping(value1); reset_menu_state(); } break; case CURRENT_STATUS_GAPLESS: { - int gapless = atoi(cmd); - set_gapless(gapless); + value1 = atoi(cmd); + set_gapless(value1); reset_menu_state(); } break; case CURRENT_STATUS_DISPLAY_SURFACE_CHANGE: { - int type = atoi(cmd); - change_surface(type); + value1 = atoi(cmd); + change_surface(value1); reset_menu_state(); } break; case CURRENT_STATUS_DISPLAY_MODE: { - int mode = atoi(cmd); - set_display_mode(mode); + value1 = atoi(cmd); + set_display_mode(value1); reset_menu_state(); } break; case CURRENT_STATUS_DISPLAY_DST_ROI_AREA: { - int value = atoi(cmd); + value1 = atoi(cmd); static int x = 0; static int y = 0; static int w = 0; @@ -2582,20 +2575,20 @@ static void interpret(char *cmd) switch (cnt) { case 0: - x = value; + x = value1; cnt++; break; case 1: - y = value; + y = value1; cnt++; break; case 2: - w = value; + w = value1; cnt++; break; case 3: cnt = 0; - h = value; + h = value1; set_display_roi_area(x, y, w, h); x = y = w = h = 0; reset_menu_state(); @@ -2607,15 +2600,15 @@ static void interpret(char *cmd) break; case CURRENT_STATUS_DISPLAY_ROTATION: { - int rotation = atoi(cmd); - set_display_rotation(rotation); + value1 = atoi(cmd); + set_display_rotation(value1); reset_menu_state(); } break; case CURRENT_STATUS_DISPLAY_VISIBLE: { - int visible = atoi(cmd); - set_display_visible(visible); + value1 = atoi(cmd); + set_display_visible(value1); reset_menu_state(); } break; @@ -2627,29 +2620,29 @@ static void interpret(char *cmd) break; case CURRENT_STATUS_AUDIO_EQUALIZER: { - int value = atoi(cmd); - set_audio_eq(value); + value1 = atoi(cmd); + set_audio_eq(value1); reset_menu_state(); } break; case CURRENT_STATUS_PLAYBACK_RATE: { - float rate = atof(cmd); - set_playback_rate(rate, FALSE); + fval = atof(cmd); + set_playback_rate(fval, FALSE); reset_menu_state(); } break; case CURRENT_STATUS_STREAMING_PLAYBACK_RATE: { - float rate = atof(cmd); - set_playback_rate(rate, TRUE); + fval = atof(cmd); + set_playback_rate(fval, TRUE); reset_menu_state(); } break; case CURRENT_STATUS_SWITCH_SUBTITLE: { - int index = atoi(cmd); - switch_subtitle(index); + value1 = atoi(cmd); + switch_subtitle(value1); reset_menu_state(); } break; @@ -2661,59 +2654,54 @@ static void interpret(char *cmd) break; case CURRENT_STATUS_GET_TRACK_INFO: { - int index = atoi(cmd); - get_track_info(index); + value1 = atoi(cmd); + get_track_info(fval); reset_menu_state(); } break; case CURRENT_STATUS_SET_MAX_BANDWIDTH_VARIANT: { - int value = atoi(cmd); - max_limit.bandwidth = value; + value1 = atoi(cmd); g_menu_state = CURRENT_STATUS_SET_MAX_WIDTH_VARIANT; } break; case CURRENT_STATUS_SET_MAX_WIDTH_VARIANT: { - int value = atoi(cmd); - max_limit.width = value; + value2 = atoi(cmd); g_menu_state = CURRENT_STATUS_SET_MAX_HEIGHT_VARIANT; } break; case CURRENT_STATUS_SET_MAX_HEIGHT_VARIANT: { - int value = atoi(cmd); - max_limit.height = value; - set_variant_limit(); + value3 = atoi(cmd); + set_variant_limit(value1, value2, value3); reset_menu_state(); } break; case CURRENT_STATUS_SET_AUDIO_ONLY: { - int value = atoi(cmd); - set_audio_only(value); + value1 = atoi(cmd); + set_audio_only(value1); reset_menu_state(); } break; case CURRENT_STATUS_SET_PRE_BUFFERING_SIZE: { - int value = atoi(cmd); - buff_size.buffer_ms = value; + value1 = atoi(cmd); g_menu_state = CURRENT_STATUS_SET_RE_BUFFERING_SIZE; } break; case CURRENT_STATUS_SET_RE_BUFFERING_SIZE: { - int value = atoi(cmd); - buff_size.rebuffer_ms = value; - set_buffer_size(); + value2 = atoi(cmd); + set_buffer_size(value1, value2); reset_menu_state(); } break; case CURRENT_STATUS_VIDEO360_SET_ENABLE: { - int enable = atoi(cmd); - video360_set_enable(enable); + value1 = atoi(cmd); + video360_set_enable(value1); reset_menu_state(); } break; @@ -2745,30 +2733,47 @@ static void interpret(char *cmd) break; case CURRENT_STATUS_VIDEO360_SET_ZOOM: { - float zoom = atof(cmd); - video360_set_zoom(zoom); + fval = atof(cmd); + video360_set_zoom(fval); + reset_menu_state(); + } + break; + case CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV: + { + fval = atof(cmd); + g_menu_state = CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV1; + } + break; + case CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV1: + { + value1 = atoi(cmd); + g_menu_state = CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV2; + } + break; + case CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV2: + { + value2 = atoi(cmd); + video360_set_zoom_with_fov(fval, value1, value2); reset_menu_state(); } break; case CURRENT_STATUS_AUDIO_CODEC_TYPE: { - int value = atoi(cmd); - codec_type.a_codec_type = value; + value1 = atoi(cmd); g_menu_state = CURRENT_STATUS_VIDEO_CODEC_TYPE; } break; case CURRENT_STATUS_VIDEO_CODEC_TYPE: { - int value = atoi(cmd); - codec_type.v_codec_type = value; - set_codec_type(); + value2 = atoi(cmd); + set_codec_type(value1, value2); reset_menu_state(); } break; case CURRENT_STATUS_REPLAYGAIN_ENABLE: { - int value = atoi(cmd); - set_replaygain_enabled(value); + value1 = atoi(cmd); + set_replaygain_enabled(value1); reset_menu_state(); } break; -- 2.7.4