implement PA_STREAM_FAIL_ON_SUSPEND logic

This commit is contained in:
Lennart Poettering 2009-02-03 02:23:46 +01:00
parent c61ad2a706
commit e47d03dea4
10 changed files with 59 additions and 24 deletions

View file

@ -237,12 +237,17 @@ typedef enum pa_stream_flags {
* checked whether the device this stream is connected to should
* auto-suspend. \since 0.9.15 */
PA_STREAM_START_UNMUTED = 0x10000U
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.15 */
PA_STREAM_FAIL_ON_SUSPEND = 0x20000U
/**< If the sink/source this stream is connected to is suspended
* during the creation of this stream, cause it to fail. If the
* sink/source is being suspended during creation of this stream,
* make sure this stream is terminated. \since 0.9.15 */
} pa_stream_flags_t;
/** \cond fulldocs */
@ -268,6 +273,7 @@ typedef enum pa_stream_flags {
#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
#define PA_STREAM_FAIL_ON_SUSPEND PA_STREAM_FAIL_ON_SUSPEND
/** \endcond */

View file

@ -891,7 +891,8 @@ static int create_stream(
PA_STREAM_ADJUST_LATENCY|
PA_STREAM_EARLY_REQUESTS|
PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND|
PA_STREAM_START_UNMUTED)), PA_ERR_INVALID);
PA_STREAM_START_UNMUTED|
PA_STREAM_FAIL_ON_SUSPEND)), 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);
@ -1017,6 +1018,7 @@ static int create_stream(
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_tagstruct_put_boolean(t, flags & PA_STREAM_FAIL_ON_SUSPEND);
}
pa_pstream_send_tagstruct(s->context->pstream, t);