switch to C99 types, part II
Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
This commit is contained in:
@@ -161,9 +161,9 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
|
||||
|
||||
switch (block->type) {
|
||||
case FLAC__METADATA_TYPE_STREAMINFO:
|
||||
data->audio_format.bits = (mpd_sint8)si->bits_per_sample;
|
||||
data->audio_format.bits = (int8_t)si->bits_per_sample;
|
||||
data->audio_format.sampleRate = si->sample_rate;
|
||||
data->audio_format.channels = (mpd_sint8)si->channels;
|
||||
data->audio_format.channels = (int8_t)si->channels;
|
||||
data->total_time = ((float)si->total_samples) / (si->sample_rate);
|
||||
break;
|
||||
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
|
||||
|
||||
@@ -50,7 +50,7 @@ static int audiofile_decode(struct decoder * decoder, char *path)
|
||||
int bits;
|
||||
struct audio_format audio_format;
|
||||
float total_time;
|
||||
mpd_uint16 bitRate;
|
||||
uint16_t bitRate;
|
||||
struct stat st;
|
||||
int ret, current = 0;
|
||||
char chunk[CHUNK_SIZE];
|
||||
@@ -69,17 +69,17 @@ static int audiofile_decode(struct decoder * decoder, char *path)
|
||||
afSetVirtualSampleFormat(af_fp, AF_DEFAULT_TRACK,
|
||||
AF_SAMPFMT_TWOSCOMP, 16);
|
||||
afGetVirtualSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits);
|
||||
audio_format.bits = (mpd_uint8)bits;
|
||||
audio_format.bits = (uint8_t)bits;
|
||||
audio_format.sampleRate =
|
||||
(unsigned int)afGetRate(af_fp, AF_DEFAULT_TRACK);
|
||||
audio_format.channels =
|
||||
(mpd_uint8)afGetVirtualChannels(af_fp, AF_DEFAULT_TRACK);
|
||||
(uint8_t)afGetVirtualChannels(af_fp, AF_DEFAULT_TRACK);
|
||||
|
||||
frame_count = afGetFrameCount(af_fp, AF_DEFAULT_TRACK);
|
||||
|
||||
total_time = ((float)frame_count / (float)audio_format.sampleRate);
|
||||
|
||||
bitRate = (mpd_uint16)(st.st_size * 8.0 / total_time / 1000.0 + 0.5);
|
||||
bitRate = (uint16_t)(st.st_size * 8.0 / total_time / 1000.0 + 0.5);
|
||||
|
||||
if (audio_format.bits != 8 && audio_format.bits != 16) {
|
||||
ERROR("Only 8 and 16-bit files are supported. %s is %i-bit\n",
|
||||
|
||||
@@ -66,10 +66,10 @@ static mpc_int32_t mpc_getsize_cb(void *vdata)
|
||||
}
|
||||
|
||||
/* this _looks_ performance-critical, don't de-inline -- eric */
|
||||
static inline mpd_sint16 convertSample(MPC_SAMPLE_FORMAT sample)
|
||||
static inline int16_t convertSample(MPC_SAMPLE_FORMAT sample)
|
||||
{
|
||||
/* only doing 16-bit audio for now */
|
||||
mpd_sint32 val;
|
||||
int32_t val;
|
||||
|
||||
const int clip_min = -1 << (16 - 1);
|
||||
const int clip_max = (1 << (16 - 1)) - 1;
|
||||
@@ -114,7 +114,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
|
||||
char chunk[MPC_CHUNK_SIZE];
|
||||
int chunkpos = 0;
|
||||
long bitRate = 0;
|
||||
mpd_sint16 *s16 = (mpd_sint16 *) chunk;
|
||||
int16_t *s16 = (int16_t *) chunk;
|
||||
unsigned long samplePos = 0;
|
||||
mpc_uint32_t vbrUpdateAcc;
|
||||
mpc_uint32_t vbrUpdateBits;
|
||||
@@ -171,7 +171,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
|
||||
audio_format.sampleRate;
|
||||
if (mpc_decoder_seek_sample(&decoder, samplePos)) {
|
||||
decoder_clear(mpd_decoder);
|
||||
s16 = (mpd_sint16 *) chunk;
|
||||
s16 = (int16_t *) chunk;
|
||||
chunkpos = 0;
|
||||
decoder_command_finished(mpd_decoder);
|
||||
} else
|
||||
@@ -213,7 +213,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
|
||||
bitRate, replayGainInfo);
|
||||
|
||||
chunkpos = 0;
|
||||
s16 = (mpd_sint16 *) chunk;
|
||||
s16 = (int16_t *) chunk;
|
||||
if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_STOP) {
|
||||
eof = 1;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user