I'm using interleaved packet for the input format. mixerInputFormat is defined elsewhere. A converter and other processing (not shown) converts between the mixerInput and the StreamFormat.
AudioStreamBasicDescription tempFormat;
int value;
OSStatus err;
parent->StreamFormat = mixerInputFormat;
parent->StreamFormat.mFormatFlags = parent->StreamFormat.mFormatFlags & ~kAudioFormatFlagIsNonInterleaved;
parent->StreamFormat.mSampleRate = atof(GetMetaData(parent->UID, "SampleRate").c_str());
if(atoi(GetMetaData(parent->UID, "Mode").c_str())){
parent->StreamFormat.mChannelsPerFrame = 2;
}else{
parent->StreamFormat.mChannelsPerFrame = 1;
}
parent->StreamFormat.mBytesPerFrame = (parent->StreamFormat.mBitsPerChannel * parent->StreamFormat.mChannelsPerFrame) / 8;
parent->StreamFormat.mBytesPerPacket = parent->StreamFormat.mBytesPerFrame;
parent->StreamFormat.mFramesPerPacket = 1;
tempFormat.mSampleRate = parent->StreamFormat.mSampleRate;
if(GetMetaData(parent->UID, "Codec") == "aacplus")
tempFormat.mFormatID = kAudioFormatMPEG4AAC_HE;
else
tempFormat.mFormatID = kAudioFormatMPEG4AAC;
tempFormat.mChannelsPerFrame = parent->fileStreamFormat.mChannelsPerFrame;
tempFormat.mFormatFlags = 0;
tempFormat.mBytesPerFrame = 0;
tempFormat.mBytesPerPacket = 0;
tempFormat.mBitsPerChannel = 0;
tempFormat.mFramesPerPacket = 1024;
err = AudioConverterNew(&parent->StreamFormat, &tempFormat, &aacEncoder);
On Mar 28, 2011, at 8:58 AM, Eric Allamanche wrote: