diff options
Diffstat (limited to '')
-rw-r--r-- | src/audio.h | 5 | ||||
-rw-r--r-- | src/decode.c | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/audio.h b/src/audio.h index 548beb806..ef0f211c2 100644 --- a/src/audio.h +++ b/src/audio.h @@ -35,6 +35,11 @@ typedef struct _AudioFormat { unsigned int audio_device_count(void); +static inline double audioFormatSizeToTime(const AudioFormat * af) +{ + return 8.0 / af->bits / af->channels / af->sampleRate; +} + void copyAudioFormat(AudioFormat * dest, AudioFormat * src); int cmpAudioFormat(AudioFormat * dest, AudioFormat * src); diff --git a/src/decode.c b/src/decode.c index 066176116..495251a09 100644 --- a/src/decode.c +++ b/src/decode.c @@ -466,9 +466,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * pc->sampleRate = dc->audioFormat.sampleRate; pc->bits = dc->audioFormat.bits; pc->channels = dc->audioFormat.channels; - sizeToTime = 8.0/cb->audioFormat.bits/ - cb->audioFormat.channels/ - cb->audioFormat.sampleRate; + sizeToTime = audioFormatSizeToTime(&cb->audioFormat); } else if(dc->state!=DECODE_STATE_START) { /* the decoder failed */ |