+ CAStreamBasicDescription client_asbd;
+
+ try {
+ client_asbd = af.GetClientDataFormat ();
+ } catch (CAXException& cax) {
+ error << string_compose("CoreAudioSource: %1 (%2)", cax.mOperation, _name);
+ return 0.0;
+ }
+
+ return client_asbd.mSampleRate;
+}
+
+int
+CoreAudioSource::update_header (framepos_t, struct tm&, time_t)
+{
+ return 0;
+}
+
+int
+CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string&)
+{
+#ifdef COREAUDIO105
+ FSRef ref;
+#endif
+ ExtAudioFileRef af = 0;
+ UInt32 size;
+ CFStringRef name;
+ int ret = -1;
+
+#ifdef COREAUDIO105
+ if (FSPathMakeRef ((UInt8*)path.c_str(), &ref, 0) != noErr) {
+ goto out;
+ }
+
+ if (ExtAudioFileOpen(&ref, &af) != noErr) {
+ goto out;
+ }
+#else
+ CFURLRef url = CFURLCreateFromFileSystemRepresentation (kCFAllocatorDefault, (const UInt8*)path.c_str (), strlen (path.c_str ()), false);
+ OSStatus res = ExtAudioFileOpenURL(url, &af);
+ if (url) CFRelease (url);
+
+ if (res != noErr) {
+ goto out;
+ }
+#endif
+
+ AudioStreamBasicDescription absd;
+ memset(&absd, 0, sizeof(absd));
+ size = sizeof(AudioStreamBasicDescription);
+ if (ExtAudioFileGetProperty (af, kExtAudioFileProperty_FileDataFormat, &size, &absd) != noErr) {
+ goto out;
+ }
+
+ _info.samplerate = absd.mSampleRate;
+ _info.channels = absd.mChannelsPerFrame;
+
+ size = sizeof(_info.length);
+ if (ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileLengthFrames, &size, &_info.length) != noErr) {
+ goto out;
+ }
+
+ size = sizeof(CFStringRef);
+ if (AudioFormatGetProperty(kAudioFormatProperty_FormatName, sizeof(absd), &absd, &size, &name) != noErr) {
+ goto out;
+ }
+
+ _info.format_name = "";
+
+ if (absd.mFormatID == kAudioFormatLinearPCM) {
+ if (absd.mFormatFlags & kAudioFormatFlagIsBigEndian) {
+ _info.format_name += "big-endian";
+ } else {
+ _info.format_name += "little-endian";
+ }
+
+ char buf[32];
+ snprintf (buf, sizeof (buf), " %" PRIu32 " bit", absd.mBitsPerChannel);
+ _info.format_name += buf;
+ _info.format_name += '\n';
+
+ if (absd.mFormatFlags & kAudioFormatFlagIsFloat) {
+ _info.format_name += "float";
+ } else {
+ if (absd.mFormatFlags & kAudioFormatFlagIsSignedInteger) {
+ _info.format_name += "signed";
+ } else {
+ _info.format_name += "unsigned";
+ }
+ /* integer is typical, do not show it */
+ }