[Flac-dev] Using libFLAC++

Miroslav Lichvar lichvarm at phoenix.inf.upol.cz
Sun Feb 16 04:08:02 PST 2003

On Sat, Feb 15, 2003 at 06:18:12PM -0700, David Bishop wrote:
> I'm attempting to add flac playback to my app, and would like a couple of 
> pointers.  First of all, I'm very much a "learn by seeing other people doing" 
> sort of programmer, and would love a pointer to an open-source app that uses 
> libFLAC++, so I could see how they do it.

In flac sources there is an example: src/test_libFLAC++/decoders.cpp

> Second, I'm having problems with 
> my simple test app (i.e. this isn't how I will use it in my app, I just want 
> to get a feel for programming with the flac api).  I've inherited from 
> FLAC::Decoder:File, and am now implementing a "::Play" function, that will 
> eventually take a file name as a parameter and play it.  I've 
> stub-implemented all the required functions (meta,error, and write_callback).  
> However, when I do the following, it prints 7, which appears to be 
> FLAC__FILE_DECODER_INVALID_CALLBACK, meaning I haven't set up one of the 
> callbacks that I need to.  
> bool FlacDecoder::play(const char *filename)
> {
>     FLAC__FileDecoderState fstate;
>     set_filename(filename);
>     fstate = FLAC__file_decoder_init(decoder_);
This is wrong. It should be:
      fstate = init();

>     cout << fstate << endl;
>     return true;
> }


Miroslav Lichvar

More information about the Flac-dev mailing list