Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SCAudioFill buffer help




On Sep 1, 2006, at 7:40 AM, Siegfried Hand wrote:

Hi, i looked at the sample scaudiocompress, but a lot of things still confuse to me.

 

The fact is a can t do it work in my implementation, i have always kAudioConverterErr_InvalidInputSize except if the output format is uncompressed.

My app gives me 65536 samples (32bitfloat, 480000, stereo interleaved)repeatedly until the end of the stream, each time i’m called, i have to compress those samples and write it to the media

 

So i prepare the audio buffer list according to the output format, the probleme comes with the maxBytesPerPacket value, if i multiply this value with my number of sample , it’s too big to allocate buffer memory.

I saw the use of a variable named PullPackets, wich is not the sample count, but what is it ? why is it 5000 ?


5000 is an arbitrary number of packets I chose to pull for -- feel free to change that number to something larger or smaller (using the -pullpackets command switch).  The SCAudioCompression contract is the same as AudioConverter's.  It doesn't really matter how many packets you pull for on the output side, and on the input proc side you are allowed to pass exactly the number you're asked for, or fewer, or more, or none (if none, return an error if it's a temporary underrun, or pass noErr + buffer pointers set to NULL if it's end of data).  On the output of SCAudioFillBuffer, you may get back fewer packets than you requested, or exactly the number you requested, or none, but never _more_ than you requested, since that would overrun your provided buffer.

how according it with my samples ?


In CoreAudio speak, sample = frame.  A frame is an individually accessible uncompressed pcm sample of data.  When dealing with PCM, 1 packet = 1 frame.  But for compressed formats, 1 packet often equals a lot of frames.  For instance, 1 AAC packet = 1024 frames.

-Brad Ford
QuickTime Engineering

 

Hope you can help

 

Thanks.

 

 _______________________________________________
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

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden

This email sent to email@hidden

References: 
 >SCAudioFill buffer help (From: "Siegfried Hand" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.