1. Add to check network.wifi.direct.display feature. 86/43786/2 accepted/tizen/mobile/20150715.003440 accepted/tizen/tv/20150715.003451 accepted/tizen/wearable/20150715.003456 submit/tizen/20150714.101420
authorSangkyu Park <sk1122.park@samsung.com>
Tue, 14 Jul 2015 03:59:59 +0000 (12:59 +0900)
committerSangkyu Park <sk1122.park@samsung.com>
Tue, 14 Jul 2015 04:04:26 +0000 (13:04 +0900)
2. Fix prevent defects.
3. Fix screen mirroring doc issue.
4. Enable build error option and fix build errors.
5. [sink] Featuring if TEST_WITH)WIFI)DIRECT is defined.
6. [sink] Add new APIs for getting negotiated audio and video information.
7. [sink] Implement new APIs for getting negotiated stream information.
8. [src] Add encoders element to config ini file
9. [src] Add audio codec to config ini file
10. [sink] Fix just typing errors.
11. [src] Enable wifi-direct for testsuite

This patch has dependency with libmm-wfd patch
(d68aba6ca39a0708ca6b7842ec8c4e22ec20de97).

Change-Id: Idd123999ac1ddeb036db6289cb8272e116bc6f9d
Signed-off-by: Sangkyu Park <sk1122.park@samsung.com>
16 files changed:
CMakeLists.txt
config/scmirroring_src.ini
doc/screen_mirroring_doc.h
include/scmirroring_internal.h [new file with mode: 0755]
include/scmirroring_private.h
include/scmirroring_sink.h
include/scmirroring_src.h
include/scmirroring_src_ini.h
include/scmirroring_type.h
miracast_server/miracast_server.c
packaging/capi-media-screen-mirroring.spec
src/scmirroring_sink.c
src/scmirroring_src.c
src/scmirroring_src_ini.c
test/scmirroring_wifi_direct_test.c
test_sink/scmirroring_sink_test.c

