[Flac-dev] Legal sample rates

Erik de Castro Lopo erikd-flac at mega-nerd.com
Wed Nov 10 12:20:10 PST 2004


Hi all,

I'm trying to use the FLAC C libraries to encode audio.

I'm doing something like:

  FLAC__seekable_stream_encoder_set_channels(pflac->fse, 1);
  FLAC__seekable_stream_encoder_set_sample_rate(pflac->fse, 11025);
  FLAC__seekable_stream_encoder_set_bits_per_sample(pflac->fse, 8);

  if ((bps = FLAC__seekable_stream_encoder_init(pflac->fse)) != FLAC__SEEKABLE_STREAM_DECODER_OK)
  {	printf ("Error : FLAC encoder init returned error : %s\n",
                FLAC__SeekableStreamEncoderStateString [bps]);
        exit (1);
	}

and I'm triggering the error message, but the most information I
can get from the FLAC__SeekableStreamEncoderStateString method is
FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR.

SOmeone else has dug through the FLAC libraries and came to the 
conclusion that FLAC doesn't accept the given sample rate (11025).
I therefore tried to test the error return value of the set_sample_rate()
method, but found that it always returns TRUE (ie no error).

Is there someway of figuring out if a sample rate is valid?

Cheers,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam at mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"Linux everywhere pretty much eliminates the need for Java everywhere"
  -- Bruce Ide in letter to LWN editors


More information about the Flac-dev mailing list