From 9df6ffe525b600ec324eb9d8814e1638804abf1e Mon Sep 17 00:00:00 2001 From: YeJin Cho Date: Tue, 8 Jul 2014 19:12:38 +0900 Subject: [PATCH] Update wfdconfigmessage for supporting Wi-Fi Display sink side Update wfdconfigmessage with modifying some variable defining Corrected path to wfdconfigmessage.c/wfdconfigmessage.h Change-Id: If3d4947dedf74a592a68a53aaf3d73545856337f --- src/include/wfdconfigmessage.h | 4 +-- src/wfdconfigmessage.c | 62 +++++++++++++++++++++++++++++------------- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/src/include/wfdconfigmessage.h b/src/include/wfdconfigmessage.h index 0813b67..a6a7fb8 100755 --- a/src/include/wfdconfigmessage.h +++ b/src/include/wfdconfigmessage.h @@ -430,7 +430,7 @@ typedef struct { } WFDUibcSetting; typedef struct { - gchar *standby_resume_cap; + gboolean standby_resume_cap; } WFDStandbyResumeCapability; typedef struct { @@ -446,7 +446,6 @@ typedef struct { gboolean idr_request; } WFDIdrRequest; - /***********************************************************/ typedef struct { @@ -574,7 +573,6 @@ WFDResult wfdconfig_get_connector_type(WFDMessage *msg, WFDConnector *connector) WFDResult wfdconfig_set_idr_request(WFDMessage *msg); - G_END_DECLS #endif /* __GST_WFD_CONFIG_MESSAGE_H__ */ diff --git a/src/wfdconfigmessage.c b/src/wfdconfigmessage.c index d1cad58..d1af33a 100755 --- a/src/wfdconfigmessage.c +++ b/src/wfdconfigmessage.c @@ -30,9 +30,9 @@ #endif #include /* for G_OS_WIN32 */ -#include /* For GST_STR_NULL */ -#include + #include "wfdconfigmessage.h" + #include /* FIXME, is currently allocated on the stack */ @@ -202,7 +202,6 @@ wfdconfig_message_uninit (WFDMessage * msg) if(msg->idr_request) { FREE_STRING(msg->idr_request); } - return WFD_OK; } @@ -329,6 +328,8 @@ wfdconfig_message_as_text (const WFDMessage * msg) } else { g_string_append_printf (lines," none"); } + } else { + g_string_append_printf (lines," none"); } g_string_append_printf (lines,"\r\n"); } @@ -383,6 +384,7 @@ wfdconfig_message_as_text (const WFDMessage * msg) g_string_append_printf (lines," none"); g_string_append_printf (lines,"\r\n"); } + if(msg->client_rtp_ports) { g_string_append_printf (lines,"wfd_client_rtp_ports"); if(msg->client_rtp_ports->profile) { @@ -782,13 +784,14 @@ read_string_type_and_value (gchar * type, gchar * value, guint tsize, guint vsiz static gboolean wfdconfig_parse_line (WFDMessage * msg, gchar * buffer) { - gchar type[8192]; - gchar value[8192]; - gchar temp[8192]; + gchar type[8192] = {0}; + gchar value[8192] = {0}; + gchar temp[8192] = {0}; gchar *p = buffer; gchar *v = value; #define WFD_SKIP_SPACE(q) if (*q && g_ascii_isspace (*q)) q++ + #define WFD_SKIP_EQUAL(q) if (*q && *q == '=') q++ #define WFD_SKIP_COMMA(q) if (*q && g_ascii_ispunct (*q)) q++ #define WFD_READ_STRING(field) read_string_space_ended (temp, sizeof (temp), v); v+=strlen(temp); REPLACE_STRING (field, temp) #define WFD_READ_CHAR_END_STRING(field, del) read_string_char_ended (temp, sizeof (temp), del, v); v+=strlen(temp); REPLACE_STRING (field, temp) @@ -904,10 +907,25 @@ wfdconfig_parse_line (WFDMessage * msg, gchar * buffer) WFD_READ_UINT32(msg->display_edid->edid_block_count); WFD_SKIP_SPACE(v); if(msg->display_edid->edid_block_count) { + gchar *edid_string = v; + int i=0, j=0; guint32 payload_size = EDID_BLOCK_SIZE * msg->display_edid->edid_block_count; msg->display_edid->edid_payload = g_malloc(payload_size); - memcpy(msg->display_edid->edid_payload, v, payload_size); - v += payload_size; + for (;i<(EDID_BLOCK_SIZE*msg->display_edid->edid_block_count*2); j++) { + int k=0,kk=0; + if(edid_string[i]>0x29 && edid_string[i]<0x40) k=edid_string[i]-48; + else if(edid_string[i]>0x60 && edid_string[i]<0x67) k=edid_string[i]-87; + else if(edid_string[i]>0x40 && edid_string[i]<0x47) k=edid_string[i]-55; + + if(edid_string[i+1]>0x29 && edid_string[i+1]<0x40) kk=edid_string[i+1]-48; + else if(edid_string[i+1]>0x60 && edid_string[i+1]<0x67) kk=edid_string[i+1]-87; + else if(edid_string[i+1]>0x40 && edid_string[i+1]<0x47) kk=edid_string[i+1]-55; + + msg->display_edid->edid_payload[j] = (k<<4)|kk; + i+=2; + } + //memcpy(msg->display_edid->edid_payload, v, payload_size); + v += (payload_size*2); } else v += strlen(v); } } @@ -1172,15 +1190,13 @@ WFDResult wfdconfig_message_parse_buffer (const guint8 * data, guint size, WFDMessage * msg) { gchar *p; - gchar buffer[MAX_LINE_LEN]; + gchar buffer[MAX_LINE_LEN] = {0}; guint idx = 0; g_return_val_if_fail (msg != NULL, WFD_EINVAL); g_return_val_if_fail (data != NULL, WFD_EINVAL); g_return_val_if_fail (size != 0, WFD_EINVAL); - GST_LOG("wfdconfig_message_parse_buffer input: %s\n", data); - p = (gchar *) data; while (TRUE) { @@ -1336,6 +1352,7 @@ wfdconfig_message_dump (const WFDMessage * msg) debug_log (" %d\n", msg->client_rtp_ports->rtp_port1); debug_log (" %s\n", msg->client_rtp_ports->mode); } + debug_log("\r\n"); } if(msg->route) { @@ -1687,20 +1704,27 @@ WFDResult wfdconfig_get_contentprotection_type(WFDMessage *msg, WFDHDCPProtectio { g_return_val_if_fail (msg != NULL, WFD_EINVAL); if(msg->content_protection && msg->content_protection->hdcp2_spec) { - char *result = NULL; - gint value= 0; + char *result = NULL; if(!g_strcmp0(msg->content_protection->hdcp2_spec->hdcpversion,"none")) { - *hdcpversion = WFD_HDCP_NONE; - *TCPPort = 0; - return WFD_OK; + debug_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; + else { + debug_warning("Unknown protection type"); + *hdcpversion = WFD_HDCP_NONE; + *TCPPort = 0; + return WFD_OK; + } + result = strtok(msg->content_protection->hdcp2_spec->TCPPort, "="); while (result !=NULL) { - result = strtok(NULL, "="); - *TCPPort = atoi (result); - break; + result = strtok(NULL, "="); + *TCPPort = atoi (result); + break; } } else *hdcpversion = WFD_HDCP_NONE; return WFD_OK; -- 2.7.4