I am taking my first crack at the new extraction API. The call to
MovieAudioExtractionFillBuffer is returning a -50 paramError. I
tweaking the numbers and different approaches at allocation the
call to MovieAudioExtractionGetProperty appears to return the expected
result. The movie passed in is playable and has a sound track.
what I am missing?
OSStatus status = MovieAudioExtractionBegin( myMovie, 0, &session);
Your bufferlist has a problem:
1) You don't know what audio will be coming out of the movie. You're
assuming it's going to be 2 interleaved channels of audio, when in
fact, by default, you' get non-interleaved audio (movies.h says so).
If you specifically want to coerce the pcm data you'll get from the
movie to a specific format, you'll need to set two properties on the
ExtractionSession - the audiostreambasicdescription, and the channel
layout. But to fix your code above, first get the stream description
from the movie, like this:
// first get the asbd from the extraction session, so you know the
proper sample rate.
status = MovieAudioExtractionGetProperty(session,
sizeof(asbd), &asbd, NULL);
// now you know how many buffers you need and how big to size them:
for (i = 0; i < abl->mNumberBuffers; i++)
abl->mBuffers[i].mNumberChannels = 1;
abl->mDataByteSize = desiredNumFrames * asbd.mBytesPerFrame;
abl->mData = malloc(abl->mDataByteSize);
// when you're done extracting, remember to free each mData in the
bufferlist, then free the abl itself!
You can of course get interleaved PCM data from audio extraction
API's, but this is not the default behavior, as most people will
probably be extracting audio from quicktime movies in order to source
audio into a CoreAudio audio unit chain or graph, and V2 audio units
require de-interleaved float32 audio.
Hope that helps.
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden