2006-05-07 13:19:23 +00:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Stephen F. Booth <me@sbooth.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2006-05-29 22:02:59 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
|
2007-02-24 20:36:27 +00:00
|
|
|
#import "CoreAudioDecoder.h"
|
2006-05-07 13:19:23 +00:00
|
|
|
|
2013-10-11 12:03:55 +00:00
|
|
|
#import "Logging.h"
|
|
|
|
|
2007-02-24 20:36:27 +00:00
|
|
|
@interface CoreAudioDecoder (Private)
|
2022-02-07 05:49:27 +00:00
|
|
|
- (BOOL)readInfoFromExtAudioFileRef;
|
2006-05-07 13:19:23 +00:00
|
|
|
@end
|
|
|
|
|
2022-02-07 10:06:51 +00:00
|
|
|
static int ffat_get_channel_id(AudioChannelLabel label) {
|
|
|
|
if(label == 0)
|
|
|
|
return -1;
|
|
|
|
else if(label <= kAudioChannelLabel_LFEScreen)
|
|
|
|
return label - 1;
|
|
|
|
else if(label <= kAudioChannelLabel_RightSurround)
|
|
|
|
return label + 4;
|
|
|
|
else if(label <= kAudioChannelLabel_CenterSurround)
|
|
|
|
return label + 1;
|
|
|
|
else if(label <= kAudioChannelLabel_RightSurroundDirect)
|
|
|
|
return label + 23;
|
|
|
|
else if(label <= kAudioChannelLabel_TopBackRight)
|
|
|
|
return label - 1;
|
|
|
|
else if(label < kAudioChannelLabel_RearSurroundLeft)
|
|
|
|
return -1;
|
|
|
|
else if(label <= kAudioChannelLabel_RearSurroundRight)
|
|
|
|
return label - 29;
|
|
|
|
else if(label <= kAudioChannelLabel_RightWide)
|
|
|
|
return label - 4;
|
|
|
|
else if(label == kAudioChannelLabel_LFE2)
|
|
|
|
return -1;
|
|
|
|
else if(label == kAudioChannelLabel_Mono)
|
|
|
|
return 2; // Front center
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
static OSStatus readProc(void *clientData,
|
2020-03-09 03:05:03 +00:00
|
|
|
SInt64 position,
|
|
|
|
UInt32 requestCount,
|
2022-02-07 05:49:27 +00:00
|
|
|
void *buffer,
|
|
|
|
UInt32 *actualCount) {
|
|
|
|
NSObject *_handle = (__bridge NSObject *)(clientData);
|
|
|
|
CoreAudioDecoder *__unsafe_unretained pSelf = (id)_handle;
|
|
|
|
|
|
|
|
id<CogSource> source = pSelf->_audioSource;
|
|
|
|
|
|
|
|
if(position != pSelf->_lastPosition) {
|
|
|
|
[source seek:position whence:SEEK_SET];
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t copyMax = 0;
|
|
|
|
size_t bytesRead = 0;
|
|
|
|
|
|
|
|
if(requestCount)
|
|
|
|
bytesRead = [source read:(((uint8_t *)buffer) + copyMax) amount:requestCount];
|
|
|
|
|
|
|
|
pSelf->_lastPosition = position + bytesRead;
|
|
|
|
|
|
|
|
if(actualCount)
|
|
|
|
*actualCount = (UInt32)(copyMax + bytesRead);
|
|
|
|
|
|
|
|
return noErr;
|
2020-03-09 03:05:03 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
static SInt64 getSizeProc(void *clientData) {
|
|
|
|
NSObject *_handle = (__bridge NSObject *)(clientData);
|
|
|
|
CoreAudioDecoder *__unsafe_unretained pSelf = (id)_handle;
|
2020-03-09 03:05:03 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
return pSelf->_fileSize;
|
2020-03-09 03:05:03 +00:00
|
|
|
}
|
|
|
|
|
2007-02-24 20:36:27 +00:00
|
|
|
@implementation CoreAudioDecoder
|
2006-05-07 13:19:23 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)close {
|
|
|
|
OSStatus err;
|
|
|
|
|
|
|
|
if(_in_opened) {
|
|
|
|
err = ExtAudioFileDispose(_in);
|
|
|
|
if(noErr != err) {
|
|
|
|
DLog(@"Error closing ExtAudioFile");
|
|
|
|
}
|
|
|
|
_in_opened = NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(_audioFile_opened) {
|
|
|
|
err = AudioFileClose(_audioFile);
|
|
|
|
if(noErr != err) {
|
|
|
|
DLog(@"Error closing AudioFile");
|
|
|
|
}
|
|
|
|
_audioFile_opened = NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
_audioSource = nil;
|
2006-05-07 13:19:23 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)dealloc {
|
|
|
|
[self close];
|
2016-06-19 19:57:18 +00:00
|
|
|
}
|
|
|
|
|
2007-03-04 04:36:10 +00:00
|
|
|
- (BOOL)open:(id<CogSource>)source;
|
2006-05-07 13:19:23 +00:00
|
|
|
{
|
2022-02-07 05:49:27 +00:00
|
|
|
OSStatus err;
|
|
|
|
|
|
|
|
_audioFile_opened = NO;
|
|
|
|
_in_opened = NO;
|
|
|
|
|
|
|
|
if(![source seekable])
|
|
|
|
return NO;
|
|
|
|
|
|
|
|
_audioSource = source;
|
|
|
|
_lastPosition = [source tell];
|
|
|
|
[source seek:0 whence:SEEK_END];
|
|
|
|
_fileSize = [source tell];
|
|
|
|
[source seek:_lastPosition whence:SEEK_SET];
|
|
|
|
|
|
|
|
err = AudioFileOpenWithCallbacks((__bridge void *)self, readProc, 0, getSizeProc, 0, 0, &_audioFile);
|
|
|
|
if(noErr != err) {
|
|
|
|
ALog(@"Error opening callback interface to file: %d", err);
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
_audioFile_opened = YES;
|
|
|
|
|
|
|
|
err = ExtAudioFileWrapAudioFileID(_audioFile, false, &_in);
|
2006-05-12 01:13:00 +00:00
|
|
|
if(noErr != err) {
|
2013-10-11 12:03:55 +00:00
|
|
|
ALog(@"Error opening file: %d", err);
|
2006-05-12 01:13:00 +00:00
|
|
|
return NO;
|
|
|
|
}
|
2022-02-07 05:49:27 +00:00
|
|
|
|
|
|
|
_in_opened = YES;
|
|
|
|
|
2006-05-13 04:50:06 +00:00
|
|
|
return [self readInfoFromExtAudioFileRef];
|
2006-05-07 13:19:23 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (BOOL)readInfoFromExtAudioFileRef {
|
|
|
|
OSStatus err;
|
|
|
|
UInt32 size;
|
|
|
|
UInt32 asbdSize;
|
|
|
|
AudioStreamBasicDescription asbd;
|
|
|
|
AudioFileID afi;
|
|
|
|
|
2006-05-07 13:19:23 +00:00
|
|
|
// Get input file information
|
2021-10-02 03:22:26 +00:00
|
|
|
asbdSize = sizeof(asbd);
|
2022-02-07 05:49:27 +00:00
|
|
|
err = ExtAudioFileGetProperty(_in, kExtAudioFileProperty_FileDataFormat, &asbdSize, &asbd);
|
2006-05-07 13:19:23 +00:00
|
|
|
if(err != noErr) {
|
2006-05-13 04:50:06 +00:00
|
|
|
err = ExtAudioFileDispose(_in);
|
2006-05-07 13:19:23 +00:00
|
|
|
return NO;
|
|
|
|
}
|
2022-02-07 05:49:27 +00:00
|
|
|
|
2007-11-24 20:16:27 +00:00
|
|
|
SInt64 total;
|
2022-02-07 05:49:27 +00:00
|
|
|
size = sizeof(total);
|
|
|
|
err = ExtAudioFileGetProperty(_in, kExtAudioFileProperty_FileLengthFrames, &size, &total);
|
2006-05-12 00:06:50 +00:00
|
|
|
if(err != noErr) {
|
2006-05-13 04:50:06 +00:00
|
|
|
err = ExtAudioFileDispose(_in);
|
2006-05-12 00:06:50 +00:00
|
|
|
return NO;
|
|
|
|
}
|
2007-11-24 20:16:27 +00:00
|
|
|
totalFrames = total;
|
2022-02-07 05:49:27 +00:00
|
|
|
|
|
|
|
size = sizeof(afi);
|
|
|
|
err = ExtAudioFileGetProperty(_in, kExtAudioFileProperty_AudioFile, &size, &afi);
|
|
|
|
if(err != noErr) {
|
|
|
|
err = ExtAudioFileDispose(_in);
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
SInt32 formatBitsPerSample;
|
|
|
|
size = sizeof(formatBitsPerSample);
|
|
|
|
err = AudioFileGetProperty(afi, kAudioFilePropertySourceBitDepth, &size, &formatBitsPerSample);
|
|
|
|
if(err != noErr) {
|
|
|
|
if(err == kAudioFileUnsupportedPropertyError) {
|
|
|
|
formatBitsPerSample = 0; // floating point formats apparently don't return this any more
|
|
|
|
} else {
|
|
|
|
err = ExtAudioFileDispose(_in);
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UInt32 _bitrate;
|
|
|
|
size = sizeof(_bitrate);
|
|
|
|
err = AudioFileGetProperty(afi, kAudioFilePropertyBitRate, &size, &_bitrate);
|
|
|
|
if(err != noErr) {
|
|
|
|
err = ExtAudioFileDispose(_in);
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
2022-02-07 10:06:51 +00:00
|
|
|
err = AudioFileGetPropertyInfo(afi, kAudioFilePropertyChannelLayout, &size, NULL);
|
|
|
|
if(err != noErr || size == 0) {
|
|
|
|
err = ExtAudioFileDispose(_in);
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
AudioChannelLayout *acl = malloc(size);
|
|
|
|
err = AudioFileGetProperty(afi, kAudioFilePropertyChannelLayout, &size, acl);
|
|
|
|
if(err != noErr) {
|
|
|
|
free(acl);
|
|
|
|
err = ExtAudioFileDispose(_in);
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t config = 0;
|
|
|
|
for(uint32_t i = 0; i < acl->mNumberChannelDescriptions; ++i) {
|
|
|
|
int channelNumber = ffat_get_channel_id(acl->mChannelDescriptions[i].mChannelLabel);
|
2022-02-07 10:47:32 +00:00
|
|
|
if(channelNumber >= 0) {
|
|
|
|
if(config & (1 << channelNumber)) {
|
|
|
|
free(acl);
|
|
|
|
err = ExtAudioFileDispose(_in);
|
|
|
|
return NO;
|
|
|
|
}
|
2022-02-07 10:06:51 +00:00
|
|
|
config |= 1 << channelNumber;
|
2022-02-07 10:47:32 +00:00
|
|
|
} else {
|
|
|
|
free(acl);
|
|
|
|
err = ExtAudioFileDispose(_in);
|
|
|
|
return NO;
|
|
|
|
}
|
2022-02-07 10:06:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
channelConfig = config;
|
|
|
|
|
2022-02-07 10:47:32 +00:00
|
|
|
free(acl);
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
bitrate = (_bitrate + 500) / 1000;
|
|
|
|
|
|
|
|
CFStringRef formatName;
|
|
|
|
size = sizeof(formatName);
|
|
|
|
err = AudioFormatGetProperty(kAudioFormatProperty_FormatName, asbdSize, &asbd, &size, &formatName);
|
|
|
|
if(err != noErr) {
|
|
|
|
err = ExtAudioFileDispose(_in);
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
codec = (__bridge NSString *)formatName;
|
|
|
|
|
|
|
|
CFRelease(formatName);
|
|
|
|
|
|
|
|
NSRange range = [codec rangeOfString:@","];
|
|
|
|
if(range.location != NSNotFound) {
|
|
|
|
codec = [codec substringToIndex:range.location];
|
|
|
|
}
|
|
|
|
|
2006-05-07 13:19:23 +00:00
|
|
|
// Set our properties
|
2022-02-07 05:49:27 +00:00
|
|
|
bitsPerSample = formatBitsPerSample;
|
|
|
|
channels = asbd.mChannelsPerFrame;
|
|
|
|
frequency = asbd.mSampleRate;
|
|
|
|
floatingPoint = NO;
|
|
|
|
|
2006-05-07 13:19:23 +00:00
|
|
|
// mBitsPerChannel will only be set for lpcm formats
|
2021-02-23 04:48:23 +00:00
|
|
|
if(bitsPerSample <= 0) {
|
2013-10-05 21:15:09 +00:00
|
|
|
bitsPerSample = 32;
|
2022-02-07 05:49:27 +00:00
|
|
|
floatingPoint = YES;
|
2006-05-07 13:19:23 +00:00
|
|
|
}
|
2022-02-07 05:49:27 +00:00
|
|
|
|
|
|
|
_audioFile_is_lossy = NO;
|
|
|
|
|
|
|
|
if(floatingPoint || [[codec lowercaseString] containsString:@"adpcm"] || [[codec lowercaseString] containsString:@"gsm"])
|
|
|
|
_audioFile_is_lossy = YES;
|
|
|
|
|
2006-05-12 00:06:50 +00:00
|
|
|
// Set output format
|
2022-02-07 05:49:27 +00:00
|
|
|
AudioStreamBasicDescription result;
|
|
|
|
|
2006-05-07 13:19:23 +00:00
|
|
|
bzero(&result, sizeof(AudioStreamBasicDescription));
|
2022-02-07 05:49:27 +00:00
|
|
|
|
|
|
|
result.mFormatID = kAudioFormatLinearPCM;
|
|
|
|
if(floatingPoint) {
|
|
|
|
result.mFormatFlags = kAudioFormatFlagIsFloat | kAudioFormatFlagIsPacked;
|
|
|
|
} else {
|
|
|
|
result.mFormatFlags = kAudioFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsBigEndian;
|
|
|
|
}
|
|
|
|
|
|
|
|
result.mSampleRate = frequency;
|
|
|
|
result.mChannelsPerFrame = channels;
|
|
|
|
result.mBitsPerChannel = bitsPerSample;
|
|
|
|
|
|
|
|
result.mBytesPerPacket = channels * (bitsPerSample / 8);
|
|
|
|
result.mFramesPerPacket = 1;
|
|
|
|
result.mBytesPerFrame = channels * (bitsPerSample / 8);
|
|
|
|
|
2006-05-13 04:50:06 +00:00
|
|
|
err = ExtAudioFileSetProperty(_in, kExtAudioFileProperty_ClientDataFormat, sizeof(result), &result);
|
|
|
|
if(noErr != err) {
|
|
|
|
err = ExtAudioFileDispose(_in);
|
2006-05-12 00:06:50 +00:00
|
|
|
return NO;
|
|
|
|
}
|
2022-02-07 05:49:27 +00:00
|
|
|
|
2007-03-04 04:36:10 +00:00
|
|
|
[self willChangeValueForKey:@"properties"];
|
|
|
|
[self didChangeValueForKey:@"properties"];
|
2022-02-07 05:49:27 +00:00
|
|
|
|
2006-05-07 13:19:23 +00:00
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2022-07-10 22:14:47 +00:00
|
|
|
- (AudioChunk *)readAudio {
|
2022-02-07 05:49:27 +00:00
|
|
|
OSStatus err;
|
|
|
|
AudioBufferList bufferList;
|
|
|
|
UInt32 frameCount;
|
|
|
|
|
2022-07-10 22:14:47 +00:00
|
|
|
int frames = 1024;
|
|
|
|
size_t bytesPerFrame = channels * (bitsPerSample / 8);
|
|
|
|
uint8_t buffer[frames * bytesPerFrame];
|
|
|
|
|
2006-05-13 04:50:06 +00:00
|
|
|
// Set up the AudioBufferList
|
2022-02-07 05:49:27 +00:00
|
|
|
bufferList.mNumberBuffers = 1;
|
|
|
|
bufferList.mBuffers[0].mNumberChannels = channels;
|
2022-07-10 22:14:47 +00:00
|
|
|
bufferList.mBuffers[0].mData = buffer;
|
2022-02-07 05:49:27 +00:00
|
|
|
bufferList.mBuffers[0].mDataByteSize = frames * channels * (bitsPerSample / 8);
|
|
|
|
|
2006-05-07 13:19:23 +00:00
|
|
|
// Read a chunk of PCM input (converted from whatever format)
|
2022-02-07 05:49:27 +00:00
|
|
|
frameCount = frames;
|
|
|
|
err = ExtAudioFileRead(_in, &frameCount, &bufferList);
|
2006-05-07 13:19:23 +00:00
|
|
|
if(err != noErr) {
|
2022-07-10 22:14:47 +00:00
|
|
|
return nil;
|
2022-02-07 05:49:27 +00:00
|
|
|
}
|
|
|
|
|
2022-07-10 22:14:47 +00:00
|
|
|
id audioChunkClass = NSClassFromString(@"AudioChunk");
|
|
|
|
AudioChunk *chunk = [[audioChunkClass alloc] initWithProperties:[self properties]];
|
|
|
|
[chunk assignSamples:buffer frameCount:frameCount];
|
|
|
|
|
|
|
|
return chunk;
|
2006-05-07 13:19:23 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (long)seek:(long)frame {
|
|
|
|
OSStatus err;
|
|
|
|
|
2007-11-24 20:16:27 +00:00
|
|
|
err = ExtAudioFileSeek(_in, frame);
|
2006-05-13 04:50:06 +00:00
|
|
|
if(noErr != err) {
|
2007-11-24 20:16:27 +00:00
|
|
|
return -1;
|
2006-05-13 04:50:06 +00:00
|
|
|
}
|
2022-02-07 05:49:27 +00:00
|
|
|
|
2007-11-24 20:16:27 +00:00
|
|
|
return frame;
|
2006-05-07 13:19:23 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
+ (NSArray *)fileTypes {
|
|
|
|
OSStatus err;
|
|
|
|
UInt32 size;
|
2007-02-24 20:36:27 +00:00
|
|
|
NSArray *sAudioExtensions;
|
2022-02-07 05:49:27 +00:00
|
|
|
|
|
|
|
size = sizeof(sAudioExtensions);
|
|
|
|
err = AudioFileGetGlobalInfo(kAudioFileGlobalInfo_AllExtensions, 0, NULL, &size, &sAudioExtensions);
|
2007-02-24 20:36:27 +00:00
|
|
|
if(noErr != err) {
|
|
|
|
return nil;
|
|
|
|
}
|
2022-02-07 05:49:27 +00:00
|
|
|
|
2016-05-05 20:05:39 +00:00
|
|
|
return sAudioExtensions;
|
2007-02-24 20:36:27 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
+ (NSArray *)mimeTypes {
|
|
|
|
OSStatus err;
|
|
|
|
UInt32 size;
|
|
|
|
NSArray *sAudioMIMETypes;
|
|
|
|
|
|
|
|
size = sizeof(sAudioMIMETypes);
|
|
|
|
err = AudioFileGetGlobalInfo(kAudioFileGlobalInfo_AllMIMETypes, 0, NULL, &size, &sAudioMIMETypes);
|
|
|
|
if(noErr != err) {
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2020-03-09 07:23:58 +00:00
|
|
|
return sAudioMIMETypes;
|
2007-10-14 19:18:20 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
+ (float)priority {
|
|
|
|
return 1.0;
|
Implemented support for multiple decoders per file name extension, with a floating point priority control per interface. In the event that more than one input is registered to a given extension, and we match that extension, it will be passed off to an instance of the multi-decoder wrapper, which will try opening the file with all of the decoders in order of priority, until either one of them accepts it, or all of them have failed. This paves the way for adding a VGMSTREAM input, so I can give it a very low priority, since it has several formats that are verified by file name extension only. All current inputs have been given a priority of 1.0, except for CoreAudio, which was given a priority of 0.5, because it contains an MP3 and AC3 decoders that I'd rather not use if I don't have to.
2013-10-21 17:54:11 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
+ (NSArray *)fileTypeAssociations {
|
|
|
|
return @[
|
|
|
|
@[@"WAVE File", @"wav.icns", @"wav", @"w64"],
|
|
|
|
@[@"AIFF File", @"aiff.icns", @"aif", @"aiff", @"aifc"],
|
|
|
|
@[@"CAF File", @"song.icns", @"caf"],
|
|
|
|
@[@"AU File", @"song.icns", @"au"],
|
|
|
|
@[@"MPEG Audio File", @"mp3.icns", @"mp3", @"mp2", @"mp1", @"m2a", @"mpa"],
|
|
|
|
@[@"MPEG Stream File", @"song.icns", @"mpeg"],
|
|
|
|
@[@"MPEG-4 Audio File", @"m4a.icns", @"m4a", @"mp4", @"m4b", @"m4r"],
|
|
|
|
@[@"MPEG-4 AAC Audio File", @"song.icns", @"aac", @"adts"],
|
|
|
|
@[@"AMR Audio File", @"song.icns", @"amr"],
|
|
|
|
@[@"USAC Audio File", @"song.icns", @"xhe"],
|
|
|
|
@[@"AC-3 Audio File", @"song.icns", @"ac3"],
|
|
|
|
@[@"FLAC Audio File", @"flac.icns", @"flac"],
|
|
|
|
@[@"SND Audio File", @"song.icns", @"snd"]
|
|
|
|
];
|
2022-01-18 11:06:03 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (NSDictionary *)properties {
|
2022-06-17 13:39:02 +00:00
|
|
|
return @{ @"channels": @(channels),
|
|
|
|
@"channelConfig": @(channelConfig),
|
|
|
|
@"bitsPerSample": @(bitsPerSample),
|
|
|
|
@"floatingPoint": @(floatingPoint),
|
|
|
|
@"bitrate": @(bitrate),
|
|
|
|
@"sampleRate": @(frequency),
|
|
|
|
@"totalFrames": @(totalFrames),
|
|
|
|
@"seekable": @(YES),
|
|
|
|
@"codec": codec,
|
|
|
|
@"endian": floatingPoint ? @"host" : @"big",
|
|
|
|
@"encoding": _audioFile_is_lossy ? @"lossy" : @"lossless" };
|
2007-02-24 20:36:27 +00:00
|
|
|
}
|
|
|
|
|
2022-02-09 03:56:39 +00:00
|
|
|
- (NSDictionary *)metadata {
|
|
|
|
return @{};
|
|
|
|
}
|
|
|
|
|
2006-05-07 13:19:23 +00:00
|
|
|
@end
|