[Flac-dev] Setting compression level

Petr petrcbr at simracing.cz
Tue Dec 12 15:23:31 PST 2006


Hi.

I'm have a little problem with setting compression level since 1.1.3 
releases.

I'm using :

FE = FLAC__stream_encoder_new();
FLAC__stream_encoder_set_channels( FE, channels);
FLAC__stream_encoder_set_bits_per_sample( FE, bitsample);
FLAC__stream_encoder_set_sample_rate( FE, samplerate);
unsigned int level;
if (formatdatalen>0)
  level = *(char*)(formatdata);
else
  level = 7;
if (level>=0 && level<=8)
  if (!FLAC__stream_encoder_set_compression_level( FE, level))
  {
    return -1;
  }
if (FLAC__stream_encoder_init_stream( FE, WriteCallback, SeekCallback, 
TellCallback, NULL, destination) != FLAC__STREAM_ENCODER_OK)
{
  FLAC__stream_encoder_delete(FE);
  return -1;
}

and sending stream to encode ....


I can set any compression level (default i have 7), but final FLAC file 
always have same size as source WAV file. FLAC is playable, but not 
compressed. Is there must be any additional settings ?

Petr 



More information about the Flac-dev mailing list