mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-09 13:30:06 -05:00
implement more API
Implement the sink/source volume/mute api
This commit is contained in:
parent
3d95ea4d13
commit
9062145e13
4 changed files with 295 additions and 74 deletions
|
|
@ -662,7 +662,6 @@ pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_su
|
||||||
|
|
||||||
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_data));
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_data));
|
||||||
d = o->userdata;
|
d = o->userdata;
|
||||||
d->ret = PA_ERR_ACCESS;
|
|
||||||
d->cb = cb;
|
d->cb = cb;
|
||||||
d->userdata = userdata;
|
d->userdata = userdata;
|
||||||
pa_operation_sync(o);
|
pa_operation_sync(o);
|
||||||
|
|
@ -700,14 +699,45 @@ uint32_t pa_context_get_server_protocol_version(pa_context *c)
|
||||||
|
|
||||||
pa_operation *pa_context_proplist_update(pa_context *c, pa_update_mode_t mode, pa_proplist *p, pa_context_success_cb_t cb, void *userdata)
|
pa_operation *pa_context_proplist_update(pa_context *c, pa_update_mode_t mode, pa_proplist *p, pa_context_success_cb_t cb, void *userdata)
|
||||||
{
|
{
|
||||||
pw_log_warn("Not Implemented");
|
pa_operation *o;
|
||||||
return NULL;
|
struct success_data *d;
|
||||||
|
|
||||||
|
spa_assert(c);
|
||||||
|
spa_assert(c->refcount >= 1);
|
||||||
|
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, mode == PA_UPDATE_SET ||
|
||||||
|
mode == PA_UPDATE_MERGE || mode == PA_UPDATE_REPLACE, PA_ERR_INVALID);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||||
|
|
||||||
|
pa_proplist_update(c->proplist, mode, p);
|
||||||
|
|
||||||
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_data));
|
||||||
|
d = o->userdata;
|
||||||
|
d->cb = cb;
|
||||||
|
d->userdata = userdata;
|
||||||
|
pa_operation_sync(o);
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_operation *pa_context_proplist_remove(pa_context *c, const char *const keys[], pa_context_success_cb_t cb, void *userdata)
|
pa_operation *pa_context_proplist_remove(pa_context *c, const char *const keys[], pa_context_success_cb_t cb, void *userdata)
|
||||||
{
|
{
|
||||||
|
pa_operation *o;
|
||||||
|
struct success_data *d;
|
||||||
|
|
||||||
|
spa_assert(c);
|
||||||
|
spa_assert(c->refcount >= 1);
|
||||||
|
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, keys && keys[0], PA_ERR_INVALID);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||||
|
|
||||||
pw_log_warn("Not Implemented");
|
pw_log_warn("Not Implemented");
|
||||||
return NULL;
|
|
||||||
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_data));
|
||||||
|
d = o->userdata;
|
||||||
|
d->cb = cb;
|
||||||
|
d->userdata = userdata;
|
||||||
|
pa_operation_sync(o);
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t pa_context_get_index(pa_context *c)
|
uint32_t pa_context_get_index(pa_context *c)
|
||||||
|
|
@ -749,12 +779,19 @@ void pa_context_rttime_restart(pa_context *c, pa_time_event *e, pa_usec_t usec)
|
||||||
|
|
||||||
size_t pa_context_get_tile_size(pa_context *c, const pa_sample_spec *ss)
|
size_t pa_context_get_tile_size(pa_context *c, const pa_sample_spec *ss)
|
||||||
{
|
{
|
||||||
pw_log_warn("Not Implemented");
|
size_t fs, mbs;
|
||||||
return 1024;
|
|
||||||
|
pa_assert(c);
|
||||||
|
pa_assert(c->refcount >= 1);
|
||||||
|
|
||||||
|
PA_CHECK_VALIDITY_RETURN_ANY(c, !ss || pa_sample_spec_valid(ss), PA_ERR_INVALID, (size_t) -1);
|
||||||
|
|
||||||
|
fs = ss ? pa_frame_size(ss) : 1;
|
||||||
|
mbs = PA_ROUND_DOWN(4096, fs);
|
||||||
|
return PA_MAX(mbs, fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pa_context_load_cookie_from_file(pa_context *c, const char *cookie_file_path)
|
int pa_context_load_cookie_from_file(pa_context *c, const char *cookie_file_path)
|
||||||
{
|
{
|
||||||
pw_log_warn("Not Implemented");
|
return 0;
|
||||||
return -ENOTSUP;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,17 @@ extern "C" {
|
||||||
#define PA_CLAMP_UNLIKELY(x, low, high) (PA_UNLIKELY((x) > (high)) ? (high) : (PA_UNLIKELY((x) < (low)) ? (low) : (x)))
|
#define PA_CLAMP_UNLIKELY(x, low, high) (PA_UNLIKELY((x) > (high)) ? (high) : (PA_UNLIKELY((x) < (low)) ? (low) : (x)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define PA_ROUND_DOWN(a, b) \
|
||||||
|
__extension__ ({ \
|
||||||
|
typeof(a) _a = (a); \
|
||||||
|
typeof(b) _b = (b); \
|
||||||
|
(_a / _b) * _b; \
|
||||||
|
})
|
||||||
|
#else
|
||||||
|
#define PA_ROUND_DOWN(a, b) (((a) / (b)) * (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define pa_init_i18n()
|
#define pa_init_i18n()
|
||||||
#define _(String) (String)
|
#define _(String) (String)
|
||||||
|
|
|
||||||
300
src/introspect.c
300
src/introspect.c
|
|
@ -478,28 +478,152 @@ pa_operation* pa_context_get_sink_info_list(pa_context *c, pa_sink_info_cb_t cb,
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_node_volume(pa_context *c, struct global *g, const pa_cvolume *volume)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
||||||
|
float v;
|
||||||
|
|
||||||
|
v = pa_cvolume_avg(volume) / (float) PA_VOLUME_NORM;
|
||||||
|
|
||||||
|
ensure_global(c, g);
|
||||||
|
|
||||||
|
pw_node_proxy_set_param((struct pw_node_proxy*)g->proxy,
|
||||||
|
SPA_PARAM_Props, 0,
|
||||||
|
spa_pod_builder_object(&b,
|
||||||
|
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
|
||||||
|
SPA_PROP_volume, &SPA_POD_Float(v),
|
||||||
|
0));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_node_mute(pa_context *c, struct global *g, bool mute)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
||||||
|
|
||||||
|
ensure_global(c, g);
|
||||||
|
|
||||||
|
pw_node_proxy_set_param((struct pw_node_proxy*)g->proxy,
|
||||||
|
SPA_PARAM_Props, 0,
|
||||||
|
spa_pod_builder_object(&b,
|
||||||
|
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
|
||||||
|
SPA_PROP_mute, &SPA_POD_Bool(mute),
|
||||||
|
0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pa_operation* pa_context_set_sink_volume_by_index(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata)
|
pa_operation* pa_context_set_sink_volume_by_index(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata)
|
||||||
{
|
{
|
||||||
pw_log_warn("Not Implemented %d", idx);
|
pa_operation *o;
|
||||||
return NULL;
|
struct global *g;
|
||||||
|
struct success_ack *d;
|
||||||
|
|
||||||
|
pa_assert(c);
|
||||||
|
pa_assert(c->refcount >= 1);
|
||||||
|
|
||||||
|
pw_log_debug("context %p: index %d", c, idx);
|
||||||
|
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
|
||||||
|
|
||||||
|
if ((g = pa_context_find_global(c, idx)) == NULL)
|
||||||
|
return NULL;
|
||||||
|
if (!(g->mask & PA_SUBSCRIPTION_MASK_SINK))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
set_node_volume(c, g, volume);
|
||||||
|
|
||||||
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
|
d = o->userdata;
|
||||||
|
d->cb = cb;
|
||||||
|
d->userdata = userdata;
|
||||||
|
pa_operation_sync(o);
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_operation* pa_context_set_sink_volume_by_name(pa_context *c, const char *name, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata)
|
pa_operation* pa_context_set_sink_volume_by_name(pa_context *c, const char *name, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata)
|
||||||
{
|
{
|
||||||
pw_log_warn("Not Implemented %s", name);
|
pa_operation *o;
|
||||||
return NULL;
|
struct global *g;
|
||||||
|
struct success_ack *d;
|
||||||
|
|
||||||
|
pa_assert(c);
|
||||||
|
pa_assert(c->refcount >= 1);
|
||||||
|
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
|
||||||
|
|
||||||
|
pw_log_debug("context %p: name %s", c, name);
|
||||||
|
|
||||||
|
if ((g = pa_context_find_global_by_name(c, PA_SUBSCRIPTION_MASK_SINK, name)) == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
set_node_volume(c, g, volume);
|
||||||
|
|
||||||
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
|
d = o->userdata;
|
||||||
|
d->cb = cb;
|
||||||
|
d->userdata = userdata;
|
||||||
|
pa_operation_sync(o);
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_operation* pa_context_set_sink_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata)
|
pa_operation* pa_context_set_sink_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata)
|
||||||
{
|
{
|
||||||
pw_log_warn("Not Implemented %d", mute);
|
pa_operation *o;
|
||||||
return NULL;
|
struct global *g;
|
||||||
|
struct success_ack *d;
|
||||||
|
|
||||||
|
pa_assert(c);
|
||||||
|
pa_assert(c->refcount >= 1);
|
||||||
|
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
|
||||||
|
|
||||||
|
pw_log_debug("context %p: index %d", c, idx);
|
||||||
|
|
||||||
|
if ((g = pa_context_find_global(c, idx)) == NULL)
|
||||||
|
return NULL;
|
||||||
|
if (!(g->mask & PA_SUBSCRIPTION_MASK_SINK))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
set_node_mute(c, g, mute);
|
||||||
|
|
||||||
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
|
d = o->userdata;
|
||||||
|
d->cb = cb;
|
||||||
|
d->userdata = userdata;
|
||||||
|
pa_operation_sync(o);
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_operation* pa_context_set_sink_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata)
|
pa_operation* pa_context_set_sink_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata)
|
||||||
{
|
{
|
||||||
pw_log_warn("Not Implemented %s", name);
|
pa_operation *o;
|
||||||
return NULL;
|
struct global *g;
|
||||||
|
struct success_ack *d;
|
||||||
|
|
||||||
|
pa_assert(c);
|
||||||
|
pa_assert(c->refcount >= 1);
|
||||||
|
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
|
||||||
|
|
||||||
|
pw_log_debug("context %p: name %s", c, name);
|
||||||
|
|
||||||
|
if ((g = pa_context_find_global_by_name(c, PA_SUBSCRIPTION_MASK_SINK, name)) == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
set_node_mute(c, g, mute);
|
||||||
|
|
||||||
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
|
d = o->userdata;
|
||||||
|
d->cb = cb;
|
||||||
|
d->userdata = userdata;
|
||||||
|
pa_operation_sync(o);
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_operation* pa_context_suspend_sink_by_name(pa_context *c, const char *sink_name, int suspend, pa_context_success_cb_t cb, void* userdata)
|
pa_operation* pa_context_suspend_sink_by_name(pa_context *c, const char *sink_name, int suspend, pa_context_success_cb_t cb, void* userdata)
|
||||||
|
|
@ -709,26 +833,116 @@ pa_operation* pa_context_get_source_info_list(pa_context *c, pa_source_info_cb_t
|
||||||
|
|
||||||
pa_operation* pa_context_set_source_volume_by_index(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata)
|
pa_operation* pa_context_set_source_volume_by_index(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata)
|
||||||
{
|
{
|
||||||
pw_log_warn("Not Implemented");
|
pa_operation *o;
|
||||||
return NULL;
|
struct global *g;
|
||||||
|
struct success_ack *d;
|
||||||
|
|
||||||
|
pa_assert(c);
|
||||||
|
pa_assert(c->refcount >= 1);
|
||||||
|
|
||||||
|
pw_log_debug("context %p: index %d", c, idx);
|
||||||
|
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
|
||||||
|
|
||||||
|
if ((g = pa_context_find_global(c, idx)) == NULL)
|
||||||
|
return NULL;
|
||||||
|
if (!(g->mask & PA_SUBSCRIPTION_MASK_SOURCE))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
set_node_volume(c, g, volume);
|
||||||
|
|
||||||
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
|
d = o->userdata;
|
||||||
|
d->cb = cb;
|
||||||
|
d->userdata = userdata;
|
||||||
|
pa_operation_sync(o);
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_operation* pa_context_set_source_volume_by_name(pa_context *c, const char *name, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata)
|
pa_operation* pa_context_set_source_volume_by_name(pa_context *c, const char *name, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata)
|
||||||
{
|
{
|
||||||
pw_log_warn("Not Implemented");
|
pa_operation *o;
|
||||||
return NULL;
|
struct global *g;
|
||||||
|
struct success_ack *d;
|
||||||
|
|
||||||
|
pa_assert(c);
|
||||||
|
pa_assert(c->refcount >= 1);
|
||||||
|
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
|
||||||
|
|
||||||
|
pw_log_debug("context %p: name %s", c, name);
|
||||||
|
|
||||||
|
if ((g = pa_context_find_global_by_name(c, PA_SUBSCRIPTION_MASK_SOURCE, name)) == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
set_node_volume(c, g, volume);
|
||||||
|
|
||||||
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
|
d = o->userdata;
|
||||||
|
d->cb = cb;
|
||||||
|
d->userdata = userdata;
|
||||||
|
pa_operation_sync(o);
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_operation* pa_context_set_source_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata)
|
pa_operation* pa_context_set_source_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata)
|
||||||
{
|
{
|
||||||
pw_log_warn("Not Implemented");
|
pa_operation *o;
|
||||||
return NULL;
|
struct global *g;
|
||||||
|
struct success_ack *d;
|
||||||
|
|
||||||
|
pa_assert(c);
|
||||||
|
pa_assert(c->refcount >= 1);
|
||||||
|
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
|
||||||
|
|
||||||
|
pw_log_debug("context %p: index %d", c, idx);
|
||||||
|
|
||||||
|
if ((g = pa_context_find_global(c, idx)) == NULL)
|
||||||
|
return NULL;
|
||||||
|
if (!(g->mask & PA_SUBSCRIPTION_MASK_SOURCE))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
set_node_mute(c, g, mute);
|
||||||
|
|
||||||
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
|
d = o->userdata;
|
||||||
|
d->cb = cb;
|
||||||
|
d->userdata = userdata;
|
||||||
|
pa_operation_sync(o);
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_operation* pa_context_set_source_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata)
|
pa_operation* pa_context_set_source_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata)
|
||||||
{
|
{
|
||||||
pw_log_warn("Not Implemented");
|
pa_operation *o;
|
||||||
return NULL;
|
struct global *g;
|
||||||
|
struct success_ack *d;
|
||||||
|
|
||||||
|
pa_assert(c);
|
||||||
|
pa_assert(c->refcount >= 1);
|
||||||
|
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||||
|
PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
|
||||||
|
|
||||||
|
pw_log_debug("context %p: name %s", c, name);
|
||||||
|
|
||||||
|
if ((g = pa_context_find_global_by_name(c, PA_SUBSCRIPTION_MASK_SOURCE, name)) == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
set_node_mute(c, g, mute);
|
||||||
|
|
||||||
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
|
d = o->userdata;
|
||||||
|
d->cb = cb;
|
||||||
|
d->userdata = userdata;
|
||||||
|
pa_operation_sync(o);
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_operation* pa_context_suspend_source_by_name(pa_context *c, const char *source_name, int suspend, pa_context_success_cb_t cb, void* userdata)
|
pa_operation* pa_context_suspend_source_by_name(pa_context *c, const char *source_name, int suspend, pa_context_success_cb_t cb, void* userdata)
|
||||||
|
|
@ -1489,11 +1703,8 @@ pa_operation* pa_context_set_sink_input_volume(pa_context *c, uint32_t idx, cons
|
||||||
struct global *g;
|
struct global *g;
|
||||||
pa_operation *o;
|
pa_operation *o;
|
||||||
struct success_ack *d;
|
struct success_ack *d;
|
||||||
float v;
|
|
||||||
|
|
||||||
v = pa_cvolume_avg(volume) / (float) PA_VOLUME_NORM;
|
pw_log_debug("contex %p: index %d", c, idx);
|
||||||
|
|
||||||
pw_log_debug("contex %p: index %d volume %f", c, idx, v);
|
|
||||||
|
|
||||||
if ((s = find_stream(c, idx)) == NULL) {
|
if ((s = find_stream(c, idx)) == NULL) {
|
||||||
if ((g = pa_context_find_global(c, idx)) == NULL)
|
if ((g = pa_context_find_global(c, idx)) == NULL)
|
||||||
|
|
@ -1503,19 +1714,11 @@ pa_operation* pa_context_set_sink_input_volume(pa_context *c, uint32_t idx, cons
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
s->volume = v;
|
s->volume = pa_cvolume_avg(volume) / (float) PA_VOLUME_NORM;
|
||||||
pw_stream_set_control(s->stream, PW_STREAM_CONTROL_VOLUME, s->mute ? 0.0 : s->volume);
|
pw_stream_set_control(s->stream, PW_STREAM_CONTROL_VOLUME, s->mute ? 0.0 : s->volume);
|
||||||
}
|
}
|
||||||
else if (g) {
|
else if (g) {
|
||||||
char buf[1024];
|
set_node_volume(c, g, volume);
|
||||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
|
||||||
|
|
||||||
pw_node_proxy_set_param((struct pw_node_proxy*)g->proxy,
|
|
||||||
SPA_PARAM_Props, 0,
|
|
||||||
spa_pod_builder_object(&b,
|
|
||||||
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
|
|
||||||
SPA_PROP_volume, &SPA_POD_Float(v),
|
|
||||||
0));
|
|
||||||
}
|
}
|
||||||
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
d = o->userdata;
|
d = o->userdata;
|
||||||
|
|
@ -1545,15 +1748,7 @@ pa_operation* pa_context_set_sink_input_mute(pa_context *c, uint32_t idx, int mu
|
||||||
pw_stream_set_control(s->stream, PW_STREAM_CONTROL_VOLUME, s->mute ? 0.0 : s->volume);
|
pw_stream_set_control(s->stream, PW_STREAM_CONTROL_VOLUME, s->mute ? 0.0 : s->volume);
|
||||||
}
|
}
|
||||||
else if (g) {
|
else if (g) {
|
||||||
char buf[1024];
|
set_node_mute(c, g, mute);
|
||||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
|
||||||
|
|
||||||
pw_node_proxy_set_param((struct pw_node_proxy*)g->proxy,
|
|
||||||
SPA_PARAM_Props, 0,
|
|
||||||
spa_pod_builder_object(&b,
|
|
||||||
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
|
|
||||||
SPA_PROP_mute, &SPA_POD_Bool(mute),
|
|
||||||
0));
|
|
||||||
}
|
}
|
||||||
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
d = o->userdata;
|
d = o->userdata;
|
||||||
|
|
@ -1769,11 +1964,8 @@ pa_operation* pa_context_set_source_output_volume(pa_context *c, uint32_t idx, c
|
||||||
struct global *g;
|
struct global *g;
|
||||||
pa_operation *o;
|
pa_operation *o;
|
||||||
struct success_ack *d;
|
struct success_ack *d;
|
||||||
float v;
|
|
||||||
|
|
||||||
v = pa_cvolume_avg(volume) / (float) PA_VOLUME_NORM;
|
pw_log_debug("contex %p: index %d", c, idx);
|
||||||
|
|
||||||
pw_log_debug("contex %p: index %d volume %f", c, idx, v);
|
|
||||||
|
|
||||||
if ((s = find_stream(c, idx)) == NULL) {
|
if ((s = find_stream(c, idx)) == NULL) {
|
||||||
if ((g = pa_context_find_global(c, idx)) == NULL)
|
if ((g = pa_context_find_global(c, idx)) == NULL)
|
||||||
|
|
@ -1783,19 +1975,11 @@ pa_operation* pa_context_set_source_output_volume(pa_context *c, uint32_t idx, c
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
s->volume = v;
|
s->volume = pa_cvolume_avg(volume) / (float) PA_VOLUME_NORM;
|
||||||
pw_stream_set_control(s->stream, PW_STREAM_CONTROL_VOLUME, s->mute ? 0.0 : s->volume);
|
pw_stream_set_control(s->stream, PW_STREAM_CONTROL_VOLUME, s->mute ? 0.0 : s->volume);
|
||||||
}
|
}
|
||||||
else if (g) {
|
else if (g) {
|
||||||
char buf[1024];
|
set_node_volume(c, g, volume);
|
||||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
|
||||||
|
|
||||||
pw_node_proxy_set_param((struct pw_node_proxy*)g->proxy,
|
|
||||||
SPA_PARAM_Props, 0,
|
|
||||||
spa_pod_builder_object(&b,
|
|
||||||
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
|
|
||||||
SPA_PROP_volume, &SPA_POD_Float(v),
|
|
||||||
0));
|
|
||||||
}
|
}
|
||||||
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
d = o->userdata;
|
d = o->userdata;
|
||||||
|
|
@ -1825,15 +2009,7 @@ pa_operation* pa_context_set_source_output_mute(pa_context *c, uint32_t idx, int
|
||||||
pw_stream_set_control(s->stream, PW_STREAM_CONTROL_VOLUME, s->mute ? 0.0 : s->volume);
|
pw_stream_set_control(s->stream, PW_STREAM_CONTROL_VOLUME, s->mute ? 0.0 : s->volume);
|
||||||
}
|
}
|
||||||
else if (g) {
|
else if (g) {
|
||||||
char buf[1024];
|
set_node_mute(c, g, mute);
|
||||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
|
||||||
|
|
||||||
pw_node_proxy_set_param((struct pw_node_proxy*)g->proxy,
|
|
||||||
SPA_PARAM_Props, 0,
|
|
||||||
spa_pod_builder_object(&b,
|
|
||||||
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
|
|
||||||
SPA_PROP_mute, &SPA_POD_Bool(mute),
|
|
||||||
0));
|
|
||||||
}
|
}
|
||||||
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||||
d = o->userdata;
|
d = o->userdata;
|
||||||
|
|
|
||||||
|
|
@ -1733,7 +1733,6 @@ pa_operation *pa_stream_proplist_update(pa_stream *s, pa_update_mode_t mode, pa_
|
||||||
{
|
{
|
||||||
pa_operation *o;
|
pa_operation *o;
|
||||||
struct success_ack *d;
|
struct success_ack *d;
|
||||||
char *str;
|
|
||||||
|
|
||||||
spa_assert(s);
|
spa_assert(s);
|
||||||
spa_assert(s->refcount >= 1);
|
spa_assert(s->refcount >= 1);
|
||||||
|
|
@ -1743,9 +1742,7 @@ pa_operation *pa_stream_proplist_update(pa_stream *s, pa_update_mode_t mode, pa_
|
||||||
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
|
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
|
||||||
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
|
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
|
||||||
|
|
||||||
str = pa_proplist_to_string(p);
|
pa_proplist_update(s->proplist, mode, p);
|
||||||
pw_log_warn("Not Implemented %s", str);
|
|
||||||
free(str);
|
|
||||||
|
|
||||||
o = pa_operation_new(s->context, s, on_success, sizeof(struct success_ack));
|
o = pa_operation_new(s->context, s, on_success, sizeof(struct success_ack));
|
||||||
d = o->userdata;
|
d = o->userdata;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue