fix some minor syntax errors
authorJosh Coalson <jcoalson@users.sourceforce.net>
Mon, 10 Jun 2002 18:25:43 +0000 (18:25 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Mon, 10 Jun 2002 18:25:43 +0000 (18:25 +0000)
src/plugin_winamp2/in_flac.c
src/plugin_winamp3/flacpcm.cpp
src/plugin_winamp3/flacpcm.h
src/plugin_xmms/plugin.c

index d3546f63f3dcf65bd4d43e8eaa7fb0329dd6833d..3a1e4b6794181c4de61d8ffb8b430c7932d6dce3 100644 (file)
@@ -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;
index d2eeaaef225122370a86cde201821e7e454890c6..6dfefdeda71818d6d32e49e0796f60003d028643 100644 (file)
@@ -89,7 +89,7 @@ int FlacPcm::getInfos(MediaInfo *infos)
        if(!reader) return 0;\r
 \r
        //@@@ to be really "clean" we should go through the reader instead of directly to the file...\r
-       if(!FLAC__metadata_get_streaminfo(infos->getFilename(), &stream_info))\r
+       if(!FLAC__metadata_get_streaminfo(infos->getFilename(), &streaminfo))\r
                return 1;\r
 \r
        id3v1_struct tag;\r
@@ -99,7 +99,7 @@ int FlacPcm::getInfos(MediaInfo *infos)
        infos->setLength(lengthInMsec());\r
        //@@@ infos->setTitle(Std::filename(infos->getFilename()));\r
        infos->setTitle(tag.description);\r
-       infos->setInfo(StringPrintf("FLAC:<%ihz:%ibps:%dch>", stream_info.sample_rate, stream_info.bits_per_sample, stream_info.channels)); //@@@ fix later\r
+       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\r
        if(has_tag) {\r
                infos->setData("Title", tag.title);\r
                infos->setData("Artist", tag.artist);\r
@@ -160,10 +160,10 @@ int FlacPcm::processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswit
                eof = true;\r
        }\r
        else {\r
-               const unsigned channels = stream_info.channels;\r
-               const unsigned bits_per_sample = stream_info.bits_per_sample;\r
+               const unsigned channels = streaminfo.data.stream_info.channels;\r
+               const unsigned bits_per_sample = streaminfo.data.stream_info.bits_per_sample;\r
                const unsigned bytes_per_sample = (bits_per_sample+7)/8;\r
-               const unsigned sample_rate = stream_info.sample_rate;\r
+               const unsigned sample_rate = streaminfo.data.stream_info.sample_rate;\r
                unsigned i, n = min(samples_in_reservoir, 576), delta;\r
                signed short *ssbuffer = (signed short*)output;\r
 \r
@@ -192,11 +192,11 @@ int FlacPcm::processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswit
 \r
 int FlacPcm::corecb_onSeeked(int newpos)\r
 {\r
-       if(stream_info.total_samples == 0 || newpos < 0)\r
+       if(streaminfo.data.stream_info.total_samples == 0 || newpos < 0)\r
                return 1;\r
 \r
        needs_seek = true;\r
-       seek_sample = (FLAC__uint64)((double)newpos / (double)lengthInMsec() * (double)(FLAC__int64)stream_info.total_samples);\r
+       seek_sample = (FLAC__uint64)((double)newpos / (double)lengthInMsec() * (double)(FLAC__int64)streaminfo.data.stream_info.total_samples);\r
        return 0;\r
 }\r
 \r
@@ -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)\r
 {\r
        FlacPcm *instance = (FlacPcm*)client_data;\r
-       const unsigned bps = instance->stream_info.bits_per_sample, channels = instance->stream_info.channels, wide_samples = frame->header.blocksize;\r
+       const unsigned bps = instance->streaminfo.data.stream_info.bits_per_sample, channels = instance->streaminfo.data.stream_info.channels, wide_samples = frame->header.blocksize;\r
        unsigned wide_sample, sample, channel;\r
 \r
        (void)decoder;\r
@@ -279,9 +279,9 @@ void FlacPcm::metadataCallback_(const FLAC__SeekableStreamDecoder *decoder, cons
        FlacPcm *instance = (FlacPcm*)client_data;\r
        (void)decoder;\r
        if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {\r
-               instance->stream_info = metadata->data.stream_info;\r
+               instance->streaminfo.data.stream_info = *metadata;\r
 \r
-               if(instance->stream_info.bits_per_sample != 16) {\r
+               if(instance->streaminfo.data.stream_info.bits_per_sample != 16) {\r
                        //@@@ 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);\r
                        instance->abort_flag = true;\r
                        return;\r
index c6c17a9ec3d9325b3e66b8a321d4021b86f57c41..e4c1fd44b53fe5343a4c7c54fe9357dddd9ec323 100644 (file)
@@ -88,11 +88,11 @@ protected:
        bool abort_flag;\r
        svc_fileReader *reader;\r
        FLAC__SeekableStreamDecoder *decoder;\r
-       FLAC__StreamMetadata_StreamInfo stream_info;\r
+       FLAC__StreamMetadata streaminfo;\r
        FLAC__int16 reservoir[FLAC__MAX_BLOCK_SIZE * 2 * 2]; // *2 for max channels, another *2 for overflow\r
        unsigned char output[576 * 2 * (16/8)]; // *2 for max channels, (16/8) for max bytes per sample\r
 \r
-       unsigned lengthInMsec() { return (unsigned)((FLAC__uint64)1000 * stream_info.total_samples / stream_info.sample_rate); }\r
+       unsigned lengthInMsec() { return (unsigned)((FLAC__uint64)1000 * streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate); }\r
 private:\r
        void cleanup();\r
        static FLAC__SeekableStreamDecoderReadStatus readCallback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);\r
index 3984555788a1a4c3c5a1a32bf2a45582d75d6523..61f185f67e5c3225b3d7fecabf4dd474af0d9244 100644 (file)
@@ -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;