1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 # T2 SDE: package/.../rezound/flac-1.1.3.patch
5 # Copyright (C) 2007 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
15 # --- T2-COPYRIGHT-NOTE-END ---
17 --- rezound-0.12.2beta/src/backend/CFLACSoundTranslator.cpp.old 2006-12-04 19:08:26.000000000 +0100
18 +++ rezound-0.12.2beta/src/backend/CFLACSoundTranslator.cpp 2006-12-04 19:33:45.000000000 +0100
21 #include "AStatusComm.h"
23 +#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
29 CFLACSoundTranslator::CFLACSoundTranslator()
33 for(unsigned t=0;t<MAX_CHANNELS;t++)
37 set_filename(filename.c_str());
40 set_metadata_ignore_all();
41 //set_metadata_respond(FLAC__METADATA_TYPE_VORBIS_COMMENT);
42 //set_metadata_respond(FLAC__METADATA_TYPE_CUESHEET);
46 if(s!=FLAC__FILE_DECODER_OK)
47 throw runtime_error(string(__func__)+" -- "+s.as_cstring());
49 + FLAC__StreamDecoderInitStatus s=init(filename.c_str());
50 + if(s!=FLAC__STREAM_DECODER_INIT_STATUS_OK)
51 + throw runtime_error(string(__func__)+" -- FLAC__STREAM_DECODER_INIT_STATUS not OK");
55 virtual ~MyFLACDecoderFile()
58 // update status bar and detect user cancel
59 FLAC__uint64 filePosition;
61 FLAC__file_decoder_get_decode_position(decoder_, &filePosition);
63 + FLAC__stream_decoder_get_decode_position(decoder_, &filePosition);
65 return statusBar.update(filePosition) ? FLAC__STREAM_DECODER_WRITE_STATUS_ABORT : FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
69 bool CFLACSoundTranslator::onLoadSound(const string filename,CSound *sound) const
71 MyFLACDecoderFile f(filename,sound);
73 return f.process_until_end_of_file();
75 + return f.process_until_end_of_stream();
82 MyFLACEncoderFile f(saveLength);
85 f.set_filename(filename.c_str());
88 f.set_channels(sound->getChannelCount());
91 //f.set_metadata(...) // ??? to do to set cues and user notes, etc
95 MyFLACEncoderFile::State s=f.init();
96 if(s==FLAC__STREAM_ENCODER_OK)
98 + FLAC__StreamEncoderInitStatus s=f.init(filename.c_str());
99 + if(s==FLAC__STREAM_ENCODER_INIT_STATUS_OK)
102 #define BUFFER_SIZE 65536
103 TAutoBuffer<FLAC__int32> buffers[MAX_CHANNELS];
109 throw runtime_error(string(__func__)+" -- error creating FLAC encoder -- "+s.as_cstring());
111 + throw runtime_error(string(__func__)+" -- error creating FLAC encoder -- ");