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

Justin Ruggles justin.ruggles
Sun Dec 7 20:45:34 CET 2008


Justin Ruggles wrote:
> 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.

Hmm... I think I just argued in favor of your way without realizing it.
We currently do not support starting decoding mid-stream, and if we
wanted to, your way would be better.  We would also need to set channels
and sample rate...or make a real FLAC parser. :)

-Justin




More information about the ffmpeg-devel mailing list