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

@ -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