[ACR-1170] Add 360 api to get spherical information 83/171583/4
authorEunhae Choi <eunhae1.choi@samsung.com>
Tue, 6 Mar 2018 05:02:00 +0000 (14:02 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Tue, 13 Mar 2018 07:37:41 +0000 (16:37 +0900)
Change-Id: Ib01d770050db463e05dd01bb20c104e1fc16d54c

include/player.h
src/player.c
test/player_test.c

index 2dbfe7a..8ed87fe 100644 (file)
@@ -2259,6 +2259,22 @@ int player_set_streaming_buffering_time(player_h player, int prebuffer_ms, int r
 int player_get_streaming_buffering_time(player_h player, int *prebuffer_ms, int *rebuffer_ms);
 
 /**
+ * @brief Gets information whether the current content of the player is spherical.
+ * @since_tizen 5.0
+ * @param[in]   player         The handle to the media player
+ * @param[out]  is_spherical   The value indicating whether the content is spherical
+ * @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_STATE     Invalid player state
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
+ * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
+ */
+int player_360_is_content_spherical(player_h player, bool *is_spherical);
+
+/**
  * @brief Sets the 360 video mode.
  * @details In case the media content is spherical, display mode can be selected by this function.
  * @since_tizen 5.0
index 6e7295b..32910cb 100644 (file)
@@ -4478,8 +4478,34 @@ int player_get_streaming_buffering_time(player_h player, int *buffer_ms, int *re
        return ret;
 }
 
+int player_360_is_content_spherical(player_h player, bool *is_spherical)
+{
+       PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_NULL_ARG_CHECK(is_spherical);
+
+       int ret = PLAYER_ERROR_NONE;
+       muse_player_api_e api = MUSE_PLAYER_API_360_IS_CONTENT_SPHERICAL;
+       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);
+               *is_spherical = val;
+       }
+       g_free(ret_buf);
+
+       LOGD("LEAVE 0x%X", ret);
+       return ret;
+}
+
 int player_360_set_enable(player_h player, bool enable)
 {
+       PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
        PLAYER_INSTANCE_CHECK(player);
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_360_SET_ENABLE;
index f682c0f..326f75a 100644 (file)
@@ -1944,6 +1944,17 @@ static void get_audio_eq()
        g_print("                                                            ==> [Player_Test] eq bands frequency range: [%d] \n", value);
 }
 
+static void video360_is_spherical(void)
+{
+       bool spherical;
+
+       if (player_360_is_content_spherical(g_player[0], &spherical) != PLAYER_ERROR_NONE)
+               g_print("failed to get content spherical info\n");
+       else
+               g_print("                                                          ==> [Player_Test] Video 360 content = %s\n", spherical ? "spherical" : "---");
+
+}
+
 static void video360_set_enable(bool enable)
 {
 #ifdef USE_EVENT_HANDLER
@@ -2250,7 +2261,9 @@ void _interpret_main_menu(char *cmd)
                else
                        g_print("unknown menu \n");
        } else if (len == 4) {
-               if (!strncmp(cmd, "v3se", 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();
@@ -2327,7 +2340,8 @@ 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] v3se. Set Enable\t\t");
+       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");