diff options
author | Matthew Gregan <[email protected]> | 2019-10-16 16:18:57 +1300 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2019-10-22 09:18:25 +1300 |
commit | c9b13d6a2bebba98b51bdf434fdb5e2221a08760 (patch) | |
tree | 3794a1be5196d19850d66dd029143fc5a8b5c228 /src/cubeb_jack.cpp | |
parent | 0596d90b3c296b44ab4b4c227bc23e68595e7cad (diff) | |
download | cubeb-c9b13d6a2bebba98b51bdf434fdb5e2221a08760.tar.gz cubeb-c9b13d6a2bebba98b51bdf434fdb5e2221a08760.zip |
jack: Don't reject default {input,output}_device in cbjack_stream_init.
Since the JACK backend fakes the enumerate_devices API by returning two
"default" devices, we should also accept those "default" devices in
cbjack_stream_init if they're passed in via {input,output}_device.
Diffstat (limited to 'src/cubeb_jack.cpp')
-rw-r--r-- | src/cubeb_jack.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cubeb_jack.cpp b/src/cubeb_jack.cpp index 1ab876c..9fc97a4 100644 --- a/src/cubeb_jack.cpp +++ b/src/cubeb_jack.cpp @@ -50,6 +50,9 @@ #define IMPORT_FUNC(x) static decltype(x) * api_##x; JACK_API_VISIT(IMPORT_FUNC); +#define JACK_DEFAULT_IN "JACK capture" +#define JACK_DEFAULT_OUT "JACK playback" + static const int MAX_STREAMS = 16; static const int MAX_CHANNELS = 8; static const int FIFO_SIZE = 4096 * sizeof(float); @@ -743,8 +746,10 @@ cbjack_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_ return CUBEB_ERROR_INVALID_FORMAT; } - if (input_device || output_device) + if ((input_device && input_device != JACK_DEFAULT_IN) || + (output_device && output_device != JACK_DEFAULT_OUT)) { return CUBEB_ERROR_NOT_SUPPORTED; + } // Loopback is unsupported if ((input_stream_params && (input_stream_params->prefs & CUBEB_STREAM_PREF_LOOPBACK)) || @@ -967,8 +972,8 @@ cbjack_stream_get_current_device(cubeb_stream * stm, cubeb_device ** const devic if (*device == NULL) return CUBEB_ERROR; - const char * j_in = "JACK capture"; - const char * j_out = "JACK playback"; + const char * j_in = JACK_DEFAULT_IN; + const char * j_out = JACK_DEFAULT_OUT; const char * empty = ""; if (stm->devs == DUPLEX) { @@ -997,9 +1002,6 @@ cbjack_stream_device_destroy(cubeb_stream * /*stream*/, return CUBEB_OK; } -#define JACK_DEFAULT_IN "JACK capture" -#define JACK_DEFAULT_OUT "JACK playback" - static int cbjack_enumerate_devices(cubeb * context, cubeb_device_type type, cubeb_device_collection * collection) |