pa_tagstruct_puts(t, pa_resample_method_to_string(pa_sink_input_get_resample_method(s)));
pa_tagstruct_puts(t, s->driver);
if (c->version >= 11)
- pa_tagstruct_put_boolean(t, pa_sink_input_get_mute(s));
+ pa_tagstruct_put_boolean(t, s->muted);
if (c->version >= 13)
pa_tagstruct_put_proplist(t, s->proplist);
if (c->version >= 19)
pa_tagstruct_put_boolean(t, (pa_source_output_get_state(s) == PA_SOURCE_OUTPUT_CORKED));
if (c->version >= 22) {
pa_tagstruct_put_cvolume(t, &v);
- pa_tagstruct_put_boolean(t, pa_source_output_get_mute(s));
+ pa_tagstruct_put_boolean(t, s->muted);
pa_tagstruct_put_boolean(t, has_volume);
pa_tagstruct_put_boolean(t, s->volume_writable);
pa_tagstruct_put_format_info(t, s->format);
pa_strnull(pa_proplist_gets(si->proplist, PA_PROP_MEDIA_NAME)));
pa_sink_input_set_volume(si, &volume, true, true);
} else if (so) {
+ CHECK_VALIDITY(c->pstream, so->volume_writable, tag, PA_ERR_BADSTATE);
CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &so->sample_spec), tag, PA_ERR_INVALID);
pa_log_debug("Client %s changes volume of source output %s.",
}
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
- CHECK_VALIDITY(c->pstream, rate > 0 && rate <= PA_RATE_MAX, tag, PA_ERR_INVALID);
+ CHECK_VALIDITY(c->pstream, pa_sample_rate_valid(rate), tag, PA_ERR_INVALID);
if (command == PA_COMMAND_UPDATE_PLAYBACK_STREAM_SAMPLE_RATE) {
playback_stream *s;
static void command_set_card_profile(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_native_connection *c = PA_NATIVE_CONNECTION(userdata);
uint32_t idx = PA_INVALID_INDEX;
- const char *name = NULL, *profile = NULL;
+ const char *name = NULL, *profile_name = NULL;
pa_card *card = NULL;
+ pa_card_profile *profile;
int ret;
pa_native_connection_assert_ref(c);
if (pa_tagstruct_getu32(t, &idx) < 0 ||
pa_tagstruct_gets(t, &name) < 0 ||
- pa_tagstruct_gets(t, &profile) < 0 ||
+ pa_tagstruct_gets(t, &profile_name) < 0 ||
!pa_tagstruct_eof(t)) {
protocol_error(c);
return;
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID);
CHECK_VALIDITY(c->pstream, (idx != PA_INVALID_INDEX) ^ (name != NULL), tag, PA_ERR_INVALID);
+ CHECK_VALIDITY(c->pstream, profile_name, tag, PA_ERR_INVALID);
if (idx != PA_INVALID_INDEX)
card = pa_idxset_get_by_index(c->protocol->core->cards, idx);
CHECK_VALIDITY(c->pstream, card, tag, PA_ERR_NOENTITY);
+ profile = pa_hashmap_get(card->profiles, profile_name);
+
+ CHECK_VALIDITY(c->pstream, profile, tag, PA_ERR_NOENTITY);
+
if ((ret = pa_card_set_profile(card, profile, true)) < 0) {
pa_pstream_send_error(c->pstream, tag, -ret);
return;
} else {
pa_source *source;
- pa_assert(command = PA_COMMAND_SET_SOURCE_PORT);
+ pa_assert(command == PA_COMMAND_SET_SOURCE_PORT);
if (idx != PA_INVALID_INDEX)
source = pa_idxset_get_by_index(c->protocol->core->sources, idx);
pa_tagstruct_gets64(t, &offset) < 0 ||
!pa_tagstruct_eof(t)) {
protocol_error(c);
+ return;
}
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);