From 0d8b551c5a3aeadfd6901469946078d5a95ecb42 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:05 +0200 Subject: added parameter total_time to decoder_initialized() Similar to the previous patch: pass total_time instead of manipulating dc->totalTime directly. --- src/inputPlugins/audiofile_plugin.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/inputPlugins/audiofile_plugin.c') diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index f96ea2fca..a50061d2b 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -46,6 +46,7 @@ static int audiofile_decode(struct decoder * decoder, char *path) AFfilehandle af_fp; int bits; AudioFormat audio_format; + float total_time; mpd_uint16 bitRate; struct stat st; @@ -71,10 +72,9 @@ static int audiofile_decode(struct decoder * decoder, char *path) frame_count = afGetFrameCount(af_fp, AF_DEFAULT_TRACK); - dc.totalTime = - ((float)frame_count / (float)audio_format.sampleRate); + total_time = ((float)frame_count / (float)audio_format.sampleRate); - bitRate = (mpd_uint16)(st.st_size * 8.0 / dc.totalTime / 1000.0 + 0.5); + bitRate = (mpd_uint16)(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", @@ -85,7 +85,7 @@ static int audiofile_decode(struct decoder * decoder, char *path) fs = (int)afGetVirtualFrameSize(af_fp, AF_DEFAULT_TRACK, 1); - decoder_initialized(decoder, &audio_format); + decoder_initialized(decoder, &audio_format, total_time); { int ret, eof = 0, current = 0; -- cgit v1.2.3