On Tue, 2015-12-29 at 09:03 +0530, arun at accosted.net wrote: > From: Arun Raghavan <git at arunraghavan.net> > > --- >  src/map-file         |  1 + >  src/pulse/internal.h |  1 + >  src/pulse/stream.c   | 28 ++++++++++++++++++++++++++++ >  src/pulse/stream.h   |  9 +++++++++ >  4 files changed, 39 insertions(+) > > diff --git a/src/map-file b/src/map-file > index afce508..17e7f6b 100644 > --- a/src/map-file > +++ b/src/map-file > @@ -320,6 +320,7 @@ pa_stream_set_event_callback; >  pa_stream_set_latency_update_callback; >  pa_stream_set_monitor_stream; >  pa_stream_set_moved_callback; > +pa_stream_set_mute; >  pa_stream_set_name; >  pa_stream_set_overflow_callback; >  pa_stream_set_read_callback; > diff --git a/src/pulse/internal.h b/src/pulse/internal.h > index a75ffbf..df67c60 100644 > --- a/src/pulse/internal.h > +++ b/src/pulse/internal.h > @@ -153,6 +153,7 @@ struct pa_stream { >  >      pa_cvolume volume; >      bool volume_set; > +    bool mute; >  >      bool channel_valid:1; >      bool suspended:1; > diff --git a/src/pulse/stream.c b/src/pulse/stream.c > index d9ca039..934a747 100644 > --- a/src/pulse/stream.c > +++ b/src/pulse/stream.c > @@ -3013,6 +3013,34 @@ int pa_stream_set_volume(pa_stream *s, pa_cvolume *v, pa_stream_success_cb_t cb, >      return 0; >  } >  > +int pa_stream_set_mute(pa_stream *s, int mute, pa_stream_success_cb_t cb, void *userdata) { > +    pa_operation *o; > +    pa_tagstruct *t; > +    uint32_t tag; > + > +    pa_assert(s); > +    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_FAILED && s->state != PA_STREAM_TERMINATED, PA_ERR_BADSTATE); > +    PA_CHECK_VALIDITY(s->context, userdata == NULL || cb != NULL, PA_ERR_INVALID); > +    PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_INVALID); /* TODO: do we want to support this? */ No, we don't. > +    /* We can't currently set this before connecting, which is not symmetric with volume */ > +    PA_CHECK_VALIDITY(s->context, s->state != PA_STREAM_UNCONNECTED, PA_ERR_BADSTATE); The function depends on s->stream_index, so the state must be PA_STREAM_READY. > + > +    o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata); > + > +    t = pa_tagstruct_command(s->context, > +            s->direction == PA_STREAM_PLAYBACK ? PA_COMMAND_SET_SINK_INPUT_MUTE : PA_COMMAND_SET_SOURCE_OUTPUT_MUTE, > +            &tag); > +    pa_tagstruct_putu32(t, s->stream_index); > +    pa_tagstruct_put_boolean(t, !!mute); > +    pa_pstream_send_tagstruct(s->context->pstream, t); > +    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref); > + > +    return 0; > +} > + >  int pa_stream_get_volume(pa_stream *s, pa_cvolume *v) { >      pa_assert(s); >      pa_assert(v); > diff --git a/src/pulse/stream.h b/src/pulse/stream.h > index c9fdec7..7adebe0 100644 > --- a/src/pulse/stream.h > +++ b/src/pulse/stream.h > @@ -828,6 +828,15 @@ uint32_t pa_stream_get_monitor_stream(pa_stream *s); >  * \since 9.0 */ >  int pa_stream_set_volume(pa_stream *s, pa_cvolume *v, pa_stream_success_cb_t cb, void *userdata); >  > +/** Set the mute status on the given stream. The operation is asynchronous and > + * a callback may optionally be provided to be invoked when the volume has been s/volume/mute/ -- Tanu