[ITC][capi-media-streamer][ACR-844][Add API for interrupt callback]
authormanu.tiwari <manu.tiwari@samsung.com>
Thu, 29 Dec 2016 09:25:59 +0000 (14:55 +0530)
committerNibha Sharma <nibha.sharma@samsung.com>
Tue, 24 Jan 2017 07:23:54 +0000 (23:23 -0800)
Change-Id: I22e6d978ef4c2dfd8b6db526359a290b4d0486c0
Signed-off-by: manu.tiwari <manu.tiwari@samsung.com>
src/itc/capi-media-streamer/ITs-capi-media-streamer-common.c
src/itc/capi-media-streamer/ITs-capi-media-streamer.c
src/itc/capi-media-streamer/tct-capi-media-streamer-native_mobile.h
src/itc/capi-media-streamer/tct-capi-media-streamer-native_wearable.h

index 06a4ae85d64e890e324c8b750f4bf711fc6fea5c..a8e0c98e0aff2ec27d50a5c3cdc678d6e1c8864e 100755 (executable)
@@ -47,7 +47,6 @@ char* MediaStreamerGetError(int nRet)
        }
        return szErrorVal;
 }
-
 /**
 * @function            MediaStreamerGetState
 * @description         Maps error enums to string values
index 9f345b1f778cf8426fd665591cc6873861a57750..05e8ad2d6c5a7b3836e10aa1a4c48b90afbd292b 100755 (executable)
@@ -180,6 +180,16 @@ void new_buffer_cb(media_streamer_node_h node, void *user_data)
 
        media_packet_destroy(packet);
 }
+/**
+* @function            interrupted_cb
+* @description         Called when the media streamer is interrupted
+* @parameter           error code: The interrupted error code and user data  sent to callback
+* @return                      NA
+*/
+void interrupted_cb(media_streamer_interrupted_code_e code, void *user_data)
+{
+       FPRINTF("[Line : %d][%s] interrupted_cb CALLBACK INVOKED", __LINE__, API_NAMESPACE);
+}
 //& purpose: A purpose of a first positive TC.
 //& type: auto
 /**
@@ -1027,7 +1037,7 @@ int ITc_capi_media_streamer_get_duration_p(void)
        media_streamer_node_h hVideoSrc = NULL;
        media_streamer_node_h hVideoSink = NULL;
 
-       nRet = media_streamer_node_create_src(MEDIA_STREAMER_NODE_SRC_TYPE_FILE, &hVideoSrc);
+       nRet = media_streamer_node_create_src(MEDIA_STREAMER_NODE_SRC_TYPE_VIDEO_TEST, &hVideoSrc);
        PRINT_RESULT(MEDIA_STREAMER_ERROR_NONE, nRet, "media_streamer_node_create_src", MediaStreamerGetError(nRet));
        CHECK_HANDLE(hVideoSrc,"media_streamer_node_create_src");
 
@@ -1036,12 +1046,15 @@ int ITc_capi_media_streamer_get_duration_p(void)
        nRet = media_streamer_node_add(streamer, hVideoSrc);
        PRINT_RESULT(MEDIA_STREAMER_ERROR_NONE, nRet, "media_streamer_node_add", MediaStreamerGetError(nRet));
 
-       nRet = media_streamer_node_create_sink(MEDIA_STREAMER_NODE_SINK_TYPE_OVERLAY, &hVideoSink);
+       nRet = media_streamer_node_create_sink(MEDIA_STREAMER_NODE_SINK_TYPE_FAKE, &hVideoSink);
        PRINT_RESULT(MEDIA_STREAMER_ERROR_NONE, nRet, "media_streamer_node_create_sink", MediaStreamerGetError(nRet));
        CHECK_HANDLE(hVideoSink,"media_streamer_node_create_sink");
 
        nRet = media_streamer_node_add(streamer, hVideoSink);
        PRINT_RESULT(MEDIA_STREAMER_ERROR_NONE, nRet, "media_streamer_node_add", MediaStreamerGetError(nRet));
+       
+       nRet = media_streamer_node_link(hVideoSrc, "src", hVideoSink, "sink");
+       PRINT_RESULT(MEDIA_STREAMER_ERROR_NONE, nRet, "media_streamer_node_link", MediaStreamerGetError(nRet));
 
        nRet = media_streamer_prepare(streamer);
        PRINT_RESULT(MEDIA_STREAMER_ERROR_NONE, nRet, "media_streamer_prepare", MediaStreamerGetError(nRet));
@@ -1063,5 +1076,33 @@ int ITc_capi_media_streamer_get_duration_p(void)
        
        return 0;
 }
+/**
+* @testcase                    ITc_capi_media_streamer_set_unset_interrupted_p
+* @since_tizen                 3.0
+* @author              SRID(manu.tiwari)
+* @reviewer            SRID(a.pandia1)
+* @type                                auto
+* @description                 Registered and unregistered a callback function
+* @scenario                            create media streamer node src\n
+*                                              Add media Streamer node\n
+*                                              get duration
+* @apicovered                  media_streamer_set_interrupted_cb\n
+                                               media_streamer_unset_interrupted_cb\n
+* @passcase                            When media_streamer_set_interrupted_cb and media_streamer_unset_interrupted_cb is successful.
+* @failcase                            If target API's media_streamer_set_interrupted_cb or media_streamer_set_interrupted_cb fails or any precondition or postcondition API fails
+* @precondition                        NA
+* @postcondition               NA
+*/
+int ITc_capi_media_streamer_set_unset_interrupted_p(void)
+{
+       START_TEST;
+       
+       int nRet = media_streamer_set_interrupted_cb(streamer, interrupted_cb, NULL);
+       PRINT_RESULT(MEDIA_STREAMER_ERROR_NONE, nRet, "media_streamer_set_interrupted_cb", MediaStreamerGetError(nRet));
+       wait_for_async(PLAY_TIME);
+       
+       nRet = media_streamer_unset_interrupted_cb(streamer);
+       PRINT_RESULT(MEDIA_STREAMER_ERROR_NONE, nRet, "media_streamer_unset_interrupted_cb", MediaStreamerGetError(nRet));
+}
 /** @} */
 /** @} */
