acp: move acp_dict_lookup to public header

This commit is contained in:
Wim Taymans 2024-03-18 11:41:01 +01:00
parent 37a51533e0
commit aec07d974e
2 changed files with 10 additions and 10 deletions

View file

@ -1625,16 +1625,6 @@ static void prune_singleton_availability_groups(pa_hashmap *ports) {
pa_hashmap_free(group_counts);
}
static const char *acp_dict_lookup(const struct acp_dict *dict, const char *key)
{
const struct acp_dict_item *it;
acp_dict_for_each(it, dict) {
if (spa_streq(key, it->key))
return it->value;
}
return NULL;
}
struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props)
{
pa_card *impl;

View file

@ -15,6 +15,7 @@ extern "C" {
#include <stdarg.h>
#include <stdint.h>
#include <poll.h>
#include <string.h>
#ifdef __GNUC__
#define ACP_PRINTF_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
@ -103,6 +104,15 @@ struct acp_format {
(item) < &(dict)->items[(dict)->n_items]; \
(item)++)
static inline const char *acp_dict_lookup(const struct acp_dict *dict, const char *key)
{
const struct acp_dict_item *it;
acp_dict_for_each(it, dict)
if (strcmp(key, it->key) == 0)
return it->value;
return NULL;
}
enum acp_direction {
ACP_DIRECTION_PLAYBACK = 1,
ACP_DIRECTION_CAPTURE = 2