when converting from bps -> kbps, divide by 1000, not 1024
git-svn-id: https://svn.musicpd.org/mpd/trunk@592 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
785cdb0114
commit
73bcce335f
@ -357,7 +357,7 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
|
|||||||
if(sampleCount>0) {
|
if(sampleCount>0) {
|
||||||
bitRate = frameInfo.bytesconsumed*8.0*
|
bitRate = frameInfo.bytesconsumed*8.0*
|
||||||
frameInfo.channels*sampleRate/
|
frameInfo.channels*sampleRate/
|
||||||
frameInfo.samples/1024+0.5;
|
frameInfo.samples/1000+0.5;
|
||||||
time+= (float)(frameInfo.samples)/frameInfo.channels/
|
time+= (float)(frameInfo.samples)/frameInfo.channels/
|
||||||
sampleRate;
|
sampleRate;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
|
|||||||
|
|
||||||
cb->totalTime = ((float)frame_count/(float)af->sampleRate);
|
cb->totalTime = ((float)frame_count/(float)af->sampleRate);
|
||||||
|
|
||||||
bitRate = st.st_size*8.0/cb->totalTime/1024.0+0.5;
|
bitRate = st.st_size*8.0/cb->totalTime/1000.0+0.5;
|
||||||
|
|
||||||
if (af->bits != 8 && af->bits != 16) {
|
if (af->bits != 8 && af->bits != 16) {
|
||||||
ERROR("Only 8 and 16-bit files are supported. %s is %i-bit\n",
|
ERROR("Only 8 and 16-bit files are supported. %s is %i-bit\n",
|
||||||
|
@ -219,7 +219,7 @@ FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__FileDecoder *dec, const FLA
|
|||||||
FLAC__file_decoder_get_decode_position(dec,&newPosition);
|
FLAC__file_decoder_get_decode_position(dec,&newPosition);
|
||||||
if(data->position) {
|
if(data->position) {
|
||||||
data->bitRate = ((newPosition-data->position)*8.0/timeChange)
|
data->bitRate = ((newPosition-data->position)*8.0/timeChange)
|
||||||
/1024+0.5;
|
/1000+0.5;
|
||||||
}
|
}
|
||||||
data->position = newPosition;
|
data->position = newPosition;
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ int mp3ChildSendData(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
|
|||||||
|
|
||||||
memcpy(cb->chunks+cb->end*CHUNK_SIZE,data->outputBuffer,CHUNK_SIZE);
|
memcpy(cb->chunks+cb->end*CHUNK_SIZE,data->outputBuffer,CHUNK_SIZE);
|
||||||
cb->chunkSize[cb->end] = data->outputPtr-data->outputBuffer;
|
cb->chunkSize[cb->end] = data->outputPtr-data->outputBuffer;
|
||||||
cb->bitRate[cb->end] = data->bitRate/1024;
|
cb->bitRate[cb->end] = data->bitRate/1000;
|
||||||
cb->times[cb->end] = data->elapsedTime;
|
cb->times[cb->end] = data->elapsedTime;
|
||||||
|
|
||||||
cb->end++;
|
cb->end++;
|
||||||
|
@ -270,7 +270,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
|
|||||||
initial =0;
|
initial =0;
|
||||||
bitRate = frameInfo.bytesconsumed*8.0*
|
bitRate = frameInfo.bytesconsumed*8.0*
|
||||||
frameInfo.channels*scale/
|
frameInfo.channels*scale/
|
||||||
frameInfo.samples/1024+0.5;
|
frameInfo.samples/1000+0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
|
|||||||
chunkpos = 0;
|
chunkpos = 0;
|
||||||
cb->times[cb->end] = ov_time_tell(&vf);
|
cb->times[cb->end] = ov_time_tell(&vf);
|
||||||
if((test = ov_bitrate_instant(&vf))>0) {
|
if((test = ov_bitrate_instant(&vf))>0) {
|
||||||
bitRate = test/1024;
|
bitRate = test/1000;
|
||||||
}
|
}
|
||||||
cb->bitRate[cb->end] = bitRate;
|
cb->bitRate[cb->end] = bitRate;
|
||||||
cb->end++;
|
cb->end++;
|
||||||
|
Loading…
Reference in New Issue
Block a user