index 8e2bcc92b5e893f58f4cc9c8ed763f79070caad0..7a3ae4125d2c8fb734c57b1cf1fceff2f343f7d4 100755 (executable)
@@ -36,6 +36,7 @@ extern int ITc_capi_media_streamer_node_get_pad_name_p(void);
 extern int ITc_capi_media_streamer_node_set_get_params_p(void);
 extern int ITc_capi_media_streamer_set_get_play_position(void);
 extern int ITc_capi_media_streamer_get_duration_p(void);
+extern int ITc_capi_media_streamer_set_unset_interrupted_p(void);
 
 testcase tc_array[] = {
     {"ITc_capi_media_streamer_prepare_unprepare_p", ITc_capi_media_streamer_prepare_unprepare_p, ITs_capi_media_streamer_startup, ITs_capi_media_streamer_cleanup},
@@ -52,6 +53,7 @@ testcase tc_array[] = {
     {"ITc_capi_media_streamer_node_set_get_params_p", ITc_capi_media_streamer_node_set_get_params_p, ITs_capi_media_streamer_startup, ITs_capi_media_streamer_cleanup},
     {"ITc_capi_media_streamer_set_get_play_position", ITc_capi_media_streamer_set_get_play_position, ITs_capi_media_streamer_startup, ITs_capi_media_streamer_cleanup},
     {"ITc_capi_media_streamer_get_duration_p", ITc_capi_media_streamer_get_duration_p, ITs_capi_media_streamer_startup, ITs_capi_media_streamer_cleanup},
+    {"ITc_capi_media_streamer_set_unset_interrupted_p", ITc_capi_media_streamer_set_unset_interrupted_p, ITs_capi_media_streamer_startup, ITs_capi_media_streamer_cleanup},
     {NULL, NULL}
 };
 
index 8e2bcc92b5e893f58f4cc9c8ed763f79070caad0..7a3ae4125d2c8fb734c57b1cf1fceff2f343f7d4 100755 (executable)
@@ -36,6 +36,7 @@ extern int ITc_capi_media_streamer_node_get_pad_name_p(void);
 extern int ITc_capi_media_streamer_node_set_get_params_p(void);
 extern int ITc_capi_media_streamer_set_get_play_position(void);
 extern int ITc_capi_media_streamer_get_duration_p(void);
+extern int ITc_capi_media_streamer_set_unset_interrupted_p(void);
 
 testcase tc_array[] = {
     {"ITc_capi_media_streamer_prepare_unprepare_p", ITc_capi_media_streamer_prepare_unprepare_p, ITs_capi_media_streamer_startup, ITs_capi_media_streamer_cleanup},
@@ -52,6 +53,7 @@ testcase tc_array[] = {
     {"ITc_capi_media_streamer_node_set_get_params_p", ITc_capi_media_streamer_node_set_get_params_p, ITs_capi_media_streamer_startup, ITs_capi_media_streamer_cleanup},
     {"ITc_capi_media_streamer_set_get_play_position", ITc_capi_media_streamer_set_get_play_position, ITs_capi_media_streamer_startup, ITs_capi_media_streamer_cleanup},
     {"ITc_capi_media_streamer_get_duration_p", ITc_capi_media_streamer_get_duration_p, ITs_capi_media_streamer_startup, ITs_capi_media_streamer_cleanup},
+    {"ITc_capi_media_streamer_set_unset_interrupted_p", ITc_capi_media_streamer_set_unset_interrupted_p, ITs_capi_media_streamer_startup, ITs_capi_media_streamer_cleanup},
     {NULL, NULL}
 };