index 7f9d1bf20d70cfda6bd3596d0fdedafb147f27a3..e25a424737d4499daed52e1ba896dd9984f9f716 100644 (file)
@@ -22,12 +22,12 @@ SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${dependents})
+pkg_check_modules(${fw_name} REQUIRED ${dependents} capi-system-info)
 FOREACH(flag ${${fw_name}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "-I./include ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Wno-error=unused-but-set-variable -DGST_EXT_TIME_ANALYSIS")
+SET(CMAKE_C_FLAGS "-I./include ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -DGST_EXT_TIME_ANALYSIS")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 IF("${ARCH}" MATCHES "^arm.*")
index cf06e9f442c9e761e644d0bbb4c4187a379853ea..50facc823ce147ec3f362b2e9d0eca66e02fe3a1 100755 (executable)
@@ -5,6 +5,9 @@
 ; 0: ximagesrc, 1: xvimagesrc, 2: camerasrc, 3: videotestsrc
 videosrc element = 1
 
+; set default video encoder element
+video encoder element = omxh264enc
+
 ; sending video only mirroring mode
 ; 0: audio-video-muxed sending, 1:video-only, 2:audio-only, 3:audio-video-saperate
 session_mode = 0
@@ -21,8 +24,19 @@ video converter element =
 ; if yes. gstreamer will not update registry
 skip rescan = yes
 
+; set default audio encoder element
+audio encoder aac name = avenc_aac
+audio encoder ac3 name = avenc_ac3
+
+; set audio codec for source
+; according to GstWFDAudioFormat
+; 0x1: LPCM, 0x2: AAC, 0x4: AC3
+; default aac and LPCM
+audio codec = 0x3
+
 ; set exynos audiosrc property
 exynosaudio device name = alsa_output.0.analog-stereo.monitor
+; exynosaudio device name = alsa_output.hw_0_3.monitor
 exynosaudio buffer_time = 200000
 ; set qcmsm audiosrc property
 qcmsmaudio device name = hw:0,8
index 916b047490b72d9cdef4cf2c4a928c4ca1e97e66..1271024ffe7eb91cd5378ada5f8e528a92cc13d1 100644 (file)
 #define __TIZEN_SCREEN_MIRRORING_DOC_H__
 
 /**
- * @ingroup CAPI_MEDIA_FRAMEWORK
+ * @file screen_mirroring_doc.h
+ * @brief This file contains high level documentation for the Screen Mirroring Sink API
+ */
+
+/**
  * @defgroup CAPI_MEDIA_SCREEN_MIRRORING_MODULE Screen Mirroring
  * @brief The @ref CAPI_MEDIA_SCREEN_MIRRORING_MODULE API provides functions for screen mirroring as sink.
+ * @ingroup CAPI_MEDIA_FRAMEWORK
+ *
  * @section CAPI_MEDIA_SCREEN_MIRRORING_MODULE_HEADER Required Header
- *    \#include <scmirroring_type.h>
  *    \#include <scmirroring_sink.h>
+ *
  * @section CAPI_MEDIA_SCREEN_MIRRORING_OVERVIEW Overview
  * The @ref CAPI_MEDIA_SCREEN_MIRRORING_MODULE API allows you to implement screen mirroring application as sink.
- *
- */
-
-/*
- * @ingroup CAPI_MEDIA_SCREEN_MIRRORING_MODULE
- * @defgroup CAPI_MEDIA_SCREEN_MIRRORING_SINK_MODULE Screen Mirroring sink
- * @brief The @ref CAPI_MEDIA_SCREEN_MIRRORING_SINK_MODULE API provides functions for screen mirroring as sink.
- *
- * @section CAPI_MEDIA_SCREEN_MIRRORING_SINK_MODULE_HEADER Required Header
- *    \#include <scmirroring_sink.h>
- *
- * @section CAPI_MEDIA_SCREEN_MIRRORING_SINK_OVERVIEW Overview
- * The @ref CAPI_MEDIA_SCREEN_MIRRORING_SINK_MODULE API allows you to implement screen mirroring application as sink.
- * It gives the ability to connect to the screen mirroring source, start / disconnect / pause / resume screen mirroring sink, set resolution and display, register state change callback function.
+ * It gives the ability to connect to and disconnect from a screen mirroring source, and start, pause, and resume the screen mirroring sink, set the resolution or display, register state change callback function.
  *
  * @subsection CAPI_MEDIA_SCREEN_MIRRORING_SINK_LIFE_CYCLE_STATE_DIAGRAM State Diagram
  * The following diagram shows the life cycle and states of the screen mirroring sink.
  * <tr>
  *    <td>scmirroring_sink_unset_state_changed_cb()</td>
  *    <td>NULL/ PREPARED/ CONNECTED/ PLAYING/ PAUSED/ DISCONNECTED</td>
- *    <td>This function must be called after register callback function.</td>
+ *    <td></td>
  * </tr>
  * <tr>
  *    <td>scmirroring_sink_set_display()</td>
  *        <td>This callback is called for state and error of screen mirroring.</td>
  *     </tr>
  *</table></div>
+ * @section CAPI_NETWORK_WIFI_DIRECT_MANAGER_MODULE_FEATURE Related Features
+ * This API is related with the following feature:\n
+ * - http://tizen.org/feature/network.wifi.direct.display\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
  */
 
 
diff --git a/include/scmirroring_internal.h b/include/scmirroring_internal.h
new file mode 100755 (executable)
index 0000000..77ff32d
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __TIZEN_MEDIA_SCMIRRORING_INTERNAL_H__
+#define __TIZEN_MEDIA_SCMIRRORING_INTERNAL_H__
+
+#include <tizen.h>
+#include <scmirroring_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file scmirroring_internal.h
+ * @brief This file contains API related to screen mirroring internal enumerations for classes of errors.
+ */
+
+/**
+ * @brief      The handle to the screen mirroring source.
+ */
+typedef void *scmirroring_src_h;
+
+/**
+ * @brief Enumeration for screen mirroring connection mode.
+ */
+typedef enum {
+       SCMIRRORING_CONNECTION_WIFI_DIRECT = 0,     /**< Wi-Fi Direct*/
+       SCMIRRORING_CONNECTION_MAX,                 /* Number of Connection mode */
+} scmirroring_connection_mode_e;
+
+/**
+ * @brief Enumeration for screen mirroring source state.
+ */
+typedef enum {
+       SCMIRRORING_STATE_NULL = 0,         /**< Screen mirroring is created, but not realized yet */
+       SCMIRRORING_STATE_READY,            /**< Screen mirroring is ready to play media */
+       SCMIRRORING_STATE_CONNECTION_WAIT,  /**< Screen mirroring is waiting for connection */
+       SCMIRRORING_STATE_CONNECTED,        /**< Screen mirroring is connected */
+       SCMIRRORING_STATE_PLAYING,          /**< Screen mirroring is now playing media */
+       SCMIRRORING_STATE_PAUSED,           /**< Screen mirroring is paused while playing media */
+       SCMIRRORING_STATE_TEARDOWN,         /**< Teardown Screen mirroring */
+       SCMIRRORING_STATE_NONE,             /**< Screen mirroring is not created yet */
+       SCMIRRORING_STATE_MAX               /* Number of screen mirroring states */
+} scmirroring_state_e;
+
+/**
+ * @brief Called when each status is changed.
+ *
+ * @details This callback is called for state and error of screen mirroring.
+ *
+ * @param[in] error     The error code
+ * @param[in] state     The screen mirroring state
+ * @param[in] user_data The user data passed from the scmirroring_src_set_state_cb() function
+ *
+ * @pre scmirroring_src_create()
+ *
+ * @see scmirroring_src_create()
+ */
+typedef void(*scmirroring_state_cb)(scmirroring_error_e error, scmirroring_state_e state, void *user_data);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIA_SCMIRRORING_INTERNAL_H__ */
+
index 3b00942f09ea88a9208214d1cef2e4668e70e76c..36e24f4f3c4988000c020ad8d1b1a9da3c291e6c 100755 (executable)
 #define __TIZEN_MEDIA_SCMIRRORING_PRIVATE_H__
 
 #include <stdlib.h>
-#include <scmirroring_type.h>
 #include <dlog.h>
 #include <mm_types.h>
+#include <system_info.h>
+#include <scmirroring_internal.h>
 
 #ifndef TRUE
 #define TRUE 1
@@ -133,6 +134,22 @@ typedef struct {
        scmirroring_sink_state_cb_s *scmirroring_sink_state_cb;
 } scmirroring_sink_s;
 
+#define WIFIDIRECT_DISPLAY_FEATURE "http://tizen.org/feature/network.wifi.direct.display"
+
+#define CHECK_FEATURE_SUPPORTED(feature_name)\
+       do {\
+               bool feature_supported = FALSE;\
+               if(!system_info_get_platform_bool(feature_name, &feature_supported)){\
+                       if(feature_supported == FALSE){\
+                               scmirroring_error("%s feature is disabled", feature_name);\
+                               return SCMIRRORING_ERROR_NOT_SUPPORTED;\
+                       }\
+               } else {\
+                       scmirroring_error("Error - Feature getting from System Info");\
+                       return SCMIRRORING_ERROR_UNKNOWN;\
+               }\
+       } while (0);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 42783681dceadfd6a6dc2f35449cca3bf9b51575..a7792d807a440616a178f1982bbfadc5dbcbb2df 100755 (executable)
@@ -29,12 +29,12 @@ extern "C" {
  */
 
 /**
- * @addtogroup CAPI_MEDIA_SCREEN_MIRRORING_SINK_MODULE
+ * @addtogroup CAPI_MEDIA_SCREEN_MIRRORING_MODULE
  * @{
  */
 
 /**
- * @brief Creates a new screen mirroring sink handle
+ * @brief Creates a new screen mirroring sink handle.
  * @since_tizen 2.4
  * @privlevel public
  * @privilege %http://tizen.org/privilege/internet
@@ -44,22 +44,22 @@ extern "C" {
  * @param[out] scmirroring_sink        A newly returned handle to the screen mirroring sink
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
- * @post The screen mirroring state will be SCMIRRORING_STATE_NULL
+ * @post The screen mirroring state will be #SCMIRRORING_STATE_NULL
  *
- * @see        scmirroring_sink_destroy()
+ * @see scmirroring_sink_destroy()
  */
 int scmirroring_sink_create(scmirroring_sink_h *scmirroring_sink);
 
 /**
- * @brief      Registers a callback function to be called when state change happens
+ * @brief Registers a callback function to be called when state change happens.
  * @details This function registers user callback and this callback is called when each status is changed.
  *
  * @since_tizen 2.4
@@ -69,13 +69,13 @@ int scmirroring_sink_create(scmirroring_sink_h *scmirroring_sink);
  * @param[in] user_data The user data passed to the callback registration function
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
  * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
  *
@@ -84,7 +84,7 @@ int scmirroring_sink_create(scmirroring_sink_h *scmirroring_sink);
 int scmirroring_sink_set_state_changed_cb(scmirroring_sink_h scmirroring_sink, scmirroring_sink_state_cb callback, void *user_data);
 
 /**
- * @brief Sets server IP and port
+ * @brief Sets server IP and port.
  *
  * @since_tizen 2.4
  *
@@ -93,13 +93,13 @@ int scmirroring_sink_set_state_changed_cb(scmirroring_sink_h scmirroring_sink, s
  * @param[in] port The server port to connect to
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
  * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
  *
@@ -108,9 +108,9 @@ int scmirroring_sink_set_state_changed_cb(scmirroring_sink_h scmirroring_sink, s
 int scmirroring_sink_set_ip_and_port(scmirroring_sink_h scmirroring_sink, const char *ip, const char *port);
 
 /**
- * @brief      Pass window handle created by application and surface type(x11/evas)
- * @details   This function will use handle created by the application to set the overlay &
- *             display on the surface passed by the application
+ * @brief Pass window handle created by application and surface type(x11/evas).
+ * @details This function will use handle created by the application to set the overlay &
+ *          display on the surface passed by the application
  *
  * @since_tizen 2.4
  *
@@ -119,26 +119,26 @@ int scmirroring_sink_set_ip_and_port(scmirroring_sink_h scmirroring_sink, const
  * @param[in] display_surface The display_surface created by application to force sink to display content over it
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
  * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
  *
  * @see scmirroring_sink_create()
  */
-int scmirroring_sink_set_display(scmirroring_sink_h scmirroring_sink, scmirroring_display_type_e type, voiddisplay_surface);
+int scmirroring_sink_set_display(scmirroring_sink_h scmirroring_sink, scmirroring_display_type_e type, void *display_surface);
 
 /**
- * @brief      Sets resolutions of screen mirroring sink
+ * @brief Sets resolutions of screen mirroring sink.
  * @details This function sets resolutions of screen mirroring sink using scmirroring_resolution_e as following.
- *  (ex. SCMIRRORING_RESOLUTION_1920x1080_P30 | SCMIRRORING_RESOLUTION_1280x720_P30)
- *  Use it only when you want to set specific resolutions but if sreen mirroring source dose not support the resolutions which you set,
- *  the screen mirroring sink will be disconnected.
+ *          (ex. SCMIRRORING_RESOLUTION_1920x1080_P30 | SCMIRRORING_RESOLUTION_1280x720_P30)
+ *          Use it only when you want to set specific resolutions but if sreen mirroring source dose not support
+ *          the resolutions which you set, the screen mirroring sink will be disconnected.
  *
  * @since_tizen 2.4
  *
@@ -146,13 +146,13 @@ int scmirroring_sink_set_display(scmirroring_sink_h scmirroring_sink, scmirrorin
  * @param[in] resolution Resolution of screen mirroring sink
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
  * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
  *
@@ -166,21 +166,21 @@ int scmirroring_sink_set_resolution(scmirroring_sink_h scmirroring_sink, int res
  * @privlevel public
  * @privilege %http://tizen.org/privilege/internet
  *
- * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
  * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
  * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
- * @pre The screen mirroring state should be SCMIRRORING_SINK_STATE_NULL
- * @post The screen mirroring state will be SCMIRRORING_SINK_STATE_PREPARED
+ * @pre The screen mirroring state should be #SCMIRRORING_SINK_STATE_NULL
+ * @post The screen mirroring state will be #SCMIRRORING_SINK_STATE_PREPARED
  *
  * @see scmirroring_sink_create()
  * @see scmirroring_sink_set_state_changed_cb()
@@ -188,28 +188,28 @@ int scmirroring_sink_set_resolution(scmirroring_sink_h scmirroring_sink, int res
 int scmirroring_sink_prepare(scmirroring_sink_h scmirroring_sink);
 
 /**
- * @brief Creates connection and prepare for receiving data from SCMIRRORING source
+ * @brief Creates connection and prepare for receiving data from SCMIRRORING source.
  *
  * @since_tizen 2.4
  * @privlevel public
  * @privilege %http://tizen.org/privilege/internet
  *
- * @param[in]  scmirroring_sink The handle to the screen mirroring sink
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
  * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
  * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
  * @pre Call scmirroring_sink_prepare()
- * @pre The screen mirroring state should be SCMIRRORING_SINK_STATE_PREPARED
- * @post The screen mirroring state will be SCMIRRORING_SINK_STATE_CONNECTED
+ * @pre The screen mirroring state should be #SCMIRRORING_SINK_STATE_PREPARED
+ * @post The screen mirroring state will be #SCMIRRORING_SINK_STATE_CONNECTED
  *
  * @see scmirroring_sink_create()
  * @see scmirroring_sink_set_state_changed_cb()
@@ -218,29 +218,29 @@ int scmirroring_sink_prepare(scmirroring_sink_h scmirroring_sink);
 int scmirroring_sink_connect(scmirroring_sink_h scmirroring_sink);
 
 /**
- * @brief Start receiving data from the SCMIRRORING source and display it(mirror)
+ * @brief Start receiving data from the SCMIRRORING source and display it(mirror).
  *
  * @since_tizen 2.4
  * @privlevel public
  * @privilege %http://tizen.org/privilege/internet
  *
- * @param[in]  scmirroring_sink The handle to the screen mirroring sink
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
  * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
  * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
  * @pre Call scmirroring_sink_prepare()
  * @pre Call scmirroring_sink_connect()
- * @pre The screen mirroring state should be SCMIRRORING_SINK_STATE_CONNECTED
- * @post The screen mirroring state will be SCMIRRORING_SINK_STATE_PLAYING
+ * @pre The screen mirroring state should be #SCMIRRORING_SINK_STATE_CONNECTED
+ * @post The screen mirroring state will be #SCMIRRORING_SINK_STATE_PLAYING
  *
  * @see scmirroring_sink_create()
  * @see scmirroring_sink_set_state_changed_cb()
@@ -250,7 +250,7 @@ int scmirroring_sink_connect(scmirroring_sink_h scmirroring_sink);
 int scmirroring_sink_start(scmirroring_sink_h scmirroring_sink);
 
 /**
- * @brief Pauses receiving data from the SCMIRRORING source
+ * @brief Pauses receiving data from the SCMIRRORING source.
  * @details This function pauses receiving data from the SCMIRRORING source,
  *     which means it sends RTSP PAUSE message to source.
  *
@@ -258,19 +258,19 @@ int scmirroring_sink_start(scmirroring_sink_h scmirroring_sink);
  * @privlevel public
  * @privilege %http://tizen.org/privilege/internet
  *
- * @param[in]  scmirroring_sink The handle to the screen mirroring sink
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
- * @pre The screen mirroring state should be SCMIRRORING_SINK_STATE_PLAYING
- * @post The screen mirroring state will be SCMIRRORING_SINK_STATE_PAUSED
+ * @pre The screen mirroring state should be #SCMIRRORING_SINK_STATE_PLAYING
+ * @post The screen mirroring state will be #SCMIRRORING_SINK_STATE_PAUSED
  *
  * @see scmirroring_sink_create()
  * @see scmirroring_sink_set_state_changed_cb()
@@ -281,52 +281,52 @@ int scmirroring_sink_start(scmirroring_sink_h scmirroring_sink);
 int scmirroring_sink_pause(scmirroring_sink_h scmirroring_sink);
 
 /**
- * @brief Pauses receiving data from the SCMIRRORING source
+ * @brief Pauses receiving data from the SCMIRRORING source.
  * @details This function pauses receiving data from the SCMIRRORING source, which means it sends RTSP PLAY message to source.
  *
  * @since_tizen 2.4
  * @privlevel public
  * @privilege %http://tizen.org/privilege/internet
  *
- * @param[in]  scmirroring_sink The handle to the screen mirroring sink
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
- * @pre The screen mirroring state should be SCMIRRORING_SINK_STATE_PAUSED
- * @post The screen mirroring state will be SCMIRRORING_SINK_STATE_PLAYING
+ * @pre The screen mirroring state should be #SCMIRRORING_SINK_STATE_PAUSED
+ * @post The screen mirroring state will be #SCMIRRORING_SINK_STATE_PLAYING
  *
  * @see scmirroring_sink_pause()
  */
 int scmirroring_sink_resume(scmirroring_sink_h scmirroring_sink);
 
 /**
- * @brief Disconnects and stops receiving data from the SCMIRRORING source
+ * @brief Disconnects and stops receiving data from the SCMIRRORING source.
  *
  * @since_tizen 2.4
  * @privlevel public
  * @privilege %http://tizen.org/privilege/internet
  *
- * @param[in]  scmirroring_sink The handle to the screen mirroring sink
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
- *
- * @pre The screen mirroring state should be SCMIRRORING_SINK_STATE_CONNECTED
- *     or SCMIRRORING_SINK_STATE_PLAYING or SCMIRRORING_SINK_STATE_PAUSED
- * @post The screen mirroring state will be SCMIRRORING_SINK_STATE_DISCONNECTED
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ *
+ * @pre The screen mirroring state should be #SCMIRRORING_SINK_STATE_CONNECTED
+ *     or #SCMIRRORING_SINK_STATE_PLAYING or #SCMIRRORING_SINK_STATE_PAUSED
+ * @post The screen mirroring state will be #SCMIRRORING_SINK_STATE_DISCONNECTED
  *
  * @see scmirroring_sink_create()
  * @see scmirroring_sink_set_state_changed_cb()
@@ -337,28 +337,28 @@ int scmirroring_sink_resume(scmirroring_sink_h scmirroring_sink);
 int scmirroring_sink_disconnect(scmirroring_sink_h scmirroring_sink);
 
 /**
- * @brief Unprepares screen mirroring
+ * @brief Unprepares screen mirroring.
  * @details This function unprepares screen mirroring, which closes specific resources.
  *
  * @since_tizen 2.4
  * @privlevel public
  * @privilege %http://tizen.org/privilege/internet
  *
- * @param[in]  scmirroring_sink The handle to the screen mirroring sink
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
  * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
  * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
  * @pre Call scmirroring_sink_prepare()
- * @post The screen mirroring state will be SCMIRRORING_STATE_NULL
+ * @post The screen mirroring state will be #SCMIRRORING_STATE_NULL
  *
  * @see scmirroring_sink_create()
  * @see scmirroring_sink_set_state_changed_cb()
@@ -367,19 +367,19 @@ int scmirroring_sink_disconnect(scmirroring_sink_h scmirroring_sink);
 int scmirroring_sink_unprepare(scmirroring_sink_h scmirroring_sink);
 
 /**
- * @brief      Unregisters the callback function user registered
+ * @brief Unregisters the callback function user registered.
  *
  * @since_tizen 2.4
  *
  * @param[in] scmirroring_sink The handle to the screen mirroring sink
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
  * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
  * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
@@ -394,23 +394,212 @@ int scmirroring_sink_unset_state_changed_cb(scmirroring_sink_h scmirroring_sink)
  *
  * @since_tizen 2.4
  *
- * @param[in]  scmirroring_sink The handle to the screen mirroring sink
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval      #SCMIRRORING_ERROR_NONE Successful
- * @retval      #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
- * @retval      #SCMIRRORING_ERROR_PERMISSION_DENIED Permission Denied
- * @retval      #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
- * @retval      #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
  *
  * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
- * @pre The screen mirroring state should be SCMIRRORING_STATE_NULL
+ * @pre The screen mirroring state should be #SCMIRRORING_STATE_NULL
  *
  * @see scmirroring_sink_create()
  */
 int scmirroring_sink_destroy(scmirroring_sink_h scmirroring_sink);
 
+/**
+ * @brief Gets negotiated video codec of screen mirroring sink.
+ * @details The video codec is negotiated by screen mirroring source.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[out] codec Codec of video
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ *
+ * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
+ * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
+ * @pre Call scmirroring_sink_prepare()
+ * @pre Call scmirroring_sink_connect()
+ * @pre The screen mirroring state must be #SCMIRRORING_SINK_STATE_CONNECTED or #SCMIRRORING_SINK_STATE_PLAYING
+ */
+int scmirroring_sink_get_negotiated_video_codec(scmirroring_sink_h *scmirroring_sink, scmirroring_video_codec_e *codec);
+
+/**
+ * @brief Gets negotiated video resolution of screen mirroring sink.
+ * @details The video resolution is negotiated by screen mirroring source.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[out] width Width of video
+ * @param[out] height Height of video
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ *
+ * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
+ * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
+ * @pre Call scmirroring_sink_prepare()
+ * @pre Call scmirroring_sink_connect()
+ * @pre The screen mirroring state must be #SCMIRRORING_SINK_STATE_CONNECTED or #SCMIRRORING_SINK_STATE_PLAYING
+ */
+int scmirroring_sink_get_negotiated_video_resolution(scmirroring_sink_h *scmirroring_sink, int *width, int *height);
+
+/**
+ * @brief Gets negotiated frame rate of screen mirroring sink.
+ * @details The video frame rate is negotiated by screen mirroring source.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[out] frame_rate Frame rate of video
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ *
+ * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
+ * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
+ * @pre Call scmirroring_sink_prepare()
+ * @pre Call scmirroring_sink_connect()
+ * @pre The screen mirroring state must be #SCMIRRORING_SINK_STATE_CONNECTED or #SCMIRRORING_SINK_STATE_PLAYING
+ */
+int scmirroring_sink_get_negotiated_video_frame_rate(scmirroring_sink_h *scmirroring_sink, int *frame_rate);
+
+/**
+ * @brief Gets negotiated audio codec of screen mirroring sink.
+ * @details The audio codec is negotiated by screen mirroring source.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[out] codec Codec of audio
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ *
+ * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
+ * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
+ * @pre Call scmirroring_sink_prepare()
+ * @pre Call scmirroring_sink_connect()
+ * @pre The screen mirroring state must be #SCMIRRORING_SINK_STATE_CONNECTED or #SCMIRRORING_SINK_STATE_PLAYING
+ */
+int scmirroring_sink_get_negotiated_audio_codec(scmirroring_sink_h *scmirroring_sink, scmirroring_audio_codec_e *codec);
+
+/**
+ * @brief Gets negotiated audio channel of screen mirroring sink.
+ * @details The audio channel is negotiated by screen mirroring source.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[out] channel Channel of audio
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ *
+ * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
+ * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
+ * @pre Call scmirroring_sink_prepare()
+ * @pre Call scmirroring_sink_connect()
+ * @pre The screen mirroring state must be #SCMIRRORING_SINK_STATE_CONNECTED or #SCMIRRORING_SINK_STATE_PLAYING
+ */
+int scmirroring_sink_get_negotiated_audio_channel(scmirroring_sink_h *scmirroring_sink, int *channel);
+
+/**
+ * @brief Gets negotiated audio sample rate of screen mirroring sink.
+ * @details The audio sample rate is negotiated by screen mirroring source.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[out] sample_rate Sample rate of audio
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ *
+ * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
+ * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
+ * @pre Call scmirroring_sink_prepare()
+ * @pre Call scmirroring_sink_connect()
+ * @pre The screen mirroring state must be #SCMIRRORING_SINK_STATE_CONNECTED or #SCMIRRORING_SINK_STATE_PLAYING
+ */
+int scmirroring_sink_get_negotiated_audio_sample_rate(scmirroring_sink_h *scmirroring_sink, int *sample_rate);
+
+/**
+ * @brief Gets negotiated audio bitwidth of screen mirroring sink.
+ * @details The audio bitwidth is negotiated by screen mirroring source.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[out] bitwidth Bitwidth of audio
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ *
+ * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
+ * @pre Register user callback by calling scmirroring_sink_set_state_changed_cb().
+ * @pre Call scmirroring_sink_prepare()
+ * @pre Call scmirroring_sink_connect()
+ * @pre The screen mirroring state must be #SCMIRRORING_SINK_STATE_CONNECTED or #SCMIRRORING_SINK_STATE_PLAYING
+ */
+int scmirroring_sink_get_negotiated_audio_bitwidth(scmirroring_sink_h *scmirroring_sink, int *bitwidth);
 
 #ifdef __cplusplus
 }
index 4e2fea6fc282fac252dc23485a21ae02a0388517..326a074df20f2ddca7a565745bbc7a9174005308 100755 (executable)
@@ -17,7 +17,7 @@
 #ifndef __TIZEN_MEDIA_SCMIRRORING_SRC_H__
 #define __TIZEN_MEDIA_SCMIRRORING_SRC_H__
 
-#include <scmirroring_type.h>
+#include <scmirroring_internal.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -28,14 +28,8 @@ extern "C" {
  * @brief This file contains the screen mirroring source API and functions related with screen mirroring as source device.
  */
 
-/**
- * @addtogroup CAPI_MEDIA_SCREEN_MIRRORING_SRC_MODULE
- * @{
- */
-
 /**
  * @brief Creates screen mirroring source handle.
- * @since_tizen 2.4
  * @remarks You must release @a scmirroring_src using scmirroring_src_destroy().
  *
  * @param[out] scmirroring_src The handle to screen mirroring source
@@ -54,8 +48,6 @@ int scmirroring_src_create(scmirroring_src_h *scmirroring_src);
  * @brief Registers user callback to get status of screen mirroring.
  * @details This function registers user callback and this callback is called when each status is changed.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  * @param[in] callback The callback function to invoke
  * @param[in] user_data The user data passed to the callback registration function
@@ -77,8 +69,6 @@ int scmirroring_src_set_state_changed_cb(scmirroring_src_h scmirroring_src, scmi
 /**
  * @brief Sets connection mode of screen mirroring.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  * @param[in] connection_mode connection mode of screen mirroring
  *
@@ -99,8 +89,6 @@ int scmirroring_src_set_connection_mode(scmirroring_src_h scmirroring_src, scmir
 /**
  * @brief Sets IP address and port number of screen mirroring source.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  * @param[in] ip Server IP address
  * @param[in] port Server port
@@ -122,8 +110,6 @@ int scmirroring_src_set_ip_and_port(scmirroring_src_h scmirroring_src, const cha
 /**
  * @brief Sets resolution of screen mirroring source.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  * @param[in] resolution Resolution of screen mirroring source
  *
@@ -145,8 +131,6 @@ int scmirroring_src_set_resolution(scmirroring_src_h scmirroring_src, scmirrorin
  * @brief Connects to server for screen mirroring as source, asynchronously.
  * @details This function launches server and connects to the server for screen mirroring as source to command server to start/pause/resume/stop.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  *
  * @return @c 0 on success,
@@ -170,8 +154,6 @@ int scmirroring_src_connect(scmirroring_src_h scmirroring_src);
 /**
  * @brief Prepares screen mirroring as source.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  *
  * @return @c 0 on success,
@@ -196,8 +178,6 @@ int scmirroring_src_prepare(scmirroring_src_h scmirroring_src);
  * @brief Starts screen mirroring, asynchronously.
  * @details This function starts screen mirroring, which means it starts to negotiate and stream RTP multimedia data.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  *
  * @return @c 0 on success,
@@ -229,8 +209,6 @@ int scmirroring_src_start(scmirroring_src_h scmirroring_src);
  * @brief Pauses screen mirroring, asynchronously.
  * @details This function pauses screen mirroring, which means it sends RTSP PAUSE trigger message to sink.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  *
  * @return @c 0 on success,
@@ -256,8 +234,6 @@ int scmirroring_src_pause(scmirroring_src_h scmirroring_src);
  * @brief Resumes screen mirroring, asynchronously.
  * @details This function resumes screen mirroring, which means it sends RTSP PLAY message to sink.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  *
  * @return @c 0 on success,
@@ -279,8 +255,6 @@ int scmirroring_src_resume(scmirroring_src_h scmirroring_src);
  * @brief Stops screen mirroring, asynchronously.
  * @details This function stops screen mirroring, which means it sends RTSP TEARDOWN trigger message to sink.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  *
  * @return @c 0 on success,
@@ -307,8 +281,6 @@ int scmirroring_src_stop(scmirroring_src_h scmirroring_src);
  * @brief Unprepares screen mirroring.
  * @details This function unprepares screen mirroring, which closes specific resources.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  *
  * @return @c 0 on success,
@@ -332,8 +304,6 @@ int scmirroring_src_unprepare(scmirroring_src_h scmirroring_src);
 /**
  * @brief Disconnects server for screen mirroring.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  *
  * @return @c 0 on success,
@@ -359,8 +329,6 @@ int scmirroring_src_disconnect(scmirroring_src_h scmirroring_src);
 /**
  * @brief Unregisters the callback function user registered
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  *
  * @return @c 0 on success,
@@ -382,8 +350,6 @@ int scmirroring_src_unset_state_changed_cb(scmirroring_src_h scmirroring_src);
 /**
  * @brief Destroys server and screen mirroring source handle.
  *
- * @since_tizen 2.4
- *
  * @param[in] scmirroring_src The handle to screen mirroring source
  *
  * @return @c 0 on success,
@@ -406,8 +372,4 @@ int scmirroring_src_destroy(scmirroring_src_h scmirroring_src);
 }
 #endif /* __cplusplus */
 
-/**
- * @}
- */
-
 #endif /* __TIZEN_MEDIA_SCMIRRORING_SRC_H__ */
index d3be13880e447024c366d7f03cb244d053fbcad5..7cb15a82de7d7729f83ed6afa3bb744eefbb5e95 100755 (executable)
@@ -71,6 +71,7 @@ typedef enum __scmirroring_ini_session_mode {
 typedef struct __scmirroring_src_ini {
        /* general */
        SCMIRRORING_INI_VSRC_ELEMENT videosrc_element;
+       gchar name_of_video_encoder[SCMIRRORING_SRC_INI_MAX_STRLEN];
        gint session_mode;
        SCMIRRORING_INI_VSINK_ELEMENT videosink_element;
        gchar name_of_video_converter[SCMIRRORING_SRC_INI_MAX_STRLEN];
@@ -80,6 +81,9 @@ typedef struct __scmirroring_src_ini {
        gint mtu_size;
 
        gchar name_of_audio_device[SCMIRRORING_SRC_INI_MAX_STRLEN];
+       gchar name_of_audio_encoder_aac[SCMIRRORING_SRC_INI_MAX_STRLEN];
+       gchar name_of_audio_encoder_ac3[SCMIRRORING_SRC_INI_MAX_STRLEN];
+       guint audio_codec;
        gint audio_latency_time;
        gint audio_buffer_time;
        gint audio_do_timestamp;
@@ -103,6 +107,7 @@ typedef struct __scmirroring_src_ini {
 #define DEFAULT_PROVIDE_CLOCK                          TRUE
 #define DEFAULT_VIDEOSINK                              SCMIRRORING_INI_VSINK_XVIMAGESINK
 #define DEFAULT_VIDEOSRC                               SCMIRRORING_INI_VSRC_XVIMAGESRC
+#define DEFAULT_VIDEOENC                               "omxh264enc"
 #define DEFAULT_VIDEO_BITRATE                          3072000 /* bps */
 #define DEFAULT_MTU_SIZE        1400 /* bytes */
 #define DEFAULT_SESSION_MODE                           0
@@ -111,6 +116,9 @@ typedef struct __scmirroring_src_ini {
 #define DEFAULT_VIDEO_CONVERTER                                ""
 /* hw accel */
 #define DEFAULT_AUDIO_DEVICE_NAME "alsa_output.0.analog-stereo.monitor"
+#define DEFAULT_AUDIOENC_AAC                           "avenc_aac"
+#define DEFAULT_AUDIOENC_AC3                           "avenc_ac3"
+#define DEFAULT_AUDIO_CODEC    2
 #define DEFAULT_AUDIO_LATENCY_TIME     10000
 #define DEFAULT_AUDIO_BUFFER_TIME      200000
 #define DEFAULT_AUDIO_DO_TIMESTAMP     0
index 8adb37c6ffcc7dfde65480964f1c03155787c767..52067e67a46c75dc991a5674e65c5ce6f49b18bc 100755 (executable)
@@ -33,12 +33,6 @@ extern "C" {
  * @{
  */
 
-/**
- * @brief      The handle to the screen mirroring source.
- * @since_tizen 2.4
- */
-typedef void *scmirroring_src_h;
-
 /**
  * @brief      The handle to the screen mirroring sink.
  * @since_tizen 2.4
@@ -50,45 +44,29 @@ typedef void *scmirroring_sink_h;
  * @since_tizen 2.4
  */
 typedef enum {
-       SCMIRRORING_ERROR_NONE                                  = TIZEN_ERROR_NONE,                                     /**< Successful */
-       SCMIRRORING_ERROR_INVALID_PARAMETER     = TIZEN_ERROR_INVALID_PARAMETER,                /**< Invalid parameter */
-       SCMIRRORING_ERROR_OUT_OF_MEMORY         = TIZEN_ERROR_OUT_OF_MEMORY,                    /**< Out of memory */
-       SCMIRRORING_ERROR_INVALID_OPERATION     = TIZEN_ERROR_INVALID_OPERATION,                /**< Invalid Operation */
-       SCMIRRORING_ERROR_CONNECTION_TIME_OUT   = TIZEN_ERROR_CONNECTION_TIME_OUT,  /**< Connection timeout */
-       SCMIRRORING_ERROR_PERMISSION_DENIED     = TIZEN_ERROR_PERMISSION_DENIED,    /**< Permission denied */
-       SCMIRRORING_ERROR_NOT_SUPPORTED         = TIZEN_ERROR_NOT_SUPPORTED,        /**< Not supported */
-       SCMIRRORING_ERROR_UNKNOWN                               = TIZEN_ERROR_UNKNOWN,        /**< Unknown error */
+       SCMIRRORING_ERROR_NONE                = TIZEN_ERROR_NONE,                /**< Successful */
+       SCMIRRORING_ERROR_INVALID_PARAMETER   = TIZEN_ERROR_INVALID_PARAMETER,   /**< Invalid parameter */
+       SCMIRRORING_ERROR_OUT_OF_MEMORY       = TIZEN_ERROR_OUT_OF_MEMORY,       /**< Out of memory */
+       SCMIRRORING_ERROR_INVALID_OPERATION   = TIZEN_ERROR_INVALID_OPERATION,   /**< Invalid Operation */
+       SCMIRRORING_ERROR_CONNECTION_TIME_OUT = TIZEN_ERROR_CONNECTION_TIME_OUT, /**< Connection timeout */
+       SCMIRRORING_ERROR_PERMISSION_DENIED       = TIZEN_ERROR_PERMISSION_DENIED,   /**< Permission denied */
+       SCMIRRORING_ERROR_NOT_SUPPORTED       = TIZEN_ERROR_NOT_SUPPORTED,       /**< Not supported */
+       SCMIRRORING_ERROR_UNKNOWN             = TIZEN_ERROR_UNKNOWN              /**< Unknown error */
 } scmirroring_error_e;
 
-/**
- * @brief Enumeration for screen mirroring source state.
- * @since_tizen 2.4
- */
-typedef enum {
-       SCMIRRORING_STATE_NULL = 0,                     /**< Screen mirroring is created, but not realized yet */
-       SCMIRRORING_STATE_READY,                                /**< Screen mirroring is ready to play media */
-       SCMIRRORING_STATE_CONNECTION_WAIT,      /**< Screen mirroring is waiting for connection */
-       SCMIRRORING_STATE_CONNECTED,            /**< Screen mirroring is connected */
-       SCMIRRORING_STATE_PLAYING,                      /**< Screen mirroring is now playing media */
-       SCMIRRORING_STATE_PAUSED,                        /**< Screen mirroring is paused while playing media */
-       SCMIRRORING_STATE_TEARDOWN,                     /**< Teardown Screen mirroring */
-       SCMIRRORING_STATE_NONE,                         /**< Screen mirroring is not created yet */
-       SCMIRRORING_STATE_MAX                           /* Number of screen mirroring states */
-} scmirroring_state_e;
-
 /**
  * @brief Enumeration for screen mirroring sink state.
  * @since_tizen 2.4
  */
 typedef enum {
-       SCMIRRORING_SINK_STATE_NONE = 0,                /**< Screen mirroring is not created yet */
-       SCMIRRORING_SINK_STATE_NULL,                    /**< Screen mirroring is created, but not prepared yet */
-       SCMIRRORING_SINK_STATE_PREPARED,        /**< Screen mirroring is prepared to play media */
-       SCMIRRORING_SINK_STATE_CONNECTED,       /**< Screen mirroring is connected */
-       SCMIRRORING_SINK_STATE_PLAYING,         /**< Screen mirroring is now playing media */
-       SCMIRRORING_SINK_STATE_PAUSED,           /**< Screen mirroring is paused while playing media */
-       SCMIRRORING_SINK_STATE_DISCONNECTED,                    /**< Screen mirroring is dieconnected */
-       SCMIRRORING_SINK_STATE_MAX                      /* Number of screen mirroring states */
+       SCMIRRORING_SINK_STATE_NONE = 0,      /**< Screen mirroring is not created yet */
+       SCMIRRORING_SINK_STATE_NULL,          /**< Screen mirroring is created, but not prepared yet */
+       SCMIRRORING_SINK_STATE_PREPARED,      /**< Screen mirroring is prepared to play media */
+       SCMIRRORING_SINK_STATE_CONNECTED,     /**< Screen mirroring is connected */
+       SCMIRRORING_SINK_STATE_PLAYING,       /**< Screen mirroring is now playing media */
+       SCMIRRORING_SINK_STATE_PAUSED,        /**< Screen mirroring is paused while playing media */
+       SCMIRRORING_SINK_STATE_DISCONNECTED,  /**< Screen mirroring is dieconnected */
+       SCMIRRORING_SINK_STATE_MAX            /* Number of screen mirroring states */
 } scmirroring_sink_state_e;
 
 /**
@@ -97,53 +75,48 @@ typedef enum {
  */
 typedef enum {
        SCMIRRORING_RESOLUTION_UNKNOWN = 0,
-       SCMIRRORING_RESOLUTION_1920x1080_P30 =(1 << 0),   /**< W-1920, H-1080, 30 fps*/
-       SCMIRRORING_RESOLUTION_1280x720_P30 =(1 << 1),    /**< W-1280, H-720, 30 fps*/
-       SCMIRRORING_RESOLUTION_960x540_P30 = (1 << 2),    /**< W-960, H-540, 30 fps*/
-       SCMIRRORING_RESOLUTION_864x480_P30 = (1 << 3),    /**< W-864, H-480, 30 fps*/
-       SCMIRRORING_RESOLUTION_720x480_P60 = (1 << 4),    /**< W-720, H-480, 30 fps*/
-       SCMIRRORING_RESOLUTION_640x480_P60 = (1 << 5),    /**< W-640, H-480, 60 fps*/
-       SCMIRRORING_RESOLUTION_640x360_P30 = (1 << 6),    /**< W-640, H-360, 30 fps*/
-       SCMIRRORING_RESOLUTION_MAX = 128,
+       SCMIRRORING_RESOLUTION_1920x1080_P30 = (1 << 0),   /**< W-1920, H-1080, 30 fps*/
+       SCMIRRORING_RESOLUTION_1280x720_P30 = (1 << 1),    /**< W-1280, H-720, 30 fps*/
+       SCMIRRORING_RESOLUTION_960x540_P30 = (1 << 2),     /**< W-960, H-540, 30 fps*/
+       SCMIRRORING_RESOLUTION_864x480_P30 = (1 << 3),     /**< W-864, H-480, 30 fps*/
+       SCMIRRORING_RESOLUTION_720x480_P60 = (1 << 4),     /**< W-720, H-480, 30 fps*/
+       SCMIRRORING_RESOLUTION_640x480_P60 = (1 << 5),     /**< W-640, H-480, 60 fps*/
+       SCMIRRORING_RESOLUTION_640x360_P30 = (1 << 6),     /**< W-640, H-360, 30 fps*/
+       SCMIRRORING_RESOLUTION_MAX = 128
 } scmirroring_resolution_e;
 
 /**
- * @brief Enumeration for screen mirroring connection mode.
+ * @brief Enumeration for screen mirroring display surface type.
  * @since_tizen 2.4
  */
 typedef enum {
-       SCMIRRORING_CONNECTION_WIFI_DIRECT = 0,         /**< Wi-Fi Direct*/
-       SCMIRRORING_CONNECTION_MAX,                                     /* Number of Connection mode */
-} scmirroring_connection_mode_e;
+       SCMIRRORING_DISPLAY_TYPE_OVERLAY = 0,    /**< Use overlay surface to display streaming multimedia data */
+       SCMIRRORING_DISPLAY_TYPE_EVAS,           /**< Use Evas pixmap surface to display streaming multimedia data */
+       SCMIRRORING_DISPLAY_TYPE_MAX             /* Number of dispaly type */
+} scmirroring_display_type_e;
 
 /**
- * @brief Enumeration for screen mirroring display surface type
+ * @brief Enumeration for screen mirroring audio codec.
  * @since_tizen 2.4
  */
 typedef enum {
-       SCMIRRORING_DISPLAY_TYPE_OVERLAY = 0,   /**< Use overlay surface to display streaming multimedia data */
-       SCMIRRORING_DISPLAY_TYPE_EVAS,                  /**< Use Evas pixmap surface to display streaming multimedia data */
-       SCMIRRORING_DISPLAY_TYPE_MAX
-} scmirroring_display_type_e;
+       SCMIRRORING_AUDIO_CODEC_NONE = 0,    /**< Screen mirroring is not negotiated yet */
+       SCMIRRORING_AUDIO_CODEC_AAC,         /**< AAC codec for audio */
+       SCMIRRORING_AUDIO_CODEC_AC3,         /**< AA3 codec for audio */
+       SCMIRRORING_AUDIO_CODEC_LPCM         /**< LPCM codec for audio */
+} scmirroring_audio_codec_e;
 
 /**
- * @brief Called when each status is changed
+ * @brief Enumeration for screen mirroring video codec.
  * @since_tizen 2.4
- *
- * @details This callback is called for state and error of screen mirroring
- *
- * @param[in] error     The error code
- * @param[in] state     The screen mirroring state
- * @param[in] user_data The user data passed from the scmirroring_src_set_state_cb() function
- *
- * @pre scmirroring_src_create()
- *
- * @see scmirroring_src_create()
  */
-typedef void(*scmirroring_state_cb)(scmirroring_error_e error, scmirroring_state_e state, void *user_data);
+typedef enum {
+       SCMIRRORING_VIDEO_CODEC_NONE = 0,    /**< Screen mirroring is not negotiated yet */
+       SCMIRRORING_VIDEO_CODEC_H264         /**< H.264 codec for video */
+} scmirroring_video_codec_e;
 
 /**
- * @brief Called when each status is changed
+ * @brief Called when each status is changed.
  * @since_tizen 2.4
  *
  * @details This callback is called for state and error of screen mirroring sink
@@ -158,12 +131,12 @@ typedef void(*scmirroring_state_cb)(scmirroring_error_e error, scmirroring_state
  */
 typedef void(*scmirroring_sink_state_cb)(scmirroring_error_e error, scmirroring_sink_state_e state, void *user_data);
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
 /**
  * @}
  */
 
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
 #endif /* __TIZEN_MEDIA_SCMIRRORING_TYPE_H__ */
index e2638c7f40d117ee53c2da7b63ea7ac281d3c97a..8e9bc57b04819e33228ab0ad5dcbaaa029a7edd5 100755 (executable)
@@ -30,7 +30,6 @@
 #include <gst/rtsp-server/rtsp-server-wfd.h>
 #include <gst/rtsp-server/rtsp-media-factory-wfd.h>
 
-#include "scmirroring_type.h"
 #include "scmirroring_private.h"
 #include "scmirroring_src_ini.h"
 
@@ -52,7 +51,7 @@ static gint g_server_status = MIRACAST_WFD_SOURCE_OFF;
 static int __miracast_server_emit_status_signal(int status);
 static const GDBusMethodInfo scmirroring_server_method_info_method = {
        -1,
-       "launch_method",
+       (char *)"launch_method",
        NULL,
        NULL,
        NULL
@@ -61,7 +60,7 @@ static const GDBusMethodInfo *const scmirroring_server_method_info_pointers[] =
 
 static const GDBusInterfaceInfo scmirroring_server_interface_info = {
        -1,
-       PROC_DBUS_INTERFACE,
+       (char *)PROC_DBUS_INTERFACE,
        (GDBusMethodInfo **) &scmirroring_server_method_info_pointers,
        (GDBusSignalInfo **) NULL,
        (GDBusPropertyInfo **) NULL,
@@ -110,7 +109,8 @@ handle_method_call(GDBusConnection       *connection,
 static const GDBusInterfaceVTable interface_vtable = {
        handle_method_call,
        NULL,
-       NULL
+       NULL,
+       {NULL}
 };
 
 static void
@@ -193,7 +193,7 @@ static void miracast_server_object_class_init(MiracastServerObjectClass *klass)
        scmirroring_debug("miracast_server_object_class_init\n");
 }
 
-int __miracast_server_send_resp(MiracastServerObject *server, char *cmd)
+int __miracast_server_send_resp(MiracastServerObject *server, const char *cmd)
 {
        int ret = SCMIRRORING_ERROR_NONE;
        char *_cmd = NULL;
@@ -213,7 +213,7 @@ int __miracast_server_send_resp(MiracastServerObject *server, char *cmd)
        _cmd = g_strdup(cmd);
        _cmd[strlen(_cmd)] = '\0';
 
-       if (write(client_sock, _cmd, strlen(_cmd) + 1) != strlen(_cmd) + 1) {
+       if (write(client_sock, _cmd, strlen(_cmd) + 1) != ((int)(strlen(_cmd) + 1))) {
                scmirroring_error("sendto failed [%s]", strerror(errno));
                ret = SCMIRRORING_ERROR_INVALID_OPERATION;
        } else {
@@ -228,7 +228,7 @@ static void __miracast_server_quit_program(MiracastServerObject *server)
 {
        scmirroring_error("Quit program is called");
 
-       void *pool;
+       void *pool = NULL;
        int i;
        int ret = 0;
 
@@ -243,8 +243,10 @@ static void __miracast_server_quit_program(MiracastServerObject *server)
        }
 
        pool = (void *)gst_rtsp_server_get_session_pool(server->server);
-       gst_rtsp_session_pool_cleanup(pool);
-       g_object_unref(pool);
+       if (pool) {
+               gst_rtsp_session_pool_cleanup(pool);
+               g_object_unref(pool);
+       }
 
        int serv_ref_cnt = GST_OBJECT_REFCOUNT_VALUE(server->server);
        scmirroring_debug("serv ref cnt:%d", serv_ref_cnt);
@@ -434,10 +436,16 @@ int __miracast_server_gst_init()
 
        /* alloc */
        argc = calloc(1, sizeof(int));
-       argv = calloc(max_argc, sizeof(gchar *));
-       if (!argc || !argv) {
+       if (!argc) {
                scmirroring_error("Cannot allocate memory for scmirroringsink\n");
-               goto ERROR;
+               return SCMIRRORING_ERROR_OUT_OF_MEMORY;
+       }
+
+       argv = calloc(max_argc, sizeof(gchar *));
+       if (!argv) {
+               scmirroring_error("Cannot allocate memory for scmirroringsink\n");
+               SCMIRRORING_SAFE_FREE(argc);
+               return SCMIRRORING_ERROR_OUT_OF_MEMORY;
        }
 
        /* we would not do fork for scanning plugins */
@@ -593,6 +601,10 @@ int __miracast_server_start(MiracastServerObject *server_obj)
        gst_rtsp_server_set_address(GST_RTSP_SERVER(server), server_obj->ip);
        gst_rtsp_server_set_service(GST_RTSP_SERVER(server), server_obj->port);
        mounts = gst_rtsp_server_get_mount_points(GST_RTSP_SERVER(server));
+       if (NULL == mounts) {
+               scmirroring_error("Failed to get mount point...");
+               return SCMIRRORING_ERROR_INVALID_OPERATION;
+       }
 
        factory = gst_rtsp_media_factory_wfd_new();
 
@@ -605,6 +617,13 @@ int __miracast_server_start(MiracastServerObject *server_obj)
                                       scmirroring_src_ini_get_structure()->mtu_size
        );
 
+       gst_rtsp_media_factory_wfd_set_encoders (factory,
+                       scmirroring_src_ini_get_structure()->name_of_video_encoder,
+                       scmirroring_src_ini_get_structure()->name_of_audio_encoder_aac,
+                       scmirroring_src_ini_get_structure()->name_of_audio_encoder_ac3);
+
+       gst_rtsp_wfd_server_set_audio_codec (server,
+                       scmirroring_src_ini_get_structure()->audio_codec);
 
        if (server_obj->resolution == SCMIRRORING_RESOLUTION_1920x1080_P30) {
                gst_rtsp_wfd_server_set_video_native_reso(server, GST_WFD_VIDEO_CEA_RESOLUTION);
@@ -765,8 +784,8 @@ gboolean __miracast_server_client_read_cb(GIOChannel *src,
                        scmirroring_debug("Read %d bytes", read);
                }
 
-               int i = 0;
-               int idx = 0;
+               gsize i = 0;
+               gsize idx = 0;
 
                /* Handling multiple commands like "CMD1\0CMD2\0CMD3\0" */
                for (i = 0; i < read; i++) {
@@ -856,9 +875,13 @@ static int __miracast_server_emit_status_signal(int status)
        }
 
        conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
-       if (!conn && err) {
-               scmirroring_error("g_bus_get_sync() error(%s) ", err->message);
-               g_error_free(err);
+       if (!conn) {
+               if (err) {
+                       scmirroring_error("g_bus_get_sync() error (%s) ", err->message);
+                       g_error_free(err);
+               } else {
+                       scmirroring_error("g_bus_get_sync() unknown error ");
+               }
                return -1;
        }
 
index c7b91779a8220a6ff5cea18143a0ebc92fc9743d..8ca0512d9f306f4faa76e5f47e7e563a640cae1c 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-screen-mirroring
 Summary:    A screen mirroring library in Tizen C API
-Version:    0.1.35
+Version:    0.1.39
 Release:    0
 Group:      Multimedia/API
 License:    Apache License, Version 2.0
@@ -8,6 +8,7 @@ Source0:    %{name}-%{version}.tar.gz
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(capi-base-common)
+BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(gstreamer-1.0)
 BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0)
@@ -34,12 +35,9 @@ Requires: %{name} = %{version}-%{release}
 
 
 %build
-#export CFLAGS+=" -Wcast-align"
-#export CFLAGS+=" -Wextra -Wno-array-bounds"
-#export CFLAGS+=" -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow"
-#export CFLAGS+=" -Wwrite-strings -Wswitch-default"
-#export CFLAGS+=" -Wall -Wcast-qual -Wno-empty-body"
-#export CFLAGS+=" -Werror"
+export CFLAGS+=" -Wextra -Wno-array-bounds"
+export CFLAGS+=" -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow"
+export CFLAGS+=" -Wwrite-strings -Wswitch-default"
 
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 
@@ -86,6 +84,7 @@ cp -rf config/scmirroring_src.ini %{buildroot}/usr/etc/scmirroring_src.ini
 %{_includedir}/media/scmirroring_sink.h
 %{_includedir}/media/scmirroring_type.h
 %{_includedir}/media/scmirroring_src_ini.h
+%{_includedir}/media/scmirroring_internal.h
 %{_libdir}/pkgconfig/*.pc
 %{_libdir}/libcapi-media-screen-mirroring.so
 
index 21312ac44895f8ec96cfadbb8b84916550b73d01..cc2ceb8fcd0a5877b81266d3067f1d3a147ac247 100755 (executable)
@@ -101,14 +101,16 @@ void __mm_scmirroring_sink_set_message_cb(int error_type, MMWFDSinkStateType sta
 
 int scmirroring_sink_create(scmirroring_sink_h *scmirroring_sink)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(scmirroring_sink == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(scmirroring_sink == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)calloc(1, sizeof(scmirroring_sink_s));
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Fail to allocate memory for handle");
 
        handle->mm_handle = 0;
        handle->ip = NULL;
@@ -134,11 +136,13 @@ int scmirroring_sink_create(scmirroring_sink_h *scmirroring_sink)
 
 int scmirroring_sink_set_ip_and_port(scmirroring_sink_h scmirroring_sink, const char *ip, const char *port)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
        scmirroring_retvm_if(ip == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "ip is NULL");
        scmirroring_retvm_if(port == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "port is NULL");
 
@@ -154,13 +158,15 @@ int scmirroring_sink_set_ip_and_port(scmirroring_sink_h scmirroring_sink, const
 
 int scmirroring_sink_prepare(scmirroring_sink_h scmirroring_sink)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
 
        ret = mm_wfd_sink_prepare(handle->mm_handle);
 
@@ -173,6 +179,8 @@ int scmirroring_sink_prepare(scmirroring_sink_h scmirroring_sink)
 
 int scmirroring_sink_connect(scmirroring_sink_h scmirroring_sink)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
        char server_uri[255] = {0, };
 
@@ -180,7 +188,7 @@ int scmirroring_sink_connect(scmirroring_sink_h scmirroring_sink)
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
 
        if (handle->ip == NULL) {
                scmirroring_error("INVALID_IP(NULL) (0x%08x)", SCMIRRORING_ERROR_INVALID_PARAMETER);
@@ -209,13 +217,15 @@ int scmirroring_sink_connect(scmirroring_sink_h scmirroring_sink)
 
 int scmirroring_sink_unprepare(scmirroring_sink_h scmirroring_sink)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
 
        ret = mm_wfd_sink_unprepare(handle->mm_handle);
 
@@ -228,13 +238,15 @@ int scmirroring_sink_unprepare(scmirroring_sink_h scmirroring_sink)
 
 int scmirroring_sink_destroy(scmirroring_sink_h scmirroring_sink)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
 
        ret = mm_wfd_sink_destroy(handle->mm_handle);
 
@@ -253,13 +265,15 @@ int scmirroring_sink_destroy(scmirroring_sink_h scmirroring_sink)
 
 int scmirroring_sink_start(scmirroring_sink_h scmirroring_sink)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
 
        ret = mm_wfd_sink_start(handle->mm_handle);
 
@@ -272,13 +286,15 @@ int scmirroring_sink_start(scmirroring_sink_h scmirroring_sink)
 
 int scmirroring_sink_disconnect(scmirroring_sink_h scmirroring_sink)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
 
        ret = mm_wfd_sink_disconnect(handle->mm_handle);
 
@@ -291,13 +307,15 @@ int scmirroring_sink_disconnect(scmirroring_sink_h scmirroring_sink)
 
 int scmirroring_sink_set_state_changed_cb(scmirroring_sink_h scmirroring_sink, scmirroring_sink_state_cb callback, void *user_data)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
        scmirroring_retvm_if(callback == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "callback is NULL");
 
        if (handle->scmirroring_sink_state_cb == NULL) {
@@ -324,13 +342,15 @@ int scmirroring_sink_set_state_changed_cb(scmirroring_sink_h scmirroring_sink, s
 
 int scmirroring_sink_unset_state_changed_cb(scmirroring_sink_h scmirroring_sink)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
 
        ret = mm_wfd_sink_set_message_callback(handle->mm_handle, NULL, NULL);
 
@@ -345,13 +365,15 @@ int scmirroring_sink_unset_state_changed_cb(scmirroring_sink_h scmirroring_sink)
 
 int scmirroring_sink_set_display(scmirroring_sink_h scmirroring_sink, scmirroring_display_type_e type, void *display_surface)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
        scmirroring_retvm_if(display_surface == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "display_surface is NULL");
 
        if ((type != SCMIRRORING_DISPLAY_TYPE_OVERLAY) && (type != SCMIRRORING_DISPLAY_TYPE_EVAS)) {
@@ -382,15 +404,17 @@ int scmirroring_sink_set_display(scmirroring_sink_h scmirroring_sink, scmirrorin
 
 int scmirroring_sink_set_resolution(scmirroring_sink_h scmirroring_sink, int resolution)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
        if ((resolution < SCMIRRORING_RESOLUTION_1920x1080_P30) || (resolution >= SCMIRRORING_RESOLUTION_MAX)) {
-               scmirroring_error("INVALID resolution : %d", resolution);
+               scmirroring_error("Invalid resolution : %d", resolution);
                return SCMIRRORING_ERROR_INVALID_PARAMETER;
        }
 
@@ -410,13 +434,15 @@ int scmirroring_sink_set_resolution(scmirroring_sink_h scmirroring_sink, int res
 
 int scmirroring_sink_pause(scmirroring_sink_h scmirroring_sink)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
 
        ret = mm_wfd_sink_pause(handle->mm_handle);
 
@@ -429,13 +455,15 @@ int scmirroring_sink_pause(scmirroring_sink_h scmirroring_sink)
 
 int scmirroring_sink_resume(scmirroring_sink_h scmirroring_sink)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
 
        scmirroring_error_fenter();
 
-       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL");
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
 
        ret = mm_wfd_sink_resume(handle->mm_handle);
 
@@ -445,3 +473,206 @@ int scmirroring_sink_resume(scmirroring_sink_h scmirroring_sink)
 
        return ret;
 }
+
+int scmirroring_sink_get_negotiated_video_codec(scmirroring_sink_h *scmirroring_sink, scmirroring_video_codec_e *codec)
+{
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
+       int ret = SCMIRRORING_ERROR_NONE;
+       int mm_codec = MM_WFD_SINK_VIDEO_CODEC_NONE;
+
+       scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
+       scmirroring_error_fenter();
+
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
+       scmirroring_retvm_if(codec == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "codec is NULL");
+
+       *codec = SCMIRRORING_VIDEO_CODEC_NONE;
+
+       ret = mm_wfd_sink_get_negotiated_video_codec(handle->mm_handle, &mm_codec);
+       ret = __scmirroring_sink_error_convert(__func__, ret);
+       if (ret != SCMIRRORING_ERROR_NONE)
+               return ret;
+
+       switch (mm_codec) {
+               case MM_WFD_SINK_VIDEO_CODEC_H264:
+                       *codec = SCMIRRORING_VIDEO_CODEC_H264;
+                       break;
+               default:
+                       *codec = SCMIRRORING_VIDEO_CODEC_NONE;
+                       break;
+       }
+
+       scmirroring_debug("codec: %d", *codec);
+       scmirroring_error_fleave();
+
+       return ret;
+}
+
+int scmirroring_sink_get_negotiated_video_resolution(scmirroring_sink_h *scmirroring_sink, int *width, int *height)
+{
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
+       int ret = SCMIRRORING_ERROR_NONE;
+
+       scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
+       scmirroring_error_fenter();
+
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
+       scmirroring_retvm_if(width == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "width is NULL");
+       scmirroring_retvm_if(height == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "height is NULL");
+
+       *width = 0;
+       *height = 0;
+
+       ret = mm_wfd_sink_get_negotiated_video_resolution(handle->mm_handle, width, height);
+       ret = __scmirroring_sink_error_convert(__func__, ret);
+       if (ret != SCMIRRORING_ERROR_NONE)
+               return ret;
+
+       scmirroring_debug("width: %d, height: %d", *width, *height);
+       scmirroring_error_fleave();
+
+       return ret;
+}
+
+int scmirroring_sink_get_negotiated_video_frame_rate(scmirroring_sink_h *scmirroring_sink, int *frame_rate)
+{
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
+       int ret = SCMIRRORING_ERROR_NONE;
+
+       scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
+       scmirroring_error_fenter();
+
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
+       scmirroring_retvm_if(frame_rate == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "frame_rate is NULL");
+
+       *frame_rate = 0;
+
+       ret = mm_wfd_sink_get_negotiated_video_frame_rate(handle->mm_handle, frame_rate);
+       ret = __scmirroring_sink_error_convert(__func__, ret);
+       if (ret != SCMIRRORING_ERROR_NONE)
+               return ret;
+
+       scmirroring_debug("frame rate: %d", *frame_rate);
+       scmirroring_error_fleave();
+
+       return ret;
+}
+
+int scmirroring_sink_get_negotiated_audio_codec(scmirroring_sink_h *scmirroring_sink, scmirroring_audio_codec_e *codec)
+{
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
+       int ret = SCMIRRORING_ERROR_NONE;
+       int mm_codec = MM_WFD_SINK_AUDIO_CODEC_NONE;
+
+       scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
+       scmirroring_error_fenter();
+
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
+       scmirroring_retvm_if(codec == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "codec is NULL");
+
+       *codec = SCMIRRORING_AUDIO_CODEC_NONE;
+
+       ret = mm_wfd_sink_get_negotiated_audio_codec(handle->mm_handle, &mm_codec);
+       ret = __scmirroring_sink_error_convert(__func__, ret);
+       if (ret != SCMIRRORING_ERROR_NONE)
+               return ret;
+
+       switch (mm_codec) {
+               case MM_WFD_SINK_AUDIO_CODEC_AAC:
+                       *codec = SCMIRRORING_AUDIO_CODEC_AAC;
+                       break;
+               case MM_WFD_SINK_AUDIO_CODEC_AC3:
+                       *codec = SCMIRRORING_AUDIO_CODEC_AC3;
+                       break;
+               case MM_WFD_SINK_AUDIO_CODEC_LPCM:
+                       *codec = SCMIRRORING_AUDIO_CODEC_LPCM;
+                       break;
+               default:
+                       *codec = SCMIRRORING_AUDIO_CODEC_NONE;
+                       break;
+       }
+
+       scmirroring_debug("codec: %d", *codec);
+       scmirroring_error_fleave();
+
+       return ret;
+}
+
+int scmirroring_sink_get_negotiated_audio_channel(scmirroring_sink_h *scmirroring_sink, int *channel)
+{
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
+       int ret = SCMIRRORING_ERROR_NONE;
+
+       scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
+       scmirroring_error_fenter();
+
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
+       scmirroring_retvm_if(channel == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "channel is NULL");
+
+       *channel = 0;
+
+       ret = mm_wfd_sink_get_negotiated_audio_channel(handle->mm_handle, channel);
+       ret = __scmirroring_sink_error_convert(__func__, ret);
+       if (ret != SCMIRRORING_ERROR_NONE)
+               return ret;
+
+       scmirroring_debug("channel: %d", *channel);
+       scmirroring_error_fleave();
+
+       return ret;
+}
+
+int scmirroring_sink_get_negotiated_audio_sample_rate(scmirroring_sink_h *scmirroring_sink, int *sample_rate)
+{
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
+       int ret = SCMIRRORING_ERROR_NONE;
+
+       scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
+       scmirroring_error_fenter();
+
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
+       scmirroring_retvm_if(sample_rate == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "sample_rate is NULL");
+
+       *sample_rate = 0;
+
+       ret = mm_wfd_sink_get_negotiated_audio_sample_rate(handle->mm_handle, sample_rate);
+       ret = __scmirroring_sink_error_convert(__func__, ret);
+       if (ret != SCMIRRORING_ERROR_NONE)
+               return ret;
+
+       scmirroring_debug("sample rate: %d", *sample_rate);
+       scmirroring_error_fleave();
+
+       return ret;
+}
+
+int scmirroring_sink_get_negotiated_audio_bitwidth(scmirroring_sink_h *scmirroring_sink, int *bitwidth)
+{
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
+       int ret = SCMIRRORING_ERROR_NONE;
+
+       scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
+       scmirroring_error_fenter();
+
+       scmirroring_retvm_if(handle == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is NULL");
+       scmirroring_retvm_if(bitwidth == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "bitwidth is NULL");
+
+       *bitwidth = 0;
+
+       ret = mm_wfd_sink_get_negotiated_audio_bitwidth(handle->mm_handle, bitwidth);
+       ret = __scmirroring_sink_error_convert(__func__, ret);
+       if (ret != SCMIRRORING_ERROR_NONE)
+               return ret;
+
+       scmirroring_debug("bitwidth: %d", *bitwidth);
+       scmirroring_error_fleave();
+
+       return ret;
+}
index b63795e7577a1986bcd5341b4153c165d75adff9..1bb8d180f82c675a22fe97206a0c277e3a2823e8 100755 (executable)
@@ -235,8 +235,8 @@ gboolean __scmirroring_src_read_cb(GIOChannel *src, GIOCondition condition, gpoi
                        scmirroring_debug("Read %d bytes", read);
                }
 
-               int i = 0;
-               int idx = 0;
+               gsize i = 0;
+               gsize idx = 0;
 
                /* Handling multiple response like "CMD1\0CMD2\0CMD3\0" */
                for (i = 0; i < read; i++) {
@@ -324,6 +324,8 @@ static int __scmirroring_src_send_set_reso(scmirroring_src_h scmirroring)
 
 int scmirroring_src_create(scmirroring_src_h *scmirroring)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
        scmirroring_src_s *_scmirroring = NULL;
 
@@ -355,6 +357,8 @@ int scmirroring_src_create(scmirroring_src_h *scmirroring)
 
 int scmirroring_src_set_connection_mode(scmirroring_src_h scmirroring, scmirroring_connection_mode_e connect_mode)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
@@ -381,6 +385,8 @@ int scmirroring_src_set_connection_mode(scmirroring_src_h scmirroring, scmirrori
 
 int scmirroring_src_set_state_changed_cb(scmirroring_src_h scmirroring, scmirroring_state_cb callback, void *user_data)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
@@ -407,6 +413,8 @@ int scmirroring_src_set_state_changed_cb(scmirroring_src_h scmirroring, scmirror
 
 int scmirroring_src_unset_state_changed_cb(scmirroring_src_h scmirroring)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
@@ -429,6 +437,8 @@ int scmirroring_src_unset_state_changed_cb(scmirroring_src_h scmirroring)
 
 int scmirroring_src_set_ip_and_port(scmirroring_src_h scmirroring, const char *ip, const char *port)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
@@ -458,6 +468,8 @@ int scmirroring_src_set_ip_and_port(scmirroring_src_h scmirroring, const char *i
 
 int scmirroring_src_set_resolution(scmirroring_src_h scmirroring, scmirroring_resolution_e resolution)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
@@ -484,6 +496,8 @@ int scmirroring_src_set_resolution(scmirroring_src_h scmirroring, scmirroring_re
 
 int scmirroring_src_connect(scmirroring_src_h scmirroring)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
        int retry = 0;
        struct sockaddr_un serv_addr;
@@ -526,6 +540,7 @@ int scmirroring_src_connect(scmirroring_src_h scmirroring)
        memset(&serv_addr, 0, sizeof(struct sockaddr_un));
        serv_addr.sun_family = AF_UNIX;
        strncpy(serv_addr.sun_path, _scmirroring->sock_path, sizeof(serv_addr.sun_path));
+       serv_addr.sun_path[sizeof(serv_addr.sun_path) - 1] = '\0';
 
 try:
        scmirroring_debug("Trying to connect to the miracast server");
@@ -586,6 +601,8 @@ try:
 
 int scmirroring_src_disconnect(scmirroring_src_h scmirroring)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
 
        scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
@@ -615,6 +632,8 @@ int scmirroring_src_disconnect(scmirroring_src_h scmirroring)
 
 int scmirroring_src_start(scmirroring_src_h scmirroring)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
        scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
 
@@ -633,6 +652,8 @@ int scmirroring_src_start(scmirroring_src_h scmirroring)
 
 int scmirroring_src_pause(scmirroring_src_h scmirroring)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
        scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
 
@@ -651,6 +672,8 @@ int scmirroring_src_pause(scmirroring_src_h scmirroring)
 
 int scmirroring_src_resume(scmirroring_src_h scmirroring)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
        scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
 
@@ -669,6 +692,8 @@ int scmirroring_src_resume(scmirroring_src_h scmirroring)
 
 int scmirroring_src_stop(scmirroring_src_h scmirroring)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
        scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
 
@@ -687,6 +712,8 @@ int scmirroring_src_stop(scmirroring_src_h scmirroring)
 
 int scmirroring_src_destroy(scmirroring_src_h scmirroring)
 {
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
        int ret = SCMIRRORING_ERROR_NONE;
        scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
 
index 1ed0953c5fd721af6a399c4ddf18125307145da4..47f77833455873e0b404b899ac985f3a55960ee9 100755 (executable)
@@ -30,7 +30,7 @@ static void __scmirroring_ini_check_ini_status(void);
 /* macro */
 #define SCMIRRORING_INI_GET_STRING(x_item, x_ini, x_default) \
        do { \
-               gchar *str = iniparser_getstring(dict, x_ini, x_default); \
+               gchar *str = iniparser_getstring(dict, x_ini, (char *)x_default); \
                \
                if (str && \
                     (strlen(str) > 1) && \
@@ -91,6 +91,7 @@ scmirroring_src_ini_load(void)
                /* general */
                gchar temp[SCMIRRORING_SRC_INI_MAX_STRLEN];
                g_scmirroring_src_ini.videosrc_element = iniparser_getint(dict, "general:videosrc element", DEFAULT_VIDEOSRC);
+               SCMIRRORING_INI_GET_STRING(g_scmirroring_src_ini.name_of_video_encoder, "general:video encoder element", DEFAULT_VIDEOENC);
                g_scmirroring_src_ini.session_mode = iniparser_getint(dict, "general:session_mode", DEFAULT_SESSION_MODE);
                g_scmirroring_src_ini.videosink_element = iniparser_getint(dict, "general:videosink element", DEFAULT_VIDEOSINK);
                g_scmirroring_src_ini.disable_segtrap = iniparser_getboolean(dict, "general:disable segtrap", DEFAULT_DISABLE_SEGTRAP);
@@ -99,6 +100,9 @@ scmirroring_src_ini_load(void)
                g_scmirroring_src_ini.mtu_size = iniparser_getint(dict, "general:mtu_size value", DEFAULT_MTU_SIZE);
                g_scmirroring_src_ini.generate_dot = iniparser_getboolean(dict, "general:generate dot", DEFAULT_GENERATE_DOT);
                g_scmirroring_src_ini.provide_clock = iniparser_getboolean(dict, "general:provide clock", DEFAULT_PROVIDE_CLOCK);
+               SCMIRRORING_INI_GET_STRING(g_scmirroring_src_ini.name_of_audio_encoder_aac, "general:audio encoder aac name", DEFAULT_AUDIOENC_AAC);
+               SCMIRRORING_INI_GET_STRING(g_scmirroring_src_ini.name_of_audio_encoder_ac3, "general:audio encoder ac3 name", DEFAULT_AUDIOENC_AC3);
+               g_scmirroring_src_ini.audio_codec = iniparser_getint(dict, "general:audio codec", DEFAULT_AUDIO_CODEC);
 #ifndef ENABLE_QC_SPECIFIC
                SCMIRRORING_INI_GET_STRING(g_scmirroring_src_ini.name_of_audio_device, "general:exynosaudio device name", DEFAULT_AUDIO_DEVICE_NAME);
                g_scmirroring_src_ini.audio_buffer_time = iniparser_getint(dict, "general:exynosaudio buffer_time", DEFAULT_AUDIO_BUFFER_TIME);
index 2459d7e33cfd9b6aa53a01636a85eee5647b55c7..20a66c3f69b61c5b21a62dde194be45a62e3a9dc 100755 (executable)
@@ -21,7 +21,7 @@
 #include <wifi-direct.h>
 
 #define MAX_STRING_LEN    2048
-/*#define ENABLE_WIFI_DIRECT */
+#define ENABLE_WIFI_DIRECT
 
 scmirroring_src_h g_scmirroring = NULL;
 GMainLoop *g_loop;
@@ -32,7 +32,9 @@ bool _discovered_peer_cb(wifi_direct_discovered_peer_info_s *peer, void *user_da
 void _discover_cb(int error_code, wifi_direct_discovery_state_e discovery_state, void *user_data);
 void _ip_assigned_cb(const char *mac_address, const char *ip_address, const char *interface_address, void *user_data);
 void _connection_cb(int error_code, wifi_direct_connection_state_e connection_state, const char *mac_address, void *user_data);
+#ifdef ENABLE_WIFI_DIRECT
 static gboolean __start_p2p_connection(gpointer data);
+#endif
 static gboolean __disconnect_p2p_connection(void);
 static int g_peer_cnt = 0;
 static char g_peer_ip[32];
@@ -310,6 +312,8 @@ void _connection_cb(int error_code, wifi_direct_connection_state_e connection_st
                case WIFI_DIRECT_GROUP_DESTROYED:
                case WIFI_DIRECT_DISASSOCIATION_IND:
                        break;
+               default:
+                       break;
        }
 
        return;
index b789558b82c85c70a88214ec0abf7d3b0e148699..3d90b2ed3b73087e564248a1de06434503441030 100755 (executable)
 #include <scmirroring_sink.h>
 #include <wifi-direct.h>
 
+/*#define TEST_WITH_WIFI_DIRECT*/
+
 #define MAX_STRING_LEN    2048
 #define SINKTEST_EXECUTE_DELAY 5000
 #define MAIN_MENU 0
 #define SUBMENU_RESOLUTION 1
-
-/*#define TEST_WITH_WIFI_DIRECT */
+#define SUBMENU_GETTING_STREAM_INFO 2
 
 scmirroring_sink_h g_scmirroring = NULL;
 gint g_resolution = 0;
@@ -50,10 +51,16 @@ static gboolean __disconnect_p2p_connection(void);
 #endif
 static void __quit_program(void);
 gboolean       __timeout_menu_display(void *data);
+
+/* Submenu for setting resolution */
 static void __display_resolution_submenu(void);
 gboolean       __timeout_resolution_submenu_display(void *data);
 static void __interpret_resolution_submenu(char *cmd);
 
+/* Submenu for getting negotiated audio and video information */
+static void __display_stream_info_submenu(void);
+gboolean       __timeout_stream_info_submenu_display(void *data);
+static void __interpret_stream_info_submenu(char *cmd);
 
 gboolean __timeout_resolution_submenu_display(void *data)
 {
@@ -119,31 +126,158 @@ static void __interpret_resolution_submenu(char *cmd)
        return;
 }
 
+gboolean __timeout_stream_info_submenu_display(void *data)
+{
+       __display_stream_info_submenu();
+       return FALSE;
+}
+
+static void __display_stream_info_submenu(void)
+{
+       g_print("\n");
+       g_print("**********************************************************************\n");
+       g_print("     Getting negotiated audio and video information \n");
+       g_print("**********************************************************************\n");
+       g_print("1 : video codec\n");
+       g_print("2 : video resolution\n");
+       g_print("3 : video frame rate\n");
+       g_print("4 : audio codec\n");
+       g_print("5 : audio channel\n");
+       g_print("6 : audio sample rate\n");
+       g_print("7 : audio bitwidth\n");
+       g_print("g : Go back to main menu \n");
+       g_print("**********************************************************************\n");
+
+}
+
+static void __interpret_stream_info_submenu(char *cmd)
+{
+       int ret = SCMIRRORING_ERROR_NONE;
+       if (strncmp(cmd, "1", 1) == 0) {
+
+               scmirroring_video_codec_e codec;
+               ret = scmirroring_sink_get_negotiated_video_codec(g_scmirroring, &codec);
+               if (ret != SCMIRRORING_ERROR_NONE) {
+                       g_print("Error : scmirroring_sink_get_negotiated_video_codec fail[%d]\n", ret);
+               } else {
+                       switch (codec) {
+                               case SCMIRRORING_VIDEO_CODEC_H264:
+                                       g_print("video codec : H264[%d]\n", codec);
+                                       break;
+                               default:
+                                       g_print("video codec : NONE[%d]\n", codec);
+                                       break;
+                       }
+               }
+
+       } else if (strncmp(cmd, "2", 1) == 0) {
+
+               int width, height;
+               ret = scmirroring_sink_get_negotiated_video_resolution(g_scmirroring, &width, &height);
+               if (ret != SCMIRRORING_ERROR_NONE) {
+                       g_print("Error : scmirroring_sink_get_negotiated_video_resolution fail[%d]\n", ret);
+               } else {
+                       g_print("video resoltuion : width[%d], height[%d]\n", width, height);
+               }
+
+       } else if (strncmp(cmd, "3", 1) == 0) {
+
+               int frame_rate;
+               ret = scmirroring_sink_get_negotiated_video_frame_rate(g_scmirroring, &frame_rate);
+               if (ret != SCMIRRORING_ERROR_NONE) {
+                       g_print("Error : scmirroring_sink_get_negotiated_video_frame_rate fail[%d]\n", ret);
+               } else {
+                       g_print("video frame rate[%d]\n", frame_rate);
+               }
+
+       } else if (strncmp(cmd, "4", 1) == 0) {
+               scmirroring_audio_codec_e codec;
+               ret = scmirroring_sink_get_negotiated_audio_codec(g_scmirroring, &codec);
+               if (ret != SCMIRRORING_ERROR_NONE) {
+                       g_print("Error : scmirroring_sink_get_negotiated_audio_codec fail[%d]\n", ret);
+               } else {
+                       switch (codec) {
+                               case SCMIRRORING_AUDIO_CODEC_AAC:
+                                       g_print("audio codec : AAC[%d]\n", codec);
+                                       break;
+                               case SCMIRRORING_AUDIO_CODEC_AC3:
+                                       g_print("audio codec : AC3[%d]\n", codec);
+                                       break;
+                               case SCMIRRORING_AUDIO_CODEC_LPCM:
+                                       g_print("audio codec : LPCM[%d]\n", codec);
+                                       break;
+                               default:
+                                       g_print("audio codec : NONE[%d]\n", codec);
+                                       break;
+                       }
+               }
+
+       } else if (strncmp(cmd, "5", 1) == 0) {
+               int channel;
+               ret = scmirroring_sink_get_negotiated_audio_channel(g_scmirroring, &channel);
+               if (ret != SCMIRRORING_ERROR_NONE) {
+                       g_print("Error : scmirroring_sink_get_negotiated_audio_channel fail[%d]\n", ret);
+               } else {
+                       g_print("audio channel[%d]\n", channel);
+               }
+
+       } else if (strncmp(cmd, "6", 1) == 0) {
+               int sample_rate;
+               ret = scmirroring_sink_get_negotiated_audio_sample_rate(g_scmirroring, &sample_rate);
+               if (ret != SCMIRRORING_ERROR_NONE) {
+                       g_print("Error : scmirroring_sink_get_negotiated_audio_sample_rate fail[%d]\n", ret);
+               } else {
+                       g_print("audio sample rate[%d]\n", sample_rate);
+               }
+
+       } else if (strncmp(cmd, "7", 1) == 0) {
+               int bitwidth;
+               ret = scmirroring_sink_get_negotiated_audio_bitwidth(g_scmirroring, &bitwidth);
+               if (ret != SCMIRRORING_ERROR_NONE) {
+                       g_print("Error : scmirroring_sink_get_negotiated_audio_bitwidth fail[%d]\n", ret);
+               } else {
+                       g_print("audio bitwidth[%d]\n", bitwidth);
+               }
+
+       } else if (strncmp(cmd, "g", 1) == 0) {
+               g_print("go back to main menu\n");
+               g_menu = MAIN_MENU;
+               g_timeout_add(100, __timeout_menu_display, 0);
+               return;
+       }
+
+       g_timeout_add(100, __timeout_stream_info_submenu_display, 0);
+
+       return;
+}
+
 static void scmirroring_sink_state_callback(scmirroring_error_e error_code, scmirroring_sink_state_e state, void *user_data)
 {
-       g_print("Received Callback error code[%d] state[%d]", error_code, state);
+       g_print("Received Callback error code[%d]", error_code);
 
        if (state == SCMIRRORING_SINK_STATE_NONE)
-               g_print(" state[%d] SCMIRRORING_SINK_STATE_NONE", state);
+               g_print(" state[%d] SCMIRRORING_SINK_STATE_NONE\n", state);
        else if (state == SCMIRRORING_SINK_STATE_NULL)
-               g_print(" st ate[%d] (state == SCMIRRORING_SINK_STATE_NULL)", state);
+               g_print(" state[%d] SCMIRRORING_SINK_STATE_NULL\n", state);
        else if (state == SCMIRRORING_SINK_STATE_PREPARED)
-               g_print(" state[%d] SCMIRRORING_SINK_STATE_PREPARED", state);
+               g_print(" state[%d] SCMIRRORING_SINK_STATE_PREPARED\n", state);
        else if (state == SCMIRRORING_SINK_STATE_CONNECTED) {
-               g_print(" state[%d] SCMIRRORING_SINK_STATE_CONNECTED", state);
+
+               g_print(" state[%d] SCMIRRORING_SINK_STATE_CONNECTED\n", state);
                if (scmirroring_sink_start(g_scmirroring) != SCMIRRORING_ERROR_NONE)
                        g_print("scmirroring_sink_start fail");
+
        } else if (state == SCMIRRORING_SINK_STATE_PLAYING)
-               g_print(" state[%d] SCMIRRORING_SINK_STATE_PLAYING", state);
+               g_print(" state[%d] SCMIRRORING_SINK_STATE_PLAYING\n", state);
        else if (state == SCMIRRORING_SINK_STATE_PAUSED)
-               g_print(" state[%d] SCMIRRORING_SINK_STATE_PAUSED", state);
+               g_print(" state[%d] SCMIRRORING_SINK_STATE_PAUSED\n", state);
        else if (state == SCMIRRORING_SINK_STATE_DISCONNECTED) {
-               g_print(" state[%d] SCMIRRORING_SINK_STATE_DISCONNECTED", state);
+               g_print(" state[%d] SCMIRRORING_SINK_STATE_DISCONNECTED\n", state);
                if (scmirroring_sink_unprepare(g_scmirroring) != SCMIRRORING_ERROR_NONE) {
-                       g_print("scmirroring_sink_unprepare fail");
+                       g_print("scmirroring_sink_unprepare fail\n");
                }
                if (scmirroring_sink_destroy(g_scmirroring) != SCMIRRORING_ERROR_NONE) {
-                       g_print("scmirroring_sink_destroy fail");
+                       g_print("scmirroring_sink_destroy fail\n");
                }
                __quit_program();
        } else
@@ -178,6 +312,7 @@ static void __displaymenu(void)
        g_print("D : Disconnect\n");
        g_print("T : desTroy\n");
        g_print("L : Setting resolution\n");
+       g_print("G : Getting negotiated audio and video information\n");
        g_print("q : quit\n");
        g_print("-----------------------------------------------------------------------------------------\n");
 }
@@ -287,7 +422,7 @@ void _connection_cb(int error_code, wifi_direct_connection_state_e connection_st
        g_print("Connected [ error : %d connection state : %d mac_addr:%s ]\n", error_code, connection_state, mac_address);
 
        if (connection_state == WIFI_DIRECT_CONNECTION_REQ) {
-               ret = wifi_direct_accept_connection(mac_address);
+               ret = wifi_direct_accept_connection((char *)mac_address);
                if (ret != WIFI_DIRECT_ERROR_NONE) {
                        g_print("Error : wifi_direct_accept_connection failed : %d\n", ret);
                }
@@ -317,8 +452,10 @@ void _connection_cb(int error_code, wifi_direct_connection_state_e connection_st
 static void __interpret(char *cmd)
 {
        int ret = SCMIRRORING_ERROR_NONE;
+#ifndef TEST_WITH_WIFI_DIRECT
        gchar **value;
        value = g_strsplit(cmd, " ", 0);
+#endif
        if (strncmp(cmd, "D", 1) == 0) {
                g_print("Disconnect\n");
                ret = scmirroring_sink_disconnect(g_scmirroring);
@@ -338,6 +475,10 @@ static void __interpret(char *cmd)
                g_menu = SUBMENU_RESOLUTION;
                g_timeout_add(100, __timeout_resolution_submenu_display, 0);
                return;
+       } else if (strncmp(cmd, "G", 1) == 0) {
+               g_menu = SUBMENU_GETTING_STREAM_INFO;
+               g_timeout_add(100, __timeout_stream_info_submenu_display, 0);
+               return;
        }
 #ifndef TEST_WITH_WIFI_DIRECT
        else if (strncmp(cmd, "a", 1) == 0) {
@@ -378,6 +519,8 @@ gboolean __input(GIOChannel *channel)
                __interpret(buf);
        else if (g_menu == SUBMENU_RESOLUTION)
                __interpret_resolution_submenu(buf);
+       else if (g_menu == SUBMENU_GETTING_STREAM_INFO)
+               __interpret_stream_info_submenu(buf);
 
        return TRUE;
 }