pulse: update to new pod api

This commit is contained in:
Wim Taymans 2019-01-16 11:04:22 +01:00
parent f509e8552d
commit 386e5c966c
2 changed files with 27 additions and 31 deletions

View file

@ -118,10 +118,10 @@ static void device_event_param(void *object,
uint32_t id; uint32_t id;
const char *name; const char *name;
if (spa_pod_object_parse(param, if (spa_pod_parse_object(param,
":", SPA_PARAM_PROFILE_id, "i", &id, SPA_TYPE_OBJECT_ParamProfile, NULL,
":", SPA_PARAM_PROFILE_name, "s", &name, SPA_PARAM_PROFILE_id, SPA_POD_Int(&id),
NULL) < 0) { SPA_PARAM_PROFILE_name, SPA_POD_String(&name)) < 0) {
pw_log_warn("device %d: can't parse profile", g->id); pw_log_warn("device %d: can't parse profile", g->id);
return; return;
} }
@ -132,9 +132,9 @@ static void device_event_param(void *object,
case SPA_PARAM_Profile: case SPA_PARAM_Profile:
{ {
uint32_t id; uint32_t id;
if (spa_pod_object_parse(param, if (spa_pod_parse_object(param,
":", SPA_PARAM_PROFILE_id, "i", &id, SPA_TYPE_OBJECT_ParamProfile, NULL,
NULL) < 0) { SPA_PARAM_PROFILE_id, SPA_POD_Int(&id)) < 0) {
pw_log_warn("device %d: can't parse profile", g->id); pw_log_warn("device %d: can't parse profile", g->id);
return; return;
} }
@ -487,10 +487,9 @@ static void set_node_volume(pa_context *c, struct global *g, const pa_cvolume *v
pw_node_proxy_set_param((struct pw_node_proxy*)g->proxy, pw_node_proxy_set_param((struct pw_node_proxy*)g->proxy,
SPA_PARAM_Props, 0, SPA_PARAM_Props, 0,
spa_pod_builder_object(&b, spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props, SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
SPA_PROP_volume, &SPA_POD_Float(v), SPA_PROP_volume, SPA_POD_Float(v)));
0));
} }
static void set_node_mute(pa_context *c, struct global *g, bool mute) static void set_node_mute(pa_context *c, struct global *g, bool mute)
@ -502,10 +501,9 @@ static void set_node_mute(pa_context *c, struct global *g, bool mute)
pw_node_proxy_set_param((struct pw_node_proxy*)g->proxy, pw_node_proxy_set_param((struct pw_node_proxy*)g->proxy,
SPA_PARAM_Props, 0, SPA_PARAM_Props, 0,
spa_pod_builder_object(&b, spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props, SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
SPA_PROP_mute, &SPA_POD_Bool(mute), SPA_PROP_mute, SPA_POD_Bool(mute)));
0));
} }
@ -1261,10 +1259,10 @@ static void card_callback(struct card_data *d)
uint32_t id; uint32_t id;
const char *name; const char *name;
if (spa_pod_object_parse(profiles[j], if (spa_pod_parse_object(profiles[j],
":", SPA_PARAM_PROFILE_id, "i", &id, SPA_TYPE_OBJECT_ParamProfile, NULL,
":", SPA_PARAM_PROFILE_name, "s", &name, SPA_PARAM_PROFILE_id, SPA_POD_Int(&id),
NULL) < 0) { SPA_PARAM_PROFILE_name, SPA_POD_String(&name)) < 0) {
pw_log_warn("device %d: can't parse profile %d", g->id, j); pw_log_warn("device %d: can't parse profile %d", g->id, j);
continue; continue;
} }
@ -1415,10 +1413,10 @@ static void card_profile(pa_operation *o, void *userdata)
uint32_t test_id; uint32_t test_id;
const char *name; const char *name;
if (spa_pod_object_parse(profiles[i], if (spa_pod_parse_object(profiles[i],
":", SPA_PARAM_PROFILE_id, "i", &test_id, SPA_TYPE_OBJECT_ParamProfile, NULL,
":", SPA_PARAM_PROFILE_name, "s", &name, SPA_PARAM_PROFILE_id, SPA_POD_Int(&test_id),
NULL) < 0) { SPA_PARAM_PROFILE_name, SPA_POD_String(&name)) < 0) {
pw_log_warn("device %d: can't parse profile %zd", g->id, i); pw_log_warn("device %d: can't parse profile %zd", g->id, i);
continue; continue;
} }
@ -1432,10 +1430,9 @@ static void card_profile(pa_operation *o, void *userdata)
pw_device_proxy_set_param((struct pw_device_proxy*)g->proxy, pw_device_proxy_set_param((struct pw_device_proxy*)g->proxy,
SPA_PARAM_Profile, 0, SPA_PARAM_Profile, 0,
spa_pod_builder_object(&b, spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamProfile, SPA_PARAM_Profile, SPA_TYPE_OBJECT_ParamProfile, SPA_PARAM_Profile,
SPA_PARAM_PROFILE_id, &SPA_POD_Int(id), SPA_PARAM_PROFILE_id, SPA_POD_Int(id)));
0));
res = 1; res = 1;
done: done:
if (d->success_cb) if (d->success_cb)

View file

@ -279,17 +279,16 @@ static const struct spa_pod *get_buffers_param(pa_stream *s, pa_buffer_attr *att
pw_log_info("stream %p: stride %d maxsize %d size %u buffers %d", s, stride, maxsize, pw_log_info("stream %p: stride %d maxsize %d size %u buffers %d", s, stride, maxsize,
size, buffers); size, buffers);
param = spa_pod_builder_object(b, param = spa_pod_builder_add_object(b,
SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers, SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
SPA_PARAM_BUFFERS_buffers, &SPA_POD_CHOICE_RANGE_Int(buffers, 3, MAX_BUFFERS), SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(buffers, 3, MAX_BUFFERS),
SPA_PARAM_BUFFERS_blocks, &SPA_POD_Int(blocks), SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(blocks),
SPA_PARAM_BUFFERS_size, &SPA_POD_CHOICE_RANGE_Int( SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
size * stride, size * stride,
size * stride, size * stride,
maxsize * stride), maxsize * stride),
SPA_PARAM_BUFFERS_stride, &SPA_POD_Int(stride), SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride),
SPA_PARAM_BUFFERS_align, &SPA_POD_Int(16), SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
0);
return param; return param;
} }