mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
use spa_debug_type_short_name() when we can
This commit is contained in:
parent
cc0727e62f
commit
2955182e4e
4 changed files with 13 additions and 15 deletions
|
|
@ -44,13 +44,9 @@ spa_debug_format_value(const struct spa_type_info *info,
|
|||
break;
|
||||
case SPA_TYPE_Id:
|
||||
{
|
||||
const char *str = spa_debug_type_find_name(info, *(int32_t *) body);
|
||||
const char *str = spa_debug_type_find_short_name(info, *(int32_t *) body);
|
||||
char tmp[64];
|
||||
if (str) {
|
||||
const char *h = rindex(str, ':');
|
||||
if (h)
|
||||
str = h + 1;
|
||||
} else {
|
||||
if (str == NULL) {
|
||||
snprintf(tmp, sizeof(tmp), "%d", *(int32_t*)body);
|
||||
str = tmp;
|
||||
}
|
||||
|
|
@ -132,8 +128,8 @@ static inline int spa_debug_format(int indent,
|
|||
media_subtype = spa_debug_type_find_name(spa_type_media_subtype, mstype);
|
||||
|
||||
fprintf(stderr, "%*s %s/%s\n", indent, "",
|
||||
media_type ? rindex(media_type, ':') + 1 : "unknown",
|
||||
media_subtype ? rindex(media_subtype, ':') + 1 : "unknown");
|
||||
media_type ? spa_debug_type_short_name(media_type) : "unknown",
|
||||
media_subtype ? spa_debug_type_short_name(media_subtype) : "unknown");
|
||||
|
||||
SPA_POD_OBJECT_FOREACH((struct spa_pod_object*)format, prop) {
|
||||
const char *key;
|
||||
|
|
@ -159,8 +155,8 @@ static inline int spa_debug_format(int indent,
|
|||
key = ti ? ti->name : NULL;
|
||||
|
||||
fprintf(stderr, "%*s %16s : (%s) ", indent, "",
|
||||
key ? rindex(key, ':') + 1 : "unknown",
|
||||
rindex(spa_types[type].name, ':') + 1);
|
||||
key ? spa_debug_type_short_name(key) : "unknown",
|
||||
spa_debug_type_short_name(spa_types[type].name));
|
||||
|
||||
if (choice == SPA_CHOICE_None) {
|
||||
spa_debug_format_value(ti ? ti->values : NULL, type, vals, size);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,8 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
|
|||
port->direction = direction;
|
||||
port->id = port_id;
|
||||
|
||||
snprintf(port->position, 16, "%s", rindex(spa_type_audio_channel[position].name, ':')+1);
|
||||
snprintf(port->position, 16, "%s",
|
||||
spa_debug_type_short_name(spa_type_audio_channel[position].name));
|
||||
|
||||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PROPS |
|
||||
|
|
|
|||
|
|
@ -154,7 +154,8 @@ static int init_port(struct impl *this, enum spa_direction direction,
|
|||
port->direction = direction;
|
||||
port->id = port_id;
|
||||
|
||||
snprintf(port->position, 7, "%s", rindex(spa_type_audio_channel[position].name, ':')+1);
|
||||
snprintf(port->position, 7, "%s",
|
||||
spa_debug_type_short_name(spa_type_audio_channel[position].name));
|
||||
|
||||
|
||||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
|
|
|
|||
|
|
@ -486,8 +486,8 @@ static unsigned int find_channel(const char *name)
|
|||
int i;
|
||||
|
||||
for (i = 0; spa_type_audio_channel[i].name; i++) {
|
||||
if (strcmp(name, rindex(spa_type_audio_channel[i].name, ':')+1) == 0)
|
||||
return i;
|
||||
if (strcmp(name, spa_debug_type_short_name(spa_type_audio_channel[i].name)) == 0)
|
||||
return spa_type_audio_channel[i].type;
|
||||
}
|
||||
return SPA_AUDIO_CHANNEL_UNKNOWN;
|
||||
}
|
||||
|
|
@ -563,7 +563,7 @@ static void channelmap_print(struct channelmap *map)
|
|||
const char *name = spa_debug_type_find_name(spa_type_audio_channel, map->channels[i]);
|
||||
if (name == NULL)
|
||||
name = ":UNK";
|
||||
printf("%s%s", rindex(name, ':')+1, i + 1 < map->n_channels ? "," : "");
|
||||
printf("%s%s", spa_debug_type_short_name(name), i + 1 < map->n_channels ? "," : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue