pw-dump: convert unknown ids to id-<hexnum>

This commit is contained in:
Wim Taymans 2020-12-18 17:54:40 +01:00
parent abe12cf790
commit 7ef15f3721

View file

@ -296,9 +296,18 @@ static void put_pod_value(struct data *d, const char *key, const struct spa_type
put_value(d, NULL, *(int32_t*)body ? "true" : "false"); put_value(d, NULL, *(int32_t*)body ? "true" : "false");
break; break;
case SPA_TYPE_Id: case SPA_TYPE_Id:
put_value(d, NULL, spa_debug_type_find_short_name(info, {
*(int32_t*)body)); const char *str;
char fallback[32];
uint32_t id = *(uint32_t*)body;
str = spa_debug_type_find_short_name(info, *(uint32_t*)body);
if (str == NULL) {
snprintf(fallback, sizeof(fallback)-1, "id-%08x", id);
str = fallback;
}
put_value(d, NULL, str);
break; break;
}
case SPA_TYPE_Int: case SPA_TYPE_Int:
put_int(d, NULL, *(int32_t*)body); put_int(d, NULL, *(int32_t*)body);
break; break;