Fix a few more warnings from -Wshadow

git-svn-id: https://svn.musicpd.org/mpd/trunk@7300 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Eric Wong 2008-04-12 04:16:32 +00:00
parent 4e4441fd32
commit f275a1a1ab
7 changed files with 38 additions and 36 deletions

View File

@ -401,7 +401,7 @@ static int playChunk(PlayerControl * pc, OutputBufferChunk * chunk,
static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb)
{ {
int pause = 0; int do_pause = 0;
int buffering = 1; int buffering = 1;
unsigned int bbp = buffered_before_play; unsigned int bbp = buffered_before_play;
/** cross fading enabled for the current song? 0=must check; /** cross fading enabled for the current song? 0=must check;
@ -428,7 +428,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
while (1) { while (1) {
processDecodeInput(pc, dc, cb, processDecodeInput(pc, dc, cb,
&pause, &bbp, &doCrossFade, &do_pause, &bbp, &doCrossFade,
&decodeWaitedOn, &next); &decodeWaitedOn, &next);
if (pc->stop) { if (pc->stop) {
dropBufferedAudio(); dropBufferedAudio();
@ -461,7 +461,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
} else { } else {
player_wakeup_decoder(); player_wakeup_decoder();
} }
if (pause) { if (do_pause) {
dropBufferedAudio(); dropBufferedAudio();
closeAudioDevice(); closeAudioDevice();
} }
@ -519,7 +519,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
race conditions and weirdness */ race conditions and weirdness */
end = cb->end; end = cb->end;
if (pause) if (do_pause)
player_sleep(); player_sleep();
else if (!outputBufferEmpty(cb) && cb->begin != next) { else if (!outputBufferEmpty(cb) && cb->begin != next) {
OutputBufferChunk *beginChunk = OutputBufferChunk *beginChunk =

View File

@ -273,18 +273,18 @@ static float getAacFloatTotalTime(char *file)
static int getAacTotalTime(char *file) static int getAacTotalTime(char *file)
{ {
int time = -1; int file_time = -1;
float length; float length;
if ((length = getAacFloatTotalTime(file)) >= 0) if ((length = getAacFloatTotalTime(file)) >= 0)
time = length + 0.5; file_time = length + 0.5;
return time; return file_time;
} }
static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path) static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
{ {
float time; float file_time;
float totalTime; float totalTime;
faacDecHandle decoder; faacDecHandle decoder;
faacDecFrameInfo frameInfo; faacDecFrameInfo frameInfo;
@ -343,7 +343,7 @@ static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
dc->totalTime = totalTime; dc->totalTime = totalTime;
time = 0.0; file_time = 0.0;
advanceAacBuffer(&b, bread); advanceAacBuffer(&b, bread);
@ -388,7 +388,7 @@ static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
bitRate = frameInfo.bytesconsumed * 8.0 * bitRate = frameInfo.bytesconsumed * 8.0 *
frameInfo.channels * sampleRate / frameInfo.channels * sampleRate /
frameInfo.samples / 1000 + 0.5; frameInfo.samples / 1000 + 0.5;
time += file_time +=
(float)(frameInfo.samples) / frameInfo.channels / (float)(frameInfo.samples) / frameInfo.channels /
sampleRate; sampleRate;
} }
@ -396,7 +396,8 @@ static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
sampleBufferLen = sampleCount * 2; sampleBufferLen = sampleCount * 2;
sendDataToOutputBuffer(cb, NULL, dc, 0, sampleBuffer, sendDataToOutputBuffer(cb, NULL, dc, 0, sampleBuffer,
sampleBufferLen, time, bitRate, NULL); sampleBufferLen, file_time,
bitRate, NULL);
if (dc->seek) { if (dc->seek) {
dc->seekError = 1; dc->seekError = 1;
dc->seek = 0; dc->seek = 0;
@ -428,14 +429,12 @@ static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
static MpdTag *aacTagDup(char *file) static MpdTag *aacTagDup(char *file)
{ {
MpdTag *ret = NULL; MpdTag *ret = NULL;
int time; int file_time = getAacTotalTime(file);
time = getAacTotalTime(file); if (file_time >= 0) {
if (time >= 0) {
if ((ret = id3Dup(file)) == NULL) if ((ret = id3Dup(file)) == NULL)
ret = newMpdTag(); ret = newMpdTag();
ret->time = time; ret->time = file_time;
} else { } else {
DEBUG("aacTagDup: Failed to get total song time from: %s\n", DEBUG("aacTagDup: Failed to get total song time from: %s\n",
file); file);

View File

@ -90,7 +90,7 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc,
mp4ff_t *mp4fh; mp4ff_t *mp4fh;
mp4ff_callback_t *mp4cb; mp4ff_callback_t *mp4cb;
int32_t track; int32_t track;
float time; float file_time;
int32_t scale; int32_t scale;
faacDecHandle decoder; faacDecHandle decoder;
faacDecFrameInfo frameInfo; faacDecFrameInfo frameInfo;
@ -163,7 +163,7 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc,
dc->audioFormat.sampleRate = sampleRate; dc->audioFormat.sampleRate = sampleRate;
dc->audioFormat.channels = channels; dc->audioFormat.channels = channels;
time = mp4ff_get_track_duration_use_offsets(mp4fh, track); file_time = mp4ff_get_track_duration_use_offsets(mp4fh, track);
scale = mp4ff_time_scale(mp4fh, track); scale = mp4ff_time_scale(mp4fh, track);
if (mp4Buffer) if (mp4Buffer)
@ -176,11 +176,11 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc,
free(mp4cb); free(mp4cb);
return -1; return -1;
} }
dc->totalTime = ((float)time) / scale; dc->totalTime = ((float)file_time) / scale;
numSamples = mp4ff_num_samples(mp4fh, track); numSamples = mp4ff_num_samples(mp4fh, track);
time = 0.0; file_time = 0.0;
seekTable = xmalloc(sizeof(float) * numSamples); seekTable = xmalloc(sizeof(float) * numSamples);
@ -194,14 +194,14 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc,
while (seekTable[i] < dc->seekWhere) while (seekTable[i] < dc->seekWhere)
i++; i++;
sampleId = i - 1; sampleId = i - 1;
time = seekTable[sampleId]; file_time = seekTable[sampleId];
} }
dur = mp4ff_get_sample_duration(mp4fh, track, sampleId); dur = mp4ff_get_sample_duration(mp4fh, track, sampleId);
offset = mp4ff_get_sample_offset(mp4fh, track, sampleId); offset = mp4ff_get_sample_offset(mp4fh, track, sampleId);
if (sampleId > seekTableEnd) { if (sampleId > seekTableEnd) {
seekTable[sampleId] = time; seekTable[sampleId] = file_time;
seekTableEnd = sampleId; seekTableEnd = sampleId;
} }
@ -211,9 +211,9 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc,
dur = 0; dur = 0;
else else
dur -= offset; dur -= offset;
time += ((float)dur) / scale; file_time += ((float)dur) / scale;
if (seeking && time > dc->seekWhere) if (seeking && file_time > dc->seekWhere)
seekPositionFound = 1; seekPositionFound = 1;
if (seeking && seekPositionFound) { if (seeking && seekPositionFound) {
@ -279,7 +279,8 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc,
sampleBuffer += offset * channels * 2; sampleBuffer += offset * channels * 2;
sendDataToOutputBuffer(cb, inStream, dc, 1, sampleBuffer, sendDataToOutputBuffer(cb, inStream, dc, 1, sampleBuffer,
sampleBufferLen, time, bitRate, NULL); sampleBufferLen, file_time,
bitRate, NULL);
if (dc->stop) { if (dc->stop) {
eof = 1; eof = 1;
break; break;
@ -311,7 +312,7 @@ static MpdTag *mp4DataDup(char *file, int *mp4MetadataFound)
mp4ff_t *mp4fh; mp4ff_t *mp4fh;
mp4ff_callback_t *cb; mp4ff_callback_t *cb;
int32_t track; int32_t track;
int32_t time; int32_t file_time;
int32_t scale; int32_t scale;
int i; int i;
@ -343,7 +344,7 @@ static MpdTag *mp4DataDup(char *file, int *mp4MetadataFound)
} }
ret = newMpdTag(); ret = newMpdTag();
time = mp4ff_get_track_duration_use_offsets(mp4fh, track); file_time = mp4ff_get_track_duration_use_offsets(mp4fh, track);
scale = mp4ff_time_scale(mp4fh, track); scale = mp4ff_time_scale(mp4fh, track);
if (scale < 0) { if (scale < 0) {
mp4ff_close(mp4fh); mp4ff_close(mp4fh);
@ -352,7 +353,7 @@ static MpdTag *mp4DataDup(char *file, int *mp4MetadataFound)
freeMpdTag(ret); freeMpdTag(ret);
return NULL; return NULL;
} }
ret->time = ((float)time) / scale + 0.5; ret->time = ((float)file_time) / scale + 0.5;
for (i = 0; i < mp4ff_meta_get_num_items(mp4fh); i++) { for (i = 0; i < mp4ff_meta_get_num_items(mp4fh); i++) {
char *item; char *item;

View File

@ -133,7 +133,7 @@ static void wavpack_decode(OutputBuffer *cb, DecoderControl *dc,
{ {
void (*format_samples)(int Bps, void *buffer, uint32_t samcnt); void (*format_samples)(int Bps, void *buffer, uint32_t samcnt);
char chunk[CHUNK_SIZE]; char chunk[CHUNK_SIZE];
float time; float file_time;
int samplesreq, samplesgot; int samplesreq, samplesgot;
int allsamples; int allsamples;
int position, outsamplesize; int position, outsamplesize;
@ -204,14 +204,16 @@ static void wavpack_decode(OutputBuffer *cb, DecoderControl *dc,
int bitrate = (int)(WavpackGetInstantBitrate(wpc) / int bitrate = (int)(WavpackGetInstantBitrate(wpc) /
1000 + 0.5); 1000 + 0.5);
position += samplesgot; position += samplesgot;
time = (float)position / dc->audioFormat.sampleRate; file_time = (float)position /
dc->audioFormat.sampleRate;
format_samples(Bps, chunk, format_samples(Bps, chunk,
samplesgot * dc->audioFormat.channels); samplesgot * dc->audioFormat.channels);
sendDataToOutputBuffer(cb, NULL, dc, 0, chunk, sendDataToOutputBuffer(cb, NULL, dc, 0, chunk,
samplesgot * outsamplesize, samplesgot * outsamplesize,
time, bitrate, replayGainInfo); file_time, bitrate,
replayGainInfo);
} }
} while (samplesgot == samplesreq); } while (samplesgot == samplesreq);

View File

@ -94,7 +94,7 @@ int sendDataToOutputBuffer(OutputBuffer * cb,
int seekable, int seekable,
void *data, void *data,
size_t datalen, size_t datalen,
float time, float data_time,
mpd_uint16 bitRate, ReplayGainInfo * replayGainInfo); mpd_uint16 bitRate, ReplayGainInfo * replayGainInfo);
#endif #endif

View File

@ -88,7 +88,7 @@ void player_sleep(void);
int playerPlay(int fd, Song * song); int playerPlay(int fd, Song * song);
int playerSetPause(int fd, int pause); int playerSetPause(int fd, int pause_flag);
int playerPause(int fd); int playerPause(int fd);
@ -122,7 +122,7 @@ void playerQueueLock(void);
void playerQueueUnlock(void); void playerQueueUnlock(void);
int playerSeek(int fd, Song * song, float time); int playerSeek(int fd, Song * song, float seek_time);
void setPlayerCrossFade(float crossFadeInSeconds); void setPlayerCrossFade(float crossFadeInSeconds);

View File

@ -124,9 +124,9 @@ unsigned long getPlaylistVersion(void);
void playPlaylistIfPlayerStopped(void); void playPlaylistIfPlayerStopped(void);
int seekSongInPlaylist(int fd, int song, float time); int seekSongInPlaylist(int fd, int song, float seek_time);
int seekSongInPlaylistById(int fd, int id, float time); int seekSongInPlaylistById(int fd, int id, float seek_time);
void playlistVersionChange(void); void playlistVersionChange(void);