[FR] FlacWriter - use a stream offset

Is it possible for you to change FlacWriter::writeMetaData() not to expect that the header is always 4 bytes inside the stream?

If you add a private member variable:

int64 streamStartPos;

and in the FlacWriter constructor add:

FlacWriter (OutputStream* const out, double rate, uint32 numChans, uint32 bits, int qualityOptionIndex)
    : AudioFormatWriter (out, flacFormatName, rate, numChans, bits)
    using namespace FlacNamespace;
    encoder = FLAC__stream_encoder_new();

    streamStartPos = out->getPosition();

then in FlacWriter::writeMetaData()


const bool seekOk = output->setPosition (4);


const bool seekOk = output->setPosition (streamStartPos + 4);

EDIT: I notice you do, do this in WavAudioFormatWriter

headerPosition = out->getPosition();



Thanks. It’s on develop.