aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndreas Pehrson <[email protected]>2023-11-21 11:21:40 +0100
committerAndreas Pehrson <[email protected]>2024-01-15 15:25:40 +0100
commitdd8a91f98260d2c6171a7cf8a73f8fd4bdbb5337 (patch)
treec0ccb7ad405da6d59a3023279f0ab646ba1fa565
parent5a2df9b0aaa5352c168b7aa2a29d80f8a0e3880b (diff)
downloadcubeb-dd8a91f98260d2c6171a7cf8a73f8fd4bdbb5337.tar.gz
cubeb-dd8a91f98260d2c6171a7cf8a73f8fd4bdbb5337.zip
Add an API for muting the input side of a stream
-rw-r--r--include/cubeb/cubeb.h12
-rw-r--r--src/cubeb-internal.h1
-rw-r--r--src/cubeb.c14
-rw-r--r--src/cubeb_aaudio.cpp1
-rw-r--r--src/cubeb_alsa.c1
-rw-r--r--src/cubeb_audiotrack.c1
-rw-r--r--src/cubeb_audiounit.cpp1
-rw-r--r--src/cubeb_jack.cpp1
-rw-r--r--src/cubeb_kai.c1
-rw-r--r--src/cubeb_opensl.cpp1
-rw-r--r--src/cubeb_oss.c1
-rw-r--r--src/cubeb_pulse.c1
-rw-r--r--src/cubeb_sndio.c1
-rw-r--r--src/cubeb_sun.c1
-rw-r--r--src/cubeb_wasapi.cpp1
-rw-r--r--src/cubeb_winmm.c1
16 files changed, 40 insertions, 0 deletions
diff --git a/include/cubeb/cubeb.h b/include/cubeb/cubeb.h
index 5c66d58..17ead45 100644
--- a/include/cubeb/cubeb.h
+++ b/include/cubeb/cubeb.h
@@ -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
diff --git a/src/cubeb-internal.h b/src/cubeb-internal.h
index c6d9b87..8357cdc 100644
--- a/src/cubeb-internal.h
+++ b/src/cubeb-internal.h
@@ -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);
diff --git a/src/cubeb.c b/src/cubeb.c
index c13a848..16bb84a 100644
--- a/src/cubeb.c
+++ b/src/cubeb.c
@@ -516,6 +516,20 @@ cubeb_stream_get_current_device(cubeb_stream * stream,
}
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)
{
diff --git a/src/cubeb_aaudio.cpp b/src/cubeb_aaudio.cpp
index d4bc87a..f6ed5c6 100644
--- a/src/cubeb_aaudio.cpp
+++ b/src/cubeb_aaudio.cpp
@@ -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,
diff --git a/src/cubeb_alsa.c b/src/cubeb_alsa.c
index 45911e5..f114f27 100644
--- a/src/cubeb_alsa.c
+++ b/src/cubeb_alsa.c
@@ -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,
diff --git a/src/cubeb_audiotrack.c b/src/cubeb_audiotrack.c
index 44119d2..84ccfb8 100644
--- a/src/cubeb_audiotrack.c
+++ b/src/cubeb_audiotrack.c
@@ -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,
diff --git a/src/cubeb_audiounit.cpp b/src/cubeb_audiounit.cpp
index 915a6c5..0341c8d 100644
--- a/src/cubeb_audiounit.cpp
+++ b/src/cubeb_audiounit.cpp
@@ -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 =*/
diff --git a/src/cubeb_jack.cpp b/src/cubeb_jack.cpp
index 573f0ab..b417078 100644
--- a/src/cubeb_jack.cpp
+++ b/src/cubeb_jack.cpp
@@ -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,
diff --git a/src/cubeb_kai.c b/src/cubeb_kai.c
index dd2af87..4bc6c7a 100644
--- a/src/cubeb_kai.c
+++ b/src/cubeb_kai.c
@@ -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,
diff --git a/src/cubeb_opensl.cpp b/src/cubeb_opensl.cpp
index c7d6227..f9914ea 100644
--- a/src/cubeb_opensl.cpp
+++ b/src/cubeb_opensl.cpp
@@ -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,
diff --git a/src/cubeb_oss.c b/src/cubeb_oss.c
index 7bda530..3d09ba4 100644
--- a/src/cubeb_oss.c
+++ b/src/cubeb_oss.c
@@ -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,
diff --git a/src/cubeb_pulse.c b/src/cubeb_pulse.c
index 636fc36..c761487 100644
--- a/src/cubeb_pulse.c
+++ b/src/cubeb_pulse.c
@@ -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,
diff --git a/src/cubeb_sndio.c b/src/cubeb_sndio.c
index d5a26ae..cd295bf 100644
--- a/src/cubeb_sndio.c
+++ b/src/cubeb_sndio.c
@@ -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,
diff --git a/src/cubeb_sun.c b/src/cubeb_sun.c
index 6c6f682..cae9eef 100644
--- a/src/cubeb_sun.c
+++ b/src/cubeb_sun.c
@@ -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,
diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp
index 2ddf543..01417a5 100644
--- a/src/cubeb_wasapi.cpp
+++ b/src/cubeb_wasapi.cpp
@@ -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,
diff --git a/src/cubeb_winmm.c b/src/cubeb_winmm.c
index 09c15df..b2234a9 100644
--- a/src/cubeb_winmm.c
+++ b/src/cubeb_winmm.c
@@ -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,