mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
acp: improve debug
This commit is contained in:
parent
0da406d304
commit
38276d126c
4 changed files with 40 additions and 33 deletions
|
|
@ -42,29 +42,6 @@ struct data {
|
||||||
bool quit;
|
bool quit;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *str_available(enum acp_available status)
|
|
||||||
{
|
|
||||||
switch (status) {
|
|
||||||
case ACP_AVAILABLE_UNKNOWN:
|
|
||||||
return "unknown";
|
|
||||||
case ACP_AVAILABLE_NO:
|
|
||||||
return "no";
|
|
||||||
case ACP_AVAILABLE_YES:
|
|
||||||
return "yes";
|
|
||||||
}
|
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *str_direction(enum acp_direction direction)
|
|
||||||
{
|
|
||||||
switch (direction) {
|
|
||||||
case ACP_DIRECTION_CAPTURE:
|
|
||||||
return "capture";
|
|
||||||
case ACP_DIRECTION_PLAYBACK:
|
|
||||||
return "playback";
|
|
||||||
}
|
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
static const char *str_port_type(enum acp_port_type type)
|
static const char *str_port_type(enum acp_port_type type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
@ -182,7 +159,7 @@ static void card_profile_available(void *data, uint32_t index,
|
||||||
struct data *d = data;
|
struct data *d = data;
|
||||||
struct acp_card *card = d->card;
|
struct acp_card *card = d->card;
|
||||||
struct acp_card_profile *p = card->profiles[index];
|
struct acp_card_profile *p = card->profiles[index];
|
||||||
fprintf(stderr, "*** profile %s available %s\n", p->name, str_available(available));
|
fprintf(stderr, "*** profile %s available %s\n", p->name, acp_available_str(available));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void card_port_available(void *data, uint32_t index,
|
static void card_port_available(void *data, uint32_t index,
|
||||||
|
|
@ -191,7 +168,7 @@ static void card_port_available(void *data, uint32_t index,
|
||||||
struct data *d = data;
|
struct data *d = data;
|
||||||
struct acp_card *card = d->card;
|
struct acp_card *card = d->card;
|
||||||
struct acp_port *p = card->ports[index];
|
struct acp_port *p = card->ports[index];
|
||||||
fprintf(stderr, "*** port %s available %s\n", p->name, str_available(available));
|
fprintf(stderr, "*** port %s available %s\n", p->name, acp_available_str(available));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_volume_changed(void *data, struct acp_device *dev)
|
static void on_volume_changed(void *data, struct acp_device *dev)
|
||||||
|
|
@ -257,9 +234,9 @@ static void print_port(struct data *data, struct acp_port *p, int indent, int le
|
||||||
|
|
||||||
fprintf(stderr, "%*s %c port %u: name:\"%s\" direction:%s prio:%d group:%s type:%s (available: %s)\n",
|
fprintf(stderr, "%*s %c port %u: name:\"%s\" direction:%s prio:%d group:%s type:%s (available: %s)\n",
|
||||||
indent, "", p->flags & ACP_PORT_ACTIVE ? '*' : ' ', p->index,
|
indent, "", p->flags & ACP_PORT_ACTIVE ? '*' : ' ', p->index,
|
||||||
p->name, str_direction(p->direction), p->priority,
|
p->name, acp_direction_str(p->direction), p->priority,
|
||||||
p->availability_group, str_port_type(p->type),
|
p->availability_group, str_port_type(p->type),
|
||||||
str_available(p->available));
|
acp_available_str(p->available));
|
||||||
if (level > 0) {
|
if (level > 0) {
|
||||||
acp_debug_dict(&p->props, indent + 8);
|
acp_debug_dict(&p->props, indent + 8);
|
||||||
}
|
}
|
||||||
|
|
@ -284,7 +261,7 @@ static void print_device(struct data *data, struct acp_device *d, int indent, in
|
||||||
|
|
||||||
fprintf(stderr, "%*s %c device %u: direction:%s name:\"%s\" prio:%d flags:%08x devices: ",
|
fprintf(stderr, "%*s %c device %u: direction:%s name:\"%s\" prio:%d flags:%08x devices: ",
|
||||||
indent, "", d->flags & ACP_DEVICE_ACTIVE ? '*' : ' ', d->index,
|
indent, "", d->flags & ACP_DEVICE_ACTIVE ? '*' : ' ', d->index,
|
||||||
str_direction(d->direction), d->name, d->priority, d->flags);
|
acp_direction_str(d->direction), d->name, d->priority, d->flags);
|
||||||
for (s = d->device_strings; *s; s++)
|
for (s = d->device_strings; *s; s++)
|
||||||
fprintf(stderr, "\"%s\" ", *s);
|
fprintf(stderr, "\"%s\" ", *s);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
@ -308,7 +285,7 @@ static void print_profile(struct data *data, struct acp_card_profile *p, int ind
|
||||||
|
|
||||||
fprintf(stderr, "%*s %c profile %u: name:\"%s\" prio:%d (available: %s)\n",
|
fprintf(stderr, "%*s %c profile %u: name:\"%s\" prio:%d (available: %s)\n",
|
||||||
indent, "", p->flags & ACP_PROFILE_ACTIVE ? '*' : ' ', p->index,
|
indent, "", p->flags & ACP_PROFILE_ACTIVE ? '*' : ' ', p->index,
|
||||||
p->name, p->priority, str_available(p->available));
|
p->name, p->priority, acp_available_str(p->available));
|
||||||
if (level > 0) {
|
if (level > 0) {
|
||||||
fprintf(stderr, "%*sdescription:\"%s\"\n",
|
fprintf(stderr, "%*sdescription:\"%s\"\n",
|
||||||
indent+8, "", p->description);
|
indent+8, "", p->description);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,30 @@ void *_acp_log_data;
|
||||||
|
|
||||||
#define VOLUME_ACCURACY (PA_VOLUME_NORM/100) /* don't require volume adjustments to be perfectly correct. don't necessarily extend granularity in software unless the differences get greater than this level */
|
#define VOLUME_ACCURACY (PA_VOLUME_NORM/100) /* don't require volume adjustments to be perfectly correct. don't necessarily extend granularity in software unless the differences get greater than this level */
|
||||||
|
|
||||||
|
const char *acp_available_str(enum acp_available status)
|
||||||
|
{
|
||||||
|
switch (status) {
|
||||||
|
case ACP_AVAILABLE_UNKNOWN:
|
||||||
|
return "unknown";
|
||||||
|
case ACP_AVAILABLE_NO:
|
||||||
|
return "no";
|
||||||
|
case ACP_AVAILABLE_YES:
|
||||||
|
return "yes";
|
||||||
|
}
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *acp_direction_str(enum acp_direction direction)
|
||||||
|
{
|
||||||
|
switch (direction) {
|
||||||
|
case ACP_DIRECTION_CAPTURE:
|
||||||
|
return "capture";
|
||||||
|
case ACP_DIRECTION_PLAYBACK:
|
||||||
|
return "playback";
|
||||||
|
}
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
|
||||||
static void profile_free(void *data)
|
static void profile_free(void *data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -421,7 +445,6 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask)
|
||||||
found_available_input_port = true;
|
found_available_input_port = true;
|
||||||
} else {
|
} else {
|
||||||
has_output_port = true;
|
has_output_port = true;
|
||||||
|
|
||||||
if (port->port.available != ACP_AVAILABLE_NO)
|
if (port->port.available != ACP_AVAILABLE_NO)
|
||||||
found_available_output_port = true;
|
found_available_output_port = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,12 +77,16 @@ enum acp_direction {
|
||||||
ACP_DIRECTION_CAPTURE = 2
|
ACP_DIRECTION_CAPTURE = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char *acp_direction_str(enum acp_direction direction);
|
||||||
|
|
||||||
enum acp_available {
|
enum acp_available {
|
||||||
ACP_AVAILABLE_UNKNOWN = 0,
|
ACP_AVAILABLE_UNKNOWN = 0,
|
||||||
ACP_AVAILABLE_NO = 1,
|
ACP_AVAILABLE_NO = 1,
|
||||||
ACP_AVAILABLE_YES = 2
|
ACP_AVAILABLE_YES = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char *acp_available_str(enum acp_available status);
|
||||||
|
|
||||||
/** Port type. New types can be added in the future, so applications should
|
/** Port type. New types can be added in the future, so applications should
|
||||||
* gracefully handle situations where a type identifier doesn't match any item
|
* gracefully handle situations where a type identifier doesn't match any item
|
||||||
* in this enumeration. */
|
* in this enumeration. */
|
||||||
|
|
|
||||||
|
|
@ -662,7 +662,9 @@ static void card_profile_available(void *data, uint32_t index,
|
||||||
struct impl *this = data;
|
struct impl *this = data;
|
||||||
struct acp_card *card = this->card;
|
struct acp_card *card = this->card;
|
||||||
struct acp_card_profile *p = card->profiles[index];
|
struct acp_card_profile *p = card->profiles[index];
|
||||||
spa_log_info(this->log, "card profile %s available %d", p->name, available);
|
|
||||||
|
spa_log_info(this->log, "card profile %s available %s -> %s", p->name,
|
||||||
|
acp_available_str(old), acp_available_str(available));
|
||||||
|
|
||||||
this->info.change_mask |= SPA_DEVICE_CHANGE_MASK_PARAMS;
|
this->info.change_mask |= SPA_DEVICE_CHANGE_MASK_PARAMS;
|
||||||
this->params[IDX_EnumProfile].flags ^= SPA_PARAM_INFO_SERIAL;
|
this->params[IDX_EnumProfile].flags ^= SPA_PARAM_INFO_SERIAL;
|
||||||
|
|
@ -696,8 +698,9 @@ static void card_port_available(void *data, uint32_t index,
|
||||||
struct impl *this = data;
|
struct impl *this = data;
|
||||||
struct acp_card *card = this->card;
|
struct acp_card *card = this->card;
|
||||||
struct acp_port *p = card->ports[index];
|
struct acp_port *p = card->ports[index];
|
||||||
spa_log_info(this->log, "card port %s available %d->%d",
|
|
||||||
p->name, old, available);
|
spa_log_info(this->log, "card port %s available %s -> %s", p->name,
|
||||||
|
acp_available_str(old), acp_available_str(available));
|
||||||
|
|
||||||
this->info.change_mask |= SPA_DEVICE_CHANGE_MASK_PARAMS;
|
this->info.change_mask |= SPA_DEVICE_CHANGE_MASK_PARAMS;
|
||||||
this->params[IDX_EnumRoute].flags ^= SPA_PARAM_INFO_SERIAL;
|
this->params[IDX_EnumRoute].flags ^= SPA_PARAM_INFO_SERIAL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue