- MM_WFD_SINK_UNKNOWN is not needed.
- For seperate operation of between R1 and R2 sink, i added create api 'mm_wfd_create_r2'
- change ‘status’ parameter return type gint to MMWFDCoupledSinkStatus
Change-Id: I7995e1d96f349186bbb2636193e7f61b79eb68c1
Signed-off-by: Hyunsoo Park <hance.park@samsung.com>
} MMWFDSinkVideoCodec;
typedef enum {
- MM_WFD_SINK_UNKNOWN = -1,
- MM_WFD_SINK_NOT_COUPLED = 0,
- MM_WFD_SINK_COUPLED,
- MM_WFD_SINK_TEARDOWN_COUPLING,
- MM_WFD_SINK_RESERVED
+ MM_WFD_COUPLED_SINK_STATUS_NOT_COUPLED = 0,
+ MM_WFD_COUPLED_SINK_STATUS_COUPLED,
+ MM_WFD_COUPLED_SINK_STATUS_TEARDOWN_COUPLING,
+ MM_WFD_COUPLED_SINK_STATUS_RESERVED
} MMWFDCoupledSinkStatus;
typedef void(*MMWFDMessageCallback)(int error_type, MMWFDSinkStateType state_type, void *user_data);
int mm_wfd_sink_create(MMHandleType *wfd_sink);
/**
+ * This function creates a wi-fi display wi-fi display R2 sink object. \n
+ * Description is same to 'mm_wfd_sink_create' but 'wfd_sink' parameter should be handle of wi-fi display R2(primary/secondary) sink. \n
+ *
+ * @param wfd_sink [out] Handle of wi-fi display R2(primary/secondary) sink
+ */
+int mm_wfd_sink_create_r2(MMHandleType *wfd_sink);
+
+/**
* This function trys to make gstreamer pipeline. \n
* If wi-fi display sink is realized, the state will become MM_WFD_SINK_STATE_READY.. \n
*
int mm_wfd_sink_get_current_state(MMHandleType wfd_sink_handle, gint *state);
/**
- * This function sets the coupled sink ip to sink\n
+ * This function sets the MAC address of wi-fi display sink for coupling wi-fi display sink.\n
*
* @param wfd_sink_handle [in] Handle of wi-fi display sink
- * @param status [in] Status which present the status of a wi-fi display sink's coupling with another wi-fi display sink
* @param address [in] Mac address of coupled wi-fi display sink.
*
* @return This function returns zero on success, or negative value with error code.
*
*/
-int mm_wfd_sink_set_coupled_sink(MMHandleType wfd_sink_handle, gint status, gchar* address);
+int mm_wfd_sink_set_coupled_sink(MMHandleType wfd_sink_handle, gchar* address);
#endif
guint coupled_sink_status;
gchar *coupled_sink_address;
+ gboolean is_coupled_sink_supported;
} mm_wfd_sink_t;
}
+int mm_wfd_sink_create_r2(MMHandleType *wfd_sink)
+{
+ int result = MM_ERROR_NONE;
+
+ result = mm_wfd_sink_create(wfd_sink);
+ if (result != MM_ERROR_NONE) {
+ wfd_sink_error("fail to create wi-fi display r2 sink handle. ret[%d]", result);
+ *wfd_sink = (MMHandleType)NULL;
+ return result;
+ }
+
+ ((mm_wfd_sink_t *)*wfd_sink)->is_coupled_sink_supported = TRUE;
+
+ return result;
+}
+
int mm_wfd_sink_prepare(MMHandleType wfd_sink_handle)
{
mm_wfd_sink_t *wfd_sink = (mm_wfd_sink_t *)wfd_sink_handle;
return result;
}
-int mm_wfd_sink_set_coupled_sink(MMHandleType wfd_sink_handle, gint status, gchar* address)
+int mm_wfd_sink_set_coupled_sink(MMHandleType wfd_sink_handle, gchar* address)
{
mm_wfd_sink_t *wfd_sink = (mm_wfd_sink_t *)wfd_sink_handle;
+ MMWFDSinkStateType cur_state = MM_WFD_SINK_STATE_NONE;
int result = MM_ERROR_NONE;
+
wfd_sink_debug_fenter();
+
wfd_sink_return_val_if_fail(wfd_sink, MM_ERROR_WFD_NOT_INITIALIZED);
- wfd_sink_return_val_if_fail(status, MM_ERROR_WFD_INVALID_ARGUMENT);
wfd_sink_return_val_if_fail(address, MM_ERROR_WFD_INVALID_ARGUMENT);
- if (status < MM_WFD_SINK_UNKNOWN || status > MM_WFD_SINK_TEARDOWN_COUPLING) {
- wfd_sink_error("Wrong status is returned. status [%d]", status);
- result = MM_ERROR_WFD_INVALID_ARGUMENT;
+ MMWFDSINK_CMD_LOCK(wfd_sink);
+ cur_state = MMWFDSINK_CURRENT_STATE(wfd_sink);
+ if (cur_state == MM_WFD_SINK_STATE_CONNECTED ||
+ cur_state == MM_WFD_SINK_STATE_PLAYING ||
+ cur_state == MM_WFD_SINK_STATE_PAUSED) {
+ wfd_sink_error("This function must be called before MM_WFD_SINK_STATE_CONNECTED");
+ result = MM_ERROR_WFD_INVALID_STATE;
} else {
- result = MM_ERROR_NONE;
+ if (wfd_sink->coupled_sink_address) {
+ wfd_sink_debug("coupled_sink_address is already set. [ %s]", wfd_sink->coupled_sink_address);
+ } else {
+ wfd_sink->coupled_sink_address = g_strdup(address);
+ wfd_sink_debug("coupled_sink_address is set [%s]", wfd_sink->coupled_sink_address);
+ }
}
-
- MMWFDSINK_CMD_LOCK(wfd_sink);
- wfd_sink->coupled_sink_status = status;
- wfd_sink->coupled_sink_address = g_strdup(address);
- wfd_sink_debug("coupled_sink in sink_t is [%d, %s]", wfd_sink->coupled_sink_status, wfd_sink->coupled_sink_address);
MMWFDSINK_CMD_UNLOCK(wfd_sink);
wfd_sink_debug_fleave();
/* Initialize video resolution */
new_wfd_sink->supportive_resolution = MM_WFD_SINK_RESOLUTION_UNKNOWN;
- /*Initialize coulped sink information*/
+ /* Initialize coulped sink information */
new_wfd_sink->coupled_sink_address = NULL;
- new_wfd_sink->coupled_sink_status = MM_WFD_SINK_NOT_COUPLED;
+ new_wfd_sink->coupled_sink_status = MM_WFD_COUPLED_SINK_STATUS_NOT_COUPLED;
+
+ /* In case of R2 sink, it would be TRUE */
+ new_wfd_sink->is_coupled_sink_supported = FALSE;
/* construct attributes */
new_wfd_sink->attrs = _mmwfd_construct_attribute((MMHandleType)new_wfd_sink);
/* release attributes */
_mmwfd_deconstruct_attribute(wfd_sink->attrs);
+ /* release the others */
+ g_free(wfd_sink->coupled_sink_address);
+
/* release manager thread */
if (MM_ERROR_NONE != _mm_wfd_sink_release_manager(wfd_sink)) {
wfd_sink_error("failed to release manager");
wfd_coupled_sink = gst_structure_new("wfd_coupled_sink",
"coupled_sink_status", G_TYPE_INT, wfd_sink->coupled_sink_status,
"coupled_sink_address", G_TYPE_STRING, wfd_sink->coupled_sink_address,
+ "is_coupled_sink_supported", G_TYPE_BOOLEAN, wfd_sink->is_coupled_sink_supported,
NULL);
- wfd_sink_debug("set wfd-coupled-sink status %d address %s", wfd_sink->coupled_sink_status, wfd_sink->coupled_sink_address);
if (wfd_coupled_sink) {
g_object_set(G_OBJECT(wfdsrc), "wfd-coupled-sink", wfd_coupled_sink, NULL);