зеркало из https://github.com/mozilla/cubeb.git
Add an API for muting the input side of a stream
This commit is contained in:
Родитель
5a2df9b0aa
Коммит
dd8a91f982
|
@ -665,6 +665,18 @@ CUBEB_EXPORT int
|
|||
cubeb_stream_get_current_device(cubeb_stream * stm,
|
||||
cubeb_device ** const device);
|
||||
|
||||
/** Set input mute state for this stream. Some platforms notify the user when an
|
||||
application is accessing audio input. When all inputs are muted they can
|
||||
prove to the user that the application is not actively capturing any input.
|
||||
@param stream the stream for which to set input mute state
|
||||
@param muted whether the input should mute or not
|
||||
@retval CUBEB_OK
|
||||
@retval CUBEB_ERROR_INVALID_PARAMETER if this stream does not have an input
|
||||
device
|
||||
@retval CUBEB_ERROR_NOT_SUPPORTED */
|
||||
CUBEB_EXPORT int
|
||||
cubeb_stream_set_input_mute(cubeb_stream * stream, int mute);
|
||||
|
||||
/** Set what input processing features to enable for this stream.
|
||||
@param stream the stream for which to set input processing features.
|
||||
@param params what input processing features to use
|
||||
|
|
|
@ -64,6 +64,7 @@ struct cubeb_ops {
|
|||
int (*stream_set_name)(cubeb_stream * stream, char const * stream_name);
|
||||
int (*stream_get_current_device)(cubeb_stream * stream,
|
||||
cubeb_device ** const device);
|
||||
int (*stream_set_input_mute)(cubeb_stream * stream, int mute);
|
||||
int (*stream_set_input_processing_params)(
|
||||
cubeb_stream * stream, cubeb_input_processing_params params);
|
||||
int (*stream_device_destroy)(cubeb_stream * stream, cubeb_device * device);
|
||||
|
|
14
src/cubeb.c
14
src/cubeb.c
|
@ -515,6 +515,20 @@ cubeb_stream_get_current_device(cubeb_stream * stream,
|
|||
return stream->context->ops->stream_get_current_device(stream, device);
|
||||
}
|
||||
|
||||
int
|
||||
cubeb_stream_set_input_mute(cubeb_stream * stream, int mute)
|
||||
{
|
||||
if (!stream) {
|
||||
return CUBEB_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (!stream->context->ops->stream_set_input_mute) {
|
||||
return CUBEB_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return stream->context->ops->stream_set_input_mute(stream, mute);
|
||||
}
|
||||
|
||||
int
|
||||
cubeb_stream_set_input_processing_params(cubeb_stream * stream,
|
||||
cubeb_input_processing_params params)
|
||||
|
|
|
@ -1750,6 +1750,7 @@ const static struct cubeb_ops aaudio_ops = {
|
|||
/*.stream_set_volume =*/aaudio_stream_set_volume,
|
||||
/*.stream_set_name =*/nullptr,
|
||||
/*.stream_get_current_device =*/nullptr,
|
||||
/*.stream_set_input_mute =*/nullptr,
|
||||
/*.stream_set_input_processing_params =*/nullptr,
|
||||
/*.stream_device_destroy =*/nullptr,
|
||||
/*.stream_register_device_changed_callback =*/nullptr,
|
||||
|
|
|
@ -1486,6 +1486,7 @@ static struct cubeb_ops const alsa_ops = {
|
|||
.stream_set_volume = alsa_stream_set_volume,
|
||||
.stream_set_name = NULL,
|
||||
.stream_get_current_device = NULL,
|
||||
.stream_set_input_mute = NULL,
|
||||
.stream_set_input_processing_params = NULL,
|
||||
.stream_device_destroy = NULL,
|
||||
.stream_register_device_changed_callback = NULL,
|
||||
|
|
|
@ -468,6 +468,7 @@ static struct cubeb_ops const audiotrack_ops = {
|
|||
.stream_set_volume = audiotrack_stream_set_volume,
|
||||
.stream_set_name = NULL,
|
||||
.stream_get_current_device = NULL,
|
||||
.stream_set_input_mute = NULL,
|
||||
.stream_set_input_processing_params = NULL,
|
||||
.stream_device_destroy = NULL,
|
||||
.stream_register_device_changed_callback = NULL,
|
||||
|
|
|
@ -3679,6 +3679,7 @@ cubeb_ops const audiounit_ops = {
|
|||
/*.stream_set_volume =*/audiounit_stream_set_volume,
|
||||
/*.stream_set_name =*/NULL,
|
||||
/*.stream_get_current_device =*/audiounit_stream_get_current_device,
|
||||
/*.stream_set_input_mute =*/NULL,
|
||||
/*.stream_set_input_processing_params =*/NULL,
|
||||
/*.stream_device_destroy =*/audiounit_stream_device_destroy,
|
||||
/*.stream_register_device_changed_callback =*/
|
||||
|
|
|
@ -174,6 +174,7 @@ static struct cubeb_ops const cbjack_ops = {
|
|||
.stream_set_volume = cbjack_stream_set_volume,
|
||||
.stream_set_name = NULL,
|
||||
.stream_get_current_device = cbjack_stream_get_current_device,
|
||||
.stream_set_input_mute = NULL,
|
||||
.stream_set_input_processing_params = NULL,
|
||||
.stream_device_destroy = cbjack_stream_device_destroy,
|
||||
.stream_register_device_changed_callback = NULL,
|
||||
|
|
|
@ -365,6 +365,7 @@ static struct cubeb_ops const kai_ops = {
|
|||
/*.stream_set_volume =*/kai_stream_set_volume,
|
||||
/*.stream_set_name =*/NULL,
|
||||
/*.stream_get_current_device =*/NULL,
|
||||
/*.stream_set_input_mute =*/NULL,
|
||||
/*.stream_set_input_processing_params =*/NULL,
|
||||
/*.stream_device_destroy =*/NULL,
|
||||
/*.stream_register_device_changed_callback=*/NULL,
|
||||
|
|
|
@ -1948,6 +1948,7 @@ struct cubeb_ops const opensl_ops = {
|
|||
.stream_set_volume = opensl_stream_set_volume,
|
||||
.stream_set_name = nullptr,
|
||||
.stream_get_current_device = nullptr,
|
||||
.stream_set_input_mute = nullptr,
|
||||
.stream_set_input_processing_params = nullptr,
|
||||
.stream_device_destroy = nullptr,
|
||||
.stream_register_device_changed_callback = nullptr,
|
||||
|
|
|
@ -1349,6 +1349,7 @@ static struct cubeb_ops const oss_ops = {
|
|||
.stream_set_volume = oss_stream_set_volume,
|
||||
.stream_set_name = NULL,
|
||||
.stream_get_current_device = oss_get_current_device,
|
||||
.stream_set_input_mute = NULL,
|
||||
.stream_set_input_processing_params = NULL,
|
||||
.stream_device_destroy = oss_stream_device_destroy,
|
||||
.stream_register_device_changed_callback = NULL,
|
||||
|
|
|
@ -1704,6 +1704,7 @@ static struct cubeb_ops const pulse_ops = {
|
|||
.stream_set_volume = pulse_stream_set_volume,
|
||||
.stream_set_name = pulse_stream_set_name,
|
||||
.stream_get_current_device = pulse_stream_get_current_device,
|
||||
.stream_set_input_mute = NULL,
|
||||
.stream_set_input_processing_params = NULL,
|
||||
.stream_device_destroy = pulse_stream_device_destroy,
|
||||
.stream_register_device_changed_callback = NULL,
|
||||
|
|
|
@ -680,6 +680,7 @@ static struct cubeb_ops const sndio_ops = {
|
|||
.stream_set_volume = sndio_stream_set_volume,
|
||||
.stream_set_name = NULL,
|
||||
.stream_get_current_device = NULL,
|
||||
.stream_set_input_mute = NULL,
|
||||
.stream_set_input_processing_params = NULL,
|
||||
.stream_device_destroy = NULL,
|
||||
.stream_register_device_changed_callback = NULL,
|
||||
|
|
|
@ -733,6 +733,7 @@ static struct cubeb_ops const sun_ops = {
|
|||
.stream_set_volume = sun_stream_set_volume,
|
||||
.stream_set_name = NULL,
|
||||
.stream_get_current_device = sun_get_current_device,
|
||||
.stream_set_input_mute = NULL,
|
||||
.stream_set_input_processing_params = NULL,
|
||||
.stream_device_destroy = sun_stream_device_destroy,
|
||||
.stream_register_device_changed_callback = NULL,
|
||||
|
|
|
@ -3575,6 +3575,7 @@ cubeb_ops const wasapi_ops = {
|
|||
/*.stream_set_volume =*/wasapi_stream_set_volume,
|
||||
/*.stream_set_name =*/NULL,
|
||||
/*.stream_get_current_device =*/NULL,
|
||||
/*.stream_set_input_mute =*/NULL,
|
||||
/*.stream_set_input_processing_params =*/NULL,
|
||||
/*.stream_device_destroy =*/NULL,
|
||||
/*.stream_register_device_changed_callback =*/NULL,
|
||||
|
|
|
@ -1206,6 +1206,7 @@ static struct cubeb_ops const winmm_ops = {
|
|||
/*.stream_set_volume =*/winmm_stream_set_volume,
|
||||
/*.stream_set_name =*/NULL,
|
||||
/*.stream_get_current_device =*/NULL,
|
||||
/*.stream_set_input_mute =*/NULL,
|
||||
/*.stream_set_input_processing_params =*/NULL,
|
||||
/*.stream_device_destroy =*/NULL,
|
||||
/*.stream_register_device_changed_callback=*/NULL,
|
||||
|
|
Загрузка…
Ссылка в новой задаче