• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[CoreAudio] Updating ConvertFile for VBR input
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[CoreAudio] Updating ConvertFile for VBR input


  • Subject: [CoreAudio] Updating ConvertFile for VBR input
  • From: Alexander von Below <email@hidden>
  • Date: Wed, 4 Jan 2006 19:56:01 +0100

The CovertFile sample code will fail for input with variable bitrates (VBR), such as MP3 and AAC files. I have updated the sample file /Developer/Examples/CoreAudio/SimpleSDK/ConvertFile with the goal to handle such input.

In order to do this, I have replaced

UInt32 maxPackets = afio->srcBufferSize / afio->srcFormat.mBytesPerPacket;

in the EncoderDataProc (file UseAC-AF.c, line 81) with this:

---->
int sizePerPacket = afio->srcFormat.mBytesPerPacket; // this will be non-zero of the format is CBR

if (sizePerPacket == 0) { // we have a VBR format, what's the max packet size?
OSStatus err;
UInt32 size = sizeof(sizePerPacket);
err = AudioConverterGetProperty(inAudioConverter, kAudioConverterPropertyMaximumOutputPacketSize, &size, &sizePerPacket);


}


UInt32 maxPackets = afio->srcBufferSize / sizePerPacket;
<----

It is the same code that can be found a little further down in the same file, and with it the sample seems to convert mp3 files to linear PCM flawlessly. However, I am still chewing on AAC (.m4a) files, for which AudioConverterFillComplexBuffer fails with an kAudioFileInvalidPacketOffsetError (the EncoderDataProc is called once, with no apparent error)

If someone has a hint for me there, it would be greatly appreciated.

Thanks

Alex
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: FW: Trouble Using Stereo Mixer
  • Next by Date: Re: AudioUnits Metering
  • Previous by thread: Re: Trouble Using Stereo Mixer
  • Next by thread: Command line app / AUVal / authorization dialogs
  • Index(es):
    • Date
    • Thread