diff options
Diffstat (limited to '')
-rw-r--r-- | src/decode.c | 8 | ||||
-rw-r--r-- | src/inputPlugins/aac_plugin.c | 23 | ||||
-rw-r--r-- | src/inputPlugins/mp4_plugin.c | 25 | ||||
-rw-r--r-- | src/inputPlugins/wavpack_plugin.c | 8 | ||||
-rw-r--r-- | src/outputBuffer.h | 2 | ||||
-rw-r--r-- | src/player.h | 4 | ||||
-rw-r--r-- | src/playlist.h | 4 |
7 files changed, 38 insertions, 36 deletions
diff --git a/src/decode.c b/src/decode.c index fea4f8b8b..7d292726d 100644 --- a/src/decode.c +++ b/src/decode.c @@ -401,7 +401,7 @@ static int playChunk(PlayerControl * pc, OutputBufferChunk * chunk, static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) { - int pause = 0; + int do_pause = 0; int buffering = 1; unsigned int bbp = buffered_before_play; /** cross fading enabled for the current song? 0=must check; @@ -428,7 +428,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * while (1) { processDecodeInput(pc, dc, cb, - &pause, &bbp, &doCrossFade, + &do_pause, &bbp, &doCrossFade, &decodeWaitedOn, &next); if (pc->stop) { dropBufferedAudio(); @@ -461,7 +461,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * } else { player_wakeup_decoder(); } - if (pause) { + if (do_pause) { dropBufferedAudio(); closeAudioDevice(); } @@ -519,7 +519,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * race conditions and weirdness */ end = cb->end; - if (pause) + if (do_pause) player_sleep(); else if (!outputBufferEmpty(cb) && cb->begin != next) { OutputBufferChunk *beginChunk = diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index 5d8eb74f3..2962b57c6 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -273,18 +273,18 @@ static float getAacFloatTotalTime(char *file) static int getAacTotalTime(char *file) { - int time = -1; + int file_time = -1; float length; 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) { - float time; + float file_time; float totalTime; faacDecHandle decoder; faacDecFrameInfo frameInfo; @@ -343,7 +343,7 @@ static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path) dc->totalTime = totalTime; - time = 0.0; + file_time = 0.0; advanceAacBuffer(&b, bread); @@ -388,7 +388,7 @@ static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path) bitRate = frameInfo.bytesconsumed * 8.0 * frameInfo.channels * sampleRate / frameInfo.samples / 1000 + 0.5; - time += + file_time += (float)(frameInfo.samples) / frameInfo.channels / sampleRate; } @@ -396,7 +396,8 @@ static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path) sampleBufferLen = sampleCount * 2; sendDataToOutputBuffer(cb, NULL, dc, 0, sampleBuffer, - sampleBufferLen, time, bitRate, NULL); + sampleBufferLen, file_time, + bitRate, NULL); if (dc->seek) { dc->seekError = 1; dc->seek = 0; @@ -428,14 +429,12 @@ static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path) static MpdTag *aacTagDup(char *file) { MpdTag *ret = NULL; - int time; + int file_time = getAacTotalTime(file); - time = getAacTotalTime(file); - - if (time >= 0) { + if (file_time >= 0) { if ((ret = id3Dup(file)) == NULL) ret = newMpdTag(); - ret->time = time; + ret->time = file_time; } else { DEBUG("aacTagDup: Failed to get total song time from: %s\n", file); diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 7f7ff9433..1e755b95c 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -90,7 +90,7 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, mp4ff_t *mp4fh; mp4ff_callback_t *mp4cb; int32_t track; - float time; + float file_time; int32_t scale; faacDecHandle decoder; faacDecFrameInfo frameInfo; @@ -163,7 +163,7 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, dc->audioFormat.sampleRate = sampleRate; 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); if (mp4Buffer) @@ -176,11 +176,11 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, free(mp4cb); return -1; } - dc->totalTime = ((float)time) / scale; + dc->totalTime = ((float)file_time) / scale; numSamples = mp4ff_num_samples(mp4fh, track); - time = 0.0; + file_time = 0.0; seekTable = xmalloc(sizeof(float) * numSamples); @@ -194,14 +194,14 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, while (seekTable[i] < dc->seekWhere) i++; sampleId = i - 1; - time = seekTable[sampleId]; + file_time = seekTable[sampleId]; } dur = mp4ff_get_sample_duration(mp4fh, track, sampleId); offset = mp4ff_get_sample_offset(mp4fh, track, sampleId); if (sampleId > seekTableEnd) { - seekTable[sampleId] = time; + seekTable[sampleId] = file_time; seekTableEnd = sampleId; } @@ -211,9 +211,9 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, dur = 0; else dur -= offset; - time += ((float)dur) / scale; + file_time += ((float)dur) / scale; - if (seeking && time > dc->seekWhere) + if (seeking && file_time > dc->seekWhere) seekPositionFound = 1; if (seeking && seekPositionFound) { @@ -279,7 +279,8 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, sampleBuffer += offset * channels * 2; sendDataToOutputBuffer(cb, inStream, dc, 1, sampleBuffer, - sampleBufferLen, time, bitRate, NULL); + sampleBufferLen, file_time, + bitRate, NULL); if (dc->stop) { eof = 1; break; @@ -311,7 +312,7 @@ static MpdTag *mp4DataDup(char *file, int *mp4MetadataFound) mp4ff_t *mp4fh; mp4ff_callback_t *cb; int32_t track; - int32_t time; + int32_t file_time; int32_t scale; int i; @@ -343,7 +344,7 @@ static MpdTag *mp4DataDup(char *file, int *mp4MetadataFound) } 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); if (scale < 0) { mp4ff_close(mp4fh); @@ -352,7 +353,7 @@ static MpdTag *mp4DataDup(char *file, int *mp4MetadataFound) freeMpdTag(ret); 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++) { char *item; diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index 527e60a56..41753c62f 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -133,7 +133,7 @@ static void wavpack_decode(OutputBuffer *cb, DecoderControl *dc, { void (*format_samples)(int Bps, void *buffer, uint32_t samcnt); char chunk[CHUNK_SIZE]; - float time; + float file_time; int samplesreq, samplesgot; int allsamples; int position, outsamplesize; @@ -204,14 +204,16 @@ static void wavpack_decode(OutputBuffer *cb, DecoderControl *dc, int bitrate = (int)(WavpackGetInstantBitrate(wpc) / 1000 + 0.5); position += samplesgot; - time = (float)position / dc->audioFormat.sampleRate; + file_time = (float)position / + dc->audioFormat.sampleRate; format_samples(Bps, chunk, samplesgot * dc->audioFormat.channels); sendDataToOutputBuffer(cb, NULL, dc, 0, chunk, samplesgot * outsamplesize, - time, bitrate, replayGainInfo); + file_time, bitrate, + replayGainInfo); } } while (samplesgot == samplesreq); diff --git a/src/outputBuffer.h b/src/outputBuffer.h index 21c375f96..d42400070 100644 --- a/src/outputBuffer.h +++ b/src/outputBuffer.h @@ -94,7 +94,7 @@ int sendDataToOutputBuffer(OutputBuffer * cb, int seekable, void *data, size_t datalen, - float time, + float data_time, mpd_uint16 bitRate, ReplayGainInfo * replayGainInfo); #endif diff --git a/src/player.h b/src/player.h index 7f43cc0d8..4260d149a 100644 --- a/src/player.h +++ b/src/player.h @@ -88,7 +88,7 @@ void player_sleep(void); int playerPlay(int fd, Song * song); -int playerSetPause(int fd, int pause); +int playerSetPause(int fd, int pause_flag); int playerPause(int fd); @@ -122,7 +122,7 @@ void playerQueueLock(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); diff --git a/src/playlist.h b/src/playlist.h index 76ef19f31..7d6c92a14 100644 --- a/src/playlist.h +++ b/src/playlist.h @@ -124,9 +124,9 @@ unsigned long getPlaylistVersion(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); |