mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
spa-node: parse bool properties
Add some more helpers to parse property values
This commit is contained in:
parent
5a9c4981d8
commit
5e21edd8d5
2 changed files with 20 additions and 4 deletions
|
|
@ -181,21 +181,29 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
|||
pw_log_info("configure prop %s", key);
|
||||
|
||||
switch(prop->body.value.type) {
|
||||
case SPA_POD_TYPE_BOOL:
|
||||
SPA_POD_VALUE(struct spa_pod_bool, &prop->body.value) =
|
||||
pw_properties_parse_bool(value);
|
||||
break;
|
||||
case SPA_POD_TYPE_ID:
|
||||
SPA_POD_VALUE(struct spa_pod_id, &prop->body.value) =
|
||||
spa_type_map_get_id(t->map, value);
|
||||
break;
|
||||
case SPA_POD_TYPE_INT:
|
||||
SPA_POD_VALUE(struct spa_pod_int, &prop->body.value) = atoi(value);
|
||||
SPA_POD_VALUE(struct spa_pod_int, &prop->body.value) =
|
||||
pw_properties_parse_int(value);
|
||||
break;
|
||||
case SPA_POD_TYPE_LONG:
|
||||
SPA_POD_VALUE(struct spa_pod_long, &prop->body.value) = atoi(value);
|
||||
SPA_POD_VALUE(struct spa_pod_long, &prop->body.value) =
|
||||
pw_properties_parse_int64(value);
|
||||
break;
|
||||
case SPA_POD_TYPE_FLOAT:
|
||||
SPA_POD_VALUE(struct spa_pod_float, &prop->body.value) = atof(value);
|
||||
SPA_POD_VALUE(struct spa_pod_float, &prop->body.value) =
|
||||
pw_properties_parse_float(value);
|
||||
break;
|
||||
case SPA_POD_TYPE_DOUBLE:
|
||||
SPA_POD_VALUE(struct spa_pod_double, &prop->body.value) = atof(value);
|
||||
SPA_POD_VALUE(struct spa_pod_double, &prop->body.value) =
|
||||
pw_properties_parse_double(value);
|
||||
break;
|
||||
case SPA_POD_TYPE_STRING:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -83,6 +83,14 @@ static inline uint64_t pw_properties_parse_uint64(const char *value) {
|
|||
return strtoull(value, NULL, 0);
|
||||
}
|
||||
|
||||
static inline float pw_properties_parse_float(const char *value) {
|
||||
return strtof(value, NULL);
|
||||
}
|
||||
|
||||
static inline double pw_properties_parse_double(const char *value) {
|
||||
return strtod(value, NULL);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue