mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
tools: try to parse float values better
First try to parse the float value as a JSON number and then fall back to atof to get the locale dependent variant. This transparently makes things work with values such as 0.5 and 0,5. Fixes #4234
This commit is contained in:
parent
e2a76824e2
commit
16a7467815
2 changed files with 4 additions and 2 deletions
|
|
@ -1778,7 +1778,8 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_VOLUME:
|
case OPT_VOLUME:
|
||||||
data.volume = (float)atof(optarg);
|
if (!spa_atof(optarg, &data.volume))
|
||||||
|
data.volume = (float)atof(optarg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto error_usage;
|
goto error_usage;
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,8 @@ int main(int argc, char *argv[])
|
||||||
data.latency = atoi(optarg) * DEFAULT_RATE / SPA_MSEC_PER_SEC;
|
data.latency = atoi(optarg) * DEFAULT_RATE / SPA_MSEC_PER_SEC;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
data.delay = (float)atof(optarg);
|
if (!spa_atof(optarg, &data.delay))
|
||||||
|
data.delay = (float)atof(optarg);
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
pw_properties_set(data.capture_props, PW_KEY_TARGET_OBJECT, optarg);
|
pw_properties_set(data.capture_props, PW_KEY_TARGET_OBJECT, optarg);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue