aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNicola Orlando <[email protected]>2021-01-20 18:51:20 +0100
committerMatthew Gregan <[email protected]>2021-01-22 13:44:54 +1300
commit8d53747d4adc3b0b03ebf79b05f1fff08c5ae8ef (patch)
tree453af5b8af75cb1a39eb15b79f4992cf4c50aacb /src
parent4a83932caee16c9ee404b39144620fcbcc7a842f (diff)
downloadcubeb-8d53747d4adc3b0b03ebf79b05f1fff08c5ae8ef.tar.gz
cubeb-8d53747d4adc3b0b03ebf79b05f1fff08c5ae8ef.zip
Fixed option to not automatically connect ports on jack.
Diffstat (limited to 'src')
-rw-r--r--src/cubeb_jack.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/cubeb_jack.cpp b/src/cubeb_jack.cpp
index 5c15672..4d5b722 100644
--- a/src/cubeb_jack.cpp
+++ b/src/cubeb_jack.cpp
@@ -64,6 +64,12 @@ enum devstream {
DUPLEX,
};
+enum cbjack_connect_ports_options {
+ CBJACK_CP_OPTIONS_NONE = 0x0,
+ CBJACK_CP_OPTIONS_SKIP_OUTPUT = 0x1,
+ CBJACK_CP_OPTIONS_SKIP_INPUT = 0x2,
+};
+
static void
s16ne_to_float(float * dst, const int16_t * src, size_t n)
{
@@ -256,7 +262,7 @@ cbjack_connect_port_in (cubeb_stream * stream, const char * const phys_out_port,
}
static int
-cbjack_connect_ports (cubeb_stream * stream)
+cbjack_connect_ports (cubeb_stream * stream, enum cbjack_connect_ports_options options)
{
int r = CUBEB_ERROR;
const char ** phys_in_ports = api_jack_get_ports (stream->context->jack_client,
@@ -268,7 +274,7 @@ cbjack_connect_ports (cubeb_stream * stream)
JackPortIsOutput
| JackPortIsPhysical);
- if (phys_in_ports == NULL || *phys_in_ports == NULL) {
+ if (phys_in_ports == NULL || *phys_in_ports == NULL || options & CBJACK_CP_OPTIONS_SKIP_OUTPUT) {
goto skipplayback;
}
@@ -285,7 +291,7 @@ cbjack_connect_ports (cubeb_stream * stream)
r = CUBEB_OK;
skipplayback:
- if (phys_out_ports == NULL || *phys_out_ports == NULL) {
+ if (phys_out_ports == NULL || *phys_out_ports == NULL || options & CBJACK_CP_OPTIONS_SKIP_INPUT) {
goto end;
}
// Connect inputs to capture
@@ -892,6 +898,13 @@ cbjack_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput,
0);
+ if (!(output_stream_params->prefs & CUBEB_STREAM_PREF_JACK_NO_AUTO_CONNECT)) {
+ if (cbjack_connect_ports(stm, CBJACK_CP_OPTIONS_SKIP_INPUT) != CUBEB_OK) {
+ pthread_mutex_unlock(&stm->mutex);
+ cbjack_stream_destroy(stm);
+ return CUBEB_ERROR;
+ }
+ }
}
}
@@ -904,14 +917,13 @@ cbjack_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsInput,
0);
- }
- }
-
- if (!input_stream_params->prefs & CUBEB_STREAM_PREF_JACK_NO_AUTO_CONNECT) {
- if (cbjack_connect_ports(stm) != CUBEB_OK) {
- pthread_mutex_unlock(&stm->mutex);
- cbjack_stream_destroy(stm);
- return CUBEB_ERROR;
+ if (!(input_stream_params->prefs & CUBEB_STREAM_PREF_JACK_NO_AUTO_CONNECT)) {
+ if (cbjack_connect_ports(stm, CBJACK_CP_OPTIONS_SKIP_OUTPUT) != CUBEB_OK) {
+ pthread_mutex_unlock(&stm->mutex);
+ cbjack_stream_destroy(stm);
+ return CUBEB_ERROR;
+ }
+ }
}
}