mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
spa: make common function to find type from short name
This commit is contained in:
parent
ba7e5d619d
commit
aa128ed489
4 changed files with 25 additions and 47 deletions
|
|
@ -96,6 +96,26 @@ static inline uint32_t spa_debug_type_find_type(const struct spa_type_info *info
|
|||
return SPA_ID_INVALID;
|
||||
}
|
||||
|
||||
static inline const struct spa_type_info *spa_debug_type_find_short(const struct spa_type_info *info, const char *name)
|
||||
{
|
||||
while (info && info->name) {
|
||||
if (strcmp(spa_debug_type_short_name(info->name), name) == 0)
|
||||
return info;
|
||||
if (strcmp(info->name, name) == 0)
|
||||
return info;
|
||||
if (info->type != 0 && info->type == (uint32_t)atoi(name))
|
||||
return info;
|
||||
info++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline uint32_t spa_debug_type_find_type_short(const struct spa_type_info *info, const char *name)
|
||||
{
|
||||
if ((info = spa_debug_type_find_short(info, name)) == NULL)
|
||||
return SPA_ID_INVALID;
|
||||
return info->type;
|
||||
}
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue