CAAudioFileFormats::InferFileFormatFromDataFormat BUG? and more
CAAudioFileFormats::InferFileFormatFromDataFormat BUG? and more
- Subject: CAAudioFileFormats::InferFileFormatFromDataFormat BUG? and more
- From: Mark's Studio <email@hidden>
- Date: Sun, 5 Jul 2009 00:33:40 +0200
I am trying to get a filetype based on audio format, so i use
InferFileFormatFromDataFormat,
but i had to comment out the two lines for it to return anything ?
it might also be better if it returned an array since there must be
many filetypes supporting the same format.
Is there an overview somewhere of what formats the files supports ?
bool CAAudioFileFormats::InferFileFormatFromDataFormat(const
CAStreamBasicDescription &fmt,
OSType &filetype)
{
// if there's exactly one file format that supports this data format
FileFormatInfo *theFileFormat = NULL;
for (int i = 0; i < mNumFileFormats; ++i) {
FileFormatInfo *ffi = &mFileFormats[i];
DataFormatInfo *dfi = ffi->mDataFormats, *dfiend = dfi + ffi-
>mNumDataFormats;
for ( ; dfi < dfiend; ++dfi)
if (dfi->mFormatID == fmt.mFormatID) {
// if (theFileFormat != NULL)
// return false; // ambiguous
theFileFormat = ffi; // got a candidate
}
}
if (theFileFormat == NULL)
return false;
filetype = theFileFormat->mFileTypeID;
return true;
}
related to this, if format ='ilbc'
dstFormat.mFormatID = format;
dstFormat.mSampleRate = myInfo.mDataFormat.mSampleRate;
dstFormat.mChannelsPerFrame = myInfo.mDataFormat.mChannelsPerFrame;
// use AudioFormat API to fill out the rest.
size = sizeof(dstFormat);
err = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0,
NULL, &size, &dstFormat);
XThrowIfError (err, "AudioFormatGetProperty
kAudioFormatProperty_FormatInfo");
i get err code !dat
is that because it's 2 channels ?
My goal is to check available encoder formats,
let the user select the format,
and then determine the proper filetype and extension.
Peter Mark
Mark's Recording Studio A/S
Lundeskovsvej 3
2900 Hellerup
Denmark
Tel: +45 35366078
Fax: +45 35366038
Mobile: +45 20416018
www.marks-studio.dk
email@hidden
_______________________________________________
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