[Flac] Assistance with an encoding plugin

yahoo2 yahoo2 at rcn.com
Mon Jun 19 11:16:44 PDT 2006


At 01:08 PM 6/17/2006, B. Ryan Newberry wrote:

>Hi,
>
>I'm working on writing a FLAC encoding plugin for a personal cd ripping
>project of mine which uses paranoia for the raw audio extraction. My
>basic setup which follows gets me oddly high pitched audio with lots of
>noise (although the music IS somewhat recognizable).
>
>#include <FLAC/stream_encoder.h>
>
>FLAC__StreamEncoder *encoder;
>FILE *output_file_descriptor;
>
>encoder = FLAC__stream_encoder_new();
>
>FLAC__stream_encoder_set_write_callback(plugin->encoder, write_callback);
>FLAC__stream_encoder_set_metadata_callback(plugin->encoder,
>metadata_callback);
>FLAC__stream_encoder_set_client_data(plugin->encoder,
>output_file_descriptor);
>FLAC__stream_encoder_init(plugin->encoder);
>
>while(/* audio data left to extract */)
>{
>   /* audio buffer is an int16_t buffer that paranoia dumps interleaved
>audio into */
>       FLAC__stream_encoder_process_interleaved(       encoder,
>                                                      audio_buffer,
>                                                       CD_FRAMESIZE_RAW /
>4);
>
>}
>
>       FLAC__stream_encoder_finish(encoder);
>       FLAC__stream_encoder_delete(encoder);
>
>write_callback simply writes the encoded data out to a file stream, and
>metadata_callback isn't doing anything at the moment (one thing at a
>time :-) ).
>
>Now one thing that I see which may be causing my issue is the fact that
>paranoia is extracting to an int16_t buffer whereas the FLAC functions
>are expecting an int32_t buffer. I've tried doing the following to convert
>
>int16_t *paranoia_buffer
>int32_t *flac_buffer
>
>for(j = 0; j < n; ++j)
>flac_buffer[j] = paranoia_buffer[j];
>
>and then using flac_buffer for the encoding, to no avail.  Other than
>that, I have no idea what I may be doing wrong.


Have you actually checked that the data from the CD (before 
compression) is actually correct? If that's off, then the FLAC 
compression won't matter. 


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.394 / Virus Database: 268.9.0/368 - Release Date: 6/16/2006



More information about the Flac mailing list