diff options
Diffstat (limited to '')
-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 |
3 files changed, 29 insertions, 27 deletions
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); |