3 * Copyright (C) 2012 Fluendo S.A. <support@fluendo.com>
4 * Authors: Andoni Morales Alastruey <amorales@fluendo.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 #import <AudioUnit/AUComponent.h>
26 gst_core_audio_open_impl (GstCoreAudio * core_audio)
28 return gst_core_audio_open_device (core_audio, kAudioUnitSubType_RemoteIO,
33 gst_core_audio_start_processing_impl (GstCoreAudio * core_audio)
35 return gst_core_audio_io_proc_start (core_audio);
39 gst_core_audio_pause_processing_impl (GstCoreAudio * core_audio)
41 GST_DEBUG_OBJECT (core_audio,
42 "osx ring buffer pause ioproc: %p device_id %lu",
43 core_audio->element->io_proc, (gulong) core_audio->device_id);
45 if (core_audio->io_proc_active) {
46 /* CoreAudio isn't threadsafe enough to do this here;
47 * we must deactivate the render callback elsewhere. See:
48 * http://lists.apple.com/archives/Coreaudio-api/2006/Mar/msg00010.html
50 core_audio->io_proc_needs_deactivation = TRUE;
56 gst_core_audio_stop_processing_impl (GstCoreAudio * core_audio)
58 gst_core_audio_io_proc_stop (core_audio);
63 gst_core_audio_get_samples_and_latency_impl (GstCoreAudio * core_audio,
64 gdouble rate, guint * samples, gdouble * latency)
69 status = AudioUnitGetProperty (core_audio->audiounit, kAudioUnitProperty_Latency, kAudioUnitScope_Global, 0, /* N/A for global */
73 GST_WARNING_OBJECT (core_audio, "Failed to get latency: %d", (int) status);
78 *samples = *latency * rate;
83 gst_core_audio_initialize_impl (GstCoreAudio * core_audio,
84 AudioStreamBasicDescription format, GstCaps * caps,
85 gboolean is_passthrough, guint32 * frame_size)
87 core_audio->is_passthrough = is_passthrough;
88 core_audio->stream_idx = 0;
89 if (!gst_core_audio_set_format (core_audio, format))
92 /* FIXME: Use kAudioSessionProperty_CurrentHardwareSampleRate and
93 * kAudioSessionProperty_CurrentHardwareIOBufferDuration with property
94 * listeners to detect changes in screen locks.
95 * For now use the maximum value */
98 GST_DEBUG_OBJECT (core_audio, "osxbuf ring buffer acquired");
103 gst_core_audio_audio_device_get_channel_layout (AudioDeviceID device_id)
109 gst_core_audio_select_device_impl (AudioDeviceID * device_id, gboolean output)
111 /* No device selection in iOS */
116 gst_core_audio_audio_device_is_spdif_avail_impl (AudioDeviceID device_id)
118 /* No SPDIF in iOS */