client/player: Add support to set empty bcode

A Broadcast Sink might scan encrypted streams, and the user might not
know the Broadcast Code to decrypt them.

This commit adds the option to set an empty Broadcast Code when prompted
for it after transport.select, if the Code is unknown. In this case, if
the Broadcast Sink is acting as a Scan Delegator, it can ask its peer
Broadcast Assistants to provide the Code through BASS.
This commit is contained in:
Iulia Tanasescu 2024-10-08 11:01:20 +03:00 committed by Luiz Augusto von Dentz
parent bd7d49d54a
commit 1c681c553f

View File

@ -5150,15 +5150,23 @@ static void set_bcode_cb(const DBusError *error, void *user_data)
static void set_bcode(const char *input, void *user_data)
{
GDBusProxy *proxy = user_data;
char *bcode = g_strdup(input);
char *bcode;
if (!strcasecmp(input, "n") || !strcasecmp(input, "no"))
bcode = g_new0(char, 16);
else
bcode = g_strdup(input);
if (g_dbus_proxy_set_property_dict(proxy, "QoS",
set_bcode_cb, user_data,
NULL, "BCode", DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
strlen(bcode), bcode, NULL) == FALSE) {
bt_shell_printf("Setting broadcast code failed\n");
g_free(bcode);
return bt_shell_noninteractive_quit(EXIT_FAILURE);
}
g_free(bcode);
}
static void transport_select(GDBusProxy *proxy, bool prompt)
@ -5183,7 +5191,8 @@ static void transport_select(GDBusProxy *proxy, bool prompt)
dbus_message_iter_get_basic(&value, &encryption);
if (encryption == 1) {
bt_shell_prompt_input("",
"Enter broadcast code:", set_bcode, proxy);
"Enter brocast code[value/no]:",
set_bcode, proxy);
return;
}
break;