types: add function to convert audio channel short name to type

Move some functions around for this
This commit is contained in:
Wim Taymans 2024-09-16 13:27:17 +02:00
parent b5cccdb382
commit 41f9abc733
5 changed files with 27 additions and 9 deletions

View file

@ -20,10 +20,6 @@ extern "C" {
#define SPA_TYPE_ROOT spa_types
#endif
static inline bool spa_type_is_a(const char *type, const char *parent)
{
return type != NULL && parent != NULL && strncmp(type, parent, strlen(parent)) == 0;
}
#include <spa/utils/type.h>
#include <spa/utils/enum-types.h>

View file

@ -123,6 +123,19 @@ struct spa_type_info {
const struct spa_type_info *values;
};
static inline bool spa_type_is_a(const char *type, const char *parent)
{
return type != NULL && parent != NULL && strncmp(type, parent, strlen(parent)) == 0;
}
static inline const char *spa_type_short_name(const char *name)
{
const char *h;
if ((h = strrchr(name, ':')) != NULL)
name = h + 1;
return name;
}
/**
* \}
*/