diff --git a/src/ctl/ctl-sink.c b/src/ctl/ctl-sink.c index 3897b9b..dd89fa4 100644 --- a/src/ctl/ctl-sink.c +++ b/src/ctl/ctl-sink.c @@ -77,88 +77,88 @@ static void sink_handle_options(struct ctl_sink *s, } static void sink_handle_get_parameter(struct ctl_sink *s, - struct rtsp_message *m) + struct rtsp_message *m) { - _rtsp_message_unref_ struct rtsp_message *rep = NULL; - int r; + _rtsp_message_unref_ struct rtsp_message *rep = NULL; + int r; - r = rtsp_message_new_reply_for(m, &rep, RTSP_CODE_OK, NULL); - if (r < 0) - return cli_vERR(r); + r = rtsp_message_new_reply_for(m, &rep, RTSP_CODE_OK, NULL); + if (r < 0) + return cli_vERR(r); - /* wfd_content_protection */ - check_and_response_option("wfd_content_protection", "none"); - GHashTable* protocol_extensions = s->protocol_extensions; - /* wfd_video_formats */ - gchar* wfd_video_formats = NULL; + /* wfd_content_protection */ + check_and_response_option("wfd_content_protection", "none"); + GHashTable* protocol_extensions = s->protocol_extensions; + /* wfd_video_formats */ + gchar* wfd_video_formats = NULL; + if (protocol_extensions != NULL) { + gchar* wfd_video_formats_extension = g_hash_table_lookup(protocol_extensions, WFD_VIDEO_FORMATS); + if (wfd_video_formats_extension != NULL) { + wfd_video_formats = wfd_video_formats_extension; + } + } + bool create_wfd_video_formats = wfd_video_formats == NULL; + if (create_wfd_video_formats) { + gchar video_formats[128]; + sprintf(video_formats, "00 00 03 10 %08x %08x %08x 00 0000 0000 10 none none", + s->resolutions_cea, s->resolutions_vesa, s->resolutions_hh); + wfd_video_formats = strdup(video_formats); + } + check_and_response_option(WFD_VIDEO_FORMATS, wfd_video_formats); + if (create_wfd_video_formats) { + g_free(wfd_video_formats); + } + + /* wfd_audio_codecs */ + gchar* wfd_audio_codecs = "AAC 00000007 00"; + if (protocol_extensions != NULL) { + gchar* wfd_audio_codecs_extension = g_hash_table_lookup(protocol_extensions, WFD_AUDIO_CODECS); + if (wfd_audio_codecs_extension != NULL) { + wfd_audio_codecs = wfd_audio_codecs_extension; + } + } + check_and_response_option(WFD_AUDIO_CODECS, wfd_audio_codecs); + + /* wfd_client_rtp_ports */ + char wfd_client_rtp_ports[128]; + sprintf(wfd_client_rtp_ports, "RTP/AVP/UDP;unicast %d 0 mode=play", rstp_port); + check_and_response_option("wfd_client_rtp_ports", wfd_client_rtp_ports); + + if (protocol_extensions != NULL) { + GList* extension_keys = g_hash_table_get_keys(protocol_extensions); + for (int i = 0; iresolutions_cea, s->resolutions_vesa, s->resolutions_hh); - wfd_video_formats = strdup(video_formats); - } - check_and_response_option(WFD_VIDEO_FORMATS, wfd_video_formats); - if (create_wfd_video_formats) { - g_free(wfd_video_formats); - } + check_and_response_option(WFD_UIBC_CAPABILITY, wfd_uibc_capability); + } - /* wfd_audio_codecs */ - gchar* wfd_audio_codecs = "AAC 00000007 00"; - if (protocol_extensions != NULL) { - gchar* wfd_audio_codecs_extension = g_hash_table_lookup(protocol_extensions, WFD_AUDIO_CODECS); - if (wfd_audio_codecs_extension != NULL) { - wfd_audio_codecs = wfd_audio_codecs_extension; - } - } - check_and_response_option(WFD_AUDIO_CODECS, wfd_audio_codecs); + rtsp_message_seal(rep); + cli_debug("OUTGOING: %s\n", rtsp_message_get_raw(rep)); - /* wfd_client_rtp_ports */ - char wfd_client_rtp_ports[128]; - sprintf(wfd_client_rtp_ports, "RTP/AVP/UDP;unicast %d 0 mode=play", rstp_port); - check_and_response_option("wfd_client_rtp_ports", wfd_client_rtp_ports); - - if (protocol_extensions != NULL) { - GList* extension_keys = g_hash_table_get_keys(protocol_extensions); - for (int i = 0; irtsp, rep); - if (r < 0) - return cli_vERR(r); + r = rtsp_send(s->rtsp, rep); + if (r < 0) + return cli_vERR(r); } bool check_rtsp_option(struct rtsp_message *m, char *option) {