1 This patch adds ifdefs to make rezound compile and work with flac 1.1.2 and >=1.1.3
2 See : http://flac.sourceforge.net/api/group__porting.html for more details
4 Index: rezound-0.12.3beta/src/backend/CFLACSoundTranslator.cpp
5 ===================================================================
6 --- rezound-0.12.3beta.orig/src/backend/CFLACSoundTranslator.cpp
7 +++ rezound-0.12.3beta/src/backend/CFLACSoundTranslator.cpp
10 #include "AStatusComm.h"
12 +#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
18 CFLACSoundTranslator::CFLACSoundTranslator()
21 @@ -75,15 +81,23 @@ public:
22 for(unsigned t=0;t<MAX_CHANNELS;t++)
26 set_filename(filename.c_str());
29 set_metadata_ignore_all();
30 //set_metadata_respond(FLAC__METADATA_TYPE_VORBIS_COMMENT);
31 //set_metadata_respond(FLAC__METADATA_TYPE_CUESHEET);
35 if(s!=FLAC__FILE_DECODER_OK)
36 throw runtime_error(string(__func__)+" -- "+s.as_cstring());
38 + FLAC__StreamDecoderInitStatus s=init(filename.c_str());
39 + if(s!=FLAC__STREAM_DECODER_INIT_STATUS_OK)
40 + throw runtime_error(string(__func__)+" -- FLAC__STREAM_DECODER_INIT_STATUS not OK");
44 virtual ~MyFLACDecoderFile()
45 @@ -170,7 +184,11 @@ protected:
47 // update status bar and detect user cancel
48 FLAC__uint64 filePosition;
50 FLAC__file_decoder_get_decode_position(decoder_, &filePosition);
52 + FLAC__stream_decoder_get_decode_position(decoder_, &filePosition);
54 return statusBar.update(filePosition) ? FLAC__STREAM_DECODER_WRITE_STATUS_ABORT : FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
57 @@ -215,7 +233,11 @@ private:
58 bool CFLACSoundTranslator::onLoadSound(const string filename,CSound *sound) const
60 MyFLACDecoderFile f(filename,sound);
62 return f.process_until_end_of_file();
64 + return f.process_until_end_of_stream();
69 @@ -258,7 +280,9 @@ bool CFLACSoundTranslator::onSaveSound(c
71 MyFLACEncoderFile f(saveLength);
74 f.set_filename(filename.c_str());
77 f.set_channels(sound->getChannelCount());
79 @@ -274,8 +298,13 @@ bool CFLACSoundTranslator::onSaveSound(c
80 //f.set_metadata(...) // ??? to do to set cues and user notes, etc
84 MyFLACEncoderFile::State s=f.init();
85 if(s==FLAC__STREAM_ENCODER_OK)
87 + FLAC__StreamEncoderInitStatus s=f.init(filename.c_str());
88 + if(s==FLAC__STREAM_ENCODER_INIT_STATUS_OK)
91 #define BUFFER_SIZE 65536
92 TAutoBuffer<FLAC__int32> buffers[MAX_CHANNELS];
93 @@ -328,7 +357,11 @@ bool CFLACSoundTranslator::onSaveSound(c
98 throw runtime_error(string(__func__)+" -- error creating FLAC encoder -- "+s.as_cstring());
100 + throw runtime_error(string(__func__)+" -- error creating FLAC encoder -- ");