4 * Copyright (c) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, ByungWook Jang <bw.jang@samsung.com>,
7 * Manoj Kumar K <manojkumar.k@samsung.com>, Abhishek Bajaj <abhi.bajaj@samsung.com>, Nikhilesh Mittal <nikhilesh.m@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
30 #ifdef HAVE_SYS_TYPES_H
31 #include <sys/types.h>
34 #include <glib.h> /* for G_OS_WIN32 */
35 #include "wfdconfigmessage.h"
36 #include "mm_wfd_common_private.h"
38 /* FIXME, is currently allocated on the stack */
39 #define MAX_LINE_LEN (1024 * 16)
41 #define FREE_STRING(field) if (field != NULL) g_free(field); (field) = NULL;
42 #define REPLACE_STRING(field, val) FREE_STRING(field); (field) = g_strdup(val);
43 #define EDID_BLOCK_SIZE 128
55 * wfdconfig_message_new:
56 * @msg: pointer to new #WFDMessage
58 * Allocate a new WFDMessage and store the result in @msg.
60 * Returns: a #WFDResult.
63 wfdconfig_message_new(WFDMessage **msg)
67 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
69 newmsg = g_new0(WFDMessage, 1);
73 return wfdconfig_message_init(newmsg);
77 * wfdconfig_message_init:
80 * Initialize @msg so that its contents are as if it was freshly allocated
81 * with wfdconfig_message_new(). This function is mostly used to initialize a message
82 * allocated on the stack. wfdconfig_message_uninit() undoes this operation.
84 * When this function is invoked on newly allocated data(with malloc or on the
85 * stack), its contents should be set to 0 before calling this function.
87 * Returns: a #WFDResult.
90 wfdconfig_message_init(WFDMessage *msg)
92 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
98 * wfdconfig_message_uninit:
101 * Free all resources allocated in @msg. @msg should not be used anymore after
102 * this function. This function should be used when @msg was allocated on the
103 * stack and initialized with wfdconfig_message_init().
105 * Returns: a #WFDResult.
108 wfdconfig_message_uninit(WFDMessage *msg)
110 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
112 if (msg->audio_codecs) {
114 if (msg->audio_codecs->list) {
115 for (; i < msg->audio_codecs->count; i++) {
116 FREE_STRING(msg->audio_codecs->list[i].audio_format);
117 msg->audio_codecs->list[i].modes = 0;
118 msg->audio_codecs->list[i].latency = 0;
120 FREE_STRING(msg->audio_codecs->list);
122 FREE_STRING(msg->audio_codecs);
125 if (msg->video_formats) {
126 FREE_STRING(msg->video_formats->list);
127 FREE_STRING(msg->video_formats);
130 if (msg->video_3d_formats) {
131 FREE_STRING(msg->video_3d_formats->list);
132 FREE_STRING(msg->video_3d_formats);
135 if (msg->content_protection) {
136 if (msg->content_protection->hdcp2_spec) {
137 FREE_STRING(msg->content_protection->hdcp2_spec->hdcpversion);
138 FREE_STRING(msg->content_protection->hdcp2_spec->TCPPort);
139 FREE_STRING(msg->content_protection->hdcp2_spec);
141 FREE_STRING(msg->content_protection);
144 if (msg->display_edid) {
145 if (msg->display_edid->edid_payload)
146 FREE_STRING(msg->display_edid->edid_payload);
147 FREE_STRING(msg->display_edid);
150 if (msg->coupled_sink) {
151 if (msg->coupled_sink->coupled_sink_cap) {
152 FREE_STRING(msg->coupled_sink->coupled_sink_cap->sink_address);
153 FREE_STRING(msg->coupled_sink->coupled_sink_cap);
155 FREE_STRING(msg->coupled_sink);
158 if (msg->trigger_method) {
159 FREE_STRING(msg->trigger_method->wfd_trigger_method);
160 FREE_STRING(msg->trigger_method);
163 if (msg->presentation_url) {
164 FREE_STRING(msg->presentation_url->wfd_url0);
165 FREE_STRING(msg->presentation_url->wfd_url1);
166 FREE_STRING(msg->presentation_url);
169 if (msg->client_rtp_ports) {
170 FREE_STRING(msg->client_rtp_ports->profile);
171 FREE_STRING(msg->client_rtp_ports->mode);
172 FREE_STRING(msg->client_rtp_ports);
176 FREE_STRING(msg->route->destination);
177 FREE_STRING(msg->route);
181 FREE_STRING(msg->I2C);
184 if (msg->av_format_change_timing) {
185 FREE_STRING(msg->av_format_change_timing);
188 if (msg->preferred_display_mode) {
189 FREE_STRING(msg->preferred_display_mode);
192 if (msg->uibc_capability) {
193 if (msg->uibc_capability->hidc_cap_list.next) {
194 detailed_cap *list = msg->uibc_capability->hidc_cap_list.next;
195 detailed_cap *temp = NULL;
202 FREE_STRING(msg->uibc_capability);
205 if (msg->uibc_setting) {
206 FREE_STRING(msg->uibc_setting);
209 if (msg->standby_resume_capability) {
210 FREE_STRING(msg->standby_resume_capability);
214 FREE_STRING(msg->standby);
217 if (msg->connector_type) {
218 FREE_STRING(msg->connector_type);
221 if (msg->idr_request) {
222 FREE_STRING(msg->idr_request);
229 * wfdconfig_message_free:
230 * @msg: a #WFDMessage
232 * Free all resources allocated by @msg. @msg should not be used anymore after
233 * this function. This function should be used when @msg was dynamically
234 * allocated with wfdconfig_message_new().
236 * Returns: a #WFDResult.
239 wfdconfig_message_free(WFDMessage *msg)
241 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
243 wfdconfig_message_uninit(msg);
250 * wfdconfig_message_as_text:
251 * @msg: a #WFDMessage
253 * Convert the contents of @msg to a text string.
255 * Returns: A dynamically allocated string representing the WFD description.
258 wfdconfig_message_as_text(const WFDMessage *msg)
260 /* change all vars so they match rfc? */
262 g_return_val_if_fail(msg != NULL, NULL);
264 lines = g_string_new("");
266 /* list of audio codecs */
267 if (msg->audio_codecs) {
269 g_string_append_printf(lines, STRING_WFD_AUDIO_CODECS);
270 if (msg->audio_codecs->list) {
271 g_string_append_printf(lines, ":");
272 for (; i < msg->audio_codecs->count; i++) {
273 g_string_append_printf(lines, " %s", msg->audio_codecs->list[i].audio_format);
274 g_string_append_printf(lines, " %08x", msg->audio_codecs->list[i].modes);
275 g_string_append_printf(lines, " %02x", msg->audio_codecs->list[i].latency);
276 if ((i + 1) < msg->audio_codecs->count)
277 g_string_append_printf(lines, ",");
280 g_string_append_printf(lines, "\r\n");
283 /* list of video codecs */
284 if (msg->video_formats) {
285 g_string_append_printf(lines, STRING_WFD_VIDEO_FORMATS);
286 if (msg->video_formats->list) {
287 g_string_append_printf(lines, ":");
288 g_string_append_printf(lines, " %02x", msg->video_formats->list->native);
289 g_string_append_printf(lines, " %02x", msg->video_formats->list->preferred_display_mode_supported);
290 g_string_append_printf(lines, " %02x", msg->video_formats->list->H264_codec.profile);
291 g_string_append_printf(lines, " %02x", msg->video_formats->list->H264_codec.level);
292 g_string_append_printf(lines, " %08x", msg->video_formats->list->H264_codec.misc_params.CEA_Support);
293 g_string_append_printf(lines, " %08x", msg->video_formats->list->H264_codec.misc_params.VESA_Support);
294 g_string_append_printf(lines, " %08x", msg->video_formats->list->H264_codec.misc_params.HH_Support);
295 g_string_append_printf(lines, " %02x", msg->video_formats->list->H264_codec.misc_params.latency);
296 g_string_append_printf(lines, " %04x", msg->video_formats->list->H264_codec.misc_params.min_slice_size);
297 g_string_append_printf(lines, " %04x", msg->video_formats->list->H264_codec.misc_params.slice_enc_params);
298 g_string_append_printf(lines, " %02x", msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support);
300 if (msg->video_formats->list->H264_codec.max_hres)
301 g_string_append_printf(lines, " %04x", msg->video_formats->list->H264_codec.max_hres);
303 g_string_append_printf(lines, " none");
305 if (msg->video_formats->list->H264_codec.max_vres)
306 g_string_append_printf(lines, " %04x", msg->video_formats->list->H264_codec.max_vres);
308 g_string_append_printf(lines, " none");
310 g_string_append_printf(lines, "\r\n");
313 /* list of video 3D codecs */
314 if (msg->video_3d_formats) {
315 g_string_append_printf(lines, STRING_WFD_3D_VIDEO_FORMATS);
316 g_string_append_printf(lines, ":");
317 if (msg->video_3d_formats->list) {
318 g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->native);
319 g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->preferred_display_mode_supported);
320 g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->H264_codec.profile);
321 g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->H264_codec.level);
322 g_string_append_printf(lines, " %16x", msg->video_3d_formats->list->H264_codec.misc_params.video_3d_capability);
323 g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->H264_codec.misc_params.latency);
324 g_string_append_printf(lines, " %04x", msg->video_3d_formats->list->H264_codec.misc_params.min_slice_size);
325 g_string_append_printf(lines, " %04x", msg->video_3d_formats->list->H264_codec.misc_params.slice_enc_params);
326 g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->H264_codec.misc_params.frame_rate_control_support);
327 if (msg->video_3d_formats->list->H264_codec.max_hres)
328 g_string_append_printf(lines, " %04x", msg->video_formats->list->H264_codec.max_hres);
330 g_string_append_printf(lines, " none");
331 if (msg->video_3d_formats->list->H264_codec.max_vres)
332 g_string_append_printf(lines, " %04x", msg->video_formats->list->H264_codec.max_vres);
334 g_string_append_printf(lines, " none");
336 g_string_append_printf(lines, " none");
338 g_string_append_printf(lines, "\r\n");
341 if (msg->content_protection) {
342 g_string_append_printf(lines, STRING_WFD_CONTENT_PROTECTION);
343 g_string_append_printf(lines, ":");
344 if (msg->content_protection->hdcp2_spec) {
345 if (msg->content_protection->hdcp2_spec->hdcpversion) {
346 g_string_append_printf(lines, " %s", msg->content_protection->hdcp2_spec->hdcpversion);
347 g_string_append_printf(lines, " %s", msg->content_protection->hdcp2_spec->TCPPort);
349 g_string_append_printf(lines, " none");
352 g_string_append_printf(lines, " none");
354 g_string_append_printf(lines, "\r\n");
357 if (msg->display_edid) {
358 g_string_append_printf(lines, STRING_WFD_DISPLAY_EDID);
359 g_string_append_printf(lines, ":");
360 if (msg->display_edid->edid_supported) {
361 g_string_append_printf(lines, " %d", msg->display_edid->edid_supported);
362 if (msg->display_edid->edid_block_count)
363 g_string_append_printf(lines, " %d", msg->display_edid->edid_block_count);
365 g_string_append_printf(lines, " none");
367 g_string_append_printf(lines, " none");
369 g_string_append_printf(lines, "\r\n");
372 if (msg->coupled_sink) {
373 g_string_append_printf(lines, STRING_WFD_COUPLED_SINK);
374 g_string_append_printf(lines, ":");
375 if (msg->coupled_sink->coupled_sink_cap) {
376 g_string_append_printf(lines, " %02x", msg->coupled_sink->coupled_sink_cap->status);
377 if (msg->coupled_sink->coupled_sink_cap->sink_address)
378 g_string_append_printf(lines, " %s", msg->coupled_sink->coupled_sink_cap->sink_address);
380 g_string_append_printf(lines, " none");
382 g_string_append_printf(lines, " none");
384 g_string_append_printf(lines, "\r\n");
387 if (msg->trigger_method) {
388 g_string_append_printf(lines, STRING_WFD_TRIGGER_METHOD);
389 g_string_append_printf(lines, ":");
390 g_string_append_printf(lines, " %s", msg->trigger_method->wfd_trigger_method);
391 g_string_append_printf(lines, "\r\n");
394 if (msg->presentation_url) {
395 g_string_append_printf(lines, STRING_WFD_PRESENTATION_URL);
396 g_string_append_printf(lines, ":");
397 if (msg->presentation_url->wfd_url0)
398 g_string_append_printf(lines, " %s", msg->presentation_url->wfd_url0);
400 g_string_append_printf(lines, " none");
401 if (msg->presentation_url->wfd_url1)
402 g_string_append_printf(lines, " %s", msg->presentation_url->wfd_url1);
404 g_string_append_printf(lines, " none");
405 g_string_append_printf(lines, "\r\n");
408 if (msg->client_rtp_ports) {
409 g_string_append_printf(lines, STRING_WFD_CLIENT_RTP_PORTS);
410 if (msg->client_rtp_ports->profile) {
411 g_string_append_printf(lines, ":");
412 g_string_append_printf(lines, " %s", msg->client_rtp_ports->profile);
413 g_string_append_printf(lines, " %d", msg->client_rtp_ports->rtp_port0);
414 g_string_append_printf(lines, " %d", msg->client_rtp_ports->rtp_port1);
415 g_string_append_printf(lines, " %s", msg->client_rtp_ports->mode);
417 g_string_append_printf(lines, "\r\n");
421 g_string_append_printf(lines, STRING_WFD_ROUTE);
422 g_string_append_printf(lines, ":");
423 g_string_append_printf(lines, " %s", msg->route->destination);
424 g_string_append_printf(lines, "\r\n");
428 g_string_append_printf(lines, STRING_WFD_I2C);
429 g_string_append_printf(lines, ":");
430 if (msg->I2C->I2CPresent)
431 g_string_append_printf(lines, " %x", msg->I2C->I2C_port);
433 g_string_append_printf(lines, " none");
434 g_string_append_printf(lines, "\r\n");
437 if (msg->av_format_change_timing) {
438 g_string_append_printf(lines, STRING_WFD_AV_FORMAT_CHANGE_TIMING);
439 g_string_append_printf(lines, ":");
440 g_string_append_printf(lines, " %010llx", msg->av_format_change_timing->PTS);
441 g_string_append_printf(lines, " %010llx", msg->av_format_change_timing->DTS);
442 g_string_append_printf(lines, "\r\n");
445 if (msg->preferred_display_mode) {
446 g_string_append_printf(lines, STRING_WFD_PREFERRED_DISPLAY_MODE);
447 g_string_append_printf(lines, ":");
448 if (msg->preferred_display_mode->displaymodesupported) {
449 g_string_append_printf(lines, " %06llx", msg->preferred_display_mode->p_clock);
450 g_string_append_printf(lines, " %04x", msg->preferred_display_mode->H);
451 g_string_append_printf(lines, " %04x", msg->preferred_display_mode->HB);
452 g_string_append_printf(lines, " %04x", msg->preferred_display_mode->HSPOL_HSOFF);
453 g_string_append_printf(lines, " %04x", msg->preferred_display_mode->HSW);
454 g_string_append_printf(lines, " %04x", msg->preferred_display_mode->V);
455 g_string_append_printf(lines, " %04x", msg->preferred_display_mode->VB);
456 g_string_append_printf(lines, " %04x", msg->preferred_display_mode->VSPOL_VSOFF);
457 g_string_append_printf(lines, " %04x", msg->preferred_display_mode->VSW);
458 g_string_append_printf(lines, " %02x", msg->preferred_display_mode->VBS3D);
459 g_string_append_printf(lines, " %02x", msg->preferred_display_mode->V2d_s3d_modes);
460 g_string_append_printf(lines, " %02x", msg->preferred_display_mode->P_depth);
461 } else g_string_append_printf(lines, " none");
462 g_string_append_printf(lines, "\r\n");
465 if (msg->uibc_capability) {
466 g_string_append_printf(lines, STRING_WFD_UIBC_CAPABILITY);
467 g_string_append_printf(lines, ":");
468 if (msg->uibc_capability->uibcsupported) {
469 g_string_append_printf(lines, " input_category_list=");
470 if (msg->uibc_capability->input_category_list.input_cat) {
472 if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_GENERIC) {
473 tempcap |= WFD_UIBC_INPUT_CAT_GENERIC;
474 g_string_append_printf(lines, "GENERIC");
475 if (msg->uibc_capability->input_category_list.input_cat != tempcap) g_string_append_printf(lines, ", ");
477 if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_HIDC) {
478 tempcap |= WFD_UIBC_INPUT_CAT_HIDC;
479 g_string_append_printf(lines, "HIDC");
480 if (msg->uibc_capability->input_category_list.input_cat != tempcap) g_string_append_printf(lines, ", ");
482 } else g_string_append_printf(lines, "none");
483 g_string_append_printf(lines, ";");
484 g_string_append_printf(lines, " generic_cap_list=");
485 if (msg->uibc_capability->generic_cap_list.inp_type) {
487 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_KEYBOARD) {
488 tempcap |= WFD_UIBC_INPUT_TYPE_KEYBOARD;
489 g_string_append_printf(lines, "Keyboard");
490 if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
492 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_MOUSE) {
493 tempcap |= WFD_UIBC_INPUT_TYPE_MOUSE;
494 g_string_append_printf(lines, "Mouse");
495 if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
497 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_SINGLETOUCH) {
498 tempcap |= WFD_UIBC_INPUT_TYPE_SINGLETOUCH;
499 g_string_append_printf(lines, "SingleTouch");
500 if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
502 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_MULTITOUCH) {
503 tempcap |= WFD_UIBC_INPUT_TYPE_MULTITOUCH;
504 g_string_append_printf(lines, "MultiTouch");
505 if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
507 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_JOYSTICK) {
508 tempcap |= WFD_UIBC_INPUT_TYPE_JOYSTICK;
509 g_string_append_printf(lines, "Joystick");
510 if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
512 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_CAMERA) {
513 tempcap |= WFD_UIBC_INPUT_TYPE_CAMERA;
514 g_string_append_printf(lines, "Camera");
515 if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
517 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_GESTURE) {
518 tempcap |= WFD_UIBC_INPUT_TYPE_GESTURE;
519 g_string_append_printf(lines, "Gesture");
520 if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
522 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_REMOTECONTROL) {
523 tempcap |= WFD_UIBC_INPUT_TYPE_REMOTECONTROL;
524 g_string_append_printf(lines, "RemoteControl");
525 if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
527 } else g_string_append_printf(lines, "none");
528 g_string_append_printf(lines, ";");
529 g_string_append_printf(lines, " hidc_cap_list=");
530 if (msg->uibc_capability->hidc_cap_list.cap_count) {
531 detailed_cap *temp_cap = msg->uibc_capability->hidc_cap_list.next;
533 if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_KEYBOARD) g_string_append_printf(lines, "Keyboard");
534 else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_MOUSE) g_string_append_printf(lines, "Mouse");
535 else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_SINGLETOUCH) g_string_append_printf(lines, "SingleTouch");
536 else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_MULTITOUCH) g_string_append_printf(lines, "MultiTouch");
537 else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_JOYSTICK) g_string_append_printf(lines, "Joystick");
538 else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_CAMERA) g_string_append_printf(lines, "Camera");
539 else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_GESTURE) g_string_append_printf(lines, "Gesture");
540 else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_REMOTECONTROL) g_string_append_printf(lines, "RemoteControl");
541 g_string_append_printf(lines, "/");
542 if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_INFRARED) g_string_append_printf(lines, "Infrared");
543 else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_USB) g_string_append_printf(lines, "USB");
544 else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_BT) g_string_append_printf(lines, "BT");
545 else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_ZIGBEE) g_string_append_printf(lines, "Zigbee");
546 else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_WIFI) g_string_append_printf(lines, "Wi-Fi");
547 else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_NOSP) g_string_append_printf(lines, "No-SP");
548 temp_cap = temp_cap->next;
549 if (temp_cap) g_string_append_printf(lines, ", ");
551 } else g_string_append_printf(lines, "none");
552 g_string_append_printf(lines, ";");
553 if (msg->uibc_capability->tcp_port) g_string_append_printf(lines, "port=%u", msg->uibc_capability->tcp_port);
554 else g_string_append_printf(lines, "port=none");
555 } else g_string_append_printf(lines, " none");
556 g_string_append_printf(lines, "\r\n");
559 if (msg->uibc_setting) {
560 g_string_append_printf(lines, STRING_WFD_UIBC_SETTING);
561 g_string_append_printf(lines, ":");
562 if (msg->uibc_setting->uibc_setting)
563 g_string_append_printf(lines, " enable");
565 g_string_append_printf(lines, " disable");
566 g_string_append_printf(lines, "\r\n");
569 if (msg->standby_resume_capability) {
570 g_string_append_printf(lines, STRING_WFD_STANDBY_RESUME_CAPABILITY);
571 g_string_append_printf(lines, ":");
572 if (msg->standby_resume_capability->standby_resume_cap)
573 g_string_append_printf(lines, " supported");
575 g_string_append_printf(lines, " none");
576 g_string_append_printf(lines, "\r\n");
580 g_string_append_printf(lines, STRING_WFD_STANDBY);
581 g_string_append_printf(lines, "\r\n");
584 if (msg->connector_type) {
585 g_string_append_printf(lines, STRING_WFD_CONNECTOR_TYPE);
586 g_string_append_printf(lines, ":");
587 g_string_append_printf(lines, "\r\n");
590 if (msg->idr_request) {
591 g_string_append_printf(lines, STRING_WFD_IDR_REQUEST);
592 g_string_append_printf(lines, "\r\n");
595 /*g_string_append_printf (lines, "\0"); */
596 /*if(g_str_has_suffix (lines, "\r\n\0"))
598 guint32 length = g_strlen(lines);
599 lines[length-2] = '\0';
601 return g_string_free(lines, FALSE);
604 gchar *wfdconfig_parameter_names_as_text(const WFDMessage *msg)
606 /* change all vars so they match rfc? */
608 g_return_val_if_fail(msg != NULL, NULL);
610 lines = g_string_new("");
612 /* list of audio codecs */
613 if (msg->audio_codecs) {
614 g_string_append_printf(lines, STRING_WFD_AUDIO_CODECS);
615 g_string_append_printf(lines, "\r\n");
617 /* list of video codecs */
618 if (msg->video_formats) {
619 g_string_append_printf(lines, STRING_WFD_VIDEO_FORMATS);
620 g_string_append_printf(lines, "\r\n");
622 /* list of video 3D codecs */
623 if (msg->video_3d_formats) {
624 g_string_append_printf(lines, STRING_WFD_3D_VIDEO_FORMATS);
625 g_string_append_printf(lines, "\r\n");
627 if (msg->content_protection) {
628 g_string_append_printf(lines, STRING_WFD_CONTENT_PROTECTION);
629 g_string_append_printf(lines, "\r\n");
631 if (msg->display_edid) {
632 g_string_append_printf(lines, STRING_WFD_DISPLAY_EDID);
633 g_string_append_printf(lines, "\r\n");
635 if (msg->coupled_sink) {
636 g_string_append_printf(lines, STRING_WFD_COUPLED_SINK);
637 g_string_append_printf(lines, "\r\n");
639 if (msg->trigger_method) {
640 g_string_append_printf(lines, STRING_WFD_TRIGGER_METHOD);
641 g_string_append_printf(lines, "\r\n");
643 if (msg->presentation_url) {
644 g_string_append_printf(lines, STRING_WFD_PRESENTATION_URL);
645 g_string_append_printf(lines, "\r\n");
647 if (msg->client_rtp_ports) {
648 g_string_append_printf(lines, STRING_WFD_CLIENT_RTP_PORTS);
649 g_string_append_printf(lines, "\r\n");
652 g_string_append_printf(lines, STRING_WFD_ROUTE);
653 g_string_append_printf(lines, "\r\n");
656 g_string_append_printf(lines, STRING_WFD_I2C);
657 g_string_append_printf(lines, "\r\n");
659 if (msg->av_format_change_timing) {
660 g_string_append_printf(lines, STRING_WFD_AV_FORMAT_CHANGE_TIMING);
661 g_string_append_printf(lines, "\r\n");
663 if (msg->preferred_display_mode) {
664 g_string_append_printf(lines, STRING_WFD_PREFERRED_DISPLAY_MODE);
665 g_string_append_printf(lines, "\r\n");
667 if (msg->uibc_capability) {
668 g_string_append_printf(lines, STRING_WFD_UIBC_CAPABILITY);
669 g_string_append_printf(lines, "\r\n");
671 if (msg->uibc_setting) {
672 g_string_append_printf(lines, STRING_WFD_UIBC_SETTING);
673 g_string_append_printf(lines, "\r\n");
675 if (msg->standby_resume_capability) {
676 g_string_append_printf(lines, STRING_WFD_STANDBY_RESUME_CAPABILITY);
677 g_string_append_printf(lines, "\r\n");
680 g_string_append_printf(lines, STRING_WFD_STANDBY);
681 g_string_append_printf(lines, "\r\n");
683 if (msg->connector_type) {
684 g_string_append_printf(lines, STRING_WFD_CONNECTOR_TYPE);
685 g_string_append_printf(lines, "\r\n");
687 if (msg->idr_request) {
688 g_string_append_printf(lines, STRING_WFD_IDR_REQUEST);
689 g_string_append_printf(lines, "\r\n");
691 return g_string_free(lines, FALSE);
695 read_string_space_ended(gchar *dest, guint size, gchar *src)
699 while (!g_ascii_isspace(*src) && *src != '\0') {
710 read_string_char_ended(gchar *dest, guint size, gchar del, gchar *src)
714 while (*src != del && *src != '\0') {
725 read_string_type_and_value(gchar *type, gchar *value, guint tsize, guint vsize, gchar del, gchar *src)
730 while (*src != del && *src != '\0') {
741 while (*src != '\0') {
751 wfdconfig_parse_line(WFDMessage *msg, gchar *buffer)
753 gchar type[8192] = {0};
754 gchar value[8192] = {0};
755 gchar temp[8192] = {0};
758 gchar *result = NULL;
760 #define WFD_SKIP_SPACE(q) if (*q && g_ascii_isspace(*q)) q++;
761 #define WFD_SKIP_EQUAL(q) if (*q && *q == '=') q++;
762 #define WFD_SKIP_COMMA(q) if (*q && g_ascii_ispunct(*q)) q++;
763 #define WFD_READ_STRING(field) read_string_space_ended(temp, sizeof(temp), v); v += strlen(temp); REPLACE_STRING(field, temp);
764 #define WFD_READ_CHAR_END_STRING(field, del) read_string_char_ended(temp, sizeof(temp), del, v); v += strlen(temp); REPLACE_STRING(field, temp);
765 #define WFD_READ_UINT32(field) read_string_space_ended(temp, sizeof(temp), v); v += strlen(temp); field = strtoul(temp, NULL, 16);
766 #define WFD_READ_UINT32_DIGIT(field) read_string_space_ended(temp, sizeof(temp), v); v += strlen(temp); field = strtoul(temp, NULL, 10);
768 /*g_print("wfdconfig_parse_line input: %s\n", buffer); */
769 read_string_type_and_value(type, value, sizeof(type), sizeof(value), ':', p);
770 /*g_print("wfdconfig_parse_line type:%s value:%s\n", type, value); */
771 if (!g_strcmp0(type, STRING_WFD_AUDIO_CODECS)) {
772 msg->audio_codecs = g_new0(WFDAudioCodeclist, 1);
775 msg->audio_codecs->count = strlen(v) / 16;
776 msg->audio_codecs->list = g_new0(WFDAudioCodec, msg->audio_codecs->count);
777 for (; i < msg->audio_codecs->count; i++) {
779 WFD_READ_STRING(msg->audio_codecs->list[i].audio_format);
781 WFD_READ_UINT32(msg->audio_codecs->list[i].modes);
783 WFD_READ_UINT32(msg->audio_codecs->list[i].latency);
787 } else if (!g_strcmp0(type, STRING_WFD_VIDEO_FORMATS)) {
788 msg->video_formats = g_new0(WFDVideoCodeclist, 1);
790 msg->video_formats->count = 1;
791 msg->video_formats->list = g_new0(WFDVideoCodec, 1);
793 WFD_READ_UINT32(msg->video_formats->list->native);
795 WFD_READ_UINT32(msg->video_formats->list->preferred_display_mode_supported);
797 WFD_READ_UINT32(msg->video_formats->list->H264_codec.profile);
799 WFD_READ_UINT32(msg->video_formats->list->H264_codec.level);
801 WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.CEA_Support);
803 WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.VESA_Support);
805 WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.HH_Support);
807 WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.latency);
809 WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.min_slice_size);
811 WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.slice_enc_params);
813 WFD_READ_UINT32(msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support);
815 if (msg->video_formats->list->preferred_display_mode_supported == 1) {
816 WFD_READ_UINT32(msg->video_formats->list->H264_codec.max_hres);
818 WFD_READ_UINT32(msg->video_formats->list->H264_codec.max_vres);
822 } else if (!g_strcmp0(type, STRING_WFD_3D_VIDEO_FORMATS)) {
823 msg->video_3d_formats = g_new0(WFD3DFormats, 1);
825 msg->video_3d_formats->count = 1;
826 msg->video_3d_formats->list = g_new0(WFD3dCapList, 1);
828 WFD_READ_UINT32(msg->video_3d_formats->list->native);
830 WFD_READ_UINT32(msg->video_3d_formats->list->preferred_display_mode_supported);
832 WFD_READ_UINT32(msg->video_3d_formats->list->H264_codec.profile);
834 WFD_READ_UINT32(msg->video_3d_formats->list->H264_codec.level);
836 WFD_READ_UINT32(msg->video_3d_formats->list->H264_codec.misc_params.video_3d_capability);
838 WFD_READ_UINT32(msg->video_3d_formats->list->H264_codec.misc_params.latency);
840 WFD_READ_UINT32(msg->video_3d_formats->list->H264_codec.misc_params.min_slice_size);
842 WFD_READ_UINT32(msg->video_3d_formats->list->H264_codec.misc_params.slice_enc_params);
844 WFD_READ_UINT32(msg->video_3d_formats->list->H264_codec.misc_params.frame_rate_control_support);
846 if (msg->video_3d_formats->list->preferred_display_mode_supported == 1) {
847 WFD_READ_UINT32(msg->video_3d_formats->list->H264_codec.max_hres);
849 WFD_READ_UINT32(msg->video_3d_formats->list->H264_codec.max_vres);
853 } else if (!g_strcmp0(type, STRING_WFD_CONTENT_PROTECTION)) {
854 msg->content_protection = g_new0(WFDContentProtection, 1);
857 msg->content_protection->hdcp2_spec = g_new0(WFDHdcp2Spec, 1);
858 if (strstr(v, "none")) {
859 msg->content_protection->hdcp2_spec->hdcpversion = g_strdup("none");
861 WFD_READ_STRING(msg->content_protection->hdcp2_spec->hdcpversion);
863 WFD_READ_STRING(msg->content_protection->hdcp2_spec->TCPPort);
866 } else if (!g_strcmp0(type, STRING_WFD_DISPLAY_EDID)) {
867 msg->display_edid = g_new0(WFDDisplayEdid, 1);
870 if (strstr(v, "none")) {
871 msg->display_edid->edid_supported = 0;
873 msg->display_edid->edid_supported = 1;
874 WFD_READ_UINT32(msg->display_edid->edid_block_count);
876 if (msg->display_edid->edid_block_count) {
877 gchar *edid_string = v;
878 int i = 0, j = 0, size = 0;
879 guint32 payload_size = EDID_BLOCK_SIZE * msg->display_edid->edid_block_count;
880 msg->display_edid->edid_payload = g_malloc(payload_size);
881 size = EDID_BLOCK_SIZE * msg->display_edid->edid_block_count * 2;
882 for (; i < size; j++) {
884 if (edid_string[i] > 0x29 && edid_string[i] < 0x40) k = edid_string[i] - 48;
885 else if (edid_string[i] > 0x60 && edid_string[i] < 0x67) k = edid_string[i] - 87;
886 else if (edid_string[i] > 0x40 && edid_string[i] < 0x47) k = edid_string[i] - 55;
888 if (edid_string[i + 1] > 0x29 && edid_string[i + 1] < 0x40) kk = edid_string[i + 1] - 48;
889 else if (edid_string[i + 1] > 0x60 && edid_string[i + 1] < 0x67) kk = edid_string[i + 1] - 87;
890 else if (edid_string[i + 1] > 0x40 && edid_string[i + 1] < 0x47) kk = edid_string[i + 1] - 55;
892 msg->display_edid->edid_payload[j] = (k << 4) | kk;
895 /*memcpy(msg->display_edid->edid_payload, v, payload_size); */
896 v += (payload_size * 2);
897 } else v += strlen(v);
900 } else if (!g_strcmp0(type, STRING_WFD_COUPLED_SINK)) {
901 msg->coupled_sink = g_new0(WFDCoupledSink, 1);
903 msg->coupled_sink->coupled_sink_cap = g_new0(WFDCoupled_sink_cap, 1);
905 WFD_READ_UINT32(msg->coupled_sink->coupled_sink_cap->status);
907 WFD_READ_STRING(msg->coupled_sink->coupled_sink_cap->sink_address);
909 } else if (!g_strcmp0(type, STRING_WFD_TRIGGER_METHOD)) {
910 msg->trigger_method = g_new0(WFDTriggerMethod, 1);
913 WFD_READ_STRING(msg->trigger_method->wfd_trigger_method);
915 } else if (!g_strcmp0(type, STRING_WFD_PRESENTATION_URL)) {
916 msg->presentation_url = g_new0(WFDPresentationUrl, 1);
919 WFD_READ_STRING(msg->presentation_url->wfd_url0);
921 WFD_READ_STRING(msg->presentation_url->wfd_url1);
923 } else if (!g_strcmp0(type, STRING_WFD_CLIENT_RTP_PORTS)) {
924 msg->client_rtp_ports = g_new0(WFDClientRtpPorts, 1);
927 WFD_READ_STRING(msg->client_rtp_ports->profile);
929 WFD_READ_UINT32_DIGIT(msg->client_rtp_ports->rtp_port0);
931 WFD_READ_UINT32_DIGIT(msg->client_rtp_ports->rtp_port1);
933 WFD_READ_STRING(msg->client_rtp_ports->mode);
935 } else if (!g_strcmp0(type, STRING_WFD_ROUTE)) {
936 msg->route = g_new0(WFDRoute, 1);
939 WFD_READ_STRING(msg->route->destination);
941 } else if (!g_strcmp0(type, STRING_WFD_I2C)) {
942 msg->I2C = g_new0(WFDI2C, 1);
944 msg->I2C->I2CPresent = TRUE;
946 WFD_READ_UINT32_DIGIT(msg->I2C->I2C_port);
947 if (msg->I2C->I2C_port) msg->I2C->I2CPresent = TRUE;
949 } else if (!g_strcmp0(type, STRING_WFD_AV_FORMAT_CHANGE_TIMING)) {
950 msg->av_format_change_timing = g_new0(WFDAVFormatChangeTiming, 1);
953 WFD_READ_UINT32(msg->av_format_change_timing->PTS);
955 WFD_READ_UINT32(msg->av_format_change_timing->DTS);
957 } else if (!g_strcmp0(type, STRING_WFD_PREFERRED_DISPLAY_MODE)) {
958 msg->preferred_display_mode = g_new0(WFDPreferredDisplayMode, 1);
961 if (!strstr(v, "none")) {
962 msg->preferred_display_mode->displaymodesupported = FALSE;
964 WFD_READ_UINT32(msg->preferred_display_mode->p_clock);
966 WFD_READ_UINT32(msg->preferred_display_mode->H);
968 WFD_READ_UINT32(msg->preferred_display_mode->HB);
970 WFD_READ_UINT32(msg->preferred_display_mode->HSPOL_HSOFF);
972 WFD_READ_UINT32(msg->preferred_display_mode->HSW);
974 WFD_READ_UINT32(msg->preferred_display_mode->V);
976 WFD_READ_UINT32(msg->preferred_display_mode->VB);
978 WFD_READ_UINT32(msg->preferred_display_mode->VSPOL_VSOFF);
980 WFD_READ_UINT32(msg->preferred_display_mode->VSW);
982 WFD_READ_UINT32(msg->preferred_display_mode->VBS3D);
984 WFD_READ_UINT32(msg->preferred_display_mode->V2d_s3d_modes);
986 WFD_READ_UINT32(msg->preferred_display_mode->P_depth);
988 WFD_READ_UINT32(msg->preferred_display_mode->H264_codec.profile);
990 WFD_READ_UINT32(msg->preferred_display_mode->H264_codec.level);
992 WFD_READ_UINT32(msg->preferred_display_mode->H264_codec.misc_params.CEA_Support);
994 WFD_READ_UINT32(msg->preferred_display_mode->H264_codec.misc_params.VESA_Support);
996 WFD_READ_UINT32(msg->preferred_display_mode->H264_codec.misc_params.HH_Support);
998 WFD_READ_UINT32(msg->preferred_display_mode->H264_codec.misc_params.latency);
1000 WFD_READ_UINT32(msg->preferred_display_mode->H264_codec.misc_params.min_slice_size);
1002 WFD_READ_UINT32(msg->preferred_display_mode->H264_codec.misc_params.slice_enc_params);
1004 WFD_READ_UINT32(msg->preferred_display_mode->H264_codec.misc_params.frame_rate_control_support);
1006 WFD_READ_UINT32(msg->preferred_display_mode->H264_codec.max_hres);
1008 WFD_READ_UINT32(msg->preferred_display_mode->H264_codec.max_vres);
1012 } else if (!g_strcmp0(type, STRING_WFD_UIBC_CAPABILITY)) {
1013 msg->uibc_capability = g_new0(WFDUibcCapability, 1);
1014 if (strstr(v, "input_category_list")) {
1015 gchar *tstring = NULL;
1016 msg->uibc_capability->uibcsupported = TRUE;
1018 WFD_READ_CHAR_END_STRING(tstring, '=');
1019 if (!g_strcmp0(tstring, "input_category_list")) {
1020 gchar temp2[8192] = {0};
1021 guint rem_len = 0, read_len = 0;
1022 WFD_READ_CHAR_END_STRING(tstring, ';');
1023 rem_len = strlen(tstring);
1026 read_string_char_ended(temp2, 8192, ',', tstring + read_len);
1027 read_len += (strlen(temp2) + 1);
1028 if (strstr(temp2, "GENERIC")) msg->uibc_capability->input_category_list.input_cat |= WFD_UIBC_INPUT_CAT_GENERIC;
1029 else if (strstr(temp2, "HIDC")) msg->uibc_capability->input_category_list.input_cat |= WFD_UIBC_INPUT_CAT_HIDC;
1030 else msg->uibc_capability->input_category_list.input_cat |= WFD_UIBC_INPUT_CAT_UNKNOWN;
1031 } while (read_len < rem_len);
1033 result = strstr(v, "generic_cap_list");
1034 if (result != NULL) {
1035 memset(temp2, 0, 8192);
1039 WFD_READ_CHAR_END_STRING(tstring, '=');
1040 if (!g_strcmp0(tstring, "generic_cap_list")) {
1042 WFD_READ_CHAR_END_STRING(tstring, ';');
1043 rem_len = strlen(tstring);
1045 read_string_char_ended(temp2, 8192, ',', tstring + read_len);
1046 read_len += (strlen(temp2) + 1);
1047 if (strstr(temp2, "Keyboard")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_KEYBOARD;
1048 else if (strstr(temp2, "Mouse")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_MOUSE;
1049 else if (strstr(temp2, "SingleTouch")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_SINGLETOUCH;
1050 else if (strstr(temp2, "MultiTouch")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_MULTITOUCH;
1051 else if (strstr(temp2, "Joystick")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_JOYSTICK;
1052 else if (strstr(temp2, "Camera")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_CAMERA;
1053 else if (strstr(temp2, "Gesture")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_GESTURE;
1054 else if (strstr(temp2, "RemoteControl")) msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_REMOTECONTROL;
1055 else msg->uibc_capability->generic_cap_list.inp_type |= WFD_UIBC_INPUT_TYPE_UNKNOWN;
1056 } while (read_len < rem_len);
1059 result = strstr(v, "hidc_cap_list");
1060 if (result != NULL) {
1063 WFD_READ_CHAR_END_STRING(tstring, '=');
1064 if (!g_strcmp0(tstring, "hidc_cap_list")) {
1065 gchar inp_type[8192];
1066 gchar inp_path[8192];
1067 memset(temp2, 0, 8192);
1070 detailed_cap *temp_cap;
1071 WFD_READ_CHAR_END_STRING(tstring, ';');
1072 rem_len = strlen(tstring);
1073 msg->uibc_capability->hidc_cap_list.next = g_new0(detailed_cap, 1);
1074 temp_cap = msg->uibc_capability->hidc_cap_list.next;
1076 msg->uibc_capability->hidc_cap_list.cap_count++;
1077 read_string_char_ended(temp2, 8192, ',', tstring + read_len);
1078 read_len += (strlen(temp2) + 1);
1079 read_string_type_and_value(inp_type, inp_path, sizeof(inp_type), sizeof(inp_path), '/', temp2);
1080 if (strstr(inp_type, "Keyboard")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_KEYBOARD;
1081 else if (strstr(inp_type, "Mouse")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_MOUSE;
1082 else if (strstr(inp_type, "SingleTouch")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_SINGLETOUCH;
1083 else if (strstr(inp_type, "MultiTouch")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_MULTITOUCH;
1084 else if (strstr(inp_type, "Joystick")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_JOYSTICK;
1085 else if (strstr(inp_type, "Camera")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_CAMERA;
1086 else if (strstr(inp_type, "Gesture")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_GESTURE;
1087 else if (strstr(inp_type, "RemoteControl")) temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_REMOTECONTROL;
1088 else temp_cap->p.inp_type = WFD_UIBC_INPUT_TYPE_UNKNOWN;
1090 if (strstr(inp_path, "Infrared")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_INFRARED;
1091 else if (strstr(inp_path, "USB")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_USB;
1092 else if (strstr(inp_path, "BT")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_BT;
1093 else if (strstr(inp_path, "Zigbee")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_ZIGBEE;
1094 else if (strstr(inp_path, "Wi-Fi")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_WIFI;
1095 else if (strstr(inp_path, "No-SP")) temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_NOSP;
1096 else temp_cap->p.inp_path = WFD_UIBC_INPUT_PATH_UNKNOWN;
1097 if (read_len < rem_len) {
1098 temp_cap->next = g_new0(detailed_cap, 1);
1099 temp_cap = temp_cap->next;
1101 } while (read_len < rem_len);
1104 result = strstr(v, "port");
1105 if (result != NULL) {
1107 WFD_READ_CHAR_END_STRING(tstring, '=');
1108 if (!g_strcmp0(tstring, "port")) {
1110 WFD_READ_CHAR_END_STRING(tstring, ';');
1111 if (!strstr(tstring, "none")) {
1112 msg->uibc_capability->tcp_port = strtoul(tstring, NULL, 10);
1117 } else if (strstr(v, "none")) {
1118 msg->uibc_capability->uibcsupported = FALSE;
1120 } else if (!g_strcmp0(type, STRING_WFD_UIBC_SETTING)) {
1121 msg->uibc_setting = g_new0(WFDUibcSetting, 1);
1124 if (!g_strcmp0(v, "enable"))
1125 msg->uibc_setting->uibc_setting = TRUE;
1127 msg->uibc_setting->uibc_setting = FALSE;
1129 } else if (!g_strcmp0(type, STRING_WFD_STANDBY_RESUME_CAPABILITY)) {
1130 msg->standby_resume_capability = g_new0(WFDStandbyResumeCapability, 1);
1133 if (!g_strcmp0(v, "supported"))
1134 msg->standby_resume_capability->standby_resume_cap = TRUE;
1136 msg->standby_resume_capability->standby_resume_cap = FALSE;
1138 } else if (!g_strcmp0(type, STRING_WFD_STANDBY)) {
1139 msg->standby = g_new0(WFDStandby, 1);
1140 msg->standby->wfd_standby = TRUE;
1141 } else if (!g_strcmp0(type, STRING_WFD_CONNECTOR_TYPE)) {
1142 msg->connector_type = g_new0(WFDConnectorType, 1);
1144 msg->connector_type->supported = TRUE;
1146 WFD_READ_UINT32(msg->connector_type->connector_type);
1148 } else if (!g_strcmp0(type, STRING_WFD_IDR_REQUEST)) {
1149 msg->idr_request = g_new0(WFDIdrRequest, 1);
1150 msg->idr_request->idr_request = TRUE;
1157 * wfdconfig_message_parse_buffer:
1158 * @data: the start of the buffer
1159 * @size: the size of the buffer
1160 * @msg: the result #WFDMessage
1162 * Parse the contents of @size bytes pointed to by @data and store the result in
1165 * Returns: #WFD_OK on success.
1168 wfdconfig_message_parse_buffer(const guint8 *data, guint size, WFDMessage *msg)
1171 gchar buffer[MAX_LINE_LEN] = {0};
1174 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1175 g_return_val_if_fail(data != NULL, WFD_EINVAL);
1176 g_return_val_if_fail(size != 0, WFD_EINVAL);
1178 p = (const gchar *) data;
1185 while (*p != '\n' && *p != '\r' && *p != '\0') {
1186 if (idx < sizeof(buffer) - 1)
1191 wfdconfig_parse_line(msg, buffer);
1202 * wfdconfig_message_dump:
1203 * @msg: a #WFDMessage
1205 * Dump the parsed contents of @msg to stdout.
1207 * Returns: a #WFDResult.
1210 wfdconfig_message_dump(const WFDMessage *msg)
1212 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1213 wfd_debug("===========WFD Message dump=========");
1215 if (msg->audio_codecs) {
1217 wfd_debug("Audio supported formats : \n");
1218 for (; i < msg->audio_codecs->count; i++) {
1219 wfd_debug("Codec: %s\n", msg->audio_codecs->list[i].audio_format);
1220 if (!strcmp(msg->audio_codecs->list[i].audio_format, "LPCM")) {
1221 if (msg->audio_codecs->list[i].modes & WFD_FREQ_44100)
1222 wfd_debug(" Freq: %d\n", 44100);
1223 if (msg->audio_codecs->list[i].modes & WFD_FREQ_48000)
1224 wfd_debug(" Freq: %d\n", 48000);
1225 wfd_debug(" Channels: %d\n", 2);
1227 if (!strcmp(msg->audio_codecs->list[i].audio_format, "AAC")) {
1228 wfd_debug(" Freq: %d\n", 48000);
1229 if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_2)
1230 wfd_debug(" Channels: %d\n", 2);
1231 if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_4)
1232 wfd_debug(" Channels: %d\n", 4);
1233 if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_6)
1234 wfd_debug(" Channels: %d\n", 6);
1235 if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_8)
1236 wfd_debug(" Channels: %d\n", 8);
1238 if (!strcmp(msg->audio_codecs->list[i].audio_format, "AC3")) {
1239 wfd_debug(" Freq: %d\n", 48000);
1240 if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_2)
1241 wfd_debug(" Channels: %d\n", 2);
1242 if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_4)
1243 wfd_debug(" Channels: %d\n", 4);
1244 if (msg->audio_codecs->list[i].modes & WFD_CHANNEL_6)
1245 wfd_debug(" Channels: %d\n", 6);
1247 wfd_debug(" Bitwidth: %d\n", 16);
1248 wfd_debug(" Latency: %d\n", msg->audio_codecs->list[i].latency);
1253 if (msg->video_formats) {
1254 wfd_debug("Video supported formats : \n");
1255 if (msg->video_formats->list) {
1256 wfd_debug("Codec: H264\n");
1257 guint nativeindex = 0;
1258 if ((msg->video_formats->list->native & 0x7) == WFD_VIDEO_CEA_RESOLUTION) {
1259 wfd_debug(" Native type: CEA\n");
1260 } else if ((msg->video_formats->list->native & 0x7) == WFD_VIDEO_VESA_RESOLUTION) {
1261 wfd_debug(" Native type: VESA\n");
1262 } else if ((msg->video_formats->list->native & 0x7) == WFD_VIDEO_HH_RESOLUTION) {
1263 wfd_debug(" Native type: HH\n");
1265 nativeindex = msg->video_formats->list->native >> 3;
1266 wfd_debug(" Resolution: %d\n", (1 << nativeindex));
1268 if (msg->video_formats->list->H264_codec.profile & WFD_H264_BASE_PROFILE) {
1269 wfd_debug(" Profile: BASE\n");
1270 } else if (msg->video_formats->list->H264_codec.profile & WFD_H264_HIGH_PROFILE) {
1271 wfd_debug(" Profile: HIGH\n");
1273 if (msg->video_formats->list->H264_codec.level & WFD_H264_LEVEL_3_1) {
1274 wfd_debug(" Level: 3.1\n");
1275 } else if (msg->video_formats->list->H264_codec.level & WFD_H264_LEVEL_3_2) {
1276 wfd_debug(" Level: 3.2\n");
1277 } else if (msg->video_formats->list->H264_codec.level & WFD_H264_LEVEL_4) {
1278 wfd_debug(" Level: 4\n");
1279 } else if (msg->video_formats->list->H264_codec.level & WFD_H264_LEVEL_4_1) {
1280 wfd_debug(" Level: 4.1\n");
1281 } else if (msg->video_formats->list->H264_codec.level & WFD_H264_LEVEL_4_2) {
1282 wfd_debug(" Level: 4.2\n");
1284 wfd_debug(" Latency: %d\n", msg->video_formats->list->H264_codec.misc_params.latency);
1285 wfd_debug(" min_slice_size: %x\n", msg->video_formats->list->H264_codec.misc_params.min_slice_size);
1286 wfd_debug(" slice_enc_params: %x\n", msg->video_formats->list->H264_codec.misc_params.slice_enc_params);
1287 wfd_debug(" frame_rate_control_support: %x\n", msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support);
1288 if (msg->video_formats->list->H264_codec.max_hres) {
1289 wfd_debug(" Max Width: %04d\n", msg->video_formats->list->H264_codec.max_hres);
1291 if (msg->video_formats->list->H264_codec.max_vres) {
1292 wfd_debug(" Max Height: %04d\n", msg->video_formats->list->H264_codec.max_vres);
1297 if (msg->video_3d_formats) {
1298 wfd_debug("wfd_3d_formats");
1302 if (msg->content_protection) {
1303 wfd_debug(STRING_WFD_CONTENT_PROTECTION);
1307 if (msg->display_edid) {
1308 wfd_debug(STRING_WFD_DISPLAY_EDID);
1312 if (msg->coupled_sink) {
1313 wfd_debug(STRING_WFD_COUPLED_SINK);
1317 if (msg->trigger_method) {
1318 wfd_debug(" Trigger type: %s\n", msg->trigger_method->wfd_trigger_method);
1321 if (msg->presentation_url) {
1322 wfd_debug(STRING_WFD_PRESENTATION_URL);
1326 if (msg->client_rtp_ports) {
1327 wfd_debug(" Client RTP Ports : \n");
1328 if (msg->client_rtp_ports->profile) {
1329 wfd_debug("%s\n", msg->client_rtp_ports->profile);
1330 wfd_debug(" %d\n", msg->client_rtp_ports->rtp_port0);
1331 wfd_debug(" %d\n", msg->client_rtp_ports->rtp_port1);
1332 wfd_debug(" %s\n", msg->client_rtp_ports->mode);
1338 wfd_debug(STRING_WFD_ROUTE);
1343 wfd_debug(STRING_WFD_I2C);
1347 if (msg->av_format_change_timing) {
1348 wfd_debug(STRING_WFD_AV_FORMAT_CHANGE_TIMING);
1352 if (msg->preferred_display_mode) {
1353 wfd_debug(STRING_WFD_PREFERRED_DISPLAY_MODE);
1357 if (msg->uibc_capability) {
1358 wfd_debug("wfd_uibc_capability \r\n");
1359 wfd_debug("input category list:");
1360 if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_GENERIC)
1361 wfd_debug("GENERIC");
1362 if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_HIDC)
1364 if (!msg->uibc_capability->input_category_list.input_cat)
1366 if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_GENERIC) {
1367 wfd_debug("generic cap list: ");
1368 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_KEYBOARD)
1369 wfd_debug("keyboard ");
1370 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_MOUSE)
1371 wfd_debug("mouse ");
1372 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_SINGLETOUCH)
1373 wfd_debug("single-touch ");
1374 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_MULTITOUCH)
1375 wfd_debug("multi-touch ");
1376 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_JOYSTICK)
1377 wfd_debug("joystick ");
1378 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_CAMERA)
1379 wfd_debug("camera ");
1380 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_GESTURE)
1381 wfd_debug("gesture ");
1382 if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_REMOTECONTROL)
1383 wfd_debug("remote control ");
1384 if (!msg->uibc_capability->generic_cap_list.inp_type)
1387 if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_HIDC) {
1388 wfd_debug("hidc cap list:");
1389 if (msg->uibc_capability->hidc_cap_list.cap_count) {
1390 detailed_cap *temp_cap = msg->uibc_capability->hidc_cap_list.next;
1392 if (temp_cap->p.inp_type & WFD_UIBC_INPUT_TYPE_KEYBOARD) {
1393 wfd_debug("keyboard ");
1394 } else if (temp_cap->p.inp_type & WFD_UIBC_INPUT_TYPE_MOUSE) {
1395 wfd_debug("mouse ");
1396 } else if (temp_cap->p.inp_type & WFD_UIBC_INPUT_TYPE_SINGLETOUCH) {
1397 wfd_debug("single-touch ");
1398 } else if (temp_cap->p.inp_type & WFD_UIBC_INPUT_TYPE_MULTITOUCH) {
1399 wfd_debug("multi-touch ");
1400 } else if (temp_cap->p.inp_type & WFD_UIBC_INPUT_TYPE_JOYSTICK) {
1401 wfd_debug("joystick ");
1402 } else if (temp_cap->p.inp_type & WFD_UIBC_INPUT_TYPE_CAMERA) {
1403 wfd_debug("camera ");
1404 } else if (temp_cap->p.inp_type & WFD_UIBC_INPUT_TYPE_GESTURE) {
1405 wfd_debug("gesture ");
1406 } else if (temp_cap->p.inp_type & WFD_UIBC_INPUT_TYPE_REMOTECONTROL) {
1407 wfd_debug("remote control ");
1408 } else if (!temp_cap->p.inp_type) {
1411 if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_INFRARED) {
1412 wfd_debug("infrared");
1413 } else if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_USB) {
1415 } else if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_BT) {
1416 wfd_debug("bluetooth");
1417 } else if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_WIFI) {
1419 } else if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_ZIGBEE) {
1420 wfd_debug("Zigbee");
1421 } else if (temp_cap->p.inp_path & WFD_UIBC_INPUT_PATH_NOSP) {
1423 } else if (!temp_cap->p.inp_path) {
1426 temp_cap = temp_cap->next;
1430 if (msg->uibc_capability->tcp_port)
1431 wfd_debug("tcp port:%u", msg->uibc_capability->tcp_port);
1432 if (!msg->uibc_capability->tcp_port)
1433 wfd_debug("tcp port: none");
1437 if (msg->uibc_setting) {
1438 wfd_debug("wfd_uibc_setting: ");
1439 if (msg->uibc_setting->uibc_setting) {
1441 } else wfd_debug("false");
1445 if (msg->standby_resume_capability) {
1446 wfd_debug(STRING_WFD_STANDBY_RESUME_CAPABILITY);
1451 wfd_debug(STRING_WFD_STANDBY);
1455 if (msg->connector_type) {
1456 wfd_debug(STRING_WFD_CONNECTOR_TYPE);
1460 if (msg->idr_request) {
1461 wfd_debug(STRING_WFD_IDR_REQUEST);
1465 wfd_debug("===============================================\n");
1469 WFDResult wfdconfig_set_supported_audio_format(WFDMessage *msg, WFDAudioFormats aCodec, guint aFreq, guint aChanels,
1470 guint aBitwidth, guint32 aLatency)
1472 guint temp = aCodec;
1474 guint pcm = 0, aac = 0, ac3 = 0;
1476 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1478 if (!msg->audio_codecs)
1479 msg->audio_codecs = g_new0(WFDAudioCodeclist, 1);
1481 if (aCodec != WFD_AUDIO_UNKNOWN) {
1483 msg->audio_codecs->count++;
1486 msg->audio_codecs->list = g_new0(WFDAudioCodec, msg->audio_codecs->count);
1487 for (; i < msg->audio_codecs->count; i++) {
1488 if ((aCodec & WFD_AUDIO_LPCM) && (!pcm)) {
1489 msg->audio_codecs->list[i].audio_format = g_strdup("LPCM");
1490 msg->audio_codecs->list[i].modes = aFreq;
1491 msg->audio_codecs->list[i].latency = aLatency;
1493 } else if ((aCodec & WFD_AUDIO_AAC) && (!aac)) {
1494 msg->audio_codecs->list[i].audio_format = g_strdup("AAC");
1495 msg->audio_codecs->list[i].modes = aChanels;
1496 msg->audio_codecs->list[i].latency = aLatency;
1498 } else if ((aCodec & WFD_AUDIO_AC3) && (!ac3)) {
1499 msg->audio_codecs->list[i].audio_format = g_strdup("AC3");
1500 msg->audio_codecs->list[i].modes = aChanels;
1501 msg->audio_codecs->list[i].latency = aLatency;
1509 WFDResult wfdconfig_set_prefered_audio_format(WFDMessage *msg, WFDAudioFormats aCodec, WFDAudioFreq aFreq, WFDAudioChannels aChanels,
1510 guint aBitwidth, guint32 aLatency)
1513 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1515 if (!msg->audio_codecs)
1516 msg->audio_codecs = g_new0(WFDAudioCodeclist, 1);
1518 msg->audio_codecs->list = g_new0(WFDAudioCodec, 1);
1519 msg->audio_codecs->count = 1;
1520 if (aCodec == WFD_AUDIO_LPCM) {
1521 msg->audio_codecs->list->audio_format = g_strdup("LPCM");
1522 msg->audio_codecs->list->modes = aFreq;
1523 msg->audio_codecs->list->latency = aLatency;
1524 } else if (aCodec == WFD_AUDIO_AAC) {
1525 msg->audio_codecs->list->audio_format = g_strdup("AAC");
1526 msg->audio_codecs->list->modes = aChanels;
1527 msg->audio_codecs->list->latency = aLatency;
1528 } else if (aCodec == WFD_AUDIO_AC3) {
1529 msg->audio_codecs->list->audio_format = g_strdup("AC3");
1530 msg->audio_codecs->list->modes = aChanels;
1531 msg->audio_codecs->list->latency = aLatency;
1536 WFDResult wfdconfig_get_supported_audio_format(WFDMessage *msg, guint *aCodec, guint *aFreq, guint *aChanels,
1537 guint *aBitwidth, guint32 *aLatency)
1540 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1541 g_return_val_if_fail(msg->audio_codecs != NULL, WFD_EINVAL);
1543 for (; i < msg->audio_codecs->count; i++) {
1544 if (!g_strcmp0(msg->audio_codecs->list[i].audio_format, "LPCM")) {
1545 *aCodec |= WFD_AUDIO_LPCM;
1546 *aFreq |= msg->audio_codecs->list[i].modes;
1547 *aChanels |= WFD_CHANNEL_2;
1549 *aLatency = msg->audio_codecs->list[i].latency;
1550 } else if (!g_strcmp0(msg->audio_codecs->list[i].audio_format, "AAC")) {
1551 *aCodec |= WFD_AUDIO_AAC;
1552 *aFreq |= WFD_FREQ_48000;
1553 *aChanels |= msg->audio_codecs->list[i].modes;
1555 *aLatency = msg->audio_codecs->list[i].latency;
1556 } else if (!g_strcmp0(msg->audio_codecs->list[i].audio_format, "AC3")) {
1557 *aCodec |= WFD_AUDIO_AC3;
1558 *aFreq |= WFD_FREQ_48000;
1559 *aChanels |= msg->audio_codecs->list[i].modes;
1561 *aLatency = msg->audio_codecs->list[i].latency;
1567 WFDResult wfdconfig_get_prefered_audio_format(WFDMessage *msg, WFDAudioFormats *aCodec, WFDAudioFreq *aFreq, WFDAudioChannels *aChanels,
1568 guint *aBitwidth, guint32 *aLatency)
1570 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1572 if (!g_strcmp0(msg->audio_codecs->list->audio_format, "LPCM")) {
1573 *aCodec = WFD_AUDIO_LPCM;
1574 *aFreq = msg->audio_codecs->list->modes;
1575 *aChanels = WFD_CHANNEL_2;
1577 *aLatency = msg->audio_codecs->list->latency;
1578 } else if (!g_strcmp0(msg->audio_codecs->list->audio_format, "AAC")) {
1579 *aCodec = WFD_AUDIO_AAC;
1580 *aFreq = WFD_FREQ_48000;
1581 *aChanels = msg->audio_codecs->list->modes;
1583 *aLatency = msg->audio_codecs->list->latency;
1584 } else if (!g_strcmp0(msg->audio_codecs->list->audio_format, "AC3")) {
1585 *aCodec = WFD_AUDIO_AC3;
1586 *aFreq = WFD_FREQ_48000;
1587 *aChanels = msg->audio_codecs->list->modes;
1589 *aLatency = msg->audio_codecs->list->latency;
1594 WFDResult wfdconfig_set_supported_video_format(WFDMessage *msg, WFDVideoCodecs vCodec,
1595 WFDVideoNativeResolution vNative, guint64 vNativeResolution,
1596 guint64 vCEAResolution, guint64 vVESAResolution, guint64 vHHResolution,
1597 guint vProfile, guint vLevel, guint32 vLatency, guint32 vMaxHeight,
1598 guint32 vMaxWidth, guint32 min_slice_size, guint32 slice_enc_params, guint frame_rate_control)
1600 guint nativeindex = 0;
1601 guint64 temp = vNativeResolution;
1603 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1605 if (!msg->video_formats)
1606 msg->video_formats = g_new0(WFDVideoCodeclist, 1);
1608 if (vCodec != WFD_VIDEO_UNKNOWN) {
1609 msg->video_formats->list = g_new0(WFDVideoCodec, 1);
1615 msg->video_formats->list->native = nativeindex - 1;
1616 msg->video_formats->list->native <<= 3;
1618 if (vNative == WFD_VIDEO_VESA_RESOLUTION)
1619 msg->video_formats->list->native |= 1;
1620 else if (vNative == WFD_VIDEO_HH_RESOLUTION)
1621 msg->video_formats->list->native |= 2;
1623 msg->video_formats->list->preferred_display_mode_supported = 1;
1624 msg->video_formats->list->H264_codec.profile = vProfile;
1625 msg->video_formats->list->H264_codec.level = vLevel;
1626 msg->video_formats->list->H264_codec.max_hres = vMaxWidth;
1627 msg->video_formats->list->H264_codec.max_vres = vMaxHeight;
1628 msg->video_formats->list->H264_codec.misc_params.CEA_Support = vCEAResolution;
1629 msg->video_formats->list->H264_codec.misc_params.VESA_Support = vVESAResolution;
1630 msg->video_formats->list->H264_codec.misc_params.HH_Support = vHHResolution;
1631 msg->video_formats->list->H264_codec.misc_params.latency = vLatency;
1632 msg->video_formats->list->H264_codec.misc_params.min_slice_size = min_slice_size;
1633 msg->video_formats->list->H264_codec.misc_params.slice_enc_params = slice_enc_params;
1634 msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support = frame_rate_control;
1639 WFDResult wfdconfig_set_prefered_video_format(WFDMessage *msg, WFDVideoCodecs vCodec,
1640 WFDVideoNativeResolution vNative, guint64 vNativeResolution,
1641 WFDVideoCEAResolution vCEAResolution, WFDVideoVESAResolution vVESAResolution,
1642 WFDVideoHHResolution vHHResolution, WFDVideoH264Profile vProfile,
1643 WFDVideoH264Level vLevel, guint32 vLatency, guint32 vMaxHeight,
1644 guint32 vMaxWidth, guint32 min_slice_size, guint32 slice_enc_params, guint frame_rate_control)
1646 guint nativeindex = 0;
1647 guint64 temp = vNativeResolution;
1649 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1651 if (!msg->video_formats)
1652 msg->video_formats = g_new0(WFDVideoCodeclist, 1);
1653 msg->video_formats->list = g_new0(WFDVideoCodec, 1);
1660 if (nativeindex) msg->video_formats->list->native = nativeindex - 1;
1661 msg->video_formats->list->native <<= 3;
1663 if (vNative == WFD_VIDEO_VESA_RESOLUTION)
1664 msg->video_formats->list->native |= 1;
1665 else if (vNative == WFD_VIDEO_HH_RESOLUTION)
1666 msg->video_formats->list->native |= 2;
1668 msg->video_formats->list->preferred_display_mode_supported = 0;
1669 msg->video_formats->list->H264_codec.profile = vProfile;
1670 msg->video_formats->list->H264_codec.level = vLevel;
1671 msg->video_formats->list->H264_codec.max_hres = vMaxWidth;
1672 msg->video_formats->list->H264_codec.max_vres = vMaxHeight;
1673 msg->video_formats->list->H264_codec.misc_params.CEA_Support = vCEAResolution;
1674 msg->video_formats->list->H264_codec.misc_params.VESA_Support = vVESAResolution;
1675 msg->video_formats->list->H264_codec.misc_params.HH_Support = vHHResolution;
1676 msg->video_formats->list->H264_codec.misc_params.latency = vLatency;
1677 msg->video_formats->list->H264_codec.misc_params.min_slice_size = min_slice_size;
1678 msg->video_formats->list->H264_codec.misc_params.slice_enc_params = slice_enc_params;
1679 msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support = frame_rate_control;
1683 WFDResult wfdconfig_get_supported_video_format(WFDMessage *msg, WFDVideoCodecs *vCodec,
1684 WFDVideoNativeResolution *vNative, guint64 *vNativeResolution,
1685 guint64 *vCEAResolution, guint64 *vVESAResolution, guint64 *vHHResolution,
1686 guint *vProfile, guint *vLevel, guint32 *vLatency, guint32 *vMaxHeight,
1687 guint32 *vMaxWidth, guint32 *min_slice_size, guint32 *slice_enc_params, guint *frame_rate_control)
1689 guint nativeindex = 0;
1691 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1692 g_return_val_if_fail(msg->video_formats != NULL, WFD_EINVAL);
1693 g_return_val_if_fail(msg->video_formats->list != NULL, WFD_EINVAL);
1695 *vCodec = WFD_VIDEO_H264;
1696 *vNative = msg->video_formats->list->native & 0x7;
1697 nativeindex = msg->video_formats->list->native >> 3;
1698 *vNativeResolution = (guint64)1 << nativeindex;
1699 *vProfile = msg->video_formats->list->H264_codec.profile;
1700 *vLevel = msg->video_formats->list->H264_codec.level;
1701 *vMaxWidth = msg->video_formats->list->H264_codec.max_hres;
1702 *vMaxHeight = msg->video_formats->list->H264_codec.max_vres;
1703 *vCEAResolution = msg->video_formats->list->H264_codec.misc_params.CEA_Support;
1704 *vVESAResolution = msg->video_formats->list->H264_codec.misc_params.VESA_Support;
1705 *vHHResolution = msg->video_formats->list->H264_codec.misc_params.HH_Support;
1706 *vLatency = msg->video_formats->list->H264_codec.misc_params.latency;
1707 *min_slice_size = msg->video_formats->list->H264_codec.misc_params.min_slice_size;
1708 *slice_enc_params = msg->video_formats->list->H264_codec.misc_params.slice_enc_params;
1709 *frame_rate_control = msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support;
1713 WFDResult wfdconfig_get_prefered_video_format(WFDMessage *msg, WFDVideoCodecs *vCodec,
1714 WFDVideoNativeResolution *vNative, guint64 *vNativeResolution,
1715 WFDVideoCEAResolution *vCEAResolution, WFDVideoVESAResolution *vVESAResolution,
1716 WFDVideoHHResolution *vHHResolution, WFDVideoH264Profile *vProfile,
1717 WFDVideoH264Level *vLevel, guint32 *vLatency, guint32 *vMaxHeight,
1718 guint32 *vMaxWidth, guint32 *min_slice_size, guint32 *slice_enc_params, guint *frame_rate_control)
1720 guint nativeindex = 0;
1721 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1722 g_return_val_if_fail(msg->video_formats != NULL, WFD_EINVAL);
1723 g_return_val_if_fail(msg->video_formats->list != NULL, WFD_EINVAL);
1725 *vCodec = WFD_VIDEO_H264;
1726 *vNative = msg->video_formats->list->native & 0x7;
1727 nativeindex = msg->video_formats->list->native >> 3;
1728 *vNativeResolution = (guint64)1 << nativeindex;
1729 *vProfile = msg->video_formats->list->H264_codec.profile;
1730 *vLevel = msg->video_formats->list->H264_codec.level;
1731 *vMaxWidth = msg->video_formats->list->H264_codec.max_hres;
1732 *vMaxHeight = msg->video_formats->list->H264_codec.max_vres;
1733 *vCEAResolution = msg->video_formats->list->H264_codec.misc_params.CEA_Support;
1734 *vVESAResolution = msg->video_formats->list->H264_codec.misc_params.VESA_Support;
1735 *vHHResolution = msg->video_formats->list->H264_codec.misc_params.HH_Support;
1736 *vLatency = msg->video_formats->list->H264_codec.misc_params.latency;
1737 *min_slice_size = msg->video_formats->list->H264_codec.misc_params.min_slice_size;
1738 *slice_enc_params = msg->video_formats->list->H264_codec.misc_params.slice_enc_params;
1739 *frame_rate_control = msg->video_formats->list->H264_codec.misc_params.frame_rate_control_support;
1743 WFDResult wfdconfig_set_contentprotection_type(WFDMessage *msg, WFDHDCPProtection hdcpversion, guint32 TCPPort)
1745 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1747 if (!msg->content_protection) msg->content_protection = g_new0(WFDContentProtection, 1);
1748 if (hdcpversion == WFD_HDCP_NONE) return WFD_OK;
1749 msg->content_protection->hdcp2_spec = g_new0(WFDHdcp2Spec, 1);
1750 if (hdcpversion == WFD_HDCP_2_0) msg->content_protection->hdcp2_spec->hdcpversion = g_strdup("HDCP2.0");
1751 else if (hdcpversion == WFD_HDCP_2_1) msg->content_protection->hdcp2_spec->hdcpversion = g_strdup("HDCP2.1");
1752 char str[11] = {0, };
1753 snprintf(str, 11, "port=%d", TCPPort);
1754 msg->content_protection->hdcp2_spec->TCPPort = g_strdup(str);
1758 WFDResult wfdconfig_get_contentprotection_type(WFDMessage *msg, WFDHDCPProtection *hdcpversion, guint32 *TCPPort)
1760 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1761 if (msg->content_protection && msg->content_protection->hdcp2_spec) {
1762 char *result = NULL;
1764 if (!g_strcmp0(msg->content_protection->hdcp2_spec->hdcpversion, "none")) {
1765 wfd_warning("HDCP none");
1766 *hdcpversion = WFD_HDCP_NONE;
1770 if (!g_strcmp0(msg->content_protection->hdcp2_spec->hdcpversion, "HDCP2.0")) *hdcpversion = WFD_HDCP_2_0;
1771 else if (!g_strcmp0(msg->content_protection->hdcp2_spec->hdcpversion, "HDCP2.1")) *hdcpversion = WFD_HDCP_2_1;
1773 wfd_warning("Unknown protection type");
1774 *hdcpversion = WFD_HDCP_NONE;
1779 result = strtok_r(msg->content_protection->hdcp2_spec->TCPPort, "=", &ptr);
1780 while (result != NULL) {
1781 result = strtok_r(NULL, "=", &ptr);
1782 *TCPPort = atoi(result);
1785 } else *hdcpversion = WFD_HDCP_NONE;
1789 WFDResult wfdconfig_set_display_EDID(WFDMessage *msg, gboolean edid_supported, guint32 edid_blockcount, gchar *edid_playload)
1791 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1792 if (!msg->display_edid) msg->display_edid = g_new0(WFDDisplayEdid, 1);
1793 msg->display_edid->edid_supported = edid_supported;
1794 if (!edid_supported) return WFD_OK;
1795 msg->display_edid->edid_block_count = edid_blockcount;
1796 if (edid_blockcount) {
1797 msg->display_edid->edid_payload = g_malloc(128 * edid_blockcount);
1798 if (!msg->display_edid->edid_payload)
1799 memcpy(msg->display_edid->edid_payload, edid_playload, 128 * edid_blockcount);
1800 } else msg->display_edid->edid_payload = g_strdup("none");
1804 WFDResult wfdconfig_get_display_EDID(WFDMessage *msg, gboolean *edid_supported, guint32 *edid_blockcount, gchar **edid_playload)
1806 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1807 if (msg->display_edid) {
1808 if (msg->display_edid->edid_supported) {
1809 *edid_blockcount = msg->display_edid->edid_block_count;
1810 if (msg->display_edid->edid_block_count) {
1812 temp = g_malloc(EDID_BLOCK_SIZE * msg->display_edid->edid_block_count);
1814 memset(temp, 0, EDID_BLOCK_SIZE * msg->display_edid->edid_block_count);
1815 memcpy(temp, msg->display_edid->edid_payload, EDID_BLOCK_SIZE * msg->display_edid->edid_block_count);
1816 *edid_playload = temp;
1817 *edid_supported = TRUE;
1819 } else *edid_playload = g_strdup("none");
1821 } else *edid_supported = FALSE;
1825 WFDResult wfdconfig_set_coupled_sink(WFDMessage *msg, WFDCoupledSinkStatus status, gchar *sink_address)
1827 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1828 if (!msg->coupled_sink) msg->coupled_sink = g_new0(WFDCoupledSink, 1);
1829 if (status == WFD_SINK_UNKNOWN) return WFD_OK;
1830 msg->coupled_sink->coupled_sink_cap = g_new0(WFDCoupled_sink_cap, 1);
1831 msg->coupled_sink->coupled_sink_cap->status = status;
1832 msg->coupled_sink->coupled_sink_cap->sink_address = g_strdup(sink_address);
1836 WFDResult wfdconfig_get_coupled_sink(WFDMessage *msg, WFDCoupledSinkStatus *status, gchar **sink_address)
1838 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1839 if (msg->coupled_sink && msg->coupled_sink->coupled_sink_cap) {
1840 *status = msg->coupled_sink->coupled_sink_cap->status;
1841 *sink_address = g_strdup(msg->coupled_sink->coupled_sink_cap->sink_address);
1842 } else *status = WFD_SINK_UNKNOWN;
1846 WFDResult wfdconfig_set_trigger_type(WFDMessage *msg, WFDTrigger trigger)
1848 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1850 if (!msg->trigger_method)
1851 msg->trigger_method = g_new0(WFDTriggerMethod, 1);
1852 if (trigger == WFD_TRIGGER_SETUP)
1853 msg->trigger_method->wfd_trigger_method = g_strdup("SETUP");
1854 else if (trigger == WFD_TRIGGER_PAUSE)
1855 msg->trigger_method->wfd_trigger_method = g_strdup("PAUSE");
1856 else if (trigger == WFD_TRIGGER_TEARDOWN)
1857 msg->trigger_method->wfd_trigger_method = g_strdup("TEARDOWN");
1858 else if (trigger == WFD_TRIGGER_PLAY)
1859 msg->trigger_method->wfd_trigger_method = g_strdup("PLAY");
1865 WFDResult wfdconfig_get_trigger_type(WFDMessage *msg, WFDTrigger *trigger)
1867 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1868 if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, "SETUP"))
1869 *trigger = WFD_TRIGGER_SETUP;
1870 else if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, "PAUSE"))
1871 *trigger = WFD_TRIGGER_PAUSE;
1872 else if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, "TEARDOWN"))
1873 *trigger = WFD_TRIGGER_TEARDOWN;
1874 else if (!g_strcmp0(msg->trigger_method->wfd_trigger_method, "PLAY"))
1875 *trigger = WFD_TRIGGER_PLAY;
1877 *trigger = WFD_TRIGGER_UNKNOWN;
1883 WFDResult wfdconfig_set_presentation_url(WFDMessage *msg, gchar *wfd_url0, gchar *wfd_url1)
1885 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1886 if (!msg->presentation_url) msg->presentation_url = g_new0(WFDPresentationUrl, 1);
1887 if (wfd_url0) msg->presentation_url->wfd_url0 = g_strdup(wfd_url0);
1888 if (wfd_url1) msg->presentation_url->wfd_url1 = g_strdup(wfd_url1);
1892 WFDResult wfdconfig_get_presentation_url(WFDMessage *msg, gchar **wfd_url0, gchar **wfd_url1)
1894 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1895 if (msg->presentation_url) {
1896 *wfd_url0 = g_strdup(msg->presentation_url->wfd_url0);
1897 *wfd_url1 = g_strdup(msg->presentation_url->wfd_url1);
1902 WFDResult wfdconfig_set_prefered_RTP_ports(WFDMessage *msg, WFDRTSPTransMode trans, WFDRTSPProfile profile,
1903 WFDRTSPLowerTrans lowertrans, guint32 rtp_port0, guint32 rtp_port1)
1906 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1908 if (!msg->client_rtp_ports)
1909 msg->client_rtp_ports = g_new0(WFDClientRtpPorts, 1);
1911 if (trans != WFD_RTSP_TRANS_UNKNOWN) {
1912 lines = g_string_new("");
1913 if (trans == WFD_RTSP_TRANS_RTP) g_string_append_printf(lines, "RTP");
1914 else if (trans == WFD_RTSP_TRANS_RDT) g_string_append_printf(lines, "RDT");
1916 if (profile == WFD_RTSP_PROFILE_AVP) g_string_append_printf(lines, "/AVP");
1917 else if (profile == WFD_RTSP_PROFILE_SAVP) g_string_append_printf(lines, "/SAVP");
1919 if (lowertrans == WFD_RTSP_LOWER_TRANS_UDP) g_string_append_printf(lines, "/UDP;unicast");
1920 else if (lowertrans == WFD_RTSP_LOWER_TRANS_UDP_MCAST) g_string_append_printf(lines, "/UDP;multicast");
1921 else if (lowertrans == WFD_RTSP_LOWER_TRANS_TCP) g_string_append_printf(lines, "/TCP;unicast");
1922 else if (lowertrans == WFD_RTSP_LOWER_TRANS_HTTP) g_string_append_printf(lines, "/HTTP");
1924 msg->client_rtp_ports->profile = g_string_free(lines, FALSE);
1925 msg->client_rtp_ports->rtp_port0 = rtp_port0;
1926 msg->client_rtp_ports->rtp_port1 = rtp_port1;
1927 msg->client_rtp_ports->mode = g_strdup("mode=play");
1932 WFDResult wfdconfig_get_prefered_RTP_ports(WFDMessage *msg, WFDRTSPTransMode *trans, WFDRTSPProfile *profile,
1933 WFDRTSPLowerTrans *lowertrans, guint32 *rtp_port0, guint32 *rtp_port1)
1935 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1936 g_return_val_if_fail(msg->client_rtp_ports != NULL, WFD_EINVAL);
1938 if (g_strrstr(msg->client_rtp_ports->profile, "RTP")) *trans = WFD_RTSP_TRANS_RTP;
1939 if (g_strrstr(msg->client_rtp_ports->profile, "RDT")) *trans = WFD_RTSP_TRANS_RDT;
1940 if (g_strrstr(msg->client_rtp_ports->profile, "AVP")) *profile = WFD_RTSP_PROFILE_AVP;
1941 if (g_strrstr(msg->client_rtp_ports->profile, "SAVP")) *profile = WFD_RTSP_PROFILE_SAVP;
1942 if (g_strrstr(msg->client_rtp_ports->profile, "UDP;unicast")) *lowertrans = WFD_RTSP_LOWER_TRANS_UDP;
1943 if (g_strrstr(msg->client_rtp_ports->profile, "UDP;multicast")) *lowertrans = WFD_RTSP_LOWER_TRANS_UDP_MCAST;
1944 if (g_strrstr(msg->client_rtp_ports->profile, "TCP;unicast")) *lowertrans = WFD_RTSP_LOWER_TRANS_TCP;
1945 if (g_strrstr(msg->client_rtp_ports->profile, "HTTP")) *lowertrans = WFD_RTSP_LOWER_TRANS_HTTP;
1947 *rtp_port0 = msg->client_rtp_ports->rtp_port0;
1948 *rtp_port1 = msg->client_rtp_ports->rtp_port1;
1953 WFDResult wfdconfig_set_audio_sink_type(WFDMessage *msg, WFDSinkType sinktype)
1955 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1956 if (!msg->route) msg->route = g_new0(WFDRoute, 1);
1957 if (sinktype == WFD_PRIMARY_SINK) msg->route->destination = g_strdup("primary");
1958 else if (sinktype == WFD_SECONDARY_SINK) msg->route->destination = g_strdup("secondary");
1962 WFDResult wfdconfig_get_audio_sink_type(WFDMessage *msg, WFDSinkType *sinktype)
1964 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1966 if (!g_strcmp0(msg->route->destination, "primary")) *sinktype = WFD_PRIMARY_SINK;
1967 else if (!g_strcmp0(msg->route->destination, "secondary")) *sinktype = WFD_SECONDARY_SINK;
1972 WFDResult wfdconfig_set_I2C_port(WFDMessage *msg, gboolean i2csupport, guint32 i2cport)
1974 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1975 if (!msg->I2C) msg->I2C = g_new0(WFDI2C, 1);
1976 msg->I2C->I2CPresent = i2csupport;
1977 msg->I2C->I2C_port = i2cport;
1981 WFDResult wfdconfig_get_I2C_port(WFDMessage *msg, gboolean *i2csupport, guint32 *i2cport)
1983 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1984 if (msg->I2C && msg->I2C->I2CPresent) {
1985 *i2csupport = msg->I2C->I2CPresent;
1986 *i2cport = msg->I2C->I2C_port;
1987 } else *i2csupport = FALSE;
1991 WFDResult wfdconfig_set_av_format_change_timing(WFDMessage *msg, guint64 PTS, guint64 DTS)
1993 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
1994 if (!msg->av_format_change_timing) msg->av_format_change_timing = g_new0(WFDAVFormatChangeTiming, 1);
1995 msg->av_format_change_timing->PTS = PTS;
1996 msg->av_format_change_timing->DTS = DTS;
2000 WFDResult wfdconfig_get_av_format_change_timing(WFDMessage *msg, guint64 *PTS, guint64 *DTS)
2002 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2003 if (msg->av_format_change_timing) {
2004 *PTS = msg->av_format_change_timing->PTS;
2005 *DTS = msg->av_format_change_timing->DTS;
2010 WFDResult wfdconfig_set_uibc_capability(WFDMessage *msg, guint32 input_category, guint32 inp_type, WFDHIDCTypePathPair *inp_pair,
2011 guint32 inp_type_path_count, guint32 tcp_port)
2013 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2014 if (!msg->uibc_capability) msg->uibc_capability = g_new0(WFDUibcCapability, 1);
2015 msg->uibc_capability->uibcsupported = TRUE;
2016 msg->uibc_capability->input_category_list.input_cat = input_category;
2017 msg->uibc_capability->generic_cap_list.inp_type = inp_type;
2018 msg->uibc_capability->hidc_cap_list.cap_count = inp_type_path_count;
2019 if (msg->uibc_capability->hidc_cap_list.cap_count) {
2020 detailed_cap *temp_cap;
2022 msg->uibc_capability->hidc_cap_list.next = g_new0(detailed_cap, 1);
2023 temp_cap = msg->uibc_capability->hidc_cap_list.next;
2024 for (; i < inp_type_path_count;) {
2025 temp_cap->p.inp_type = inp_pair[i].inp_type;
2026 temp_cap->p.inp_path = inp_pair[i].inp_path;
2028 if (i < inp_type_path_count) {
2029 temp_cap->next = g_new0(detailed_cap, 1);
2030 temp_cap = temp_cap->next;
2034 msg->uibc_capability->tcp_port = tcp_port;
2038 WFDResult wfdconfig_get_uibc_capability(WFDMessage *msg, guint32 *input_category, guint32 *inp_type, WFDHIDCTypePathPair **inp_pair,
2039 guint32 *inp_type_path_count, guint32 *tcp_port)
2041 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2042 if (msg->uibc_capability && msg->uibc_capability->uibcsupported) {
2043 *input_category = msg->uibc_capability->input_category_list.input_cat;
2044 *inp_type = msg->uibc_capability->generic_cap_list.inp_type;
2045 *inp_type_path_count = msg->uibc_capability->hidc_cap_list.cap_count;
2046 if (msg->uibc_capability->hidc_cap_list.cap_count) {
2047 detailed_cap *temp_cap;
2049 *inp_pair = g_new0(WFDHIDCTypePathPair, msg->uibc_capability->hidc_cap_list.cap_count);
2050 temp_cap = msg->uibc_capability->hidc_cap_list.next;
2052 (*(inp_pair))[i].inp_type = temp_cap->p.inp_type;
2053 (*(inp_pair))[i].inp_path = temp_cap->p.inp_path;
2054 temp_cap = temp_cap->next;
2058 *tcp_port = msg->uibc_capability->tcp_port;
2063 WFDResult wfdconfig_set_uibc_status(WFDMessage *msg, gboolean uibc_enable)
2065 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2066 if (!msg->uibc_setting) msg->uibc_setting = g_new0(WFDUibcSetting, 1);
2067 msg->uibc_setting->uibc_setting = uibc_enable;
2071 WFDResult wfdconfig_get_uibc_status(WFDMessage *msg, gboolean *uibc_enable)
2073 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2074 if (msg->uibc_setting) *uibc_enable = msg->uibc_setting->uibc_setting;
2077 #ifdef STANDBY_RESUME_CAPABILITY
2078 WFDResult wfdconfig_set_standby_resume_capability(WFDMessage *msg, gboolean supported)
2080 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2081 if (!msg->standby_resume_capability) msg->standby_resume_capability = g_new0(WFDStandbyResumeCapability, 1);
2082 msg->standby_resume_capability->standby_resume_cap = supported;
2086 WFDResult wfdconfig_get_standby_resume_capability(WFDMessage *msg, gboolean *supported)
2088 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2089 if (msg->standby_resume_capability) *supported = msg->standby_resume_capability->standby_resume_cap;
2093 WFDResult wfdconfig_set_standby(WFDMessage *msg, gboolean standby_enable)
2095 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2096 if (!msg->standby) msg->standby = g_new0(WFDStandby, 1);
2097 msg->standby->wfd_standby = standby_enable;
2101 WFDResult wfdconfig_get_standby(WFDMessage *msg, gboolean *standby_enable)
2103 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2104 if (msg->standby) *standby_enable = msg->standby->wfd_standby;
2108 WFDResult wfdconfig_set_connector_type(WFDMessage *msg, WFDConnector connector)
2110 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2111 if (!msg->connector_type) msg->connector_type = g_new0(WFDConnectorType, 1);
2112 msg->connector_type->connector_type = connector;
2116 WFDResult wfdconfig_get_connector_type(WFDMessage *msg, WFDConnector *connector)
2118 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2119 if (msg->connector_type) *connector = msg->connector_type->connector_type;
2123 WFDResult wfdconfig_set_idr_request(WFDMessage *msg)
2125 g_return_val_if_fail(msg != NULL, WFD_EINVAL);
2126 if (!msg->idr_request) msg->idr_request = g_new0(WFDIdrRequest, 1);
2127 msg->idr_request->idr_request = TRUE;