mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
osxaudio: Fix deprecation in macOS 12.0
kAudioObjectPropertyElementMaster has been renamed to kAudioObjectPropertyElementMain Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2764>
This commit is contained in:
parent
87a4391698
commit
d0ed9fdab5
2 changed files with 31 additions and 23 deletions
|
@ -29,6 +29,10 @@
|
||||||
#include "gstosxaudiosink.h"
|
#include "gstosxaudiosink.h"
|
||||||
#include "gstosxaudiodeviceprovider.h"
|
#include "gstosxaudiodeviceprovider.h"
|
||||||
|
|
||||||
|
#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED < 120000
|
||||||
|
#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
|
||||||
|
#endif
|
||||||
|
|
||||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
|
@ -108,7 +112,7 @@ _audio_device_get_name (AudioDeviceID device_id, gboolean output)
|
||||||
AudioObjectPropertyAddress deviceNameAddress = {
|
AudioObjectPropertyAddress deviceNameAddress = {
|
||||||
kAudioDevicePropertyDeviceName,
|
kAudioDevicePropertyDeviceName,
|
||||||
kAudioDevicePropertyScopeOutput,
|
kAudioDevicePropertyScopeOutput,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
prop_scope = output ? kAudioDevicePropertyScopeOutput :
|
prop_scope = output ? kAudioDevicePropertyScopeOutput :
|
||||||
|
@ -145,7 +149,7 @@ _audio_device_has_output (AudioDeviceID device_id)
|
||||||
AudioObjectPropertyAddress streamsAddress = {
|
AudioObjectPropertyAddress streamsAddress = {
|
||||||
kAudioDevicePropertyStreams,
|
kAudioDevicePropertyStreams,
|
||||||
kAudioDevicePropertyScopeOutput,
|
kAudioDevicePropertyScopeOutput,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyDataSize (device_id,
|
status = AudioObjectGetPropertyDataSize (device_id,
|
||||||
|
@ -172,7 +176,7 @@ _audio_device_has_input (AudioDeviceID device_id)
|
||||||
AudioObjectPropertyAddress streamsAddress = {
|
AudioObjectPropertyAddress streamsAddress = {
|
||||||
kAudioDevicePropertyStreams,
|
kAudioDevicePropertyStreams,
|
||||||
kAudioDevicePropertyScopeInput,
|
kAudioDevicePropertyScopeInput,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyDataSize (device_id,
|
status = AudioObjectGetPropertyDataSize (device_id,
|
||||||
|
@ -200,7 +204,7 @@ _audio_system_get_devices (gint * ndevices)
|
||||||
AudioObjectPropertyAddress audioDevicesAddress = {
|
AudioObjectPropertyAddress audioDevicesAddress = {
|
||||||
kAudioHardwarePropertyDevices,
|
kAudioHardwarePropertyDevices,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyDataSize (kAudioObjectSystemObject,
|
status = AudioObjectGetPropertyDataSize (kAudioObjectSystemObject,
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
#include <unistd.h> /* for getpid */
|
#include <unistd.h> /* for getpid */
|
||||||
#include "gstosxaudiosink.h"
|
#include "gstosxaudiosink.h"
|
||||||
|
|
||||||
|
#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED < 120000
|
||||||
|
#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
_audio_system_set_runloop (CFRunLoopRef runLoop)
|
_audio_system_set_runloop (CFRunLoopRef runLoop)
|
||||||
{
|
{
|
||||||
|
@ -34,7 +38,7 @@ _audio_system_set_runloop (CFRunLoopRef runLoop)
|
||||||
AudioObjectPropertyAddress runloopAddress = {
|
AudioObjectPropertyAddress runloopAddress = {
|
||||||
kAudioHardwarePropertyRunLoop,
|
kAudioHardwarePropertyRunLoop,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectSetPropertyData (kAudioObjectSystemObject,
|
status = AudioObjectSetPropertyData (kAudioObjectSystemObject,
|
||||||
|
@ -62,7 +66,7 @@ _audio_system_get_default_device (gboolean output)
|
||||||
AudioObjectPropertyAddress defaultDeviceAddress = {
|
AudioObjectPropertyAddress defaultDeviceAddress = {
|
||||||
prop_selector,
|
prop_selector,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyData (kAudioObjectSystemObject,
|
status = AudioObjectGetPropertyData (kAudioObjectSystemObject,
|
||||||
|
@ -86,7 +90,7 @@ _audio_system_get_devices (gint * ndevices)
|
||||||
AudioObjectPropertyAddress audioDevicesAddress = {
|
AudioObjectPropertyAddress audioDevicesAddress = {
|
||||||
kAudioHardwarePropertyDevices,
|
kAudioHardwarePropertyDevices,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyDataSize (kAudioObjectSystemObject,
|
status = AudioObjectGetPropertyDataSize (kAudioObjectSystemObject,
|
||||||
|
@ -126,7 +130,7 @@ _audio_device_is_alive (AudioDeviceID device_id, gboolean output)
|
||||||
AudioObjectPropertyAddress audioDeviceAliveAddress = {
|
AudioObjectPropertyAddress audioDeviceAliveAddress = {
|
||||||
kAudioDevicePropertyDeviceIsAlive,
|
kAudioDevicePropertyDeviceIsAlive,
|
||||||
prop_scope,
|
prop_scope,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyData (device_id,
|
status = AudioObjectGetPropertyData (device_id,
|
||||||
|
@ -148,7 +152,7 @@ _audio_device_get_latency (AudioDeviceID device_id)
|
||||||
AudioObjectPropertyAddress audioDeviceLatencyAddress = {
|
AudioObjectPropertyAddress audioDeviceLatencyAddress = {
|
||||||
kAudioDevicePropertyLatency,
|
kAudioDevicePropertyLatency,
|
||||||
kAudioDevicePropertyScopeOutput,
|
kAudioDevicePropertyScopeOutput,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyData (device_id,
|
status = AudioObjectGetPropertyData (device_id,
|
||||||
|
@ -171,7 +175,7 @@ _audio_device_get_hog (AudioDeviceID device_id)
|
||||||
AudioObjectPropertyAddress audioDeviceHogModeAddress = {
|
AudioObjectPropertyAddress audioDeviceHogModeAddress = {
|
||||||
kAudioDevicePropertyHogMode,
|
kAudioDevicePropertyHogMode,
|
||||||
kAudioDevicePropertyScopeOutput,
|
kAudioDevicePropertyScopeOutput,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyData (device_id,
|
status = AudioObjectGetPropertyData (device_id,
|
||||||
|
@ -194,7 +198,7 @@ _audio_device_set_hog (AudioDeviceID device_id, pid_t hog_pid)
|
||||||
AudioObjectPropertyAddress audioDeviceHogModeAddress = {
|
AudioObjectPropertyAddress audioDeviceHogModeAddress = {
|
||||||
kAudioDevicePropertyHogMode,
|
kAudioDevicePropertyHogMode,
|
||||||
kAudioDevicePropertyScopeOutput,
|
kAudioDevicePropertyScopeOutput,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectSetPropertyData (device_id,
|
status = AudioObjectSetPropertyData (device_id,
|
||||||
|
@ -220,7 +224,7 @@ _audio_device_set_mixing (AudioDeviceID device_id, gboolean enable_mix)
|
||||||
AudioObjectPropertyAddress audioDeviceSupportsMixingAddress = {
|
AudioObjectPropertyAddress audioDeviceSupportsMixingAddress = {
|
||||||
kAudioDevicePropertySupportsMixing,
|
kAudioDevicePropertySupportsMixing,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
if (AudioObjectHasProperty (device_id, &audioDeviceSupportsMixingAddress)) {
|
if (AudioObjectHasProperty (device_id, &audioDeviceSupportsMixingAddress)) {
|
||||||
|
@ -272,7 +276,7 @@ _audio_device_get_name (AudioDeviceID device_id, gboolean output)
|
||||||
AudioObjectPropertyAddress deviceNameAddress = {
|
AudioObjectPropertyAddress deviceNameAddress = {
|
||||||
kAudioDevicePropertyDeviceName,
|
kAudioDevicePropertyDeviceName,
|
||||||
prop_scope,
|
prop_scope,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Get the length of the device name */
|
/* Get the length of the device name */
|
||||||
|
@ -304,7 +308,7 @@ _audio_device_has_output (AudioDeviceID device_id)
|
||||||
AudioObjectPropertyAddress streamsAddress = {
|
AudioObjectPropertyAddress streamsAddress = {
|
||||||
kAudioDevicePropertyStreams,
|
kAudioDevicePropertyStreams,
|
||||||
kAudioDevicePropertyScopeOutput,
|
kAudioDevicePropertyScopeOutput,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyDataSize (device_id,
|
status = AudioObjectGetPropertyDataSize (device_id,
|
||||||
|
@ -335,7 +339,7 @@ gst_core_audio_audio_device_get_channel_layout (AudioDeviceID device_id,
|
||||||
AudioObjectPropertyAddress channelLayoutAddress = {
|
AudioObjectPropertyAddress channelLayoutAddress = {
|
||||||
kAudioDevicePropertyPreferredChannelLayout,
|
kAudioDevicePropertyPreferredChannelLayout,
|
||||||
prop_scope,
|
prop_scope,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Get the length of the default channel layout structure */
|
/* Get the length of the default channel layout structure */
|
||||||
|
@ -397,7 +401,7 @@ _audio_device_get_streams (AudioDeviceID device_id, gint * nstreams)
|
||||||
AudioObjectPropertyAddress streamsAddress = {
|
AudioObjectPropertyAddress streamsAddress = {
|
||||||
kAudioDevicePropertyStreams,
|
kAudioDevicePropertyStreams,
|
||||||
kAudioDevicePropertyScopeOutput,
|
kAudioDevicePropertyScopeOutput,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyDataSize (device_id,
|
status = AudioObjectGetPropertyDataSize (device_id,
|
||||||
|
@ -434,7 +438,7 @@ _audio_stream_get_latency (AudioStreamID stream_id)
|
||||||
AudioObjectPropertyAddress latencyAddress = {
|
AudioObjectPropertyAddress latencyAddress = {
|
||||||
kAudioStreamPropertyLatency,
|
kAudioStreamPropertyLatency,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyData (stream_id,
|
status = AudioObjectGetPropertyData (stream_id,
|
||||||
|
@ -457,7 +461,7 @@ _audio_stream_get_current_format (AudioStreamID stream_id,
|
||||||
AudioObjectPropertyAddress formatAddress = {
|
AudioObjectPropertyAddress formatAddress = {
|
||||||
kAudioStreamPropertyPhysicalFormat,
|
kAudioStreamPropertyPhysicalFormat,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyData (stream_id,
|
status = AudioObjectGetPropertyData (stream_id,
|
||||||
|
@ -480,7 +484,7 @@ _audio_stream_set_current_format (AudioStreamID stream_id,
|
||||||
AudioObjectPropertyAddress formatAddress = {
|
AudioObjectPropertyAddress formatAddress = {
|
||||||
kAudioStreamPropertyPhysicalFormat,
|
kAudioStreamPropertyPhysicalFormat,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectSetPropertyData (stream_id,
|
status = AudioObjectSetPropertyData (stream_id,
|
||||||
|
@ -503,7 +507,7 @@ _audio_stream_get_formats (AudioStreamID stream_id, gint * nformats)
|
||||||
AudioObjectPropertyAddress formatsAddress = {
|
AudioObjectPropertyAddress formatsAddress = {
|
||||||
kAudioStreamPropertyAvailablePhysicalFormats,
|
kAudioStreamPropertyAvailablePhysicalFormats,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
status = AudioObjectGetPropertyDataSize (stream_id,
|
status = AudioObjectGetPropertyDataSize (stream_id,
|
||||||
|
@ -590,7 +594,7 @@ _audio_stream_change_format (AudioStreamID stream_id,
|
||||||
AudioObjectPropertyAddress formatAddress = {
|
AudioObjectPropertyAddress formatAddress = {
|
||||||
kAudioStreamPropertyPhysicalFormat,
|
kAudioStreamPropertyPhysicalFormat,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
GST_DEBUG ("setting stream format: " CORE_AUDIO_FORMAT,
|
GST_DEBUG ("setting stream format: " CORE_AUDIO_FORMAT,
|
||||||
|
@ -696,7 +700,7 @@ _monitorize_spdif (GstCoreAudio * core_audio)
|
||||||
AudioObjectPropertyAddress propAddress = {
|
AudioObjectPropertyAddress propAddress = {
|
||||||
kAudioDevicePropertyDeviceHasChanged,
|
kAudioDevicePropertyDeviceHasChanged,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Install the property listener */
|
/* Install the property listener */
|
||||||
|
@ -721,7 +725,7 @@ _unmonitorize_spdif (GstCoreAudio * core_audio)
|
||||||
AudioObjectPropertyAddress propAddress = {
|
AudioObjectPropertyAddress propAddress = {
|
||||||
kAudioDevicePropertyDeviceHasChanged,
|
kAudioDevicePropertyDeviceHasChanged,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Remove the property listener */
|
/* Remove the property listener */
|
||||||
|
|
Loading…
Reference in a new issue