[Flac] Encoding questions...

Josh Coalson xflac at yahoo.com
Fri Oct 8 16:18:50 PDT 2004


--- Mike Pilat <mpilat at gmail.com> wrote:
> Since the sample rate and bit depth of each frame can be encoded in
> the frame header, does this imply that the sample rate and bit depth
> can vary from frame-to-frame, or this information purely for
> stream-decoding purposes?

it can vary from frame to frame in a stream, but the native FLAC
or Ogg FLAC file transports does not allow them to vary.

> If the former, the reference encoder does not support this
> functionality, correct? (Since you have to specify these values
> before
> initializing the encoder).

yes, if you wanted to stream with varying parameters you
would have to use the stream encoder layer and tear it down
and re-init at each change.  you probably would also separate
out the metadata each time before stuffing it into whatever
streaming transport you were using.

> Also, can I call *_encoder_process() repeatedly with buffers of data,
> or is assumed that all my data to be encoded is contained in one
> giant
> buffer? This isn't entirely clear from the documentation.

you can call it multiple times.  that's the normal usage.

> If I can call _encoder_process() multiple times, and the size of the
> buffer modulo the blocksize is not zero, will the last block be
> encoded in a frame that is smaller than blocksize, or will the
> encoder
> wait until more data is sent in or _encoder_finish() is called?

the latter. you will get as many write callbacks during the
*_encoder_process() call as there are complete blocks buffered.
any incomplete block will stay buffered until more data is added
or *_encoder_finish().

Josh



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com


More information about the Flac mailing list