[Flac-dev] Setting compression level

Josh Coalson xflac at yahoo.com
Tue Dec 12 16:26:34 PST 2006


--- Petr <petrcbr at simracing.cz> wrote:
> 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 ?

that looks fine.  I don't think it's the compression level setting.
try without calling that function at all, the encoder will default
to compression level 0, which should still give some compression.

usually the problem is in the way the samples are formatted and
passed to FLAC__stream_encoder_process().  I'd have to see that
code to debug.  see also
http://flac.sourceforge.net/api/group__flac__stream__encoder.html#ga63

Josh



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com


More information about the Flac-dev mailing list