[Flac-dev] Using libFLAC++

David Bishop tech at bishop.dhs.org
Sat Feb 15 17:21:10 PST 2003

Hash: SHA1

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.  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;

    fstate = FLAC__file_decoder_init(decoder_);
    cout << fstate << endl;

    return true;

Now, I thought the main difference between libFLAC and libFLAC++ was that in 
c++ you didn't have to manually set the callbacks, just inherit and they 
would be set for you.  Am I miss reading the docs there?  Of course, probably 
the #1 problem here is that I'm pretty lost in C-land, and am almost 
undoubtably doing something stupid.  But hey! Helping newbies gives good 
karma ;-)

Thanks for any advice/pointers you can give.  Full source-code (not that much 
more than this) available upon request.

Version: GnuPG v1.2.1 (GNU/Linux)


More information about the Flac-dev mailing list