Implement new flags DONT_INHIBIT_AUTO_SUSPEND and START_UNMUTED

This commit is contained in:
Lennart Poettering 2008-10-26 19:32:04 +01:00
parent c180cb5c48
commit adc2973c8d
13 changed files with 156 additions and 24 deletions

View file

@ -194,7 +194,10 @@ typedef enum pa_stream_flags {
/**< Find peaks instead of resampling. \since 0.9.11 */
PA_STREAM_START_MUTED = 0x1000U,
/**< Create in muted state. \since 0.9.11 */
/**< Create in muted state. If neither PA_STREAM_START_UNMUTED nor
* PA_STREAM_START_MUTED it is left to the server to decide
* whether to create the stream in muted or in unmuted
* state. \since 0.9.11 */
PA_STREAM_ADJUST_LATENCY = 0x2000U,
/**< Try to adjust the latency of the sink/source based on the
@ -203,7 +206,7 @@ typedef enum pa_stream_flags {
* specified at the same time as PA_STREAM_EARLY_REQUESTS. \since
* 0.9.11 */
PA_STREAM_EARLY_REQUESTS = 0x4000U
PA_STREAM_EARLY_REQUESTS = 0x4000U,
/**< Enable compatibility mode for legacy clients that rely on a
* "classic" hardware device fragment-style playback model. If
* this option is set, the minreq value of the buffer metrics gets
@ -220,6 +223,17 @@ typedef enum pa_stream_flags {
* not be specified at the same time as
* PA_STREAM_ADJUST_LATENCY. \since 0.9.12 */
PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND = 0x8000U,
/**< If set this stream won't be taken into account when we it is
* checked whether the device this stream is connected to should
* auto-suspend. \ since 0.9.14 */
PA_STREAM_START_UNMUTED = 0x10000U
/**< Create in unmuted state. If neither PA_STREAM_START_UNMUTED
* nor PA_STREAM_START_MUTED it is left to the server to decide
* whether to create the stream in muted or in unmuted
* state. \since 0.9.14 */
} pa_stream_flags_t;
/** \cond fulldocs */
@ -243,6 +257,8 @@ typedef enum pa_stream_flags {
#define PA_STREAM_START_MUTED PA_STREAM_START_MUTED
#define PA_STREAM_ADJUST_LATENCY PA_STREAM_ADJUST_LATENCY
#define PA_STREAM_EARLY_REQUESTS PA_STREAM_EARLY_REQUESTS
#define PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND
#define PA_STREAM_START_UNMUTED PA_STREAM_START_UNMUTED
/** \endcond */

View file

@ -887,7 +887,9 @@ static int create_stream(
PA_STREAM_PEAK_DETECT|
PA_STREAM_START_MUTED|
PA_STREAM_ADJUST_LATENCY|
PA_STREAM_EARLY_REQUESTS)), PA_ERR_INVALID);
PA_STREAM_EARLY_REQUESTS|
PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND|
PA_STREAM_START_UNMUTED)), PA_ERR_INVALID);
PA_CHECK_VALIDITY(s->context, s->context->version >= 12 || !(flags & PA_STREAM_VARIABLE_RATE), PA_ERR_NOTSUPPORTED);
PA_CHECK_VALIDITY(s->context, s->context->version >= 13 || !(flags & PA_STREAM_PEAK_DETECT), PA_ERR_NOTSUPPORTED);
@ -1007,6 +1009,14 @@ static int create_stream(
pa_tagstruct_put_boolean(t, flags & PA_STREAM_EARLY_REQUESTS);
}
if (s->context->version >= 15) {
if (s->direction == PA_STREAM_PLAYBACK)
pa_tagstruct_put_boolean(t, flags & (PA_STREAM_START_MUTED|PA_STREAM_START_UNMUTED));
pa_tagstruct_put_boolean(t, flags & PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND);
}
pa_pstream_send_tagstruct(s->context->pstream, t);
pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s, NULL);