Created
November 21, 2013 06:18
-
-
Save danoli3/7576852 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AudioChannelLayout channelLayout; | |
bzero(&channelLayout, sizeof(channelLayout)); | |
channelLayout.mChannelLayoutTag = kAudioChannelLayoutTag_Mono; | |
int numOfChannels = 1; | |
if(channelLayout.mChannelLayoutTag == kAudioChannelLayoutTag_Stereo) { | |
numOfChannels = 2; | |
} | |
NSDictionary * audioOutputSettings = nil; | |
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_5_1) { | |
audioOutputSettings = [NSDictionary dictionaryWithObjectsAndKeys: | |
[NSNumber numberWithInt:kAudioFormatLinearPCM], AVFormatIDKey, | |
[NSNumber numberWithFloat:preferredHardwareSampleRate], AVSampleRateKey, | |
[NSNumber numberWithInt:16], AVLinearPCMBitDepthKey, | |
[NSNumber numberWithBool:NO], AVLinearPCMIsNonInterleaved, | |
[NSNumber numberWithBool:NO], AVLinearPCMIsFloatKey, | |
[NSNumber numberWithBool:NO], AVLinearPCMIsBigEndianKey, | |
nil]; | |
} else { | |
audioOutputSettings = [NSDictionary dictionaryWithObjectsAndKeys: | |
[NSNumber numberWithInt:kAudioFormatLinearPCM], AVFormatIDKey, | |
[NSNumber numberWithFloat:preferredHardwareSampleRate], AVSampleRateKey, | |
[NSNumber numberWithInt:numOfChannels], AVNumberOfChannelsKey, | |
[NSData dataWithBytes:&channelLayout length:sizeof(AudioChannelLayout)], AVChannelLayoutKey, | |
[NSNumber numberWithInt:16], AVLinearPCMBitDepthKey, | |
[NSNumber numberWithBool:NO], AVLinearPCMIsNonInterleaved, | |
[NSNumber numberWithBool:NO], AVLinearPCMIsFloatKey, | |
[NSNumber numberWithBool:NO], AVLinearPCMIsBigEndianKey, | |
nil]; | |
} |
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[AVAssetReaderTrackOutput initWithTrack:outputSettings:] AVAssetReaderTrackOutput does not currently support AVNumberOfChannelsKey or AVChannelLayoutKey'
*** First throw call stack:
(0x3411b8bf 0x3213d1e5 0x37a71789 0x37a71005 0x41366d 0x412e6d 0x3698cd55 0x36997e8d 0x340ee2dd 0x340714dd 0x340713a5 0x324c6fcd 0x372c7743 0x406507 0xac45 0x8fd8)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
AVFoundationVideoPlayer.m: