sink-input, source-output: rework property setting

pa_sink_input_update_proplist() is inconvenient in many cases, because
it requires allocating a new proplist, even if the goal is to just set
one property. pa_sink_input_update_properties also can't properly log
property changes, because it has to assume that all values are
arbitrary binary data.

This patch adds pa_sink_input_set_property() for setting a string
value for a single property, and pa_sink_input_set_property_arbitrary()
for setting a binary value for a single property.
pa_sink_input_update_properties() is reimplemented as a wrapper around
pa_sink_input_set_property_arbitrary() to centralize logging and
sending change notifications.

(The above mentions only sink input functions for brevity, but the
same changes are implemented for source outputs too.)
This commit is contained in:
Tanu Kaskinen 2016-03-11 12:02:22 +02:00
parent 085cced42c
commit 3e7e901ba0
4 changed files with 232 additions and 14 deletions

View file

@ -316,6 +316,8 @@ pa_cvolume *pa_source_output_get_volume(pa_source_output *o, pa_cvolume *volume,
void pa_source_output_set_mute(pa_source_output *o, bool mute, bool save);
void pa_source_output_set_property(pa_source_output *o, const char *key, const char *value);
void pa_source_output_set_property_arbitrary(pa_source_output *o, const char *key, const uint8_t *value, size_t nbytes);
void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode, pa_proplist *p);
pa_resample_method_t pa_source_output_get_resample_method(pa_source_output *o);