moved expression to audioFormatSizeToTime()
The multi-line expression which calculates sizeToTime is hard to read, partly because "cb->audioFormat." is too long. Create a separate inline function in audio.h for that. git-svn-id: https://svn.musicpd.org/mpd/trunk@7277 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
dc55e13ca1
commit
646260b19e
@ -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);
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user