Lines 58-63
Link Here
|
58 |
|
58 |
|
59 |
#include "FLAC++/decoder.h" |
59 |
#include "FLAC++/decoder.h" |
60 |
|
60 |
|
|
|
61 |
/* FLAC 1.1.3 has FLAC_API_VERSION_CURRENT == 8 */ |
62 |
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8 |
63 |
#define LEGACY_FLAC |
64 |
#else |
65 |
#undef LEGACY_FLAC |
66 |
#endif |
67 |
|
61 |
#include "../FileFormats.h" |
68 |
#include "../FileFormats.h" |
62 |
#include "../Prefs.h" |
69 |
#include "../Prefs.h" |
63 |
#include "../WaveTrack.h" |
70 |
#include "../WaveTrack.h" |
Lines 264-282
Link Here
|
264 |
|
271 |
|
265 |
bool FLACImportFileHandle::Init() |
272 |
bool FLACImportFileHandle::Init() |
266 |
{ |
273 |
{ |
267 |
bool success = mFile->set_filename(OSFILENAME(mName)); |
274 |
#ifdef LEGACY_FLAC |
268 |
if (!success) { |
275 |
if (!mFile->set_filename(OSFILENAME(mName))) return false; |
269 |
return false; |
276 |
#endif |
270 |
} |
277 |
#ifdef LEGACY_FLAC |
271 |
FLAC::Decoder::File::State state = mFile->init(); |
278 |
if (mFile->init() != FLAC__FILE_DECODER_OK) |
272 |
if (state != FLAC__FILE_DECODER_OK) { |
279 |
#else |
|
|
280 |
if (mFile->init(OSFILENAME(mName)) != FLAC__STREAM_DECODER_INIT_STATUS_OK) |
281 |
#endif |
273 |
return false; |
282 |
return false; |
274 |
} |
|
|
275 |
mFile->process_until_end_of_metadata(); |
283 |
mFile->process_until_end_of_metadata(); |
276 |
state = mFile->get_state(); |
284 |
#ifdef LEGACY_FLAC |
277 |
if (state != FLAC__FILE_DECODER_OK) { |
285 |
if (mFile->get_state() != FLAC__FILE_DECODER_OK) |
|
|
286 |
#else |
287 |
if (!mFile->get_state()) |
288 |
#endif |
278 |
return false; |
289 |
return false; |
279 |
} |
|
|
280 |
if (!mFile->is_valid() || mFile->get_was_error()) |
290 |
if (!mFile->is_valid() || mFile->get_was_error()) |
281 |
{ |
291 |
{ |
282 |
// This probably is not a FLAC file at all |
292 |
// This probably is not a FLAC file at all |
Lines 340-346
Link Here
|
340 |
mChannels[1]->SetTeamed(true); |
350 |
mChannels[1]->SetTeamed(true); |
341 |
} |
351 |
} |
342 |
|
352 |
|
|
|
353 |
#ifdef LEGACY_FLAC |
343 |
mFile->process_until_end_of_file(); |
354 |
mFile->process_until_end_of_file(); |
|
|
355 |
#else |
356 |
mFile->process_until_end_of_stream(); |
357 |
#endif |
344 |
|
358 |
|
345 |
*outTracks = new Track *[*outNumTracks]; |
359 |
*outTracks = new Track *[*outNumTracks]; |
346 |
for(c = 0; c < *outNumTracks; c++) { |
360 |
for(c = 0; c < *outNumTracks; c++) { |