[pulseaudio-discuss] [PATCH 6/6] stream: Add a pa_stream_get_mute() API
Tanu Kaskinen
tanuk at iki.fi
Sat Mar 5 12:30:55 UTC 2016
On Tue, 2015-12-29 at 09:03 +0530, arun at accosted.net wrote:
> @@ -1195,8 +1198,10 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag,
> }
> }
>
> - if (s->context->version >= 31)
> + if (s->context->version >= 31) {
> pa_tagstruct_get_cvolume(t, &s->volume);
> + pa_tagstruct_get_boolean(t, &s->mute);
The pa_tagstruct_get_boolean() return value needs to be checked.
> +int pa_stream_get_mute(pa_stream *s, int *mute) {
> + pa_assert(s);
> + pa_assert(mute);
> + pa_assert(PA_REFCNT_VALUE(s) >= 1);
> +
> + PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED);
> + PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
> + PA_CHECK_VALIDITY(s->context, s->state != PA_STREAM_FAILED && s->state != PA_STREAM_TERMINATED, PA_ERR_BADSTATE);
> + PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_NODATA);
The second and third s->state checks can be removed, because the first
check already covers all cases.
> + PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_INVALID); /* TODO: do we want to support this? */
No, we don't.
> +/** Get the mute status on the given stream.
> + *
> + * Returns 0 on success, negative error value on failure.
> + *
> + * \since 9.0 */
> +int pa_stream_get_mute(pa_stream *s, int *mute);
It should be documented that this works only with protocol version >=
31.
--
Tanu
More information about the pulseaudio-discuss
mailing list