mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
spa: add spa_json_begin_array/object and relaxed versions
Add spa_json_begin_array/object to replace spa_json_init+spa_json_begin_array/object This function is better because it does not waste a useless spa_json structure as an iterator. The relaxed versions also error out when the container is mismatched because parsing a mismatched container is not going to give any results anyway.
This commit is contained in:
parent
feccb882b6
commit
cd81b5f39a
51 changed files with 401 additions and 452 deletions
|
|
@ -70,10 +70,9 @@ static int parse_mic_geometry(struct impl_data *impl, const char *mic_geometry,
|
|||
{
|
||||
int res;
|
||||
size_t i;
|
||||
struct spa_json it[2];
|
||||
struct spa_json it[1];
|
||||
|
||||
spa_json_init(&it[0], mic_geometry, strlen(mic_geometry));
|
||||
if (spa_json_enter_array(&it[0], &it[1]) <= 0) {
|
||||
if (spa_json_begin_array(&it[0], mic_geometry, strlen(mic_geometry)) <= 0) {
|
||||
spa_log_error(impl->log, "Error: webrtc.mic-geometry expects an array");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -81,7 +80,7 @@ static int parse_mic_geometry(struct impl_data *impl, const char *mic_geometry,
|
|||
for (i = 0; i < geometry.size(); i++) {
|
||||
float f[3];
|
||||
|
||||
if ((res = parse_point(&it[1], f)) < 0) {
|
||||
if ((res = parse_point(&it[0], f)) < 0) {
|
||||
spa_log_error(impl->log, "Error: can't parse webrtc.mic-geometry points: %d", res);
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue