• 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
Re: iPhone - how to make sure AudioQueue will be able to decode a file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iPhone - how to make sure AudioQueue will be able to decode a file?


  • Subject: Re: iPhone - how to make sure AudioQueue will be able to decode a file?
  • From: Doug Wyatt <email@hidden>
  • Date: Thu, 15 Oct 2009 10:52:24 -0700

Yes, this is one (maybe the only) unfortunate consequence of the way our APIs make such a strong distinction between container formats (files) and audio data formats. Files don't know if their data is actually decodable.

For PCM, the best way to determine whether the format you have is usable by AudioQueue without creating a queue is to create an AudioConverter. That's pretty lightweight.

For other formats, AudioFormat can tell you whether a codec exists for the format. This isn't a guarantee of being able to play the file, however, since it's theoretically possible that the format is an unsupported variant. Here too you could try creating an AudioConverter, but this is slippery territory because AudioConverter will fail on version 2.x where it will succeed on 3.x due to the advent of software decoders.

Also be careful with ulaw and alaw, in some older versions, AudioFormat doesn't correctly include them in lists of supported codecs.

Doug

On Oct 15, 2009, at 8:44 , tahome izwah wrote:

I just ran into the same problem. The iPhone doesn't support the
floating point data type for audio. I'm not sure how to obtain a list
of allowed formats but I'd be interested to know, too.

--th

2009/10/15 Roni Music <email@hidden>:


My iPhone audio player uses the AudioQueue to decode files for later
playback with kAudioUnitSubType_RemoteIO.

I check if a file is playable by checking if AudioFileOpenURL() succeeds.

This assumptions seems wrong since even if that succeeds,
AudioQueueNewOutput() fails with a 'fmt?' error for the following file
format:


AudioStreamBasicDescription: 2 ch, 44100 Hz, 'lpcm' (0x0000000B) 32-bit
big-endian float


It seems that I also need to check that file is not a 32-bit float file?
What more do I need to check to be sure it's OK?


I know the following
- iPhone OS input and output: Linear PCM with 16-bit integer samples
- iPhone OS audio units and other audio processing: Noninterleaved linear
PCM with 8.24-bit fixed-point samples
but that does not seem to answer my question.


I can of course check if AudioQueueNewOutput() succeeds but that seems
unnecessary "expensive" at a point when the app is not about to play the
file.


Rolf

_______________________________________________ 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
References: 
 >iPhone - how to make sure AudioQueue will be able to decode a file? (From: Roni Music <email@hidden>)
 >Re: iPhone - how to make sure AudioQueue will be able to decode a file? (From: tahome izwah <email@hidden>)

  • Prev by Date: Re: AudioUnitRender returning -10863 if no input device is present
  • Next by Date: Re: AudioDeviceStart Error Codes
  • Previous by thread: Re: iPhone - how to make sure AudioQueue will be able to decode a file?
  • Next by thread: Use of RegisterComponent
  • Index(es):
    • Date
    • Thread