5#ifndef PIPEWIRE_PROPERTIES_H
6#define PIPEWIRE_PROPERTIES_H
14#include <spa/utils/cleanup.h>
18#ifndef PW_API_PROPERTIES
19#define PW_API_PROPERTIES static inline
58 const struct
spa_dict *
dict, const
char * const ignore[]);
66 const
char *str,
size_t size);
111 uint32_t val = deflt;
127 uint64_t val = deflt;
152#define PW_PROPERTIES_FLAG_NL (1<<0)
153#define PW_PROPERTIES_FLAG_RECURSE (1<<1)
154#define PW_PROPERTIES_FLAG_ENCLOSE (1<<2)
155#define PW_PROPERTIES_FLAG_ARRAY (1<<3)
156#define PW_PROPERTIES_FLAG_COLORS (1<<4)
180 return spa_atof(value, &v) ? v : 0.0f;
185 return spa_atod(value, &v) ? v : 0.0;
uint32_t int int const char va_list args
Definition core.h:434
void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition properties.c:558
PW_API_PROPERTIES int pw_properties_parse_int(const char *value)
Definition properties.h:173
PW_API_PROPERTIES int64_t pw_properties_parse_int64(const char *value)
Definition properties.h:178
struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition properties.c:97
PW_API_PROPERTIES float pw_properties_parse_float(const char *value)
Definition properties.h:188
int pw_properties_update_string(struct pw_properties *props, const char *str, size_t size)
Update the properties from the given string, overwriting any existing keys with the new values from s...
Definition properties.c:300
int pw_properties_add(struct pw_properties *oldprops, const struct spa_dict *dict)
Add properties.
Definition properties.c:502
PW_API_PROPERTIES bool pw_properties_parse_bool(const char *value)
Definition properties.h:169
int pw_properties_fetch_bool(const struct pw_properties *properties, const char *key, bool *value)
Fetch a property as boolean value.
Definition properties.c:761
int pw_properties_update_ignore(struct pw_properties *props, const struct spa_dict *dict, const char *const ignore[])
Definition properties.c:433
int pw_properties_update(struct pw_properties *props, const struct spa_dict *dict)
Update properties.
Definition properties.c:477
const char * pw_properties_iterate(const struct pw_properties *properties, void **state)
Iterate property values.
Definition properties.c:785
struct pw_properties * pw_properties_new_dict(const struct spa_dict *dict)
Make a new properties object from the given dictionary.
Definition properties.c:132
int pw_properties_fetch_uint64(const struct pw_properties *properties, const char *key, uint64_t *value)
Fetch a property as uint64_t.
Definition properties.c:707
int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...)
Set a property value by format.
Definition properties.c:616
PW_API_PROPERTIES double pw_properties_parse_double(const char *value)
Definition properties.h:193
PW_API_PROPERTIES int64_t pw_properties_get_int64(const struct pw_properties *properties, const char *key, int64_t deflt)
Definition properties.h:138
const char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition properties.c:637
struct pw_properties * pw_properties_new_string(const char *args)
Make a new properties object from the given str.
Definition properties.c:345
PW_API_PROPERTIES int32_t pw_properties_get_int32(const struct pw_properties *properties, const char *key, int32_t deflt)
Definition properties.h:122
int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition properties.c:585
PW_API_PROPERTIES bool pw_properties_get_bool(const struct pw_properties *properties, const char *key, bool deflt)
Definition properties.h:147
int pw_properties_update_keys(struct pw_properties *props, const struct spa_dict *dict, const char *const keys[])
Copy multiple keys from one property to another.
Definition properties.c:404
int pw_properties_fetch_int64(const struct pw_properties *properties, const char *key, int64_t *value)
Fetch a property as int64_t.
Definition properties.c:734
PW_API_PROPERTIES uint32_t pw_properties_get_uint32(const struct pw_properties *properties, const char *key, uint32_t deflt)
Definition properties.h:114
void pw_properties_clear(struct pw_properties *properties)
Clear a properties object.
Definition properties.c:456
int pw_properties_fetch_uint32(const struct pw_properties *properties, const char *key, uint32_t *value)
Fetch a property as uint32_t.
Definition properties.c:653
int pw_properties_update_string_checked(struct pw_properties *props, const char *str, size_t size, struct spa_error_location *loc)
Check str is a well-formed properties JSON string and update the properties on success.
Definition properties.c:326
PW_API_PROPERTIES uint64_t pw_properties_get_uint64(const struct pw_properties *properties, const char *key, uint64_t deflt)
Definition properties.h:130
int pw_properties_setva(struct pw_properties *properties, const char *key, const char *format, va_list args)
Definition properties.c:591
int pw_properties_add_keys(struct pw_properties *oldprops, const struct spa_dict *dict, const char *const keys[])
Add keys.
Definition properties.c:532
struct pw_properties * pw_properties_copy(const struct pw_properties *properties)
Copy a properties object.
Definition properties.c:391
struct pw_properties * pw_properties_new_string_checked(const char *args, size_t size, struct spa_error_location *loc)
Definition properties.c:366
PW_API_PROPERTIES uint64_t pw_properties_parse_uint64(const char *value)
Definition properties.h:183
int pw_properties_serialize_dict(FILE *f, const struct spa_dict *dict, uint32_t flags)
Definition properties.c:914
int pw_properties_fetch_int32(const struct pw_properties *properties, const char *key, int32_t *value)
Fetch a property as int32_t.
Definition properties.c:680
SPA_API_STRING bool spa_atou64(const char *str, uint64_t *val, int base)
Convert str to an uint64_t with the given base and store the result in val.
Definition string.h:191
SPA_API_STRING bool spa_atof(const char *str, float *val)
Convert str to a float and store the result in val.
Definition string.h:297
SPA_API_STRING bool spa_atob(const char *str)
Convert str to a boolean.
Definition string.h:214
SPA_API_STRING bool spa_atoi64(const char *str, int64_t *val, int base)
Convert str to an int64_t with the given base and store the result in val.
Definition string.h:166
SPA_API_STRING bool spa_atoi32(const char *str, int32_t *val, int base)
Convert str to an int32_t with the given base and store the result in val.
Definition string.h:110
SPA_API_STRING bool spa_atod(const char *str, double *val)
Convert str to a double and store the result in val.
Definition string.h:347
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition defs.h:295
#define SPA_SENTINEL
Definition defs.h:305
#define PW_API_PROPERTIES
Definition properties.h:24
Definition properties.h:39
struct spa_dict dict
dictionary of key/values
Definition properties.h:40
uint32_t flags
extra flags
Definition properties.h:41