[ITC][Player][ACR-1010][Added new apis]
authorbipinkumar <bipin.k@samsung.com>
Mon, 24 Jul 2017 11:44:40 +0000 (17:14 +0530)
committershobhit verma <shobhit.v@samsung.com>
Tue, 25 Jul 2017 11:17:46 +0000 (11:17 +0000)
Change-Id: I548799fbb87c1ecf35f8178cde65857947ae67b3
Signed-off-by: bipinkumar <bipin.k@samsung.com>
src/itc/player/ITs-player-common.c
src/itc/player/ITs-player-stream-info.c
src/itc/player/tct-player-native_mobile.h
src/itc/player/tct-player-native_wearable.h

index af49722..1a5fc46 100755 (executable)
@@ -264,6 +264,34 @@ bool InitializePlayerHandler(bool bPrepare, int nMediaType)
        {
                nRet = player_set_uri(g_player, pPath3);
        }
+       else if (nMediaType == 5 )
+       {
+               char pstrValue[CONFIG_VALUE_LEN_MAX] = {0,};
+               if ( true == GetValueFromConfigFile("PLAYER_ADAPTIVE_STREAMING_URL", pstrValue, API_NAMESPACE) )
+               {
+#if DEBUG
+                       FPRINTF("[Line: %d][%s] Values Received = %s\\n", __LINE__, API_NAMESPACE, pstrValue);
+#endif
+               }
+               else
+               {
+                       FPRINTF("[Line: %d][%s] GetValueFromConfigFile returned error\\n", __LINE__, API_NAMESPACE);
+                       return false;
+               }
+               nRet = player_set_uri(g_player, pstrValue);
+               #if defined(WEARABLE)
+               bValue = false;
+               system_info_get_platform_bool(INTERNET_FEATURE, &bValue);
+               if(bValue == false)
+               {
+                       if(nRet != PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE)
+                       {
+                               FPRINTF("[Line : %d][%s] player_set_uri API call returned mismatch %s error for unsupported internet feature\\n", __LINE__, API_NAMESPACE,  PlayerGetError(nRet));
+                               return false;
+                       }
+               }
+               #endif
+       }
 
        if ( nRet != PLAYER_ERROR_NONE )
        {
index 6acda03..8cb6614 100755 (executable)
@@ -23,7 +23,7 @@
 //& set: Player
 bool g_bPlayerCreation;
 sound_stream_info_h g_stream_info_h = NULL;
-
+bool g_bCallbackHit;
 
 /**
 * @function            ITs_player_startup
@@ -122,6 +122,18 @@ void focus_callback (sound_stream_info_h stream_info,
        return;
 }
 
+/**
+* @function            player_adaptive_variant_callback
+* @description         Called to notify the streaming variant information
+* @parameter           int bandwidth, int width, int height, void *user_data
+* @return                      NA
+*/
+void player_adaptive_variant_callback(int bandwidth, int width, int height, void *user_data)
+{
+       FPRINTF("Inside player_adaptive_variant_callback\n");
+       g_bCallbackHit = true;
+       return;
+}
 
 /** @addtogroup itc-player-testcases
 *  @brief              Integration testcases for module player
@@ -261,6 +273,107 @@ int ITc_player_set_sound_stream_info_p(void)
        return 0;
 }
 
+//& purpose: Verifies wether set and get of the variant limit is being done correctly or not
+//& type : auto
+/**
+* @testcase                    ITc_player_set_get_adaptive_variant_limit_p
+* @author                              SRID(bipin.k)
+* @reviewer                            SRID(nibha.sharma)
+* @type                                auto
+* @since_tizen                         4.0
+* @description                 Provides set get variant limit
+* @scenario                            Initialize player handle\n
+*                                              start player\n
+*                                              call set adaptive variant limit \n
+*                                              get adaptive variant limit \n
+*                                              destroy the handler
+* @apicovered                  player_set_max_adaptive_variant_limit,
+*                       player_get_max_adaptive_variant_limit, player_unprepare
+* @passcase                            When bandwidth ,height and width are set and get correctly.
+* @failcase                            When bandwidth ,height and width any of them is not set and get properly
+* @precondition                        The player state must be one of: PLAYER_STATE_IDLE, PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
+* @postcondition               N/A
+*/
+int ITc_player_set_get_adaptive_variant_limit_p(void)
+{
+START_TEST;
+
+       int nSetBandwidth = 500000, nSetWidth = 1920, nSetHeight = 1080;
+       int nGetBandwidth = 0, nGetWidth = 0, nGetHeight = 0;
+
+       if ( InitializePlayerHandler(true, 5) != true )
+       {
+               PRINT_API_ERROR_IN_LOOP_MSG_SINGLE(InitializePlayerHandler);
+               return 1;
+       }
+
+       int nRet =  player_set_max_adaptive_variant_limit(g_player, nSetBandwidth, nSetWidth, nSetHeight);
+       PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_set_max_adaptive_variant_limit", PlayerGetError(nRet));
+
+       nRet = player_get_max_adaptive_variant_limit(g_player, &nGetBandwidth, &nGetWidth, &nGetHeight);
+       PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_get_max_adaptive_variant_limit", PlayerGetError(nRet));
+       if(nSetBandwidth != nGetBandwidth)
+       {
+               FPRINTF("[Line : %d][%s] Value Mismatch nSetBandwidth = %d  nGetBandwidth = %d\\n", __LINE__, API_NAMESPACE,nSetBandwidth,nGetBandwidth);
+               return 1;
+       }
+       if(nSetWidth != nGetWidth)
+       {
+               FPRINTF("[Line : %d][%s] Value Mismatch nSetWidth = %d  nGetWidth = %d\\n", __LINE__, API_NAMESPACE,nSetWidth,nGetWidth);
+               return 1;
+       }
+       if(nSetHeight != nGetHeight)
+       {
+               FPRINTF("[Line : %d][%s] Value Mismatch nSetHeight = %d  nGetHeight = %d\\n", __LINE__, API_NAMESPACE,nSetHeight,nGetHeight);
+               return 1;
+       }
+       FPRINTF("[Line : %d][%s] nSetBandwidth = %d  nGetBandwidth = %d nSetWidth = %d  nGetWidth = %d nSetHeight = %d  nGetHeight = %d\\n", __LINE__, API_NAMESPACE,nSetBandwidth,nGetBandwidth,nSetWidth,nGetWidth,nSetHeight,nGetHeight);
+       return 0;
+}
+
+//& purpose: Verifies wether callback of adaptive_variant is being called correctly or not
+//& type : auto
+/**
+* @testcase                    ITc_player_foreach_adaptive_variant_p
+* @author                              SRID(bipin.k)
+* @reviewer                            SRID(nibha.sharma)
+* @type                                auto
+* @since_tizen                         4.0
+* @description                 adaptive variant callback is being set and called
+* @scenario                            Initialize player handle\n
+*                                              start player\n
+*                                              set adaptive variant callback \n
+*                                              check wether adaptive variant callback is called or not \n
+*                                              destroy the handler\n
+* @apicovered                  player_foreach_adaptive_variant, player_unprepare
+* @passcase                            Callback set is being called correctly.
+* @failcase                            When set callback is not being called.
+* @precondition                        The player state must be one of: PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED
+* @postcondition               N/A
+*/
+int ITc_player_foreach_adaptive_variant_p(void)
+{
+START_TEST;
+
+       g_bCallbackHit =false;
+
+       if( InitializePlayerHandler(true, 5) != true )
+       {
+               PRINT_API_ERROR_IN_LOOP_MSG_SINGLE(InitializePlayerHandler);
+               return 1;
+       }
+
+       int nRet = player_foreach_adaptive_variant(g_player,player_adaptive_variant_callback, NULL);
+       PRINT_RESULT(PLAYER_ERROR_NONE, nRet,"player_foreach_adaptive_variant", PlayerGetError(nRet));
+       if(g_bCallbackHit == false)
+       {
+               FPRINTF("[Line : %d][%s] Callback not hit\\n", __LINE__, API_NAMESPACE);
+               return 1;
+       }
+
+       return 0;
+}
+
 //& purpose: Gets the album art in media resource
 //& type : auto
 /**
index 3895838..d1fae99 100755 (executable)
@@ -86,6 +86,9 @@ extern int ITc_player_get_track_language_code_p(void);
 extern int ITc_player_select_track_p(void);
 extern int ITc_player_set_unset_media_stream_buffer_status_cb_p(void);
 extern int ITc_player_in_set_unset_interrupted_cb_p(void);
+extern int ITc_player_set_get_adaptive_variant_limit_p(void);
+extern int ITc_player_foreach_adaptive_variant_p(void);
+
 
 testcase tc_array[] = {
        {"ITc_player_set_get_display_rotation_p",ITc_player_set_get_display_rotation_p,ITs_player_display_startup,ITs_player_display_cleanup},
@@ -144,6 +147,8 @@ testcase tc_array[] = {
        {"ITc_player_select_track_p",ITc_player_select_track_p,ITs_player_startup,ITs_player_cleanup},
        {"ITc_player_set_unset_media_stream_buffer_status_cb_p",ITc_player_set_unset_media_stream_buffer_status_cb_p,ITs_player_startup,ITs_player_cleanup},
        {"ITc_player_in_set_unset_interrupted_cb_p",ITc_player_in_set_unset_interrupted_cb_p,ITs_player_startup,ITs_player_cleanup},
+       {"ITc_player_set_get_adaptive_variant_limit_p",ITc_player_set_get_adaptive_variant_limit_p,ITs_player_startup,ITs_player_cleanup},
+       {"ITc_player_foreach_adaptive_variant_p",ITc_player_foreach_adaptive_variant_p,ITs_player_startup,ITs_player_cleanup},
        {NULL, NULL}
 };
 
index 3895838..c698a93 100755 (executable)
@@ -86,6 +86,10 @@ extern int ITc_player_get_track_language_code_p(void);
 extern int ITc_player_select_track_p(void);
 extern int ITc_player_set_unset_media_stream_buffer_status_cb_p(void);
 extern int ITc_player_in_set_unset_interrupted_cb_p(void);
+extern int ITc_player_set_get_adaptive_variant_limit_p(void);
+extern int ITc_player_foreach_adaptive_variant_p(void);
+
+
 
 testcase tc_array[] = {
        {"ITc_player_set_get_display_rotation_p",ITc_player_set_get_display_rotation_p,ITs_player_display_startup,ITs_player_display_cleanup},
@@ -144,6 +148,8 @@ testcase tc_array[] = {
        {"ITc_player_select_track_p",ITc_player_select_track_p,ITs_player_startup,ITs_player_cleanup},
        {"ITc_player_set_unset_media_stream_buffer_status_cb_p",ITc_player_set_unset_media_stream_buffer_status_cb_p,ITs_player_startup,ITs_player_cleanup},
        {"ITc_player_in_set_unset_interrupted_cb_p",ITc_player_in_set_unset_interrupted_cb_p,ITs_player_startup,ITs_player_cleanup},
+       {"ITc_player_set_get_adaptive_variant_limit_p",ITc_player_set_get_adaptive_variant_limit_p,ITs_player_startup,ITs_player_cleanup},
+       {"ITc_player_foreach_adaptive_variant_p",ITc_player_foreach_adaptive_variant_p,ITs_player_startup,ITs_player_cleanup},
        {NULL, NULL}
 };