mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
osxaudio: support hidden devices
macOS features hidden devices. These are devices that will not be shown in the macOS UIs and that cannot be retrieved without having the specific UID of the hidden device. There are cases when you might want to have a hidden device, for example when having a virtual speaker that forwards the data to a virtual hidden input device from which you can then grab the audio. The blackhole project supports these hidden devices and this patch provides a way that if the device id is a hidden device it will use it instead of check the hardware list of devices to understand if the device is valid. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2251>
This commit is contained in:
parent
243f8e8882
commit
caa5972abd
1 changed files with 26 additions and 0 deletions
|
@ -138,6 +138,25 @@ _audio_device_is_alive (AudioDeviceID device_id, gboolean output)
|
|||
return alive;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
_audio_device_is_hidden (AudioDeviceID device_id)
|
||||
{
|
||||
OSStatus status = noErr;
|
||||
UInt32 hidden = FALSE;
|
||||
UInt32 property_size = sizeof (hidden);
|
||||
AudioObjectPropertyAddress property_address;
|
||||
|
||||
property_address.mSelector = kAudioDevicePropertyIsHidden;
|
||||
|
||||
status = AudioObjectGetPropertyData (device_id,
|
||||
&property_address, 0, NULL, &property_size, &hidden);
|
||||
if (status != noErr) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return hidden;
|
||||
}
|
||||
|
||||
static inline guint
|
||||
_audio_device_get_latency (AudioDeviceID device_id)
|
||||
{
|
||||
|
@ -1202,6 +1221,13 @@ gst_core_audio_select_device_impl (GstCoreAudio * core_audio)
|
|||
GST_ERROR ("No device of required type available");
|
||||
res = FALSE;
|
||||
}
|
||||
} else if (_audio_device_is_hidden (device_id)) {
|
||||
if (_audio_device_is_alive (device_id, output)) {
|
||||
res = TRUE;
|
||||
} else {
|
||||
GST_ERROR ("Requested hidden device not usable");
|
||||
res = FALSE;
|
||||
}
|
||||
} else {
|
||||
AudioDeviceID *devices = NULL;
|
||||
gint i, ndevices = 0;
|
||||
|
|
Loading…
Reference in a new issue