Skip to content

Commit

Permalink
whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
albfan committed Jan 22, 2023
1 parent 279303d commit f3debd5
Showing 1 changed file with 72 additions and 72 deletions.
144 changes: 72 additions & 72 deletions src/ctl/ctl-sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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;
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;
}
_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);

/* 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);
}
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_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; i<g_list_length(extension_keys); i++) {
gchar* key = g_list_nth_data(extension_keys, i);
if (g_strcmp0(key, WFD_VIDEO_FORMATS) == 0
|| g_strcmp0(key, WFD_AUDIO_CODECS) == 0
|| g_strcmp0(key, WFD_UIBC_CAPABILITY) == 0) {
continue;
}
gchar* value = g_hash_table_lookup(protocol_extensions, key);
check_and_response_option(key, value);
}
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);

}

/* wfd_uibc_capability */
if (uibc_option) {
gchar* wfd_uibc_capability = "input_category_list=GENERIC;"
"generic_cap_list=Mouse,SingleTouch;"
"hidc_cap_list=none;"
"port=none";
if (protocol_extensions != NULL) {
GList* extension_keys = g_hash_table_get_keys(protocol_extensions);
for (int i = 0; i<g_list_length(extension_keys); i++) {
gchar* key = g_list_nth_data(extension_keys, i);
if (g_strcmp0(key, WFD_VIDEO_FORMATS) == 0
|| g_strcmp0(key, WFD_AUDIO_CODECS) == 0
|| g_strcmp0(key, WFD_UIBC_CAPABILITY) == 0) {
continue;
}
gchar* value = g_hash_table_lookup(protocol_extensions, key);
check_and_response_option(key, value);
gchar* wfd_uibc_capability_extension = g_hash_table_lookup(protocol_extensions, WFD_UIBC_CAPABILITY);
if (wfd_uibc_capability_extension != NULL) {
wfd_uibc_capability = wfd_uibc_capability_extension;
}
}
check_and_response_option(WFD_UIBC_CAPABILITY, wfd_uibc_capability);
}

/* wfd_uibc_capability */
if (uibc_option) {
gchar* wfd_uibc_capability = "input_category_list=GENERIC;"
"generic_cap_list=Mouse,SingleTouch;"
"hidc_cap_list=none;"
"port=none";
if (protocol_extensions != NULL) {
gchar* wfd_uibc_capability_extension = g_hash_table_lookup(protocol_extensions, WFD_UIBC_CAPABILITY);
if (wfd_uibc_capability_extension != NULL) {
wfd_uibc_capability = wfd_uibc_capability_extension;
}
}
check_and_response_option(WFD_UIBC_CAPABILITY, wfd_uibc_capability);
}

rtsp_message_seal(rep);
cli_debug("OUTGOING: %s\n", rtsp_message_get_raw(rep));
rtsp_message_seal(rep);
cli_debug("OUTGOING: %s\n", rtsp_message_get_raw(rep));

r = rtsp_send(s->rtsp, 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) {
Expand Down

0 comments on commit f3debd5

Please sign in to comment.