Go to the documentation of this file.
25 #ifndef PIPEWIRE_PROPERTIES_H
26 #define PIPEWIRE_PROPERTIES_H
69 const struct
spa_dict *
dict, const
char * const ignore[]);
76 const
char *str,
size_t size);
96 const
char *key, const
char *format, va_list args)
SPA_PRINTF_FUNC(3,0);
103 #define PW_PROPERTIES_FLAG_NL (1<<0)
106 static inline bool pw_properties_parse_bool(
const char *value) {
110 static inline int pw_properties_parse_int(
const char *value) {
115 static inline int64_t pw_properties_parse_int64(
const char *value) {
120 static inline uint64_t pw_properties_parse_uint64(
const char *value) {
125 static inline float pw_properties_parse_float(
const char *value) {
127 return spa_atof(value, &v) ? v : 0.0f;
130 static inline double pw_properties_parse_double(
const char *value) {
132 return spa_atod(value, &v) ? v : 0.0;
uint32_t flags
Definition: utils/dict.h:50
const char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:487
uint32_t flags
extra flags
Definition: properties.h:51
int pw_properties_add_keys(struct pw_properties *props, const struct spa_dict *dict, const char *const keys[])
Add keys.
Definition: properties.c:343
const char * pw_properties_iterate(const struct pw_properties *properties, void **state)
Iterate property values.
Definition: properties.c:510
#define SPA_FLAG_CLEAR(field, flag)
Definition: defs.h:75
const char * key
Definition: utils/dict.h:42
int pw_properties_update(struct pw_properties *props, const struct spa_dict *dict)
Update properties.
Definition: properties.c:298
int spa_json_container_len(struct spa_json *iter, const char *value, int len)
Definition: json.h:200
#define pw_array_check_index(a, idx, t)
Check if an item with index idx and type t exist in array.
Definition: array.h:66
int spa_json_enter_object(struct spa_json *iter, struct spa_json *sub)
Definition: json.h:214
uint8_t data[MAX_BUFFER]
Definition: module-profiler.c:87
bool spa_streq(const char *s1, const char *s2)
Definition: string.h:50
#define SPA_EXPORT
Definition: defs.h:208
bool spa_json_is_bool(const char *val, int len)
Definition: json.h:288
#define SPA_ROUND_UP_N(num, align)
Definition: defs.h:223
int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...)
Set a property value by format.
Definition: properties.c:466
#define pw_array_for_each(pos, array)
Definition: array.h:72
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:205
struct pw_properties * pw_properties_new_dict(const struct spa_dict *dict)
Make a new properties object from the given dictionary.
Definition: properties.c:126
#define pw_array_get_len(a, t)
Get the number of items of type t in array.
Definition: array.h:62
struct spa_dict dict
dictionary of key/values
Definition: properties.h:50
Definition: utils/dict.h:41
#define SPA_CONTAINER_OF(p, t, m)
Definition: defs.h:170
bool spa_json_is_float(const char *val, int len)
Definition: json.h:242
Definition: impl-metadata.c:49
int spa_json_is_container(const char *val, int len)
Definition: json.h:195
int int pw_properties_setva(struct pw_properties *properties, const char *key, const char *format, va_list args) 1(3
bool spa_atod(const char *str, double *val)
Convert str to a double and store the result in val.
Definition: string.h:293
int pw_properties_setva(struct pw_properties *properties, const char *key, const char *format, va_list args)
Definition: properties.c:441
int pw_properties_serialize_dict(FILE *f, const struct spa_dict *dict, uint32_t flags)
Definition: properties.c:567
#define pw_array_get_unchecked(a, idx, t)
Get the item with index idx and type t from array.
Definition: array.h:64
void pw_properties_clear(struct pw_properties *properties)
Clear a properties object.
Definition: properties.c:277
#define spa_dict_for_each(item, dict)
Definition: utils/dict.h:58
const struct spa_dict_item * items
Definition: utils/dict.h:52
bool spa_json_is_null(const char *val, int len)
Definition: json.h:230
#define SPA_DICT_FLAG_SORTED
items are sorted
Definition: utils/dict.h:49
void spa_json_init(struct spa_json *iter, const char *data, size_t size)
Definition: json.h:59
bool spa_atof(const char *str, float *val)
Convert str to a float and store the result in val.
Definition: string.h:269
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:235
int pw_properties_update_ignore(struct pw_properties *props, const struct spa_dict *dict, const char *const ignore[])
Definition: properties.c:259
Definition: utils/dict.h:48
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:109
const char * spa_dict_lookup(const struct spa_dict *dict, const char *key)
Definition: utils/dict.h:99
int spa_json_parse_string(const char *val, int len, char *result)
Definition: json.h:316
char * key
Definition: impl-metadata.c:51
int spa_json_get_string(struct spa_json *iter, char *res, int maxlen)
Definition: json.h:360
const char * value
Definition: utils/dict.h:43
struct pw_properties * pw_properties_new_string(const char *object)
Make a new properties object from the given str.
Definition: properties.c:197
int spa_json_next(struct spa_json *iter, const char **value)
Get the next token.
Definition: json.h:74
int pw_properties_add(struct pw_properties *props, const struct spa_dict *dict)
Add properties.
Definition: properties.c:319
const struct spa_dict_item * spa_dict_lookup_item(const struct spa_dict *dict, const char *key)
Definition: utils/dict.h:77
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:154
int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:435
#define SPA_SENTINEL
Definition: defs.h:209
bool spa_json_is_string(const char *val, int len)
Definition: json.h:311
char * value
Definition: impl-metadata.c:53
#define SPA_INT_TO_PTR(u)
Definition: defs.h:175
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:165
struct pw_control this
Definition: control.c:34
struct pw_properties * pw_properties_copy(const struct pw_properties *properties)
Copy a properties object.
Definition: properties.c:222
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:190
uint32_t n_items
Definition: utils/dict.h:51
int spa_json_encode_string(char *str, int size, const char *val)
Definition: json.h:369
#define SPA_PTR_TO_INT(p)
Definition: defs.h:174
#define PW_PROPERTIES_FLAG_NL
Definition: properties.h:103
struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:98
int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...) 1(3
bool spa_atob(const char *str)
Convert str to a boolean.
Definition: string.h:213
Definition: properties.h:49
void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:364