• 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
AudioFile components, the DataSource utility class and non-seekable audio sources
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AudioFile components, the DataSource utility class and non-seekable audio sources


  • Subject: AudioFile components, the DataSource utility class and non-seekable audio sources
  • From: Jean-Francois Roy <email@hidden>
  • Date: Thu, 12 May 2005 13:32:43 -0400

Hello,

I am currently working on an AudioFile component for a format that can be used for streaming and file storage. I've glanced over the various bits of code related to AudioFile components, which leads me to my question. Because I am still in the early stages of coding, I haven't been able to test any of my assumptions yet, so bear with me =)

From the documentation and header files, an AudioFile component will export a subclass of AudioFileFormat, which is a factory class for AudioFileObject objects. The AudioFileFormat class has the following method:

DataSourceIsThisFormat(DataSource* inDataSource)

I assume this method is called by the AudioFile API when an audio file is opened on disk using AudioFileOpen, although I am not certain under which conditions exactly. My assumption is that if the specified file has an extension, the AudioFileFormat method ExtensionIsThisFormat(CFStringRef inExtension) will be called first, and if that method returns true, it will end there. If the audio file has an HFS type and the AudioFileFormat class implements GetHFSCodes (UInt32* ioDataSize, void* outPropertyData), then this will be used next to determine if the AudioFile component can handle that file. Finally, if that fails, then the DataSourceIsThisFormat(DataSource* inDataSource) method will be used. I am unsure how the inFileTypeHint parameter of AudioFileOpen will influence that process.

So far, no big problems since files on disk are seekable. So any kind of read operations you might do in DataSourceIsThisFormat will not cause you problems when the actual AudioFileObject object is initialized for the specified file.

The problems may arise for non-seekable sources, such as a network stream. One could open an AudioFile for a network stream by using AudioFileOpenWithCallbacks. Although it is not explicitly written in the documentation, comments in the header files indicate this will open a read-only, non seekable AudioFile. This makes sense for network or other kinds of streams.

My question pertains to the DataSourceIsThisFormat(DataSource* inDataSource) method for AudioFiles being opened using AudioFileOpenWithCallbacks. As far as I can see, there is no DataSource subclass for non-seekable sources, meaning the DataSource object you will presumably get will report that it is seekable. Should you perform any read operations to determine if your AudioFile component supports that file type, you will cripple your ability to later initialize the AudioFileObject using that data source.

Which makes me wonder when or why exactly will the DataSourceIsThisFormat method be called? It probably has to do with the inFileTypeHint parameter for AudioFileOpenWithCallbacks, but I do not know the relationship directly. Is that parameter required for AudioFileOpenWithCallbacks to succeed?

I'd appreciate any clarification on the matter. Thank you!

Jeff Roy

--
Co-Founder of MacStorm
Programmer at MacStorm

http://www.macstorm.org
email@hidden

http://www.macstorm.org/bahamut/Jean-Francois.gpgkey


Attachment: PGP.sig
Description: This is a digitally signed message part

 _______________________________________________
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

  • Follow-Ups:
    • Re: AudioFile components, the DataSource utility class and non-seekable audio sources
      • From: James McCartney <email@hidden>
  • Prev by Date: Re: Render callback disappearing (QT 7.0)
  • Next by Date: Re: AudioFile components, the DataSource utility class and non-seekable audio sources
  • Previous by thread: User space plugin problems on Tiger
  • Next by thread: Re: AudioFile components, the DataSource utility class and non-seekable audio sources
  • Index(es):
    • Date
    • Thread