From 96a4e62e0944954704236b8114f1655a03dd27ed Mon Sep 17 00:00:00 2001 From: "Hyunsoo, Park" Date: Tue, 21 Feb 2017 20:25:20 +0900 Subject: [PATCH] Change wfd message for video only mirroring Using this patch, 'wfd-audio-formats' parameter have none parameter for video only sink. Basically, screen mirroring provides video & audio simultaneously. This patch will make screen mirroring to provide Video only. -When Video only mirroring mode goes, it makes 'wfd_audio_codecs' messages to 'none'. If 'sink session mode' in 'mmfw_wfd_sink.ini' is set '2', screen mirroring runs without audio(that is, video only mirroring) Change-Id: Ib71d7b1b9faacc2b98b9f6e3ae20c9bebac4d350 Signed-off-by: Hyunsoo, Park --- packaging/gst-plugins-tizen.spec | 2 +- wfdmanager/wfdbase/gstwfdbasesrc.c | 12 +-- wfdmanager/wfdbase/gstwfdsinkmessage.c | 130 ++++++++++++++++++--------------- 3 files changed, 80 insertions(+), 64 deletions(-) diff --git a/packaging/gst-plugins-tizen.spec b/packaging/gst-plugins-tizen.spec index ffc4798..d9e66e0 100644 --- a/packaging/gst-plugins-tizen.spec +++ b/packaging/gst-plugins-tizen.spec @@ -5,7 +5,7 @@ Name: gst-plugins-tizen Version: 1.0.0 Summary: GStreamer tizen plugins (common) -Release: 37 +Release: 38 Group: Multimedia/Framework Url: http://gstreamer.freedesktop.org/ License: LGPL-2.1+ diff --git a/wfdmanager/wfdbase/gstwfdbasesrc.c b/wfdmanager/wfdbase/gstwfdbasesrc.c index dbba724..1342ee6 100644 --- a/wfdmanager/wfdbase/gstwfdbasesrc.c +++ b/wfdmanager/wfdbase/gstwfdbasesrc.c @@ -1750,9 +1750,9 @@ gst_wfd_base_src_handle_request (GstWFDBaseSrc * src, GstRTSPMessage * request) if (wfd_msg->audio_codecs || wfd_msg->video_formats || wfd_msg->video_3d_formats) { GstStructure *stream_info = gst_structure_new ("WFDStreamInfo", NULL, NULL); - if(wfd_msg->audio_codecs) { - res = gst_wfd_base_src_get_wfd_audio_codecseter(src, wfd_msg); - if(res != GST_RTSP_OK) { + if (wfd_msg->audio_codecs && wfd_msg->audio_codecs->count > 0) { + res = gst_wfd_base_src_get_wfd_audio_codecseter (src, wfd_msg); + if (res != GST_RTSP_OK) { goto message_config_error; } @@ -1764,9 +1764,9 @@ gst_wfd_base_src_handle_request (GstWFDBaseSrc * src, GstRTSPMessage * request) NULL); } - if(wfd_msg->video_formats) { - res = gst_wfd_base_src_get_wfd_video_formatseter(src, wfd_msg); - if(res != GST_RTSP_OK) { + if (wfd_msg->video_formats && wfd_msg->video_formats->count > 0) { + res = gst_wfd_base_src_get_wfd_video_formatseter (src, wfd_msg); + if (res != GST_RTSP_OK) { goto message_config_error; } diff --git a/wfdmanager/wfdbase/gstwfdsinkmessage.c b/wfdmanager/wfdbase/gstwfdsinkmessage.c index 83a3026..333eada 100644 --- a/wfdmanager/wfdbase/gstwfdsinkmessage.c +++ b/wfdmanager/wfdbase/gstwfdsinkmessage.c @@ -272,8 +272,8 @@ gst_wfd_message_as_text(const GstWFDMessage *msg) if (msg->audio_codecs) { guint i = 0; g_string_append_printf(lines, GST_STRING_WFD_AUDIO_CODECS); + g_string_append_printf(lines, GST_STRING_WFD_COLON); if (msg->audio_codecs->list) { - g_string_append_printf(lines, GST_STRING_WFD_COLON); for (; i < msg->audio_codecs->count; i++) { g_string_append_printf(lines, " %s", msg->audio_codecs->list[i].audio_format); g_string_append_printf(lines, " %08x", msg->audio_codecs->list[i].modes); @@ -281,6 +281,9 @@ gst_wfd_message_as_text(const GstWFDMessage *msg) if ((i + 1) < msg->audio_codecs->count) g_string_append_printf(lines, GST_STRING_WFD_COMMA); } + } else { + g_string_append_printf(lines, GST_STRING_WFD_SPACE); + g_string_append_printf(lines, GST_STRING_WFD_NONE); } g_string_append_printf(lines, GST_STRING_WFD_CRLF); } @@ -730,55 +733,66 @@ gst_wfd_parse_line(GstWFDMessage *msg, gchar *buffer) /*g_print("gst_wfd_parse_line input: %s\n", buffer); */ read_string_type_and_value(type, value, sizeof(type), sizeof(value), ':', p); /*g_print("gst_wfd_parse_line type:%s value:%s\n", type, value); */ + if (!g_strcmp0(type, GST_STRING_WFD_AUDIO_CODECS)) { msg->audio_codecs = g_new0(GstWFDAudioCodeclist, 1); if (strlen(v)) { - guint i = 0; - msg->audio_codecs->count = strlen(v) / 16; - msg->audio_codecs->list = g_new0(GstWFDAudioCodec, msg->audio_codecs->count); - for (; i < msg->audio_codecs->count; i++) { - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_STRING(msg->audio_codecs->list[i].audio_format); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->audio_codecs->list[i].modes); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->audio_codecs->list[i].latency); - GST_WFD_SKIP_COMMA(v); + if (!strcmp(v, GST_STRING_WFD_NONE)) { + msg->audio_codecs->list = NULL; + msg->audio_codecs->count = 0; + } else { + guint i = 0; + msg->audio_codecs->count = strlen(v) / 16; + msg->audio_codecs->list = g_new0(GstWFDAudioCodec, msg->audio_codecs->count); + for (; i < msg->audio_codecs->count; i++) { + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_STRING(msg->audio_codecs->list[i].audio_format); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->audio_codecs->list[i].modes); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->audio_codecs->list[i].latency); + GST_WFD_SKIP_COMMA(v); + } } } } else if (!g_strcmp0(type, GST_STRING_WFD_VIDEO_FORMATS)) { msg->video_formats = g_new0(GstWFDVideoCodeclist, 1); if (strlen(v)) { - msg->video_formats->count = 1; - msg->video_formats->list = g_new0(GstWFDVideoCodec, 1); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->native); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->preferred_display_mode_supported); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.profile); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.level); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.CEA_Support); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.VESA_Support); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.HH_Support); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.latency); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.min_slice_size); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.slice_enc_params); - GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support); - GST_WFD_SKIP_SPACE(v); - if (msg->video_formats->list->preferred_display_mode_supported == GST_WFD_PREFERRED_DISPLAY_MODE_SUPPORTED) { - GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.max_hres); + if (!strcmp(v, GST_STRING_WFD_NONE)) { + msg->video_formats->count = 0 ; + msg->video_formats->list = NULL; + } else { + msg->video_formats->count = 1; + msg->video_formats->list = g_new0(GstWFDVideoCodec, 1); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->video_formats->list->native); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->video_formats->list->preferred_display_mode_supported); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.profile); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.level); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.CEA_Support); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.VESA_Support); GST_WFD_SKIP_SPACE(v); - GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.max_vres); + GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.HH_Support); GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.latency); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.min_slice_size); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.slice_enc_params); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support); + GST_WFD_SKIP_SPACE(v); + if (msg->video_formats->list->preferred_display_mode_supported == GST_WFD_PREFERRED_DISPLAY_MODE_SUPPORTED) { + GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.max_hres); + GST_WFD_SKIP_SPACE(v); + GST_WFD_READ_UINT32(msg->video_formats->list->H264_codec.max_vres); + GST_WFD_SKIP_SPACE(v); + } } } } else if (!g_strcmp0(type, GST_STRING_WFD_3D_VIDEO_FORMATS)) { @@ -1304,21 +1318,25 @@ GstWFDResult gst_wfd_message_set_preferred_audio_format(GstWFDMessage *msg, GstW if (!msg->audio_codecs) msg->audio_codecs = g_new0(GstWFDAudioCodeclist, 1); - - msg->audio_codecs->list = g_new0(GstWFDAudioCodec, 1); - msg->audio_codecs->count = 1; - if (aCodec == GST_WFD_AUDIO_LPCM) { - msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_LPCM); - msg->audio_codecs->list->modes = aFreq; - msg->audio_codecs->list->latency = aLatency; - } else if (aCodec == GST_WFD_AUDIO_AAC) { - msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_AAC); - msg->audio_codecs->list->modes = aChanels; - msg->audio_codecs->list->latency = aLatency; - } else if (aCodec == GST_WFD_AUDIO_AC3) { - msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_AC3); - msg->audio_codecs->list->modes = aChanels; - msg->audio_codecs->list->latency = aLatency; + if (aCodec != GST_WFD_AUDIO_UNKNOWN) { + msg->audio_codecs->list = g_new0(GstWFDAudioCodec, 1); + msg->audio_codecs->count = 1; + if (aCodec == GST_WFD_AUDIO_LPCM) { + msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_LPCM); + msg->audio_codecs->list->modes = aFreq; + msg->audio_codecs->list->latency = aLatency; + } else if (aCodec == GST_WFD_AUDIO_AAC) { + msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_AAC); + msg->audio_codecs->list->modes = aChanels; + msg->audio_codecs->list->latency = aLatency; + } else if (aCodec == GST_WFD_AUDIO_AC3) { + msg->audio_codecs->list->audio_format = g_strdup(GST_STRING_WFD_AC3); + msg->audio_codecs->list->modes = aChanels; + msg->audio_codecs->list->latency = aLatency; + } + } else { + msg->audio_codecs->list = NULL; + msg->audio_codecs->count = 0; } return GST_WFD_OK; } @@ -1329,7 +1347,6 @@ GstWFDResult gst_wfd_message_get_supported_audio_format(GstWFDMessage *msg, guin guint i = 0; g_return_val_if_fail(msg != NULL, GST_WFD_EINVAL); g_return_val_if_fail(msg->audio_codecs != NULL, GST_WFD_EINVAL); - for (; i < msg->audio_codecs->count; i++) { if (!g_strcmp0(msg->audio_codecs->list[i].audio_format, GST_STRING_WFD_LPCM)) { *aCodec |= GST_WFD_AUDIO_LPCM; @@ -1358,7 +1375,6 @@ GstWFDResult gst_wfd_message_get_preferred_audio_format(GstWFDMessage *msg, GstW guint *aBitwidth, guint32 *aLatency) { g_return_val_if_fail(msg != NULL, GST_WFD_EINVAL); - if (!g_strcmp0(msg->audio_codecs->list->audio_format, GST_STRING_WFD_LPCM)) { *aCodec = GST_WFD_AUDIO_LPCM; *aFreq = msg->audio_codecs->list->modes; -- 2.7.4