From 09b4ae52d533a2fbaf7a96466a92daeb3da7e553 Mon Sep 17 00:00:00 2001 From: Sangkyu Park Date: Tue, 28 Jul 2015 14:33:41 +0900 Subject: [PATCH] Fix to use string for wfd rtsp message. Change-Id: I2de2b0c69dd56f8bd184b2af94460debb674b2d9 Signed-off-by: Sangkyu Park --- packaging/libmm-scmirroring-common.spec | 2 +- wfdconfig/include/wfdconfigmessage.h | 48 ++- wfdconfig/wfdconfigmessage.c | 599 +++++++++++++++++--------------- 3 files changed, 375 insertions(+), 274 deletions(-) diff --git a/packaging/libmm-scmirroring-common.spec b/packaging/libmm-scmirroring-common.spec index cbeb4b7..9c8c6ef 100755 --- a/packaging/libmm-scmirroring-common.spec +++ b/packaging/libmm-scmirroring-common.spec @@ -1,6 +1,6 @@ Name: libmm-scmirroring-common Summary: Multimedia Framework Wifi-Display Common Library -Version: 0.0.40 +Version: 0.0.41 Release: 0 Group: System/Libraries License: Apache License 2.0 diff --git a/wfdconfig/include/wfdconfigmessage.h b/wfdconfig/include/wfdconfigmessage.h index d9c942b..d6e637e 100755 --- a/wfdconfig/include/wfdconfigmessage.h +++ b/wfdconfig/include/wfdconfigmessage.h @@ -46,6 +46,52 @@ G_BEGIN_DECLS #define STRING_WFD_STANDBY "wfd_standby" #define STRING_WFD_CONNECTOR_TYPE "wfd_connector_type" #define STRING_WFD_IDR_REQUEST "wfd_idr_request" +#define STRING_WFD_NONE "none" +#define STRING_WFD_ENABLE "enable" +#define STRING_WFD_DISABLE "disable" +#define STRING_WFD_CRLF "\r\n" +#define STRING_WFD_SPACE " " +#define STRING_WFD_INPUT_CATEGORY_LIST "input_category_list" +#define STRING_WFD_GENERIC "GENERIC" +#define STRING_WFD_HIDC "HIDC" +#define STRING_WFD_GENERIC_CAP_LIST "generic_cap_list" +#define STRING_WFD_KEYBOARD "Keyboard" +#define STRING_WFD_MOUSE "Mouse" +#define STRING_WFD_SINGLE_TOUCH "SingleTouch" +#define STRING_WFD_MULTI_TOUCH "MultiTouch" +#define STRING_WFD_JOYSTICK "Joystick" +#define STRING_WFD_CAMERA "Camera" +#define STRING_WFD_GESTURE "Gesture" +#define STRING_WFD_REMOTE_CONTROL "RemoteControl" +#define STRING_WFD_HIDC_CAP_LIST "hidc_cap_list" +#define STRING_WFD_INFRARED "Infrared" +#define STRING_WFD_USB "USB" +#define STRING_WFD_BT "BT" +#define STRING_WFD_ZIGBEE "Zigbee" +#define STRING_WFD_WIFI "Wi-Fi" +#define STRING_WFD_NO_SP "No-SP" +#define STRING_WFD_PORT "port" +#define STRING_WFD_SUPPORTED "supported" +#define STRING_WFD_LPCM "LPCM" +#define STRING_WFD_AAC "AAC" +#define STRING_WFD_AC3 "AC3" +#define STRING_WFD_HDCP2_0 "HDCP2.0" +#define STRING_WFD_HDCP2_1 "HDCP2.1" +#define STRING_WFD_SETUP "SETUP" +#define STRING_WFD_PAUSE "PAUSE" +#define STRING_WFD_TEARDOWN "TEARDOWN" +#define STRING_WFD_PLAY "PLAY" +#define STRING_WFD_RTP "RTP" +#define STRING_WFD_RDT "RDT" +#define STRING_WFD_AVP "AVP" +#define STRING_WFD_SAVP "SAVP" +#define STRING_WFD_UDP "UDP" +#define STRING_WFD_TCP "TCP" +#define STRING_WFD_UNICAST "unicast" +#define STRING_WFD_MULTICAST "multicast" +#define STRING_WFD_TCP_HTTP "HTTP" +#define STRING_WFD_PRIMARY "primary" +#define STRING_WFD_SECONDARY "secondary" /** * WFDResult: @@ -316,7 +362,7 @@ typedef struct { } WFDVideoCodeclist; typedef struct { - guint video_3d_capability; + guint64 video_3d_capability; guint latency; guint min_slice_size; guint slice_enc_params; diff --git a/wfdconfig/wfdconfigmessage.c b/wfdconfig/wfdconfigmessage.c index ba20888..06dcdf3 100755 --- a/wfdconfig/wfdconfigmessage.c +++ b/wfdconfig/wfdconfigmessage.c @@ -277,7 +277,7 @@ wfdconfig_message_as_text(const WFDMessage *msg) g_string_append_printf(lines, ","); } } - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } /* list of video codecs */ @@ -297,17 +297,20 @@ wfdconfig_message_as_text(const WFDMessage *msg) g_string_append_printf(lines, " %04x", msg->video_formats->list->H264_codec.misc_params.slice_enc_params); g_string_append_printf(lines, " %02x", msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support); - if (msg->video_formats->list->H264_codec.max_hres) + if (msg->video_formats->list->H264_codec.max_hres) { g_string_append_printf(lines, " %04x", msg->video_formats->list->H264_codec.max_hres); - else - g_string_append_printf(lines, " none"); - - if (msg->video_formats->list->H264_codec.max_vres) + } else { + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); + } + if (msg->video_formats->list->H264_codec.max_vres) { g_string_append_printf(lines, " %04x", msg->video_formats->list->H264_codec.max_vres); - else - g_string_append_printf(lines, " none"); + } else { + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); + } } - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } /* list of video 3D codecs */ @@ -319,23 +322,29 @@ wfdconfig_message_as_text(const WFDMessage *msg) g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->preferred_display_mode_supported); g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->H264_codec.profile); g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->H264_codec.level); - g_string_append_printf(lines, " %16x", msg->video_3d_formats->list->H264_codec.misc_params.video_3d_capability); + g_string_append_printf(lines, " %016llx", msg->video_3d_formats->list->H264_codec.misc_params.video_3d_capability); g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->H264_codec.misc_params.latency); g_string_append_printf(lines, " %04x", msg->video_3d_formats->list->H264_codec.misc_params.min_slice_size); g_string_append_printf(lines, " %04x", msg->video_3d_formats->list->H264_codec.misc_params.slice_enc_params); g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->H264_codec.misc_params.frame_rate_control_support); - if (msg->video_3d_formats->list->H264_codec.max_hres) + if (msg->video_3d_formats->list->H264_codec.max_hres) { g_string_append_printf(lines, " %04x", msg->video_formats->list->H264_codec.max_hres); - else - g_string_append_printf(lines, " none"); - if (msg->video_3d_formats->list->H264_codec.max_vres) + } else { + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); + } + + if (msg->video_3d_formats->list->H264_codec.max_vres) { g_string_append_printf(lines, " %04x", msg->video_formats->list->H264_codec.max_vres); - else - g_string_append_printf(lines, " none"); + } else { + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); + } } else { - g_string_append_printf(lines, " none"); + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); } - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->content_protection) { @@ -346,12 +355,14 @@ wfdconfig_message_as_text(const WFDMessage *msg) g_string_append_printf(lines, " %s", msg->content_protection->hdcp2_spec->hdcpversion); g_string_append_printf(lines, " %s", msg->content_protection->hdcp2_spec->TCPPort); } else { - g_string_append_printf(lines, " none"); + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); } } else { - g_string_append_printf(lines, " none"); + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); } - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->display_edid) { @@ -359,14 +370,17 @@ wfdconfig_message_as_text(const WFDMessage *msg) g_string_append_printf(lines, ":"); if (msg->display_edid->edid_supported) { g_string_append_printf(lines, " %d", msg->display_edid->edid_supported); - if (msg->display_edid->edid_block_count) + if (msg->display_edid->edid_block_count) { g_string_append_printf(lines, " %d", msg->display_edid->edid_block_count); - else - g_string_append_printf(lines, " none"); + } else { + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); + } } else { - g_string_append_printf(lines, " none"); + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); } - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->coupled_sink) { @@ -374,35 +388,42 @@ wfdconfig_message_as_text(const WFDMessage *msg) g_string_append_printf(lines, ":"); if (msg->coupled_sink->coupled_sink_cap) { g_string_append_printf(lines, " %02x", msg->coupled_sink->coupled_sink_cap->status); - if (msg->coupled_sink->coupled_sink_cap->sink_address) + if (msg->coupled_sink->coupled_sink_cap->sink_address) { g_string_append_printf(lines, " %s", msg->coupled_sink->coupled_sink_cap->sink_address); - else - g_string_append_printf(lines, " none"); + } else { + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); + } } else { - g_string_append_printf(lines, " none"); + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); } - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->trigger_method) { g_string_append_printf(lines, STRING_WFD_TRIGGER_METHOD); g_string_append_printf(lines, ":"); g_string_append_printf(lines, " %s", msg->trigger_method->wfd_trigger_method); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->presentation_url) { g_string_append_printf(lines, STRING_WFD_PRESENTATION_URL); g_string_append_printf(lines, ":"); - if (msg->presentation_url->wfd_url0) + if (msg->presentation_url->wfd_url0) { g_string_append_printf(lines, " %s", msg->presentation_url->wfd_url0); - else - g_string_append_printf(lines, " none"); - if (msg->presentation_url->wfd_url1) + } else { + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); + } + if (msg->presentation_url->wfd_url1) { g_string_append_printf(lines, " %s", msg->presentation_url->wfd_url1); - else - g_string_append_printf(lines, " none"); - g_string_append_printf(lines, "\r\n"); + } else { + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); + } + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->client_rtp_ports) { @@ -414,24 +435,26 @@ wfdconfig_message_as_text(const WFDMessage *msg) g_string_append_printf(lines, " %d", msg->client_rtp_ports->rtp_port1); g_string_append_printf(lines, " %s", msg->client_rtp_ports->mode); } - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->route) { g_string_append_printf(lines, STRING_WFD_ROUTE); g_string_append_printf(lines, ":"); g_string_append_printf(lines, " %s", msg->route->destination); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->I2C) { g_string_append_printf(lines, STRING_WFD_I2C); g_string_append_printf(lines, ":"); - if (msg->I2C->I2CPresent) - g_string_append_printf(lines, " %x", msg->I2C->I2C_port); - else - g_string_append_printf(lines, " none"); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_SPACE); + if (msg->I2C->I2CPresent) { + g_string_append_printf(lines, "%x", msg->I2C->I2C_port); + } else { + g_string_append_printf(lines, STRING_WFD_NONE); + } + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->av_format_change_timing) { @@ -439,7 +462,7 @@ wfdconfig_message_as_text(const WFDMessage *msg) g_string_append_printf(lines, ":"); g_string_append_printf(lines, " %010llx", msg->av_format_change_timing->PTS); g_string_append_printf(lines, " %010llx", msg->av_format_change_timing->DTS); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->preferred_display_mode) { @@ -458,138 +481,168 @@ wfdconfig_message_as_text(const WFDMessage *msg) g_string_append_printf(lines, " %02x", msg->preferred_display_mode->VBS3D); g_string_append_printf(lines, " %02x", msg->preferred_display_mode->V2d_s3d_modes); g_string_append_printf(lines, " %02x", msg->preferred_display_mode->P_depth); - } else g_string_append_printf(lines, " none"); - g_string_append_printf(lines, "\r\n"); + } else { + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); + } + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->uibc_capability) { g_string_append_printf(lines, STRING_WFD_UIBC_CAPABILITY); g_string_append_printf(lines, ":"); if (msg->uibc_capability->uibcsupported) { - g_string_append_printf(lines, " input_category_list="); + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_INPUT_CATEGORY_LIST); + g_string_append_printf(lines, "="); if (msg->uibc_capability->input_category_list.input_cat) { guint32 tempcap = 0; if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_GENERIC) { tempcap |= WFD_UIBC_INPUT_CAT_GENERIC; - g_string_append_printf(lines, "GENERIC"); - if (msg->uibc_capability->input_category_list.input_cat != tempcap) g_string_append_printf(lines, ", "); + g_string_append_printf(lines, STRING_WFD_GENERIC); + if (msg->uibc_capability->input_category_list.input_cat != tempcap) { + g_string_append_printf(lines, ", "); + } } if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_HIDC) { tempcap |= WFD_UIBC_INPUT_CAT_HIDC; - g_string_append_printf(lines, "HIDC"); - if (msg->uibc_capability->input_category_list.input_cat != tempcap) g_string_append_printf(lines, ", "); + g_string_append_printf(lines, STRING_WFD_HIDC); + if (msg->uibc_capability->input_category_list.input_cat != tempcap) { + g_string_append_printf(lines, ", "); + } } - } else g_string_append_printf(lines, "none"); + } else { + g_string_append_printf(lines, STRING_WFD_NONE); + } g_string_append_printf(lines, ";"); - g_string_append_printf(lines, " generic_cap_list="); + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_GENERIC_CAP_LIST); + g_string_append_printf(lines, "="); if (msg->uibc_capability->generic_cap_list.inp_type) { guint32 tempcap = 0; if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_KEYBOARD) { tempcap |= WFD_UIBC_INPUT_TYPE_KEYBOARD; - g_string_append_printf(lines, "Keyboard"); + g_string_append_printf(lines, STRING_WFD_KEYBOARD); if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", "); } if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_MOUSE) { tempcap |= WFD_UIBC_INPUT_TYPE_MOUSE; - g_string_append_printf(lines, "Mouse"); + g_string_append_printf(lines, STRING_WFD_MOUSE); if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", "); } if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_SINGLETOUCH) { tempcap |= WFD_UIBC_INPUT_TYPE_SINGLETOUCH; - g_string_append_printf(lines, "SingleTouch"); + g_string_append_printf(lines, STRING_WFD_SINGLE_TOUCH); if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", "); } if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_MULTITOUCH) { tempcap |= WFD_UIBC_INPUT_TYPE_MULTITOUCH; - g_string_append_printf(lines, "MultiTouch"); + g_string_append_printf(lines, STRING_WFD_MULTI_TOUCH); if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", "); } if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_JOYSTICK) { tempcap |= WFD_UIBC_INPUT_TYPE_JOYSTICK; - g_string_append_printf(lines, "Joystick"); + g_string_append_printf(lines, STRING_WFD_JOYSTICK); if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", "); } if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_CAMERA) { tempcap |= WFD_UIBC_INPUT_TYPE_CAMERA; - g_string_append_printf(lines, "Camera"); + g_string_append_printf(lines, STRING_WFD_CAMERA); if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", "); } if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_GESTURE) { tempcap |= WFD_UIBC_INPUT_TYPE_GESTURE; - g_string_append_printf(lines, "Gesture"); + g_string_append_printf(lines, STRING_WFD_GESTURE); if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", "); } if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_REMOTECONTROL) { tempcap |= WFD_UIBC_INPUT_TYPE_REMOTECONTROL; - g_string_append_printf(lines, "RemoteControl"); + g_string_append_printf(lines, STRING_WFD_REMOTE_CONTROL); if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", "); } - } else g_string_append_printf(lines, "none"); + } else { + g_string_append_printf(lines, STRING_WFD_NONE); + } g_string_append_printf(lines, ";"); - g_string_append_printf(lines, " hidc_cap_list="); + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_HIDC_CAP_LIST); + g_string_append_printf(lines, "="); if (msg->uibc_capability->hidc_cap_list.cap_count) { detailed_cap *temp_cap = msg->uibc_capability->hidc_cap_list.next; while (temp_cap) { - if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_KEYBOARD) g_string_append_printf(lines, "Keyboard"); - else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_MOUSE) g_string_append_printf(lines, "Mouse"); - else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_SINGLETOUCH) g_string_append_printf(lines, "SingleTouch"); - else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_MULTITOUCH) g_string_append_printf(lines, "MultiTouch"); - else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_JOYSTICK) g_string_append_printf(lines, "Joystick"); - else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_CAMERA) g_string_append_printf(lines, "Camera"); - else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_GESTURE) g_string_append_printf(lines, "Gesture"); - else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_REMOTECONTROL) g_string_append_printf(lines, "RemoteControl"); + if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_KEYBOARD) g_string_append_printf(lines, STRING_WFD_KEYBOARD); + else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_MOUSE) g_string_append_printf(lines, STRING_WFD_MOUSE); + else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_SINGLETOUCH) g_string_append_printf(lines, STRING_WFD_SINGLE_TOUCH); + else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_MULTITOUCH) g_string_append_printf(lines, STRING_WFD_MULTI_TOUCH); + else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_JOYSTICK) g_string_append_printf(lines, STRING_WFD_JOYSTICK); + else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_CAMERA) g_string_append_printf(lines, STRING_WFD_CAMERA); + else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_GESTURE) g_string_append_printf(lines, STRING_WFD_GESTURE); + else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_REMOTECONTROL) g_string_append_printf(lines, STRING_WFD_REMOTE_CONTROL); g_string_append_printf(lines, "/"); - if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_INFRARED) g_string_append_printf(lines, "Infrared"); - else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_USB) g_string_append_printf(lines, "USB"); - else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_BT) g_string_append_printf(lines, "BT"); - else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_ZIGBEE) g_string_append_printf(lines, "Zigbee"); - else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_WIFI) g_string_append_printf(lines, "Wi-Fi"); - else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_NOSP) g_string_append_printf(lines, "No-SP"); + if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_INFRARED) g_string_append_printf(lines, STRING_WFD_INFRARED); + else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_USB) g_string_append_printf(lines, STRING_WFD_USB); + else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_BT) g_string_append_printf(lines, STRING_WFD_BT); + else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_ZIGBEE) g_string_append_printf(lines, STRING_WFD_ZIGBEE); + else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_WIFI) g_string_append_printf(lines, STRING_WFD_WIFI); + else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_NOSP) g_string_append_printf(lines, STRING_WFD_NO_SP); temp_cap = temp_cap->next; if (temp_cap) g_string_append_printf(lines, ", "); } - } else g_string_append_printf(lines, "none"); + } else { + g_string_append_printf(lines, STRING_WFD_NONE); + } g_string_append_printf(lines, ";"); - if (msg->uibc_capability->tcp_port) g_string_append_printf(lines, "port=%u", msg->uibc_capability->tcp_port); - else g_string_append_printf(lines, "port=none"); - } else g_string_append_printf(lines, " none"); - g_string_append_printf(lines, "\r\n"); + if (msg->uibc_capability->tcp_port) { + g_string_append_printf(lines, STRING_WFD_PORT); + g_string_append_printf(lines, "=%u", msg->uibc_capability->tcp_port); + } else { + g_string_append_printf(lines, STRING_WFD_PORT); + g_string_append_printf(lines, "="); + g_string_append_printf(lines, STRING_WFD_NONE); + } + } else { + g_string_append_printf(lines, STRING_WFD_SPACE); + g_string_append_printf(lines, STRING_WFD_NONE); + } + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->uibc_setting) { g_string_append_printf(lines, STRING_WFD_UIBC_SETTING); g_string_append_printf(lines, ":"); + g_string_append_printf(lines, STRING_WFD_SPACE); if (msg->uibc_setting->uibc_setting) - g_string_append_printf(lines, " enable"); + g_string_append_printf(lines, STRING_WFD_ENABLE); else - g_string_append_printf(lines, " disable"); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_DISABLE); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->standby_resume_capability) { g_string_append_printf(lines, STRING_WFD_STANDBY_RESUME_CAPABILITY); g_string_append_printf(lines, ":"); + g_string_append_printf(lines, STRING_WFD_SPACE); if (msg->standby_resume_capability->standby_resume_cap) - g_string_append_printf(lines, " supported"); + g_string_append_printf(lines, STRING_WFD_SUPPORTED); else - g_string_append_printf(lines, " none"); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_NONE); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->standby) { g_string_append_printf(lines, STRING_WFD_STANDBY); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->connector_type) { g_string_append_printf(lines, STRING_WFD_CONNECTOR_TYPE); g_string_append_printf(lines, ":"); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->idr_request) { g_string_append_printf(lines, STRING_WFD_IDR_REQUEST); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } /*g_string_append_printf (lines, "\0"); */ @@ -612,81 +665,81 @@ gchar *wfdconfig_parameter_names_as_text(const WFDMessage *msg) /* list of audio codecs */ if (msg->audio_codecs) { g_string_append_printf(lines, STRING_WFD_AUDIO_CODECS); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } /* list of video codecs */ if (msg->video_formats) { g_string_append_printf(lines, STRING_WFD_VIDEO_FORMATS); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } /* list of video 3D codecs */ if (msg->video_3d_formats) { g_string_append_printf(lines, STRING_WFD_3D_VIDEO_FORMATS); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->content_protection) { g_string_append_printf(lines, STRING_WFD_CONTENT_PROTECTION); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->display_edid) { g_string_append_printf(lines, STRING_WFD_DISPLAY_EDID); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->coupled_sink) { g_string_append_printf(lines, STRING_WFD_COUPLED_SINK); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->trigger_method) { g_string_append_printf(lines, STRING_WFD_TRIGGER_METHOD); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->presentation_url) { g_string_append_printf(lines, STRING_WFD_PRESENTATION_URL); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->client_rtp_ports) { g_string_append_printf(lines, STRING_WFD_CLIENT_RTP_PORTS); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->route) { g_string_append_printf(lines, STRING_WFD_ROUTE); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->I2C) { g_string_append_printf(lines, STRING_WFD_I2C); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->av_format_change_timing) { g_string_append_printf(lines, STRING_WFD_AV_FORMAT_CHANGE_TIMING); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->preferred_display_mode) { g_string_append_printf(lines, STRING_WFD_PREFERRED_DISPLAY_MODE); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->uibc_capability) { g_string_append_printf(lines, STRING_WFD_UIBC_CAPABILITY); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->uibc_setting) { g_string_append_printf(lines, STRING_WFD_UIBC_SETTING); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->standby_resume_capability) { g_string_append_printf(lines, STRING_WFD_STANDBY_RESUME_CAPABILITY); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->standby) { g_string_append_printf(lines, STRING_WFD_STANDBY); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->connector_type) { g_string_append_printf(lines, STRING_WFD_CONNECTOR_TYPE); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } if (msg->idr_request) { g_string_append_printf(lines, STRING_WFD_IDR_REQUEST); - g_string_append_printf(lines, "\r\n"); + g_string_append_printf(lines, STRING_WFD_CRLF); } return g_string_free(lines, FALSE); } @@ -855,8 +908,8 @@ wfdconfig_parse_line(WFDMessage *msg, gchar *buffer) if (strlen(v)) { WFD_SKIP_SPACE(v); msg->content_protection->hdcp2_spec = g_new0(WFDHdcp2Spec, 1); - if (strstr(v, "none")) { - msg->content_protection->hdcp2_spec->hdcpversion = g_strdup("none"); + if (strstr(v, STRING_WFD_NONE)) { + msg->content_protection->hdcp2_spec->hdcpversion = g_strdup(STRING_WFD_NONE); } else { WFD_READ_STRING(msg->content_protection->hdcp2_spec->hdcpversion); WFD_SKIP_SPACE(v); @@ -867,7 +920,7 @@ wfdconfig_parse_line(WFDMessage *msg, gchar *buffer) msg->display_edid = g_new0(WFDDisplayEdid, 1); if (strlen(v)) { WFD_SKIP_SPACE(v); - if (strstr(v, "none")) { + if (strstr(v, STRING_WFD_NONE)) { msg->display_edid->edid_supported = 0; } else { msg->display_edid->edid_supported = 1; @@ -958,7 +1011,7 @@ wfdconfig_parse_line(WFDMessage *msg, gchar *buffer) msg->preferred_display_mode = g_new0(WFDPreferredDisplayMode, 1); if (strlen(v)) { WFD_SKIP_SPACE(v); - if (!strstr(v, "none")) { + if (!strstr(v, STRING_WFD_NONE)) { msg->preferred_display_mode->displaymodesupported = FALSE; } else { WFD_READ_UINT32(msg->preferred_display_mode->p_clock); @@ -1011,12 +1064,12 @@ wfdconfig_parse_line(WFDMessage *msg, gchar *buffer) } } else if (!g_strcmp0(type, STRING_WFD_UIBC_CAPABILITY)) { msg->uibc_capability = g_new0(WFDUibcCapability, 1); - if (strstr(v, "input_category_list")) { + if (strstr(v, STRING_WFD_INPUT_CATEGORY_LIST)) { gchar *tstring = NULL; msg->uibc_capability->uibcsupported = TRUE; WFD_SKIP_SPACE(v); WFD_READ_CHAR_END_STRING(tstring, '='); - if (!g_strcmp0(tstring, "input_category_list")) { + if (!g_strcmp0(tstring, STRING_WFD_INPUT_CATEGORY_LIST)) { gchar temp2[8192] = {0}; guint rem_len = 0, read_len = 0; WFD_READ_CHAR_END_STRING(tstring, ';'); @@ -1025,43 +1078,43 @@ wfdconfig_parse_line(WFDMessage *msg, gchar *buffer) WFD_SKIP_SPACE(v); read_string_char_ended(temp2, 8192, ',', tstring + read_len); read_len += (strlen(temp2) + 1); - if (strstr(temp2, "GENERIC")) msg->uibc_capability->input_category_list.input_cat |= WFD_UIBC_INPUT_CAT_GENERIC; - else if (strstr(temp2, "HIDC")) msg->uibc_capability->input_category_list.input_cat |= WFD_UIBC_INPUT_CAT_HIDC; + if (strstr(temp2, STRING_WFD_GENERIC)) msg->uibc_capability->input_category_list.input_cat |= WFD_UIBC_INPUT_CAT_GENERIC; + else if (strstr(temp2, STRING_WFD_HIDC)) msg->uibc_capability->input_category_list.input_cat |= WFD_UIBC_INPUT_CAT_HIDC; else msg->uibc_capability->input_category_list.input_cat |= WFD_UIBC_INPUT_CAT_UNKNOWN; } while (read_len < rem_len); - result = strstr(v, "generic_cap_list"); + result = strstr(v, STRING_WFD_GENERIC_CAP_LIST); if (result != NULL) { memset(temp2, 0, 8192); rem_len = 0; read_len = 0; v = result; WFD_READ_CHAR_END_STRING(tstring, '='); - if (!g_strcmp0(tstring, "generic_cap_list")) { + if (!g_strcmp0(tstring, STRING_WFD_GENERIC_CAP_LIST)) { WFD_SKIP_SPACE(v); WFD_READ_CHAR_END_STRING(tstring, ';'); rem_len = strlen(tstring); do { read_string_char_ended(temp2, 8192, ',', tstring + read_len); read_len += (strlen(temp2) + 1); - if (strstr(temp2, "Keyboard")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_KEYBOARD; - else if (strstr(temp2, "Mouse")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_MOUSE; - else if (strstr(temp2, "SingleTouch")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_SINGLETOUCH; - else if (strstr(temp2, "MultiTouch")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_MULTITOUCH; - else if (strstr(temp2, "Joystick")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_JOYSTICK; - else if (strstr(temp2, "Camera")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_CAMERA; - else if (strstr(temp2, "Gesture")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_GESTURE; - else if (strstr(temp2, "RemoteControl")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_REMOTECONTROL; + if (strstr(temp2, STRING_WFD_KEYBOARD)) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_KEYBOARD; + else if (strstr(temp2, STRING_WFD_MOUSE)) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_MOUSE; + else if (strstr(temp2, STRING_WFD_SINGLE_TOUCH)) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_SINGLETOUCH; + else if (strstr(temp2, STRING_WFD_MULTI_TOUCH)) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_MULTITOUCH; + else if (strstr(temp2, STRING_WFD_JOYSTICK)) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_JOYSTICK; + else if (strstr(temp2, STRING_WFD_CAMERA)) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_CAMERA; + else if (strstr(temp2, STRING_WFD_GESTURE)) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_GESTURE; + else if (strstr(temp2, STRING_WFD_REMOTE_CONTROL)) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_REMOTECONTROL; else msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_UNKNOWN; } while (read_len < rem_len); } } - result = strstr(v, "hidc_cap_list"); + result = strstr(v, STRING_WFD_HIDC_CAP_LIST); if (result != NULL) { v = result; WFD_SKIP_SPACE(v); WFD_READ_CHAR_END_STRING(tstring, '='); - if (!g_strcmp0(tstring, "hidc_cap_list")) { + if (!g_strcmp0(tstring, STRING_WFD_HIDC_CAP_LIST)) { gchar inp_type[8192]; gchar inp_path[8192]; memset(temp2, 0, 8192); @@ -1077,22 +1130,22 @@ wfdconfig_parse_line(WFDMessage *msg, gchar *buffer) read_string_char_ended(temp2, 8192, ',', tstring + read_len); read_len += (strlen(temp2) + 1); read_string_type_and_value(inp_type, inp_path, sizeof(inp_type), sizeof(inp_path), '/', temp2); - if (strstr(inp_type, "Keyboard")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_KEYBOARD; - else if (strstr(inp_type, "Mouse")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_MOUSE; - else if (strstr(inp_type, "SingleTouch")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_SINGLETOUCH; - else if (strstr(inp_type, "MultiTouch")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_MULTITOUCH; - else if (strstr(inp_type, "Joystick")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_JOYSTICK; - else if (strstr(inp_type, "Camera")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_CAMERA; - else if (strstr(inp_type, "Gesture")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_GESTURE; - else if (strstr(inp_type, "RemoteControl")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_REMOTECONTROL; + if (strstr(inp_type, STRING_WFD_KEYBOARD)) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_KEYBOARD; + else if (strstr(inp_type, STRING_WFD_MOUSE)) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_MOUSE; + else if (strstr(inp_type, STRING_WFD_SINGLE_TOUCH)) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_SINGLETOUCH; + else if (strstr(inp_type, STRING_WFD_MULTI_TOUCH)) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_MULTITOUCH; + else if (strstr(inp_type, STRING_WFD_JOYSTICK)) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_JOYSTICK; + else if (strstr(inp_type, STRING_WFD_CAMERA)) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_CAMERA; + else if (strstr(inp_type, STRING_WFD_GESTURE)) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_GESTURE; + else if (strstr(inp_type, STRING_WFD_REMOTE_CONTROL)) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_REMOTECONTROL; else temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_UNKNOWN; - if (strstr(inp_path, "Infrared")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_INFRARED; - else if (strstr(inp_path, "USB")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_USB; - else if (strstr(inp_path, "BT")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_BT; - else if (strstr(inp_path, "Zigbee")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_ZIGBEE; - else if (strstr(inp_path, "Wi-Fi")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_WIFI; - else if (strstr(inp_path, "No-SP")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_NOSP; + if (strstr(inp_path, STRING_WFD_INFRARED)) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_INFRARED; + else if (strstr(inp_path, STRING_WFD_USB)) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_USB; + else if (strstr(inp_path, STRING_WFD_BT)) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_BT; + else if (strstr(inp_path, STRING_WFD_ZIGBEE)) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_ZIGBEE; + else if (strstr(inp_path, STRING_WFD_WIFI)) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_WIFI; + else if (strstr(inp_path, STRING_WFD_NO_SP)) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_NOSP; else temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_UNKNOWN; if (read_len < rem_len) { temp_cap->next = g_new0(detailed_cap, 1); @@ -1101,27 +1154,27 @@ wfdconfig_parse_line(WFDMessage *msg, gchar *buffer) } while (read_len < rem_len); } } - result = strstr(v, "port"); + result = strstr(v, STRING_WFD_PORT); if (result != NULL) { v = result; WFD_READ_CHAR_END_STRING(tstring, '='); - if (!g_strcmp0(tstring, "port")) { + if (!g_strcmp0(tstring, STRING_WFD_PORT)) { WFD_SKIP_EQUAL(v); WFD_READ_CHAR_END_STRING(tstring, ';'); - if (!strstr(tstring, "none")) { + if (!strstr(tstring, STRING_WFD_NONE)) { msg->uibc_capability->tcp_port = strtoul(tstring, NULL, 10); } } } } - } else if (strstr(v, "none")) { + } else if (strstr(v, STRING_WFD_NONE)) { msg->uibc_capability->uibcsupported = FALSE; } } else if (!g_strcmp0(type, STRING_WFD_UIBC_SETTING)) { msg->uibc_setting = g_new0(WFDUibcSetting, 1); if (strlen(v)) { WFD_SKIP_SPACE(v); - if (!g_strcmp0(v, "enable")) + if (!g_strcmp0(v, STRING_WFD_ENABLE)) msg->uibc_setting->uibc_setting = TRUE; else msg->uibc_setting->uibc_setting = FALSE; @@ -1130,7 +1183,7 @@ wfdconfig_parse_line(WFDMessage *msg, gchar *buffer) msg->standby_resume_capability = g_new0(WFDStandbyResumeCapability, 1); if (strlen(v)) { WFD_SKIP_SPACE(v); - if (!g_strcmp0(v, "supported")) + if (!g_strcmp0(v, STRING_WFD_SUPPORTED)) msg->standby_resume_capability->standby_resume_cap = TRUE; else msg->standby_resume_capability->standby_resume_cap = FALSE; @@ -1214,155 +1267,145 @@ wfdconfig_message_dump(const WFDMessage *msg) if (msg->audio_codecs) { guint i = 0; - wfd_debug("Audio supported formats : \n"); + wfd_debug("Audio supported formats : "); for (; i < msg->audio_codecs->count; i++) { - wfd_debug("Codec: %s\n", msg->audio_codecs->list[i].audio_format); - if (!strcmp(msg->audio_codecs->list[i].audio_format, "LPCM")) { + wfd_debug("Codec: %s", msg->audio_codecs->list[i].audio_format); + if (!strcmp(msg->audio_codecs->list[i].audio_format, STRING_WFD_LPCM)) { if (msg->audio_codecs->list[i].modes & WFD_FREQ_44100) - wfd_debug(" Freq: %d\n", 44100); + wfd_debug(" Freq: %d", 44100); if (msg->audio_codecs->list[i].modes & WFD_FREQ_48000) - wfd_debug(" Freq: %d\n", 48000); - wfd_debug(" Channels: %d\n", 2); + wfd_debug(" Freq: %d", 48000); + wfd_debug(" Channels: %d", 2); } - if (!strcmp(msg->audio_codecs->list[i].audio_format, "AAC")) { - wfd_debug(" Freq: %d\n", 48000); + if (!strcmp(msg->audio_codecs->list[i].audio_format, STRING_WFD_AAC)) { + wfd_debug(" Freq: %d", 48000); if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_2) - wfd_debug(" Channels: %d\n", 2); + wfd_debug(" Channels: %d", 2); if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_4) - wfd_debug(" Channels: %d\n", 4); + wfd_debug(" Channels: %d", 4); if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_6) - wfd_debug(" Channels: %d\n", 6); + wfd_debug(" Channels: %d", 6); if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_8) - wfd_debug(" Channels: %d\n", 8); + wfd_debug(" Channels: %d", 8); } - if (!strcmp(msg->audio_codecs->list[i].audio_format, "AC3")) { - wfd_debug(" Freq: %d\n", 48000); + if (!strcmp(msg->audio_codecs->list[i].audio_format, STRING_WFD_AC3)) { + wfd_debug(" Freq: %d", 48000); if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_2) - wfd_debug(" Channels: %d\n", 2); + wfd_debug(" Channels: %d", 2); if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_4) - wfd_debug(" Channels: %d\n", 4); + wfd_debug(" Channels: %d", 4); if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_6) - wfd_debug(" Channels: %d\n", 6); + wfd_debug(" Channels: %d", 6); } - wfd_debug(" Bitwidth: %d\n", 16); - wfd_debug(" Latency: %d\n", msg->audio_codecs->list[i].latency); + wfd_debug(" Bitwidth: %d", 16); + wfd_debug(" Latency: %d", msg->audio_codecs->list[i].latency); } } if (msg->video_formats) { - wfd_debug("Video supported formats : \n"); + wfd_debug("Video supported formats : "); if (msg->video_formats->list) { - wfd_debug("Codec: H264\n"); + wfd_debug("Codec: H264"); guint nativeindex = 0; if ((msg->video_formats->list->native & 0x7) == WFD_VIDEO_CEA_RESOLUTION) { - wfd_debug(" Native type: CEA\n"); + wfd_debug(" Native type: CEA"); } else if ((msg->video_formats->list->native & 0x7) == WFD_VIDEO_VESA_RESOLUTION) { - wfd_debug(" Native type: VESA\n"); + wfd_debug(" Native type: VESA"); } else if ((msg->video_formats->list->native & 0x7) == WFD_VIDEO_HH_RESOLUTION) { - wfd_debug(" Native type: HH\n"); + wfd_debug(" Native type: HH"); } nativeindex = msg->video_formats->list->native >> 3; - wfd_debug(" Resolution: %d\n", (1 << nativeindex)); + wfd_debug(" Resolution: %d", (1 << nativeindex)); if (msg->video_formats->list->H264_codec.profile & WFD_H264_BASE_PROFILE) { - wfd_debug(" Profile: BASE\n"); + wfd_debug(" Profile: BASE"); } else if (msg->video_formats->list->H264_codec.profile & WFD_H264_HIGH_PROFILE) { - wfd_debug(" Profile: HIGH\n"); + wfd_debug(" Profile: HIGH"); } if (msg->video_formats->list->H264_codec.level & WFD_H264_LEVEL_3_1) { - wfd_debug(" Level: 3.1\n"); + wfd_debug(" Level: 3.1"); } else if (msg->video_formats->list->H264_codec.level & WFD_H264_LEVEL_3_2) { - wfd_debug(" Level: 3.2\n"); + wfd_debug(" Level: 3.2"); } else if (msg->video_formats->list->H264_codec.level & WFD_H264_LEVEL_4) { - wfd_debug(" Level: 4\n"); + wfd_debug(" Level: 4"); } else if (msg->video_formats->list->H264_codec.level & WFD_H264_LEVEL_4_1) { - wfd_debug(" Level: 4.1\n"); + wfd_debug(" Level: 4.1"); } else if (msg->video_formats->list->H264_codec.level & WFD_H264_LEVEL_4_2) { - wfd_debug(" Level: 4.2\n"); + wfd_debug(" Level: 4.2"); } - wfd_debug(" Latency: %d\n", msg->video_formats->list->H264_codec.misc_params.latency); - wfd_debug(" min_slice_size: %x\n", msg->video_formats->list->H264_codec.misc_params.min_slice_size); - wfd_debug(" slice_enc_params: %x\n", msg->video_formats->list->H264_codec.misc_params.slice_enc_params); - wfd_debug(" frame_rate_control_support: %x\n", msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support); + wfd_debug(" Latency: %d", msg->video_formats->list->H264_codec.misc_params.latency); + wfd_debug(" min_slice_size: %x", msg->video_formats->list->H264_codec.misc_params.min_slice_size); + wfd_debug(" slice_enc_params: %x", msg->video_formats->list->H264_codec.misc_params.slice_enc_params); + wfd_debug(" frame_rate_control_support: %x", msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support); if (msg->video_formats->list->H264_codec.max_hres) { - wfd_debug(" Max Width: %04d\n", msg->video_formats->list->H264_codec.max_hres); + wfd_debug(" Max Width: %04d", msg->video_formats->list->H264_codec.max_hres); } if (msg->video_formats->list->H264_codec.max_vres) { - wfd_debug(" Max Height: %04d\n", msg->video_formats->list->H264_codec.max_vres); + wfd_debug(" Max Height: %04d", msg->video_formats->list->H264_codec.max_vres); } } } if (msg->video_3d_formats) { wfd_debug("wfd_3d_formats"); - wfd_debug("\r\n"); } if (msg->content_protection) { wfd_debug(STRING_WFD_CONTENT_PROTECTION); - wfd_debug("\r\n"); } if (msg->display_edid) { wfd_debug(STRING_WFD_DISPLAY_EDID); - wfd_debug("\r\n"); } if (msg->coupled_sink) { wfd_debug(STRING_WFD_COUPLED_SINK); - wfd_debug("\r\n"); } if (msg->trigger_method) { - wfd_debug(" Trigger type: %s\n", msg->trigger_method->wfd_trigger_method); + wfd_debug(" Trigger type: %s", msg->trigger_method->wfd_trigger_method); } if (msg->presentation_url) { wfd_debug(STRING_WFD_PRESENTATION_URL); - wfd_debug("\r\n"); } if (msg->client_rtp_ports) { - wfd_debug(" Client RTP Ports : \n"); + wfd_debug(" Client RTP Ports : "); if (msg->client_rtp_ports->profile) { - wfd_debug("%s\n", msg->client_rtp_ports->profile); - wfd_debug(" %d\n", msg->client_rtp_ports->rtp_port0); - wfd_debug(" %d\n", msg->client_rtp_ports->rtp_port1); - wfd_debug(" %s\n", msg->client_rtp_ports->mode); + wfd_debug("%s", msg->client_rtp_ports->profile); + wfd_debug(" %d", msg->client_rtp_ports->rtp_port0); + wfd_debug(" %d", msg->client_rtp_ports->rtp_port1); + wfd_debug(" %s", msg->client_rtp_ports->mode); } - wfd_debug("\r\n"); } if (msg->route) { wfd_debug(STRING_WFD_ROUTE); - wfd_debug("\r\n"); } if (msg->I2C) { wfd_debug(STRING_WFD_I2C); - wfd_debug("\r\n"); } if (msg->av_format_change_timing) { wfd_debug(STRING_WFD_AV_FORMAT_CHANGE_TIMING); - wfd_debug("\r\n"); } if (msg->preferred_display_mode) { wfd_debug(STRING_WFD_PREFERRED_DISPLAY_MODE); - wfd_debug("\r\n"); } if (msg->uibc_capability) { - wfd_debug("wfd_uibc_capability \r\n"); + wfd_debug("wfd_uibc_capability \r"); wfd_debug("input category list:"); if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_GENERIC) - wfd_debug("GENERIC"); + wfd_debug(STRING_WFD_GENERIC); if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_HIDC) - wfd_debug("HIDC"); + wfd_debug(STRING_WFD_HIDC); if (!msg->uibc_capability->input_category_list.input_cat) - wfd_debug("none"); + wfd_debug(STRING_WFD_NONE); if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_GENERIC) { wfd_debug("generic cap list: "); if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_KEYBOARD) @@ -1409,19 +1452,19 @@ wfdconfig_message_dump(const WFDMessage *msg) wfd_debug("none "); } if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_INFRARED) { - wfd_debug("infrared"); + wfd_debug(STRING_WFD_INFRARED); } else if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_USB) { - wfd_debug("usb"); + wfd_debug(STRING_WFD_USB); } else if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_BT) { - wfd_debug("bluetooth"); + wfd_debug(STRING_WFD_BT); } else if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_WIFI) { - wfd_debug("Wi-Fi"); + wfd_debug(STRING_WFD_WIFI); } else if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_ZIGBEE) { - wfd_debug("Zigbee"); + wfd_debug(STRING_WFD_ZIGBEE); } else if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_NOSP) { - wfd_debug("No-SP"); + wfd_debug(STRING_WFD_NO_SP); } else if (!temp_cap->p.inp_path) { - wfd_debug("none"); + wfd_debug(STRING_WFD_NONE); } temp_cap = temp_cap->next; } @@ -1431,7 +1474,6 @@ wfdconfig_message_dump(const WFDMessage *msg) wfd_debug("tcp port:%u", msg->uibc_capability->tcp_port); if (!msg->uibc_capability->tcp_port) wfd_debug("tcp port: none"); - wfd_debug("\r\n"); } if (msg->uibc_setting) { @@ -1439,30 +1481,25 @@ wfdconfig_message_dump(const WFDMessage *msg) if (msg->uibc_setting->uibc_setting) { wfd_debug("true"); } else wfd_debug("false"); - wfd_debug("\r\n"); } if (msg->standby_resume_capability) { wfd_debug(STRING_WFD_STANDBY_RESUME_CAPABILITY); - wfd_debug("\r\n"); } if (msg->standby) { wfd_debug(STRING_WFD_STANDBY); - wfd_debug("\r\n"); } if (msg->connector_type) { wfd_debug(STRING_WFD_CONNECTOR_TYPE); - wfd_debug("\r\n"); } if (msg->idr_request) { wfd_debug(STRING_WFD_IDR_REQUEST); - wfd_debug("\r\n"); } - wfd_debug("===============================================\n"); + wfd_debug("==============================================="); return WFD_OK; } @@ -1486,17 +1523,17 @@ WFDResult wfdconfig_set_supported_audio_format(WFDMessage *msg, WFDAudioFormats msg->audio_codecs->list = g_new0(WFDAudioCodec, msg->audio_codecs->count); for (; i < msg->audio_codecs->count; i++) { if ((aCodec & WFD_AUDIO_LPCM) && (!pcm)) { - msg->audio_codecs->list[i].audio_format = g_strdup("LPCM"); + msg->audio_codecs->list[i].audio_format = g_strdup(STRING_WFD_LPCM); msg->audio_codecs->list[i].modes = aFreq; msg->audio_codecs->list[i].latency = aLatency; pcm = 1; } else if ((aCodec & WFD_AUDIO_AAC) && (!aac)) { - msg->audio_codecs->list[i].audio_format = g_strdup("AAC"); + msg->audio_codecs->list[i].audio_format = g_strdup(STRING_WFD_AAC); msg->audio_codecs->list[i].modes = aChanels; msg->audio_codecs->list[i].latency = aLatency; aac = 1; } else if ((aCodec & WFD_AUDIO_AC3) && (!ac3)) { - msg->audio_codecs->list[i].audio_format = g_strdup("AC3"); + msg->audio_codecs->list[i].audio_format = g_strdup(STRING_WFD_AC3); msg->audio_codecs->list[i].modes = aChanels; msg->audio_codecs->list[i].latency = aLatency; ac3 = 1; @@ -1518,15 +1555,15 @@ WFDResult wfdconfig_set_prefered_audio_format(WFDMessage *msg, WFDAudioFormats a msg->audio_codecs->list = g_new0(WFDAudioCodec, 1); msg->audio_codecs->count = 1; if (aCodec == WFD_AUDIO_LPCM) { - msg->audio_codecs->list->audio_format = g_strdup("LPCM"); + msg->audio_codecs->list->audio_format = g_strdup(STRING_WFD_LPCM); msg->audio_codecs->list->modes = aFreq; msg->audio_codecs->list->latency = aLatency; } else if (aCodec == WFD_AUDIO_AAC) { - msg->audio_codecs->list->audio_format = g_strdup("AAC"); + msg->audio_codecs->list->audio_format = g_strdup(STRING_WFD_AAC); msg->audio_codecs->list->modes = aChanels; msg->audio_codecs->list->latency = aLatency; } else if (aCodec == WFD_AUDIO_AC3) { - msg->audio_codecs->list->audio_format = g_strdup("AC3"); + msg->audio_codecs->list->audio_format = g_strdup(STRING_WFD_AC3); msg->audio_codecs->list->modes = aChanels; msg->audio_codecs->list->latency = aLatency; } @@ -1541,19 +1578,19 @@ WFDResult wfdconfig_get_supported_audio_format(WFDMessage *msg, guint *aCodec, g g_return_val_if_fail(msg->audio_codecs != NULL, WFD_EINVAL); for (; i < msg->audio_codecs->count; i++) { - if (!g_strcmp0(msg->audio_codecs->list[i].audio_format, "LPCM")) { + if (!g_strcmp0(msg->audio_codecs->list[i].audio_format, STRING_WFD_LPCM)) { *aCodec |= WFD_AUDIO_LPCM; *aFreq |= msg->audio_codecs->list[i].modes; *aChanels |= WFD_CHANNEL_2; *aBitwidth = 16; *aLatency = msg->audio_codecs->list[i].latency; - } else if (!g_strcmp0(msg->audio_codecs->list[i].audio_format, "AAC")) { + } else if (!g_strcmp0(msg->audio_codecs->list[i].audio_format, STRING_WFD_AAC)) { *aCodec |= WFD_AUDIO_AAC; *aFreq |= WFD_FREQ_48000; *aChanels |= msg->audio_codecs->list[i].modes; *aBitwidth = 16; *aLatency = msg->audio_codecs->list[i].latency; - } else if (!g_strcmp0(msg->audio_codecs->list[i].audio_format, "AC3")) { + } else if (!g_strcmp0(msg->audio_codecs->list[i].audio_format, STRING_WFD_AC3)) { *aCodec |= WFD_AUDIO_AC3; *aFreq |= WFD_FREQ_48000; *aChanels |= msg->audio_codecs->list[i].modes; @@ -1569,19 +1606,19 @@ WFDResult wfdconfig_get_prefered_audio_format(WFDMessage *msg, WFDAudioFormats * { g_return_val_if_fail(msg != NULL, WFD_EINVAL); - if (!g_strcmp0(msg->audio_codecs->list->audio_format, "LPCM")) { + if (!g_strcmp0(msg->audio_codecs->list->audio_format, STRING_WFD_LPCM)) { *aCodec = WFD_AUDIO_LPCM; *aFreq = msg->audio_codecs->list->modes; *aChanels = WFD_CHANNEL_2; *aBitwidth = 16; *aLatency = msg->audio_codecs->list->latency; - } else if (!g_strcmp0(msg->audio_codecs->list->audio_format, "AAC")) { + } else if (!g_strcmp0(msg->audio_codecs->list->audio_format, STRING_WFD_AAC)) { *aCodec = WFD_AUDIO_AAC; *aFreq = WFD_FREQ_48000; *aChanels = msg->audio_codecs->list->modes; *aBitwidth = 16; *aLatency = msg->audio_codecs->list->latency; - } else if (!g_strcmp0(msg->audio_codecs->list->audio_format, "AC3")) { + } else if (!g_strcmp0(msg->audio_codecs->list->audio_format, STRING_WFD_AC3)) { *aCodec = WFD_AUDIO_AC3; *aFreq = WFD_FREQ_48000; *aChanels = msg->audio_codecs->list->modes; @@ -1747,8 +1784,8 @@ WFDResult wfdconfig_set_contentprotection_type(WFDMessage *msg, WFDHDCPProtectio if (!msg->content_protection) msg->content_protection = g_new0(WFDContentProtection, 1); if (hdcpversion == WFD_HDCP_NONE) return WFD_OK; msg->content_protection->hdcp2_spec = g_new0(WFDHdcp2Spec, 1); - if (hdcpversion == WFD_HDCP_2_0) msg->content_protection->hdcp2_spec->hdcpversion = g_strdup("HDCP2.0"); - else if (hdcpversion == WFD_HDCP_2_1) msg->content_protection->hdcp2_spec->hdcpversion = g_strdup("HDCP2.1"); + if (hdcpversion == WFD_HDCP_2_0) msg->content_protection->hdcp2_spec->hdcpversion = g_strdup(STRING_WFD_HDCP2_0); + else if (hdcpversion == WFD_HDCP_2_1) msg->content_protection->hdcp2_spec->hdcpversion = g_strdup(STRING_WFD_HDCP2_1); char str[11] = {0, }; snprintf(str, 11, "port=%d", TCPPort); msg->content_protection->hdcp2_spec->TCPPort = g_strdup(str); @@ -1761,14 +1798,14 @@ WFDResult wfdconfig_get_contentprotection_type(WFDMessage *msg, WFDHDCPProtectio if (msg->content_protection && msg->content_protection->hdcp2_spec) { char *result = NULL; char *ptr = NULL; - if (!g_strcmp0(msg->content_protection->hdcp2_spec->hdcpversion, "none")) { + if (!g_strcmp0(msg->content_protection->hdcp2_spec->hdcpversion, STRING_WFD_NONE)) { wfd_warning("HDCP none"); *hdcpversion = WFD_HDCP_NONE; *TCPPort = 0; return WFD_OK; } - if (!g_strcmp0(msg->content_protection->hdcp2_spec->hdcpversion, "HDCP2.0")) *hdcpversion = WFD_HDCP_2_0; - else if (!g_strcmp0(msg->content_protection->hdcp2_spec->hdcpversion, "HDCP2.1")) *hdcpversion = WFD_HDCP_2_1; + if (!g_strcmp0(msg->content_protection->hdcp2_spec->hdcpversion, STRING_WFD_HDCP2_0)) *hdcpversion = WFD_HDCP_2_0; + else if (!g_strcmp0(msg->content_protection->hdcp2_spec->hdcpversion, STRING_WFD_HDCP2_1)) *hdcpversion = WFD_HDCP_2_1; else { wfd_warning("Unknown protection type"); *hdcpversion = WFD_HDCP_NONE; @@ -1797,7 +1834,7 @@ WFDResult wfdconfig_set_display_EDID(WFDMessage *msg, gboolean edid_supported, g msg->display_edid->edid_payload = g_malloc(128 * edid_blockcount); if (!msg->display_edid->edid_payload) memcpy(msg->display_edid->edid_payload, edid_playload, 128 * edid_blockcount); - } else msg->display_edid->edid_payload = g_strdup("none"); + } else msg->display_edid->edid_payload = g_strdup(STRING_WFD_NONE); return WFD_OK; } @@ -1816,7 +1853,7 @@ WFDResult wfdconfig_get_display_EDID(WFDMessage *msg, gboolean *edid_supported, *edid_playload = temp; *edid_supported = TRUE; } - } else *edid_playload = g_strdup("none"); + } else *edid_playload = g_strdup(STRING_WFD_NONE); } } else *edid_supported = FALSE; return WFD_OK; @@ -1850,13 +1887,13 @@ WFDResult wfdconfig_set_trigger_type(WFDMessage *msg, WFDTrigger trigger) if (!msg->trigger_method) msg->trigger_method = g_new0(WFDTriggerMethod, 1); if (trigger == WFD_TRIGGER_SETUP) - msg->trigger_method->wfd_trigger_method = g_strdup("SETUP"); + msg->trigger_method->wfd_trigger_method = g_strdup(STRING_WFD_SETUP); else if (trigger == WFD_TRIGGER_PAUSE) - msg->trigger_method->wfd_trigger_method = g_strdup("PAUSE"); + msg->trigger_method->wfd_trigger_method = g_strdup(STRING_WFD_PAUSE); else if (trigger == WFD_TRIGGER_TEARDOWN) - msg->trigger_method->wfd_trigger_method = g_strdup("TEARDOWN"); + msg->trigger_method->wfd_trigger_method = g_strdup(STRING_WFD_TEARDOWN); else if (trigger == WFD_TRIGGER_PLAY) - msg->trigger_method->wfd_trigger_method = g_strdup("PLAY"); + msg->trigger_method->wfd_trigger_method = g_strdup(STRING_WFD_PLAY); else return WFD_EINVAL; return WFD_OK; @@ -1865,13 +1902,13 @@ WFDResult wfdconfig_set_trigger_type(WFDMessage *msg, WFDTrigger trigger) WFDResult wfdconfig_get_trigger_type(WFDMessage *msg, WFDTrigger *trigger) { g_return_val_if_fail(msg != NULL, WFD_EINVAL); - if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, "SETUP")) + if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, STRING_WFD_SETUP)) *trigger = WFD_TRIGGER_SETUP; - else if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, "PAUSE")) + else if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, STRING_WFD_PAUSE)) *trigger = WFD_TRIGGER_PAUSE; - else if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, "TEARDOWN")) + else if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, STRING_WFD_TEARDOWN)) *trigger = WFD_TRIGGER_TEARDOWN; - else if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, "PLAY")) + else if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, STRING_WFD_PLAY)) *trigger = WFD_TRIGGER_PLAY; else { *trigger = WFD_TRIGGER_UNKNOWN; @@ -1910,16 +1947,31 @@ WFDResult wfdconfig_set_prefered_RTP_ports(WFDMessage *msg, WFDRTSPTransMode tra if (trans != WFD_RTSP_TRANS_UNKNOWN) { lines = g_string_new(""); - if (trans == WFD_RTSP_TRANS_RTP) g_string_append_printf(lines, "RTP"); - else if (trans == WFD_RTSP_TRANS_RDT) g_string_append_printf(lines, "RDT"); + if (trans == WFD_RTSP_TRANS_RTP) g_string_append_printf(lines, STRING_WFD_RTP); + else if (trans == WFD_RTSP_TRANS_RDT) g_string_append_printf(lines, STRING_WFD_RDT); - if (profile == WFD_RTSP_PROFILE_AVP) g_string_append_printf(lines, "/AVP"); - else if (profile == WFD_RTSP_PROFILE_SAVP) g_string_append_printf(lines, "/SAVP"); + if (profile != WFD_RTSP_PROFILE_UNKNOWN) g_string_append_printf(lines, "/"); - if (lowertrans == WFD_RTSP_LOWER_TRANS_UDP) g_string_append_printf(lines, "/UDP;unicast"); - else if (lowertrans == WFD_RTSP_LOWER_TRANS_UDP_MCAST) g_string_append_printf(lines, "/UDP;multicast"); - else if (lowertrans == WFD_RTSP_LOWER_TRANS_TCP) g_string_append_printf(lines, "/TCP;unicast"); - else if (lowertrans == WFD_RTSP_LOWER_TRANS_HTTP) g_string_append_printf(lines, "/HTTP"); + if (profile == WFD_RTSP_PROFILE_AVP) g_string_append_printf(lines, STRING_WFD_AVP); + else if (profile == WFD_RTSP_PROFILE_SAVP) g_string_append_printf(lines, STRING_WFD_SAVP); + + if (lowertrans != WFD_RTSP_LOWER_TRANS_UNKNOWN) g_string_append_printf(lines, "/"); + + if (lowertrans == WFD_RTSP_LOWER_TRANS_UDP) { + g_string_append_printf(lines, STRING_WFD_UDP); + g_string_append_printf(lines, ";"); + g_string_append_printf(lines, STRING_WFD_UNICAST); + } else if (lowertrans == WFD_RTSP_LOWER_TRANS_UDP_MCAST) { + g_string_append_printf(lines, STRING_WFD_UDP); + g_string_append_printf(lines, ";"); + g_string_append_printf(lines, STRING_WFD_MULTICAST); + } else if (lowertrans == WFD_RTSP_LOWER_TRANS_TCP) { + g_string_append_printf(lines, STRING_WFD_TCP); + g_string_append_printf(lines, ";"); + g_string_append_printf(lines, STRING_WFD_UNICAST); + } else if (lowertrans == WFD_RTSP_LOWER_TRANS_HTTP) { + g_string_append_printf(lines, STRING_WFD_TCP_HTTP); + } msg->client_rtp_ports->profile = g_string_free(lines, FALSE); msg->client_rtp_ports->rtp_port0 = rtp_port0; @@ -1935,14 +1987,17 @@ WFDResult wfdconfig_get_prefered_RTP_ports(WFDMessage *msg, WFDRTSPTransMode *tr g_return_val_if_fail(msg != NULL, WFD_EINVAL); g_return_val_if_fail(msg->client_rtp_ports != NULL, WFD_EINVAL); - if (g_strrstr(msg->client_rtp_ports->profile, "RTP")) *trans = WFD_RTSP_TRANS_RTP; - if (g_strrstr(msg->client_rtp_ports->profile, "RDT")) *trans = WFD_RTSP_TRANS_RDT; - if (g_strrstr(msg->client_rtp_ports->profile, "AVP")) *profile = WFD_RTSP_PROFILE_AVP; - if (g_strrstr(msg->client_rtp_ports->profile, "SAVP")) *profile = WFD_RTSP_PROFILE_SAVP; - if (g_strrstr(msg->client_rtp_ports->profile, "UDP;unicast")) *lowertrans = WFD_RTSP_LOWER_TRANS_UDP; - if (g_strrstr(msg->client_rtp_ports->profile, "UDP;multicast")) *lowertrans = WFD_RTSP_LOWER_TRANS_UDP_MCAST; - if (g_strrstr(msg->client_rtp_ports->profile, "TCP;unicast")) *lowertrans = WFD_RTSP_LOWER_TRANS_TCP; - if (g_strrstr(msg->client_rtp_ports->profile, "HTTP")) *lowertrans = WFD_RTSP_LOWER_TRANS_HTTP; + if (g_strrstr(msg->client_rtp_ports->profile, STRING_WFD_RTP)) *trans = WFD_RTSP_TRANS_RTP; + if (g_strrstr(msg->client_rtp_ports->profile, STRING_WFD_RDT)) *trans = WFD_RTSP_TRANS_RDT; + if (g_strrstr(msg->client_rtp_ports->profile, STRING_WFD_AVP)) *profile = WFD_RTSP_PROFILE_AVP; + if (g_strrstr(msg->client_rtp_ports->profile, STRING_WFD_SAVP)) *profile = WFD_RTSP_PROFILE_SAVP; + if (g_strrstr(msg->client_rtp_ports->profile, STRING_WFD_UDP) && + g_strrstr(msg->client_rtp_ports->profile, STRING_WFD_UNICAST)) *lowertrans = WFD_RTSP_LOWER_TRANS_UDP; + if (g_strrstr(msg->client_rtp_ports->profile, STRING_WFD_UDP) && + g_strrstr(msg->client_rtp_ports->profile, STRING_WFD_MULTICAST)) *lowertrans = WFD_RTSP_LOWER_TRANS_UDP_MCAST; + if (g_strrstr(msg->client_rtp_ports->profile, STRING_WFD_TCP) && + g_strrstr(msg->client_rtp_ports->profile, STRING_WFD_UNICAST)) *lowertrans = WFD_RTSP_LOWER_TRANS_TCP; + if (g_strrstr(msg->client_rtp_ports->profile, STRING_WFD_TCP_HTTP)) *lowertrans = WFD_RTSP_LOWER_TRANS_HTTP; *rtp_port0 = msg->client_rtp_ports->rtp_port0; *rtp_port1 = msg->client_rtp_ports->rtp_port1; @@ -1954,8 +2009,8 @@ WFDResult wfdconfig_set_audio_sink_type(WFDMessage *msg, WFDSinkType sinktype) { g_return_val_if_fail(msg != NULL, WFD_EINVAL); if (!msg->route) msg->route = g_new0(WFDRoute, 1); - if (sinktype == WFD_PRIMARY_SINK) msg->route->destination = g_strdup("primary"); - else if (sinktype == WFD_SECONDARY_SINK) msg->route->destination = g_strdup("secondary"); + if (sinktype == WFD_PRIMARY_SINK) msg->route->destination = g_strdup(STRING_WFD_PRIMARY); + else if (sinktype == WFD_SECONDARY_SINK) msg->route->destination = g_strdup(STRING_WFD_SECONDARY); return WFD_OK; } @@ -1963,8 +2018,8 @@ WFDResult wfdconfig_get_audio_sink_type(WFDMessage *msg, WFDSinkType *sinktype) { g_return_val_if_fail(msg != NULL, WFD_EINVAL); if (msg->route) { - if (!g_strcmp0(msg->route->destination, "primary")) *sinktype = WFD_PRIMARY_SINK; - else if (!g_strcmp0(msg->route->destination, "secondary")) *sinktype = WFD_SECONDARY_SINK; + if (!g_strcmp0(msg->route->destination, STRING_WFD_PRIMARY)) *sinktype = WFD_PRIMARY_SINK; + else if (!g_strcmp0(msg->route->destination, STRING_WFD_SECONDARY)) *sinktype = WFD_SECONDARY_SINK; } return WFD_OK; } -- 2.7.4