Go to the documentation of this file.
20 #ifndef __PIPEWIRE_PROPERTIES_H__
21 #define __PIPEWIRE_PROPERTIES_H__
27 #include <spa/utils/dict.h>
66 const
char *key, const
char *format, ...) SPA_PRINTF_FUNC(3, 4);
73 static inline
bool pw_properties_parse_bool(const
char *value) {
74 return (strcmp(value,
"true") == 0 || atoi(value) == 1);
77 static inline int pw_properties_parse_int(
const char *value) {
78 return strtol(value, NULL, 0);
81 static inline int64_t pw_properties_parse_int64(
const char *value) {
82 return strtoll(value, NULL, 0);
85 static inline uint64_t pw_properties_parse_uint64(
const char *value) {
86 return strtoull(value, NULL, 0);
89 static inline float pw_properties_parse_float(
const char *value) {
90 return strtof(value, NULL);
93 static inline double pw_properties_parse_double(
const char *value) {
94 return strtod(value, NULL);
const SPA_EXPORT char * pw_split_walk(const char *str, const char *delimiter, size_t *len, const char **state)
Split a string based on delimiters.
Definition: utils.c:40
SPA_EXPORT struct pw_properties * pw_properties_merge(const struct pw_properties *oldprops, struct pw_properties *newprops)
Merge properties into one.
Definition: properties.c:211
#define pw_array_for_each(pos, array)
Definition: array.h:56
SPA_EXPORT struct pw_properties * pw_properties_new_string(const char *str)
Make a new properties object from the given str.
Definition: properties.c:149
struct spa_dict dict
Definition: properties.h:39
An array object.
Definition: array.h:36
SPA_EXPORT int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...)
Set a property value by format.
Definition: properties.c:338
SPA_EXPORT struct pw_properties * pw_properties_new_dict(const struct spa_dict *dict)
Make a new properties object from the given dictionary.
Definition: properties.c:119
const SPA_EXPORT char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:361
static void * pw_array_add(struct pw_array *arr, size_t size)
Add ref size bytes to arr.
Definition: array.h:98
#define pw_array_get_len(a, t)
Get the number of items of type t in array.
Definition: array.h:50
SPA_EXPORT struct pw_properties * pw_properties_copy(const struct pw_properties *properties)
Copy a properties object.
Definition: properties.c:183
SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:308
const SPA_EXPORT char * pw_properties_iterate(const struct pw_properties *properties, void **state)
Iterate property values.
Definition: properties.c:386
#define pw_array_get_unchecked(a, idx, t)
Get the item with index idx and type t from array.
Definition: array.h:52
struct pw_control this
Definition: control.c:26
SPA_EXPORT struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:89
#define pw_array_check_index(a, idx, t)
Check if an item with index idx and type t exist in array.
Definition: array.h:54
A collection of key/value pairs.
Definition: properties.h:38
SPA_EXPORT void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:245
SPA_EXPORT int pw_properties_setva(struct pw_properties *properties, const char *key, const char *format, va_list args)
Definition: properties.c:315
static void pw_array_init(struct pw_array *arr, size_t extend)
Initialize the array with given extend.
Definition: array.h:62