aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/audiofile_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:05 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:05 +0200
commit0d8b551c5a3aeadfd6901469946078d5a95ecb42 (patch)
tree3fd36e06ef46dfcfc7f9e426b42668318aec8d59 /src/inputPlugins/audiofile_plugin.c
parent4590a98f0eb9484e185e7e0c25a3373c8e9076ea (diff)
downloadmpd-0d8b551c5a3aeadfd6901469946078d5a95ecb42.tar.gz
mpd-0d8b551c5a3aeadfd6901469946078d5a95ecb42.tar.xz
mpd-0d8b551c5a3aeadfd6901469946078d5a95ecb42.zip
added parameter total_time to decoder_initialized()
Similar to the previous patch: pass total_time instead of manipulating dc->totalTime directly.
Diffstat (limited to 'src/inputPlugins/audiofile_plugin.c')
-rw-r--r--src/inputPlugins/audiofile_plugin.c8
1 files changed, 4 insertions, 4 deletions
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;