|
Lines 28-33
Link Here
|
| 28 |
#include <string.h> |
28 |
#include <string.h> |
| 29 |
#include "flacdecode.h" |
29 |
#include "flacdecode.h" |
| 30 |
|
30 |
|
|
|
31 |
#include <FLAC/export.h> |
| 32 |
/* FLAC 1.1.3 has FLAC_API_VERSION_CURRENT == 8 */ |
| 33 |
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8 |
| 34 |
#define LEGACY_FLAC |
| 35 |
#else |
| 36 |
#undef LEGACY_FLAC |
| 37 |
#endif |
| 38 |
|
| 31 |
void FLAC_errorcb(const FLAC__StreamDecoder * decoder, |
39 |
void FLAC_errorcb(const FLAC__StreamDecoder * decoder, |
| 32 |
FLAC__StreamDecoderErrorStatus status, void *client_data) |
40 |
FLAC__StreamDecoderErrorStatus status, void *client_data) |
| 33 |
{ |
41 |
{ |
|
Lines 99-105
Link Here
|
| 99 |
|
107 |
|
| 100 |
FLAC__StreamDecoderReadStatus FLAC_readcb(const FLAC__StreamDecoder *decoder, |
108 |
FLAC__StreamDecoderReadStatus FLAC_readcb(const FLAC__StreamDecoder *decoder, |
| 101 |
FLAC__byte buffer[], |
109 |
FLAC__byte buffer[], |
|
|
110 |
#ifdef LEGACY_FLAC |
| 102 |
unsigned *bytes, |
111 |
unsigned *bytes, |
|
|
112 |
#else |
| 113 |
size_t *bytes, |
| 114 |
#endif |
| 103 |
void *client_data) |
115 |
void *client_data) |
| 104 |
{ |
116 |
{ |
| 105 |
clientdata_t *cd = reinterpret_cast < clientdata_t * >(client_data); |
117 |
clientdata_t *cd = reinterpret_cast < clientdata_t * >(client_data); |
|
Lines 131-136
Link Here
|
| 131 |
if (!cd.in) |
143 |
if (!cd.in) |
| 132 |
return; |
144 |
return; |
| 133 |
|
145 |
|
|
|
146 |
#ifdef LEGACY_FLAC |
| 134 |
if (!FLAC__stream_decoder_set_read_callback(decoder, &FLAC_readcb)) |
147 |
if (!FLAC__stream_decoder_set_read_callback(decoder, &FLAC_readcb)) |
| 135 |
return; |
148 |
return; |
| 136 |
|
149 |
|
|
Lines 149-154
Link Here
|
| 149 |
state = FLAC__stream_decoder_init(decoder); |
162 |
state = FLAC__stream_decoder_init(decoder); |
| 150 |
if (state != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA) |
163 |
if (state != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA) |
| 151 |
return; |
164 |
return; |
|
|
165 |
#else |
| 166 |
if (FLAC__stream_decoder_init_stream(decoder, &FLAC_readcb, NULL, NULL, NULL, NULL, &FLAC_writecb, &FLAC_metadatacb, &FLAC_errorcb, &cd) != FLAC__STREAM_DECODER_INIT_STATUS_OK) |
| 167 |
return; |
| 168 |
#endif |
| 152 |
|
169 |
|
| 153 |
FLAC__stream_decoder_process_until_end_of_metadata(decoder); |
170 |
FLAC__stream_decoder_process_until_end_of_metadata(decoder); |
| 154 |
state = FLAC__stream_decoder_get_state(decoder); |
171 |
state = FLAC__stream_decoder_get_state(decoder); |