Hi,

I'm sorry to say that I've found the libFLAC++ interface and documentation pretty slim and baffling.

What I need to do is add some application-specific metadata to a FLAC file (i'm using the FLAC++ fileencoder). It is currently just a string of characters, which doesn't need to be null-terminated.

I've looked through the docs, i've looked through the tests, and sorry to say, but I just Don't Get It.

Based on some of the test code, I had assumed I would do something like:

FLAC::Metadata::Application header_flac;
FLAC__byte header_flac_id[4] = { 1, 2, 3, 4 };
header_flac.set_id(header_flac_id);
header_flac.set_data((FLAC__byte*)(header_str.begin()),header_str.size());

// set the metadata
FLAC::Metadata::Prototype *metadata_sequence[] = { &header_flac };
enc.set_metadata(metadata_sequence,sizeof(metadata_sequence)/sizeof(metadata_sequence[0]));
// and now i continue to init(), process_interleaved() and finish()



But that kept giving me segmentation faults. So I tried the following, and it still gave me segmentation faults.




FLAC__byte header_flac_id[4] = { 1, 2, 3, 4 };

FLAC__byte * header_byte = new FLAC__byte[header_str.size()];
copy(header_str.begin(),header_str.end(),header_byte);

// set the metadata
FLAC::Metadata::Application * header_flac = new FLAC::Metadata::Application;
header_flac->set_id(header_flac_id);
header_flac->set_data(header_byte,header_str.size());

FLAC::Metadata::Prototype **metadata_sequence = new (FLAC::Metadata::Prototype*)[1];
metadata_sequence[0] = header_flac;

cnc.set_metadata(metadata_sequence,1);

// and now i continue to init(), process_interleaved() and finish()



Sorry, I'm truely lost.  Can someone please give me a pointer?

Thanks
Paul
_______________________________________________
Flac mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/flac

Reply via email to