Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 206351 Details for
Bug 237575
libsndfile should be rebuilt with flac support
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch for flac.c of libsndfile-1.0.17 to update to FLAC 1.2.1
flac.c_flac-1.1.2_to_1.2.1.diff (text/plain), 22.66 KB, created by
stanl
on 2007-09-26 02:32:30 UTC
(
hide
)
Description:
Patch for flac.c of libsndfile-1.0.17 to update to FLAC 1.2.1
Filename:
MIME Type:
Creator:
stanl
Created:
2007-09-26 02:32:30 UTC
Size:
22.66 KB
patch
obsolete
>--- /home/b0o5teG/src/libsndfile_1.0.17/src/flac.c 2007-09-25 17:55:00.000000000 -0700 >+++ flac.c 2007-09-25 18:22:48.000000000 -0700 >@@ -29,11 +29,12 @@ > #include "common.h" > > >-#ifndef HAVE_FLAC_ALL_H >+#if (HAVE_FLAC_ALL_H != 1) > > int > flac_open (SF_PRIVATE *psf) >-{ if (psf) >+{ fprintf (stderr, "FLAC not compiled into this version of libsndfile.\n"); >+ if (psf) > return SFE_UNIMPLEMENTED ; > return (psf && 0) ; > } /* flac_open */ >@@ -60,8 +61,13 @@ typedef enum > } PFLAC_PCM ; > > typedef struct >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > { FLAC__SeekableStreamDecoder *fsd ; > FLAC__SeekableStreamEncoder *fse ; >+#else /* # if HAVE_FLAC_1_1_3 */ >+{ FLAC__StreamDecoder *fsd ; >+ FLAC__StreamEncoder *fse ; >+#endif > PFLAC_PCM pcmtype ; > void* ptr ; > unsigned pos, len, remain ; >@@ -108,6 +114,7 @@ static void d2flac24_clip_array (const > static int flac_command (SF_PRIVATE *psf, int command, void *data, int datasize) ; > > /* Decoder Callbacks */ >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > static FLAC__SeekableStreamDecoderReadStatus sf_flac_read_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer [], unsigned *bytes, void *client_data) ; > static FLAC__SeekableStreamDecoderSeekStatus sf_flac_seek_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) ; > static FLAC__SeekableStreamDecoderTellStatus sf_flac_tell_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) ; >@@ -116,13 +123,29 @@ static FLAC__bool sf_flac_eof_callback ( > static FLAC__StreamDecoderWriteStatus sf_flac_write_callback (const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data) ; > static void sf_flac_meta_callback (const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) ; > static void sf_flac_error_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) ; >+#else /* # if HAVE_FLAC_1_1_3 */ >+static FLAC__StreamDecoderReadStatus sf_flac_read_callback (const FLAC__StreamDecoder *decoder, FLAC__byte buffer [], unsigned *bytes, void *client_data) ; >+static FLAC__StreamDecoderSeekStatus sf_flac_seek_callback (const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) ; >+static FLAC__StreamDecoderTellStatus sf_flac_tell_callback (const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) ; >+static FLAC__StreamDecoderLengthStatus sf_flac_length_callback (const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) ; >+static FLAC__bool sf_flac_eof_callback (const FLAC__StreamDecoder *decoder, void *client_data) ; >+static FLAC__StreamDecoderWriteStatus sf_flac_write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data) ; >+static void sf_flac_meta_callback (const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) ; >+static void sf_flac_error_callback (const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) ; >+#endif > > /* Encoder Callbacks */ >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > static FLAC__SeekableStreamEncoderSeekStatus sf_flac_enc_seek_callback (const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) ; >-#ifdef HAVE_FLAC_1_1_1 >+#if HAVE_FLAC_1_1_1 > static FLAC__SeekableStreamEncoderTellStatus sf_flac_enc_tell_callback (const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) ; > #endif > static FLAC__StreamEncoderWriteStatus sf_flac_enc_write_callback (const FLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer [], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) ; >+#else /* # if HAVE_FLAC_1_1_3 */ >+static FLAC__StreamEncoderSeekStatus sf_flac_enc_seek_callback (const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) ; >+static FLAC__StreamEncoderTellStatus sf_flac_enc_tell_callback (const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) ; >+static FLAC__StreamEncoderWriteStatus sf_flac_enc_write_callback (const FLAC__StreamEncoder *encoder, const FLAC__byte buffer [], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) ; >+#endif /* Check FLAC version */ > > static const int legal_sample_rates [] = > { 8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000 >@@ -283,6 +306,7 @@ flac_buffer_copy (SF_PRIVATE *psf) > } /* flac_buffer_copy */ > > >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > static FLAC__SeekableStreamDecoderReadStatus > sf_flac_read_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__byte buffer [], unsigned *bytes, void *client_data) > { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >@@ -291,9 +315,24 @@ sf_flac_read_callback (const FLAC__Seeka > if (*bytes > 0 && psf->error == 0) > return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK ; > >- return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR ; >+ return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR ; > } /* sf_flac_read_callback */ >+#else /* # if HAVE_FLAC_1_1_3 */ >+static FLAC__StreamDecoderReadStatus >+sf_flac_read_callback (const FLAC__StreamDecoder * UNUSED (decoder), FLAC__byte buffer [], unsigned *bytes, void *client_data) >+{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >+ >+ *bytes = psf_fread (buffer, 1, *bytes, psf) ; >+ if (*bytes > 0 && psf->error == 0) >+ return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE ; >+ else if (*bytes == 0 && psf->error == 0) >+ return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM ; >+ else >+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT ; >+} /* sf_flac_read_callback */ >+#endif /* Check FLAC version */ > >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > static FLAC__SeekableStreamDecoderSeekStatus > sf_flac_seek_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__uint64 absolute_byte_offset, void *client_data) > { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >@@ -304,7 +343,20 @@ sf_flac_seek_callback (const FLAC__Seeka > > return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK ; > } /* sf_flac_seek_callback */ >+#else /* # if HAVE_FLAC_1_1_3 */ >+static FLAC__StreamDecoderSeekStatus >+sf_flac_seek_callback (const FLAC__StreamDecoder * UNUSED (decoder), FLAC__uint64 absolute_byte_offset, void *client_data) >+{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >+ >+ psf_fseek (psf, absolute_byte_offset, SEEK_SET) ; >+ if (psf->error) >+ return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR ; >+ >+ return FLAC__STREAM_DECODER_SEEK_STATUS_OK ; >+} /* sf_flac_seek_callback */ >+#endif /* Check FLAC version */ > >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > static FLAC__SeekableStreamDecoderTellStatus > sf_flac_tell_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__uint64 *absolute_byte_offset, void *client_data) > { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >@@ -315,7 +367,20 @@ sf_flac_tell_callback (const FLAC__Seeka > > return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK ; > } /* sf_flac_tell_callback */ >+#else /* # if HAVE_FLAC_1_1_3 */ >+static FLAC__StreamDecoderTellStatus >+sf_flac_tell_callback (const FLAC__StreamDecoder * UNUSED (decoder), FLAC__uint64 *absolute_byte_offset, void *client_data) >+{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >+ >+ *absolute_byte_offset = psf_ftell (psf) ; >+ if (psf->error) >+ return FLAC__STREAM_DECODER_TELL_STATUS_ERROR ; >+ >+ return FLAC__STREAM_DECODER_TELL_STATUS_OK ; >+} /* sf_flac_tell_callback */ >+#endif /* Check FLAC version */ > >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > static FLAC__SeekableStreamDecoderLengthStatus > sf_flac_length_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__uint64 *stream_length, void *client_data) > { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >@@ -325,9 +390,24 @@ sf_flac_length_callback (const FLAC__See > > return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK ; > } /* sf_flac_length_callback */ >+#else /* # if HAVE_FLAC_1_1_3 */ >+static FLAC__StreamDecoderLengthStatus >+sf_flac_length_callback (const FLAC__StreamDecoder * UNUSED (decoder), FLAC__uint64 *stream_length, void *client_data) >+{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >+ >+ if ((*stream_length = psf->filelength) == 0) >+ return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR ; >+ >+ return FLAC__STREAM_DECODER_LENGTH_STATUS_OK ; >+} /* sf_flac_length_callback */ >+#endif /* Check FLAC version */ > > static FLAC__bool >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > sf_flac_eof_callback (const FLAC__SeekableStreamDecoder *UNUSED (decoder), void *client_data) >+#else /* # if HAVE_FLAC_1_1_3 */ >+sf_flac_eof_callback (const FLAC__StreamDecoder *UNUSED (decoder), void *client_data) >+#endif /* Check FLAC version */ > { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; > > if (psf_ftell (psf) == psf->filelength) >@@ -337,7 +417,11 @@ sf_flac_eof_callback (const FLAC__Seekab > } /* sf_flac_eof_callback */ > > static FLAC__StreamDecoderWriteStatus >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > sf_flac_write_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data) >+#else /* # if HAVE_FLAC_1_1_3 */ >+sf_flac_write_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data) >+#endif /* Check FLAC version */ > { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; > FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ; > >@@ -353,7 +437,11 @@ sf_flac_write_callback (const FLAC__Seek > } /* sf_flac_write_callback */ > > static void >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > sf_flac_meta_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), const FLAC__StreamMetadata *metadata, void *client_data) >+#else /* # if HAVE_FLAC_1_1_3 */ >+sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC__StreamMetadata *metadata, void *client_data) >+#endif /* Check FLAC version */ > { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; > > switch (metadata->type) >@@ -387,7 +475,11 @@ sf_flac_meta_callback (const FLAC__Seeka > } /* sf_flac_meta_callback */ > > static void >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > sf_flac_error_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__StreamDecoderErrorStatus status, void *client_data) >+#else /* # if HAVE_FLAC_1_1_3 */ >+sf_flac_error_callback (const FLAC__StreamDecoder * UNUSED (decoder), FLAC__StreamDecoderErrorStatus status, void *client_data) >+#endif /* Check FLAC version */ > { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; > > psf_log_printf (psf, "ERROR : %s\n", FLAC__StreamDecoderErrorStatusString [status]) ; >@@ -407,6 +499,7 @@ sf_flac_error_callback (const FLAC__Seek > return ; > } /* sf_flac_error_callback */ > >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > static FLAC__SeekableStreamEncoderSeekStatus > sf_flac_enc_seek_callback (const FLAC__SeekableStreamEncoder * UNUSED (encoder), FLAC__uint64 absolute_byte_offset, void *client_data) > { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >@@ -417,8 +510,21 @@ sf_flac_enc_seek_callback (const FLAC__S > > return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK ; > } /* sf_flac_enc_seek_callback */ >+#else /* # if HAVE_FLAC_1_1_3 */ >+static FLAC__StreamEncoderSeekStatus >+sf_flac_enc_seek_callback (const FLAC__StreamEncoder * UNUSED (encoder), FLAC__uint64 absolute_byte_offset, void *client_data) >+{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >+ >+ psf_fseek (psf, absolute_byte_offset, SEEK_SET) ; >+ if (psf->error) >+ return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR ; >+ >+ return FLAC__STREAM_ENCODER_SEEK_STATUS_OK ; >+} /* sf_flac_enc_seek_callback */ >+#endif /* Check FLAC version */ > >-#ifdef HAVE_FLAC_1_1_1 >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) >+# if HAVE_FLAC_1_1_1 > static FLAC__SeekableStreamEncoderTellStatus > sf_flac_enc_tell_callback (const FLAC__SeekableStreamEncoder *UNUSED (encoder), FLAC__uint64 *absolute_byte_offset, void *client_data) > { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >@@ -429,10 +535,26 @@ sf_flac_enc_tell_callback (const FLAC__S > > return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK ; > } /* sf_flac_enc_tell_callback */ >-#endif >+# endif /* FLAC 1.1.1 */ >+#else /* # if HAVE_FLAC_1_1_3 */ >+static FLAC__StreamEncoderTellStatus >+sf_flac_enc_tell_callback (const FLAC__StreamEncoder *UNUSED (encoder), FLAC__uint64 *absolute_byte_offset, void *client_data) >+{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; >+ >+ *absolute_byte_offset = psf_ftell (psf) ; >+ if (psf->error) >+ return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR ; >+ >+ return FLAC__STREAM_ENCODER_TELL_STATUS_OK ; >+} /* sf_flac_enc_tell_callback */ >+#endif /* Check FLAC version */ > > static FLAC__StreamEncoderWriteStatus >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > sf_flac_enc_write_callback (const FLAC__SeekableStreamEncoder * UNUSED (encoder), const FLAC__byte buffer [], unsigned bytes, unsigned UNUSED (samples), unsigned UNUSED (current_frame), void *client_data) >+#else /* # if HAVE_FLAC_1_1_3 */ >+sf_flac_enc_write_callback (const FLAC__StreamEncoder * UNUSED (encoder), const FLAC__byte buffer [], unsigned bytes, unsigned UNUSED (samples), unsigned UNUSED (current_frame), void *client_data) >+#endif /* Check FLAC version */ > { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; > > if (psf_fwrite (buffer, 1, bytes, psf) == bytes && psf->error == 0) >@@ -509,16 +631,27 @@ flac_close (SF_PRIVATE *psf) > return 0 ; > > if (psf->mode == SFM_WRITE) >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > { FLAC__seekable_stream_encoder_finish (pflac->fse) ; > FLAC__seekable_stream_encoder_delete (pflac->fse) ; >+#else /* # if HAVE_FLAC_1_1_3 */ >+ { FLAC__stream_encoder_finish (pflac->fse) ; >+ FLAC__stream_encoder_delete (pflac->fse) ; >+#endif /* Check FLAC version */ > if (pflac->encbuffer) > free (pflac->encbuffer) ; > } ; > > if (psf->mode == SFM_READ) >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > { FLAC__seekable_stream_decoder_finish (pflac->fsd) ; > FLAC__seekable_stream_decoder_delete (pflac->fsd) ; > } ; >+#else /* # if HAVE_FLAC_1_1_3 */ >+ { FLAC__stream_decoder_finish (pflac->fsd) ; >+ FLAC__stream_decoder_delete (pflac->fsd) ; >+ } ; >+#endif /* Check FLAC version */ > > for (k = 0 ; k < ARRAY_LEN (pflac->rbuffer) ; k++) > free (pflac->rbuffer [k]) ; >@@ -546,17 +679,26 @@ flac_enc_init (SF_PRIVATE *psf) > return SFE_FLAC_BAD_SAMPLE_RATE ; > > psf_fseek (psf, 0, SEEK_SET) ; >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > if ((pflac->fse = FLAC__seekable_stream_encoder_new ()) == NULL) >+#else /* # if HAVE_FLAC_1_1_3 */ >+ if ((pflac->fse = FLAC__stream_encoder_new ()) == NULL) >+#endif /* Check FLAC version */ > return SFE_FLAC_NEW_DECODER ; >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > FLAC__seekable_stream_encoder_set_write_callback (pflac->fse, sf_flac_enc_write_callback) ; > FLAC__seekable_stream_encoder_set_seek_callback (pflac->fse, sf_flac_enc_seek_callback) ; > >-#ifdef HAVE_FLAC_1_1_1 >+# if HAVE_FLAC_1_1_1 > FLAC__seekable_stream_encoder_set_tell_callback (pflac->fse, sf_flac_enc_tell_callback) ; >-#endif >+# endif > FLAC__seekable_stream_encoder_set_client_data (pflac->fse, psf) ; > FLAC__seekable_stream_encoder_set_channels (pflac->fse, psf->sf.channels) ; > FLAC__seekable_stream_encoder_set_sample_rate (pflac->fse, psf->sf.samplerate) ; >+#else /* # if HAVE_FLAC_1_1_3 */ >+ FLAC__stream_encoder_set_channels (pflac->fse, psf->sf.channels) ; >+ FLAC__stream_encoder_set_sample_rate (pflac->fse, psf->sf.samplerate) ; >+#endif /* Check FLAC version */ > > switch (psf->sf.format & SF_FORMAT_SUBMASK) > { case SF_FORMAT_PCM_S8 : >@@ -574,10 +716,25 @@ flac_enc_init (SF_PRIVATE *psf) > break ; > } ; > >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > FLAC__seekable_stream_encoder_set_bits_per_sample (pflac->fse, bps) ; > > if ((bps = FLAC__seekable_stream_encoder_init (pflac->fse)) != FLAC__SEEKABLE_STREAM_DECODER_OK) > { psf_log_printf (psf, "Error : FLAC encoder init returned error : %s\n", FLAC__seekable_stream_encoder_get_resolved_state_string (pflac->fse)) ; >+#else /* # if HAVE_FLAC_1_1_3 */ >+ FLAC__stream_encoder_set_bits_per_sample (pflac->fse, bps) ; >+ >+ if((bps = FLAC__stream_encoder_init_stream( >+ pflac->fse, >+ sf_flac_enc_write_callback, >+ sf_flac_enc_seek_callback, // or NULL neither or both of these >+ sf_flac_enc_tell_callback, // or NULL two must be provided >+ NULL, // my_metadata_callback, // or NULL >+ psf >+ )) != FLAC__STREAM_ENCODER_INIT_STATUS_OK) >+ { psf_log_printf (psf, "Error : FLAC encoder init returned error : %s\n", FLAC__stream_encoder_get_resolved_state_string (pflac->fse)) ; >+ fprintf (stderr, "FLAC encoder failed to initialize, error %u\n", bps); >+#endif /* Check FLAC version */ > return SFE_FLAC_INIT_DECODER ; > } ; > >@@ -591,11 +748,17 @@ flac_enc_init (SF_PRIVATE *psf) > static int > flac_read_header (SF_PRIVATE *psf) > { FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ; >+ int err = 0; > > psf_fseek (psf, 0, SEEK_SET) ; >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > if ((pflac->fsd = FLAC__seekable_stream_decoder_new ()) == NULL) >+#else /* # if HAVE_FLAC_1_1_3 */ >+ if ((pflac->fsd = FLAC__stream_decoder_new ()) == NULL) >+#endif /* Check FLAC version */ > return SFE_FLAC_NEW_DECODER ; > >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > FLAC__seekable_stream_decoder_set_read_callback (pflac->fsd, sf_flac_read_callback) ; > FLAC__seekable_stream_decoder_set_seek_callback (pflac->fsd, sf_flac_seek_callback) ; > FLAC__seekable_stream_decoder_set_tell_callback (pflac->fsd, sf_flac_tell_callback) ; >@@ -607,12 +770,38 @@ flac_read_header (SF_PRIVATE *psf) > FLAC__seekable_stream_decoder_set_client_data (pflac->fsd, psf) ; > > if (FLAC__seekable_stream_decoder_init (pflac->fsd) != FLAC__SEEKABLE_STREAM_DECODER_OK) >+ { >+#else /* # if HAVE_FLAC_1_1_3 */ >+ if((err = FLAC__stream_decoder_init_stream( >+ pflac->fsd, >+ sf_flac_read_callback, >+ sf_flac_seek_callback, // or NULL >+ sf_flac_tell_callback, // or NULL >+ sf_flac_length_callback, // or NULL >+ sf_flac_eof_callback, // or NULL >+ sf_flac_write_callback, >+ sf_flac_meta_callback, // or NULL >+ sf_flac_error_callback, >+ psf >+ )) != FLAC__STREAM_DECODER_INIT_STATUS_OK) >+ { >+ fprintf (stderr, "FLAC decoder failed to initialize, error %d\n", err); >+#endif /* Check FLAC version */ > return SFE_FLAC_INIT_DECODER ; >+ } > >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > FLAC__seekable_stream_decoder_process_until_end_of_metadata (pflac->fsd) ; >+#else /* # if HAVE_FLAC_1_1_3 */ >+ FLAC__stream_decoder_process_until_end_of_metadata (pflac->fsd) ; >+#endif /* Check FLAC version */ > if (psf->error == 0) > { FLAC__uint64 position ; >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > FLAC__seekable_stream_decoder_get_decode_position (pflac->fsd, &position) ; >+#else /* # if HAVE_FLAC_1_1_3 */ >+ FLAC__stream_decoder_get_decode_position (pflac->fsd, &position) ; >+#endif /* Check FLAC version */ > psf->dataoffset = position ; > } ; > >@@ -676,9 +865,17 @@ flac_read_loop (SF_PRIVATE *psf, unsigne > flac_buffer_copy (psf) ; > > while (pflac->pos < pflac->len) >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > { if (FLAC__seekable_stream_decoder_process_single (pflac->fsd) == 0) >+#else /* # if HAVE_FLAC_1_1_3 */ >+ { if (FLAC__stream_decoder_process_single (pflac->fsd) == 0) >+#endif /* Check FLAC version */ > break ; >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > if (FLAC__seekable_stream_decoder_get_state (pflac->fsd) != FLAC__SEEKABLE_STREAM_DECODER_OK) >+#else /* # if HAVE_FLAC_1_1_3 */ >+ if (FLAC__stream_decoder_get_state (pflac->fsd) != FLAC__STREAM_DECODER_READ_FRAME) >+#endif /* Check FLAC version */ > break ; > } ; > >@@ -795,7 +992,11 @@ flac_write_s2flac (SF_PRIVATE *psf, cons > while (len > 0) > { writecount = (len >= bufferlen) ? bufferlen : (int) len ; > convert (ptr + total, buffer, writecount) ; >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) >+#else /* # if HAVE_FLAC_1_1_3 */ >+ if (FLAC__stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) >+#endif /* Check FLAC version */ > thiswrite = writecount ; > else > break ; >@@ -837,7 +1038,11 @@ flac_write_i2flac (SF_PRIVATE *psf, cons > while (len > 0) > { writecount = (len >= bufferlen) ? bufferlen : (int) len ; > convert (ptr + total, buffer, writecount) ; >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) >+#else /* # if HAVE_FLAC_1_1_3 */ >+ if (FLAC__stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) >+#endif /* Check FLAC version */ > thiswrite = writecount ; > else > break ; >@@ -879,7 +1084,11 @@ flac_write_f2flac (SF_PRIVATE *psf, cons > while (len > 0) > { writecount = (len >= bufferlen) ? bufferlen : (int) len ; > convert (ptr + total, buffer, writecount, psf->norm_float) ; >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) >+#else /* # if HAVE_FLAC_1_1_3 */ >+ if (FLAC__stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) >+#endif /* Check FLAC version */ > thiswrite = writecount ; > else > break ; >@@ -1011,7 +1220,11 @@ flac_write_d2flac (SF_PRIVATE *psf, cons > while (len > 0) > { writecount = (len >= bufferlen) ? bufferlen : (int) len ; > convert (ptr + total, buffer, writecount, psf->norm_double) ; >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) >+#else /* # if HAVE_FLAC_1_1_3 */ >+ if (FLAC__stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) >+#endif /* Check FLAC version */ > thiswrite = writecount ; > else > break ; >@@ -1131,8 +1344,13 @@ flac_seek (SF_PRIVATE *psf, int UNUSED ( > > if (psf->mode == SFM_READ) > { FLAC__uint64 position ; >+#if (HAVE_FLAC_1_1_1 == 1 || HAVE_FLAC_1_1_2 == 1) > if (FLAC__seekable_stream_decoder_seek_absolute (pflac->fsd, offset)) > { FLAC__seekable_stream_decoder_get_decode_position (pflac->fsd, &position) ; >+#else /* # if HAVE_FLAC_1_1_3 */ >+ if (FLAC__stream_decoder_seek_absolute (pflac->fsd, offset)) >+ { FLAC__stream_decoder_get_decode_position (pflac->fsd, &position) ; >+#endif /* Check FLAC version */ > return offset ; > } ; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 237575
:
194801
|
206341
| 206351