mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-06 07:15:35 -04:00
Add wireless status fields and enum to card structure with proper cleanup
This commit is contained in:
parent
35817c0d85
commit
4564f76627
1 changed files with 18 additions and 2 deletions
|
|
@ -39,6 +39,14 @@ enum action {
|
||||||
/* Used for unavailable devices in the card structure. */
|
/* Used for unavailable devices in the card structure. */
|
||||||
#define ID_DEVICE_NOT_SUPPORTED 0
|
#define ID_DEVICE_NOT_SUPPORTED 0
|
||||||
|
|
||||||
|
#define MAX_PARENT_TRAVERSAL_DEPTH 5
|
||||||
|
|
||||||
|
enum wireless_status {
|
||||||
|
WIRELESS_STATUS_UNKNOWN = 0,
|
||||||
|
WIRELESS_STATUS_CONNECTED,
|
||||||
|
WIRELESS_STATUS_DISCONNECTED,
|
||||||
|
};
|
||||||
|
|
||||||
/* This represents an ALSA card.
|
/* This represents an ALSA card.
|
||||||
* One card can have up to 1 PCM and 1 Compress-Offload device. */
|
* One card can have up to 1 PCM and 1 Compress-Offload device. */
|
||||||
struct card {
|
struct card {
|
||||||
|
|
@ -48,6 +56,7 @@ struct card {
|
||||||
unsigned int accessible:1;
|
unsigned int accessible:1;
|
||||||
unsigned int ignored:1;
|
unsigned int ignored:1;
|
||||||
unsigned int emitted:1;
|
unsigned int emitted:1;
|
||||||
|
unsigned int wireless_disconnected:1;
|
||||||
|
|
||||||
/* Local SPA object IDs. (Global IDs are produced by PipeWire
|
/* Local SPA object IDs. (Global IDs are produced by PipeWire
|
||||||
* out of this using its registry.) Compress-Offload or PCM
|
* out of this using its registry.) Compress-Offload or PCM
|
||||||
|
|
@ -59,6 +68,8 @@ struct card {
|
||||||
* is used because 0 is a valid ALSA card number. */
|
* is used because 0 is a valid ALSA card number. */
|
||||||
uint32_t pcm_device_id;
|
uint32_t pcm_device_id;
|
||||||
uint32_t compress_offload_device_id;
|
uint32_t compress_offload_device_id;
|
||||||
|
|
||||||
|
char *wireless_status_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint32_t calc_pcm_device_id(struct card *card)
|
static uint32_t calc_pcm_device_id(struct card *card)
|
||||||
|
|
@ -144,14 +155,19 @@ static struct card *find_card(struct impl *this, unsigned int card_nr)
|
||||||
static void remove_card(struct impl *this, struct card *card)
|
static void remove_card(struct impl *this, struct card *card)
|
||||||
{
|
{
|
||||||
udev_device_unref(card->udev_device);
|
udev_device_unref(card->udev_device);
|
||||||
*card = this->cards[--this->n_cards];
|
free(card->wireless_status_path);
|
||||||
|
this->n_cards--;
|
||||||
|
if (card != &this->cards[this->n_cards])
|
||||||
|
*card = this->cards[this->n_cards];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_cards(struct impl *this)
|
static void clear_cards(struct impl *this)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < this->n_cards; i++)
|
for (i = 0; i < this->n_cards; i++) {
|
||||||
udev_device_unref(this->cards[i].udev_device);
|
udev_device_unref(this->cards[i].udev_device);
|
||||||
|
free(this->cards[i].wireless_status_path);
|
||||||
|
}
|
||||||
this->n_cards = 0;
|
this->n_cards = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue