module-avb: avdecc: use enum instead of a boolean for avb mode (milan vs legacy avb)

This commit is contained in:
hackerman-kl 2025-11-29 15:02:39 +01:00 committed by Wim Taymans
parent 9f1c11ac34
commit f3d0642994
2 changed files with 18 additions and 4 deletions

View file

@ -253,10 +253,10 @@ struct server *avdecc_server_new(struct impl *impl, struct spa_dict *props)
str = spa_dict_lookup(props, "ifname");
server->ifname = str ? strdup(str) : NULL;
if ((str = spa_dict_lookup(props, "milan")) != NULL)
server->milan = spa_atob(str);
if ((str = spa_dict_lookup(props, "milan")) != NULL && spa_atob(str))
server->avb_mode = AVB_MODE_MILAN_V12;
else
server->milan = false;
server->avb_mode = AVB_MODE_LEGACY;
spa_hook_list_init(&server->listener_list);
spa_list_init(&server->descriptors);

View file

@ -52,13 +52,27 @@ struct descriptor {
void *ptr;
};
enum avb_mode {
/** The legacy AVB Mode */
AVB_MODE_LEGACY,
/**
* \brief Milan version 1.2, which subset of the AVB,
* \see Milan Specifications https://avnu.org/resource/milan-specification/
*/
AVB_MODE_MILAN_V12,
/** Future AVB mode will be added here if necessary */
AVB_MODE_MAX
};
struct server {
struct spa_list link;
struct impl *impl;
char *ifname;
/** Parsed from the configuration pipewire-avb.conf */
bool milan;
enum avb_mode avb_mode;
uint8_t mac_addr[6];
uint64_t entity_id;
int ifindex;