mirror of
https://github.com/taglib/taglib.git
synced 2025-06-03 09:08:09 -04:00
mp4 properties: handle the case when mp4 file header has zero bitrate
calculate it based on filesize and length
This commit is contained in:
parent
6455671ece
commit
6ca536b5b6
@ -213,7 +213,12 @@ MP4::Properties::read(File *file, Atoms *atoms)
|
||||
pos += 3;
|
||||
}
|
||||
pos += 10;
|
||||
d->bitrate = static_cast<int>((data.toUInt(pos) + 500) / 1000.0 + 0.5);
|
||||
if(data.toUInt(pos) != 0u || d->length <= 0) {
|
||||
d->bitrate = static_cast<int>((data.toUInt(pos) + 500) / 1000.0 + 0.5);
|
||||
}
|
||||
else {
|
||||
d->bitrate = 8 * (file->length() - atom->offset - atom->length) / d->length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user