mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 16:08:51 +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/2761>
This commit is contained in:
parent
e0014ef4fe
commit
41bf3f6c1b
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,
|
||||||
|
@ -167,7 +171,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,
|
||||||
|
@ -190,7 +194,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,
|
||||||
|
@ -213,7 +217,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,
|
||||||
|
@ -239,7 +243,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)) {
|
||||||
|
@ -291,7 +295,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 */
|
||||||
|
@ -323,7 +327,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,
|
||||||
|
@ -354,7 +358,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 */
|
||||||
|
@ -416,7 +420,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,
|
||||||
|
@ -453,7 +457,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,
|
||||||
|
@ -476,7 +480,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,
|
||||||
|
@ -499,7 +503,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,
|
||||||
|
@ -522,7 +526,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,
|
||||||
|
@ -609,7 +613,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,
|
||||||
|
@ -715,7 +719,7 @@ _monitorize_spdif (GstCoreAudio * core_audio)
|
||||||
AudioObjectPropertyAddress propAddress = {
|
AudioObjectPropertyAddress propAddress = {
|
||||||
kAudioDevicePropertyDeviceHasChanged,
|
kAudioDevicePropertyDeviceHasChanged,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyElementMaster
|
kAudioObjectPropertyElementMain
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Install the property listener */
|
/* Install the property listener */
|
||||||
|
@ -740,7 +744,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