简体   繁体   中英

Using AudioFileStreamParseBytes to parse bytes by reading from a file does not call kAudioFileStreamProperty_ReadyToProducePackets

I am trying to parse bytes by opening a audio file (M4A), reading 2048 bytes in a loop and passing it to AudioFileStreamParseBytes. This does not call the callback with the property kAudioFileStreamProperty_ReadyToProducePackets . But the property kAudioFileStreamProperty_FileFormat is being successfully called. (So I know the callback mechanism is working.)

Questions :

  1. Can I use AudioFileStreamParseBytes to parse audio data by reading from a local file ? Most examples show how to use AudioFileStreamParseBytes by parsing HTTP stream data, but not reading from a local file.
  2. Has anyone tried to do the above and has been successful processing audio files ?

NOTE : The reason I am not using AudioFileOpenWithCallbacks to open the m4a file is that the api call is failing to open the following file after downloading it locally ( http://www.arsenal-music.com/podcast/arsenal-podcast-05.m4a ). This m4a file has images embedded in it and AudioFileOpenWithCallbacks is not able to parse the file. At the same time I have used Matt Gallagher AudioStreamer code that opens this file, parses it and plays it fine. So I am leaning towards using AudioFileStreamerParseBytes by reading data from a local file. (As far as I understand there should be no difference whether the data is coming from HTTP stream or a local file. But I could be wrong.)

I do not see any errors in the any API calls (just in case someone asks me this question). I can paste the code if needed, but all I want to know is if the approach of reading from file and passing it to AudioFileStreamParseBytes will work or not ?

After some testing I found that one can use AudioFileStreamParseBytes to parse bytes that are read from a local file. Data need not come from a Http stream.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM