aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-03-20 14:27:35 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-03-20 14:27:35 +0000
commitcf2986c68f20e7cfb1c8dbe457a17038c57eff37 (patch)
treec9b2e49e4a16ce4941db95a5ffa64cb3e55d07b6 /src
parentffd0ccfc3be26640d2bb237debc249e3c46b4bb8 (diff)
downloadmpd-cf2986c68f20e7cfb1c8dbe457a17038c57eff37.tar.gz
mpd-cf2986c68f20e7cfb1c8dbe457a17038c57eff37.tar.xz
mpd-cf2986c68f20e7cfb1c8dbe457a17038c57eff37.zip
average bitrate for mp4's
git-svn-id: https://svn.musicpd.org/mpd/trunk@325 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/mp3_decode.c2
-rw-r--r--src/mp4_decode.c3
-rw-r--r--src/ogg_decode.c2
3 files changed, 5 insertions, 2 deletions
diff --git a/src/mp3_decode.c b/src/mp3_decode.c
index ede0af6e3..ec495b002 100644
--- a/src/mp3_decode.c
+++ b/src/mp3_decode.c
@@ -409,7 +409,7 @@ int mp3ChildSendData(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
#endif
memcpy(cb->chunks+cb->end*CHUNK_SIZE,data->outputBuffer,CHUNK_SIZE);
cb->chunkSize[cb->end] = data->outputPtr-data->outputBuffer;
- cb->bitRate[cb->end] = data->bitRate/1000;
+ cb->bitRate[cb->end] = data->bitRate/1024;
cb->times[cb->end] = data->elapsedTime;
cb->end++;
diff --git a/src/mp4_decode.c b/src/mp4_decode.c
index 19b076845..587f437f3 100644
--- a/src/mp4_decode.c
+++ b/src/mp4_decode.c
@@ -98,6 +98,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
long seekTableEnd = -1;
int seekPositionFound = 0;
long offset;
+ mpd_uint16 bitRate;
fh = fopen(dc->file,"r");
if(!fh) {
@@ -155,6 +156,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
af->sampleRate = sampleRate;
af->channels = channels;
time = mp4ff_get_track_duration_use_offsets(mp4fh,track);
+ bitRate = mp4ff_get_avg_bitrate(mp4fh,track);
scale = mp4ff_time_scale(mp4fh,track);
if(mp4Buffer) free(mp4Buffer);
@@ -260,6 +262,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
memcpy(cb->chunks+cb->end*CHUNK_SIZE+chunkLen,
sampleBuffer,size);
cb->times[cb->end] = time;
+ cb->bitRate[cb->end] = bitRate/1024;
sampleBuffer+=size;
chunkLen+=size;
if(chunkLen>=CHUNK_SIZE) {
diff --git a/src/ogg_decode.c b/src/ogg_decode.c
index 1aaa4d6be..7fe3dfeb6 100644
--- a/src/ogg_decode.c
+++ b/src/ogg_decode.c
@@ -122,7 +122,7 @@ int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
chunkpos = 0;
cb->times[cb->end] = ov_time_tell(&vf);
if((test = ov_bitrate_instant(&vf))>0) {
- bitRate = test/1000;
+ bitRate = test/1024;
}
cb->bitRate[cb->end] = bitRate;
cb->end++;