[FFmpeg-devel] [PATCH] add 32bits output format to the flac decoder

Justin Ruggles justin.ruggles
Sun Dec 7 20:33:07 CET 2008

Mathieu Velten wrote:
> 2008/12/7 Justin Ruggles <justin.ruggles at gmail.com>:
>> If you move shift and offset_per_sample to the FLACContext you can just
>> set them once at the start of encoding instead of for every frame, along
>> with avctx->bits_per_raw_sample.  It would also make ffmpeg report s32
>> as the sample type instead of s16 when appropriate.  A good place to do
>> this would be in ff_flac_parse_streaminfo().
> I am not sure that is a good idea, the specs specifies that the bps
> can change every frame.

I cannot find any place in the specification which specifically allows
or disallows changing bps mid-stream.  The closest thing I could find
seems to suggest that it should not do so.

"Again, since a decoder may start decoding at an arbitrary frame in the
stream, each frame header must contain some basic information about the
stream because the decoder may not have access to the STREAMINFO
metadata block at the start of the stream."

This suggests that the only reason the bps is in every frame is so
decoding can start at arbitrary points without access to STREAMINFO.
Nothing in the spec states that the value can change.  The same could be
said for sample rate.

If the libFLAC decoder doesn't support it, I'd say we keep to fixed bps.
 If you have a sample which actually changes bps mid-stream and libFLAC
supports it, then maybe we should consider it.  Or we could ask Josh
Coalson what his intentions are, and he may clarify the spec.


More information about the ffmpeg-devel mailing list