-It is of no use setting coupled sink information when teardown.
-Add coupling mode process
Change-Id: Ie7fe95676530ef8eb207d98544dc035a0e95f7b1
Signed-off-by: Hyunsoo Park <hance.park@samsung.com>
} else if (!g_strcmp0 (attr, GST_STRING_WFD_COUPLED_SINK)) {
msg->coupled_sink = g_new0 (GstWFDCoupledSink, 1);
if (strlen (v)) {
- msg->coupled_sink->coupled_sink_cap = g_new0 (GstWFDCoupled_sink_cap, 1);
+ msg->coupled_sink->coupled_sink_cap = g_new0 (GstWFDCoupledSinkCap, 1);
WFD_SKIP_SPACE (v);
WFD_READ_UINT32 (msg->coupled_sink->coupled_sink_cap->status);
WFD_SKIP_SPACE (v);
if (msg->coupled_sink) {
g_string_append_printf (lines, GST_STRING_WFD_COUPLED_SINK);
g_string_append_printf (lines, ":");
- if (msg->coupled_sink->coupled_sink_cap) {
+ if (msg->coupled_sink->coupled_sink_cap &&
+ (gboolean)msg->coupled_sink->coupled_sink_cap->sink_supported == TRUE) {
g_string_append_printf (lines, " %02x",
msg->coupled_sink->coupled_sink_cap->status);
if (msg->coupled_sink->coupled_sink_cap->sink_address)
return GST_WFD_OK;
}
+GstWFDResult gst_wfd_message_set_coupled_sink(GstWFDMessage *msg,
+ GstWFDCoupledSinkStatus status, gchar *sink_address, gboolean sink_supported)
+{
+ g_return_val_if_fail(msg != NULL, GST_WFD_EINVAL);
+ if (!msg->coupled_sink) msg->coupled_sink = g_new0(GstWFDCoupledSink, 1);
+ if (!sink_supported) return GST_WFD_OK;
+ msg->coupled_sink->coupled_sink_cap = g_new0(GstWFDCoupledSinkCap, 1);
+ msg->coupled_sink->coupled_sink_cap->status = status;
+ msg->coupled_sink->coupled_sink_cap->sink_address = g_strdup(sink_address);
+ msg->coupled_sink->coupled_sink_cap->sink_supported = sink_supported;
+ return GST_WFD_OK;
+}
+
+GstWFDResult gst_wfd_message_get_coupled_sink(GstWFDMessage *msg,
+ GstWFDCoupledSinkStatus *status, gchar **sink_address, gboolean *sink_supported)
+{
+ g_return_val_if_fail(msg != NULL, GST_WFD_EINVAL);
+ if (msg->coupled_sink
+ && msg->coupled_sink->coupled_sink_cap->sink_supported) {
+ *status = msg->coupled_sink->coupled_sink_cap->status;
+ *sink_address = g_strdup(msg->coupled_sink->coupled_sink_cap->sink_address);
+ *sink_supported = (gboolean)msg->coupled_sink->coupled_sink_cap->sink_supported;
+ }
+ else {
+ *status = GST_WFD_SINK_NOT_COUPLED;
+ }
+ return GST_WFD_OK;
+}
GstWFDResult
gst_wfd_message_set_contentprotection_type (GstWFDMessage * msg,
} GstWFDHDCPProtection;
typedef enum {
- GST_WFD_SINK_UNKNOWN = -1,
- GST_WFD_SINK_NOT_COUPLED = 0,
- GST_WFD_SINK_COUPLED,
- GST_WFD_SINK_TEARDOWN_COUPLING,
- GST_WFD_SINK_RESERVED
+ GST_WFD_SINK_NOT_COUPLED = 0,
+ GST_WFD_SINK_COUPLED = (1 << 0),
+ GST_WFD_SINK_TEARDOWN_COUPLING = (1 << 1)
} GstWFDCoupledSinkStatus;
typedef enum {
typedef struct {
guint status;
gchar *sink_address;
-} GstWFDCoupled_sink_cap;
+ gboolean sink_supported;
+} GstWFDCoupledSinkCap;
typedef struct {
- GstWFDCoupled_sink_cap *coupled_sink_cap;
+ GstWFDCoupledSinkCap *coupled_sink_cap;
} GstWFDCoupledSink;
typedef struct {
guint32 *edid_blockcount,
gchar **edid_playload);
+GstWFDResult gst_wfd_message_set_coupled_sink(GstWFDMessage *msg,
+ GstWFDCoupledSinkStatus status,
+ gchar *sink_address,
+ gboolean sink_supported);
+
+GstWFDResult gst_wfd_message_get_coupled_sink(GstWFDMessage *msg,
+ GstWFDCoupledSinkStatus *status,
+ gchar **sink_address,
+ gboolean *sink_supported);
+
GstWFDResult gst_wfd_message_set_contentprotection_type (GstWFDMessage *msg,
GstWFDHDCPProtection hdcpversion,
guint32 TCPPort);
/* enable or disable R2 features */
gboolean wfd2_mode;
gint wfd2_supported;
+ gboolean coupling_mode;
+
+ guint coupled_sink_status;
+ gchar *coupled_sink_address;
+ gboolean coupled_sink_supported;
};
#define DEFAULT_WFD_TIMEOUT 60
priv->report_type = WFD_TS_REP_AUDIO;
priv->wfd2_supported = 0;
+ priv->coupled_sink_address = NULL;
g_mutex_init (&priv->tcp_send_lock);
GST_INFO_OBJECT (client, "Client is initialized");
} else if (!priv->m4_done) {
GST_INFO_OBJECT (_client, "M4 response is done");
priv->m4_done = TRUE;
-
- gst_rtsp_wfd_client_trigger_request (_client, WFD_TRIGGER_SETUP);
+ /* Checks whether server is 'coupling mode' or not */
+ GST_DEBUG_OBJECT (client, "server coupling mode [%d]",priv->coupling_mode );
+ if (priv->coupling_mode) {
+ gst_rtsp_wfd_client_trigger_request (_client, WFD_TRIGGER_TEARDOWN_COUPLING);
+ } else {
+ gst_rtsp_wfd_client_trigger_request (_client, WFD_TRIGGER_SETUP);
+ }
} else {
g_mutex_lock (&priv->keep_alive_lock);
if (priv->keep_alive_flag == FALSE) {
M4_RES_MSG,
M5_REQ_MSG,
TEARDOWN_TRIGGER,
+ TEARDOWN_COUPLING_TRIGGER,
PLAY_TRIGGER,
PAUSE_TRIGGER,
TS_REQ_MSG,
"Failed to set tcp ports parameter on wfd message...");
goto error;
}
+
+ /* set the coupled sink for the WFD server */
+ wfd_res =
+ gst_wfd_message_set_coupled_sink (msg, GST_WFD_SINK_NOT_COUPLED, NULL, TRUE);
+
+ if (wfd_res != GST_WFD_OK) {
+ GST_ERROR_OBJECT (client,
+ "Failed to set coupled sink parameter on wfd message...");
+ goto error;
+ }
+
*data = gst_wfd_message_param_names_as_text (msg);
if (*data == NULL) {
GST_ERROR_OBJECT (client, "Failed to get wfd message as text...");
*len = strlen (*data);
}
} else if (msg_type == M5_REQ_MSG) {
- buf = g_string_new ("");
+ buf = g_string_new ("wfd_trigger_method: SETUP\r\n");
if (buf == NULL)
goto error;
- g_string_append (buf, "wfd_trigger_method: SETUP");
- g_string_append (buf, "\r\n");
*len = buf->len;
*data = g_string_free (buf, FALSE);
} else if (msg_type == TEARDOWN_TRIGGER) {
- buf = g_string_new ("");
+ buf = g_string_new ("wfd_trigger_method: TEARDOWN\r\n");
+ if (buf == NULL)
+ goto error;
+ *len = buf->len;
+ *data = g_string_free (buf, FALSE);
+ } else if (msg_type == TEARDOWN_COUPLING_TRIGGER) {
+ buf = g_string_new ("wfd_trigger_method: TEARDOWN_COUPLING\r\n");
if (buf == NULL)
goto error;
- g_string_append (buf, "wfd_trigger_method: TEARDOWN");
- g_string_append (buf, "\r\n");
*len = buf->len;
*data = g_string_free (buf, FALSE);
} else if (msg_type == PLAY_TRIGGER) {
- buf = g_string_new ("");
+ buf = g_string_new ("wfd_trigger_method: PLAY\r\n");
if (buf == NULL)
goto error;
- g_string_append (buf, "wfd_trigger_method: PLAY");
- g_string_append (buf, "\r\n");
*len = buf->len;
*data = g_string_free (buf, FALSE);
} else if (msg_type == PAUSE_TRIGGER) {
- buf = g_string_new ("");
+ buf = g_string_new ("wfd_trigger_method: PAUSE\r\n");
if (buf == NULL)
goto error;
- g_string_append (buf, "wfd_trigger_method: PAUSE");
- g_string_append (buf, "\r\n");
*len = buf->len;
*data = g_string_free (buf, FALSE);
}
g_free (msg);
break;
}
+ case WFD_TRIGGER_TEARDOWN_COUPLING:{
+ gchar *msg;
+ guint msglen = 0;
+ GString *msglength;
+
+ /* add content type */
+ res =
+ gst_rtsp_message_add_header (request, GST_RTSP_HDR_CONTENT_TYPE,
+ "text/parameters");
+ if (res != GST_RTSP_OK) {
+ GST_ERROR_OBJECT (client, "Failed to add header to rtsp request...");
+ goto error;
+ }
+
+ _set_wfd_message_body (client, TEARDOWN_COUPLING_TRIGGER, &msg, &msglen);
+ msglength = g_string_new ("");
+ g_string_append_printf (msglength, "%d", msglen);
+ GST_DEBUG ("Trigger TEARDOWN server side message body: %s", msg);
+
+ /* add content-length type */
+ res =
+ gst_rtsp_message_add_header (request, GST_RTSP_HDR_CONTENT_LENGTH,
+ g_string_free (msglength, FALSE));
+ if (res != GST_RTSP_OK) {
+ GST_ERROR_OBJECT (client, "Failed to add header to rtsp message...");
+ goto error;
+ }
+
+ res = gst_rtsp_message_set_body (request, (guint8 *) msg, msglen);
+ if (res != GST_RTSP_OK) {
+ GST_ERROR_OBJECT (client, "Failed to add header to rtsp message...");
+ goto error;
+ }
+
+ g_free (msg);
+ break;
+ }
case WFD_TRIGGER_PLAY:{
gchar *msg;
guint msglen = 0;
return res;
}
+GstRTSPResult
+gst_rtsp_wfd_client_set_coupling_mode (GstRTSPWFDClient * client,
+ gboolean coupling_mode)
+{
+ GstRTSPResult res = GST_RTSP_OK;
+ GstRTSPWFDClientPrivate *priv = GST_RTSP_WFD_CLIENT_GET_PRIVATE (client);
+
+ g_return_val_if_fail (priv != NULL, GST_RTSP_EINVAL);
+ priv->coupling_mode = coupling_mode;
+
+ return res;
+}
+
+
static gboolean
wfd_ckeck_keep_alive_response (gpointer userdata)
{
return priv->protection_enabled;
}
+gboolean
+gst_rtsp_wfd_client_get_coupling_mode (GstRTSPWFDClient * client)
+{
+ GstRTSPWFDClientPrivate *priv = GST_RTSP_WFD_CLIENT_GET_PRIVATE (client);
+ g_return_val_if_fail (priv != NULL, 0);
+
+ return priv->coupling_mode;
+}
+
void
gst_rtsp_wfd_client_set_audio_freq (GstRTSPWFDClient * client, guint freq)
{
WFD_TRIGGER_SETUP,
WFD_TRIGGER_PAUSE,
WFD_TRIGGER_TEARDOWN,
+ WFD_TRIGGER_TEARDOWN_COUPLING,
WFD_TRIGGER_PLAY
} GstWFDTriggerType;
GstRTSPWFDClient * client, guint8 audio_codec);
GstRTSPResult gst_rtsp_wfd_client_set_direct_streaming(
GstRTSPWFDClient * client, gint direct_streaming, gchar *urisrc);
+GstRTSPResult gst_rtsp_wfd_client_set_coupling_mode(
+ GstRTSPWFDClient * client, gboolean coupling_mode);
+
GstRTSPResult gst_prepare_request (GstRTSPWFDClient * client,
GstRTSPMessage * request, GstRTSPMethod method, gchar * url);
void gst_send_request (GstRTSPWFDClient * client,
guint32 gst_rtsp_wfd_client_get_edid_hresolution(GstRTSPWFDClient *client);
guint32 gst_rtsp_wfd_client_get_edid_vresolution(GstRTSPWFDClient *client);
gboolean gst_rtsp_wfd_client_get_protection_enabled(GstRTSPWFDClient *client);
+gboolean gst_rtsp_wfd_client_get_coupling_mode(GstRTSPWFDClient *client);
+
void gst_rtsp_wfd_client_set_audio_freq(GstRTSPWFDClient *client, guint freq);
void gst_rtsp_wfd_client_set_edid_supported(GstRTSPWFDClient *client, gboolean supported);
guint8 audio_codec;
guint8 video_codec;
gint wfd2_supported;
+ gboolean coupling_mode;
};
G_DEFINE_TYPE (GstRTSPWFDServer, gst_rtsp_wfd_server, GST_TYPE_RTSP_SERVER);
server->priv->native_resolution = 0;
server->priv->supported_resolution = 1;
server->priv->audio_codec = 2;
+ server->priv->coupling_mode = FALSE;
GST_INFO_OBJECT (server, "New server is initialized");
}
gst_rtsp_wfd_client_set_video_codec (client, priv->video_codec);
+ gst_rtsp_wfd_client_set_coupling_mode (client, priv->coupling_mode);
+
/* enable or disable R2 features following ini */
gst_rtsp_wfd_client_set_wfd2_supported (client, priv->wfd2_supported);
return res;
}
+
+GstRTSPResult
+gst_rtsp_wfd_server_set_coupling_mode (GstRTSPWFDServer * server,
+ gboolean coupling_mode)
+{
+ GstRTSPResult res = GST_RTSP_OK;
+ GstRTSPWFDServerPrivate *priv = GST_RTSP_WFD_SERVER_GET_PRIVATE (server);
+
+ g_return_val_if_fail (GST_IS_RTSP_WFD_SERVER (server), GST_RTSP_ERROR);
+ g_return_val_if_fail (priv != NULL, GST_RTSP_ERROR);
+
+ GST_RTSP_WFD_SERVER_LOCK (server);
+ priv->coupling_mode = coupling_mode;
+ GST_RTSP_WFD_SERVER_UNLOCK (server);
+ return res;
+}
+
GstRTSPResult
gst_rtsp_wfd_server_switch_to_udp (GstRTSPWFDServer *server)
{
GstRTSPResult gst_rtsp_wfd_server_set_video_codec (GstRTSPWFDServer *server, guint8 video_codec);
GstRTSPResult gst_rtsp_wfd_server_set_audio_codec (GstRTSPWFDServer *server, guint8 audio_codec);
GstRTSPResult gst_rtsp_wfd_server_set_direct_streaming (GstRTSPWFDServer *server, gint direct_streaming, gchar *urisrc);
+GstRTSPResult gst_rtsp_wfd_server_set_coupling_mode (GstRTSPWFDServer *server, gboolean coupling_mode);
+
GstRTSPResult gst_rtsp_wfd_server_switch_to_udp (GstRTSPWFDServer *server);
GstRTSPResult gst_rtsp_wfd_server_switch_to_tcp (GstRTSPWFDServer *server);
GstRTSPResult gst_rtsp_wfd_server_set_wfd2_supported (GstRTSPWFDServer *server, guint flag);
Name: gst-rtsp-server
Summary: Multimedia Framework Library
Version: 1.12.2
-Release: 10
+Release: 11
Url: http://gstreamer.freedesktop.org/
Group: System/Libraries
License: LGPL-2.0+