fix some minor syntax errors
This commit is contained in:
parent
3ba1c37f6a
commit
3b678d5b02
@ -57,7 +57,7 @@ typedef struct {
|
||||
static FLAC__bool safe_decoder_init_(const char *infilename, FLAC__FileDecoder *decoder);
|
||||
static void safe_decoder_finish_(FLAC__FileDecoder *decoder);
|
||||
static void safe_decoder_delete_(FLAC__FileDecoder *decoder);
|
||||
static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
|
||||
static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
|
||||
static void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
|
||||
static void error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||
static FLAC__bool get_id3v1_tag_(const char *filename, id3v1_struct *tag);
|
||||
@ -237,7 +237,7 @@ void getfileinfo(char *filename, char *title, int *length_in_ms)
|
||||
strcpy(title, tag.description);
|
||||
}
|
||||
if(length_in_msec)
|
||||
*length_in_msec = streaminfo.total_samples * 10 / (streaminfo.sample_rate / 100);
|
||||
*length_in_msec = streaminfo.data.stream_info.total_samples * 10 / (streaminfo.data.stream_info.sample_rate / 100);
|
||||
}
|
||||
|
||||
void eq_set(int on, char data[10], int preamp)
|
||||
@ -407,7 +407,7 @@ void safe_decoder_delete_(FLAC__FileDecoder *decoder)
|
||||
}
|
||||
}
|
||||
|
||||
FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data)
|
||||
FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
|
||||
{
|
||||
file_info_struct *file_info_ = (file_info_struct *)client_data;
|
||||
const unsigned bps = file_info_->bits_per_sample, channels = file_info_->channels, wide_samples = frame->header.blocksize;
|
||||
|
@ -89,7 +89,7 @@ int FlacPcm::getInfos(MediaInfo *infos)
|
||||
if(!reader) return 0;
|
||||
|
||||
//@@@ to be really "clean" we should go through the reader instead of directly to the file...
|
||||
if(!FLAC__metadata_get_streaminfo(infos->getFilename(), &stream_info))
|
||||
if(!FLAC__metadata_get_streaminfo(infos->getFilename(), &streaminfo))
|
||||
return 1;
|
||||
|
||||
id3v1_struct tag;
|
||||
@ -99,7 +99,7 @@ int FlacPcm::getInfos(MediaInfo *infos)
|
||||
infos->setLength(lengthInMsec());
|
||||
//@@@ infos->setTitle(Std::filename(infos->getFilename()));
|
||||
infos->setTitle(tag.description);
|
||||
infos->setInfo(StringPrintf("FLAC:<%ihz:%ibps:%dch>", stream_info.sample_rate, stream_info.bits_per_sample, stream_info.channels)); //@@@ fix later
|
||||
infos->setInfo(StringPrintf("FLAC:<%ihz:%ibps:%dch>", streaminfo.data.stream_info.sample_rate, streaminfo.data.stream_info.bits_per_sample, streaminfo.data.stream_info.channels)); //@@@ fix later
|
||||
if(has_tag) {
|
||||
infos->setData("Title", tag.title);
|
||||
infos->setData("Artist", tag.artist);
|
||||
@ -160,10 +160,10 @@ int FlacPcm::processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswit
|
||||
eof = true;
|
||||
}
|
||||
else {
|
||||
const unsigned channels = stream_info.channels;
|
||||
const unsigned bits_per_sample = stream_info.bits_per_sample;
|
||||
const unsigned channels = streaminfo.data.stream_info.channels;
|
||||
const unsigned bits_per_sample = streaminfo.data.stream_info.bits_per_sample;
|
||||
const unsigned bytes_per_sample = (bits_per_sample+7)/8;
|
||||
const unsigned sample_rate = stream_info.sample_rate;
|
||||
const unsigned sample_rate = streaminfo.data.stream_info.sample_rate;
|
||||
unsigned i, n = min(samples_in_reservoir, 576), delta;
|
||||
signed short *ssbuffer = (signed short*)output;
|
||||
|
||||
@ -192,11 +192,11 @@ int FlacPcm::processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswit
|
||||
|
||||
int FlacPcm::corecb_onSeeked(int newpos)
|
||||
{
|
||||
if(stream_info.total_samples == 0 || newpos < 0)
|
||||
if(streaminfo.data.stream_info.total_samples == 0 || newpos < 0)
|
||||
return 1;
|
||||
|
||||
needs_seek = true;
|
||||
seek_sample = (FLAC__uint64)((double)newpos / (double)lengthInMsec() * (double)(FLAC__int64)stream_info.total_samples);
|
||||
seek_sample = (FLAC__uint64)((double)newpos / (double)lengthInMsec() * (double)(FLAC__int64)streaminfo.data.stream_info.total_samples);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ FLAC__bool FlacPcm::eofCallback_(const FLAC__SeekableStreamDecoder *decoder, voi
|
||||
FLAC__StreamDecoderWriteStatus FlacPcm::writeCallback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data)
|
||||
{
|
||||
FlacPcm *instance = (FlacPcm*)client_data;
|
||||
const unsigned bps = instance->stream_info.bits_per_sample, channels = instance->stream_info.channels, wide_samples = frame->header.blocksize;
|
||||
const unsigned bps = instance->streaminfo.data.stream_info.bits_per_sample, channels = instance->streaminfo.data.stream_info.channels, wide_samples = frame->header.blocksize;
|
||||
unsigned wide_sample, sample, channel;
|
||||
|
||||
(void)decoder;
|
||||
@ -279,9 +279,9 @@ void FlacPcm::metadataCallback_(const FLAC__SeekableStreamDecoder *decoder, cons
|
||||
FlacPcm *instance = (FlacPcm*)client_data;
|
||||
(void)decoder;
|
||||
if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
|
||||
instance->stream_info = metadata->data.stream_info;
|
||||
instance->streaminfo.data.stream_info = *metadata;
|
||||
|
||||
if(instance->stream_info.bits_per_sample != 16) {
|
||||
if(instance->streaminfo.data.stream_info.bits_per_sample != 16) {
|
||||
//@@@ how to do this? MessageBox(mod.hMainWindow, "ERROR: plugin can only handle 16-bit samples\n", "ERROR: plugin can only handle 16-bit samples", 0);
|
||||
instance->abort_flag = true;
|
||||
return;
|
||||
|
@ -88,11 +88,11 @@ protected:
|
||||
bool abort_flag;
|
||||
svc_fileReader *reader;
|
||||
FLAC__SeekableStreamDecoder *decoder;
|
||||
FLAC__StreamMetadata_StreamInfo stream_info;
|
||||
FLAC__StreamMetadata streaminfo;
|
||||
FLAC__int16 reservoir[FLAC__MAX_BLOCK_SIZE * 2 * 2]; // *2 for max channels, another *2 for overflow
|
||||
unsigned char output[576 * 2 * (16/8)]; // *2 for max channels, (16/8) for max bytes per sample
|
||||
|
||||
unsigned lengthInMsec() { return (unsigned)((FLAC__uint64)1000 * stream_info.total_samples / stream_info.sample_rate); }
|
||||
unsigned lengthInMsec() { return (unsigned)((FLAC__uint64)1000 * streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate); }
|
||||
private:
|
||||
void cleanup();
|
||||
static FLAC__SeekableStreamDecoderReadStatus readCallback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
|
||||
|
@ -70,9 +70,9 @@ static void FLAC_XMMS__get_song_info(char *filename, char **title, int *length);
|
||||
static FLAC__bool get_id3v1_tag_(const char *filename, id3v1_struct *tag);
|
||||
static void *play_loop_(void *arg);
|
||||
static FLAC__bool safe_decoder_init_(const char *filename, FLAC__FileDecoder *decoder);
|
||||
static FLAC__bool safe_decoder_finish_(FLAC__FileDecoder *decoder);
|
||||
static FLAC__bool safe_decoder_delete_(FLAC__FileDecoder *decoder);
|
||||
static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
|
||||
static void safe_decoder_finish_(FLAC__FileDecoder *decoder);
|
||||
static void safe_decoder_delete_(FLAC__FileDecoder *decoder);
|
||||
static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
|
||||
static void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
|
||||
static void error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||
|
||||
@ -213,7 +213,7 @@ int FLAC_XMMS__get_time()
|
||||
|
||||
void FLAC_XMMS__cleanup()
|
||||
{
|
||||
safe_decoder_delete(decoder_);
|
||||
safe_decoder_delete_(decoder_);
|
||||
decoder_ = 0;
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ void FLAC_XMMS__get_song_info(char *filename, char **title, int *length_in_msec)
|
||||
if(!FLAC__metadata_get_streaminfo(filename, &streaminfo)) {
|
||||
/* @@@ how to report the error? */
|
||||
if(title) {
|
||||
static const char *errtitle = "Invalid FLAC File: ");
|
||||
static const char *errtitle = "Invalid FLAC File: ";
|
||||
*title = g_malloc(strlen(errtitle) + 1 + strlen(filename) + 1 + 1);
|
||||
sprintf(*title, "%s\"%s\"", errtitle, filename);
|
||||
}
|
||||
@ -243,7 +243,7 @@ void FLAC_XMMS__get_song_info(char *filename, char **title, int *length_in_msec)
|
||||
strcpy(*title, tag.description);
|
||||
}
|
||||
if(length_in_msec)
|
||||
*length_in_msec = streaminfo.total_samples * 10 / (streaminfo.sample_rate / 100);
|
||||
*length_in_msec = streaminfo.data.stream_info.total_samples * 10 / (streaminfo.data.stream_info.sample_rate / 100);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -394,7 +394,7 @@ void safe_decoder_delete_(FLAC__FileDecoder *decoder)
|
||||
}
|
||||
}
|
||||
|
||||
FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data)
|
||||
FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
|
||||
{
|
||||
file_info_struct *file_info = (file_info_struct *)client_data;
|
||||
const unsigned bps = file_info->bits_per_sample, channels = file_info->channels, wide_samples = frame->header.blocksize;
|
||||
|
Loading…
x
Reference in New Issue
Block a user