[FFmpeg-devel] flac decoding

Justin Ruggles justin.ruggles
Fri Jan 23 05:13:28 CET 2009


I want to dedicate some time to finally getting some of the stuff done
with FLAC decoding that I've been saving up and tinkering with for too
long.  I wanted to list out some of my ideas here so I can get
suggestions ahead of time and maybe cut down on wasted time.

1. rename flac.c to flacdec.c

2. ask for a review of Mathieu Velten's 32-bit output patch
07 Dec 2008 [PATCH] add 32bits output format to the flac decoder

3. clean up debugging statements
flac.c is littered with debugging code. Some of it is commented-out,
some of it is not. Some of it is outdated. Should the debugging
printouts be left in there and the commented ones enabled? comment-out
the enabled ones? or take them out altogether. I have not found them
useful, but then again they sort of do the same as "flac -a" and it
might be useful at some point to compare the values in the two outputs.

4. remove unused code
There are some chunks of code which are disabled with ifdefs or
commented out. They seem to mostly be alternative implementations...
What is being used seems to work ok. I see no need to keep this old code
around in HEAD.

5. coding style clean up & some indentation cosmetics
The coding style in flac.c is very inconsistent.

6. extend the raw FLAC demuxer to process the header
This was proposed recently by someone in order to read the metadata in
the demuxer. I made some suggestions, but did not get any response to
the most recent ones. I have an alternate patch ready-to-go based on the
one submitted.

7. add a FLAC parser
This one has been a bit difficult, but I'm still working on it. I have
almost given up on a traditional use of ff_combine_frame() due to the
design of the FLAC format. The first issue is that frame sizes are not
stored in the stream at all. Also, the frame start code and header CRC
cannot be relied upon for accurate frame boundary detection, so the
whole frame CRC has to be used in conjunction with those 2 methods.
Another way to go about it might be to do something similar to the
buffering done in the decoder currently. That is, buffer way more than
is needed so we know we'll have a full frame somewhere in there...all we
have to do is find it. I also have some other ideas I haven't fully
tried out.

8. start decoding mid-stream
I started working on this patch and I need to finish it.

Suggestions welcome!


More information about the ffmpeg-devel mailing list