2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Use DocumentData::getDuration for all types.

This commit is contained in:
John Preston
2019-03-06 12:21:42 +04:00
parent 41c60419f1
commit 01d763eed1
11 changed files with 27 additions and 41 deletions

View File

@@ -1397,8 +1397,15 @@ bool DocumentData::isVideoFile() const {
return (type == VideoDocument);
}
int32 DocumentData::duration() const {
return (isAnimation() || isVideoFile()) ? _duration : -1;
TimeId DocumentData::getDuration() const {
if (const auto song = this->song()) {
return std::max(song->duration, 0);
} else if (const auto voice = this->voice()) {
return std::max(voice->duration, 0);
} else if (isAnimation() || isVideoFile()) {
return std::max(_duration, 0);
}
return -1;
}
bool DocumentData::isImage() const {