Dash:
[t2.git] / package / audio / rezound / flac-1.1.3.patch
bloba54803f50b383c391702318301e01953e751acef
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../rezound/flac-1.1.3.patch
5 # Copyright (C) 2007 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
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
14 # version.
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
19 @@ -42,6 +42,12 @@
20 #include "CSound.h"
21 #include "AStatusComm.h"
23 +#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
24 +#define LEGACY_FLAC
25 +#else
26 +#undef LEGACY_FLAC
27 +#endif
29 CFLACSoundTranslator::CFLACSoundTranslator()
32 @@ -75,15 +81,23 @@
33 for(unsigned t=0;t<MAX_CHANNELS;t++)
34 accessers[t]=NULL;
36 +#ifdef LEGACY_FLAC
37 set_filename(filename.c_str());
38 +#endif
40 set_metadata_ignore_all();
41 //set_metadata_respond(FLAC__METADATA_TYPE_VORBIS_COMMENT);
42 //set_metadata_respond(FLAC__METADATA_TYPE_CUESHEET);
44 +#ifdef LEGACY_FLAC
45 State s=init();
46 if(s!=FLAC__FILE_DECODER_OK)
47 throw runtime_error(string(__func__)+" -- "+s.as_cstring());
48 +#else
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");
52 +#endif
55 virtual ~MyFLACDecoderFile()
56 @@ -170,7 +184,11 @@
58 // update status bar and detect user cancel
59 FLAC__uint64 filePosition;
60 +#ifdef LEGACY_FLAC
61 FLAC__file_decoder_get_decode_position(decoder_, &filePosition);
62 +#else
63 + FLAC__stream_decoder_get_decode_position(decoder_, &filePosition);
64 +#endif
65 return statusBar.update(filePosition) ? FLAC__STREAM_DECODER_WRITE_STATUS_ABORT : FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
68 @@ -215,7 +233,11 @@
69 bool CFLACSoundTranslator::onLoadSound(const string filename,CSound *sound) const
71 MyFLACDecoderFile f(filename,sound);
72 +#ifdef LEGACY_FLAC
73 return f.process_until_end_of_file();
74 +#else
75 + return f.process_until_end_of_stream();
76 +#endif
80 @@ -258,7 +280,9 @@
82 MyFLACEncoderFile f(saveLength);
84 +#ifdef LEGACY_FLAC
85 f.set_filename(filename.c_str());
86 +#endif
88 f.set_channels(sound->getChannelCount());
90 @@ -274,8 +298,13 @@
91 //f.set_metadata(...) // ??? to do to set cues and user notes, etc
94 +#ifdef LEGACY_FLAC
95 MyFLACEncoderFile::State s=f.init();
96 if(s==FLAC__STREAM_ENCODER_OK)
97 +#else
98 + FLAC__StreamEncoderInitStatus s=f.init(filename.c_str());
99 + if(s==FLAC__STREAM_ENCODER_INIT_STATUS_OK)
100 +#endif
102 #define BUFFER_SIZE 65536
103 TAutoBuffer<FLAC__int32> buffers[MAX_CHANNELS];
104 @@ -328,7 +357,11 @@
105 return true;
107 else
108 +#ifdef LEGACY_FLAC
109 throw runtime_error(string(__func__)+" -- error creating FLAC encoder -- "+s.as_cstring());
110 +#else
111 + throw runtime_error(string(__func__)+" -- error creating FLAC encoder -- ");
112 +#endif