2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Detect and send supports_streaming bit for videos.

This commit is contained in:
John Preston
2018-11-07 18:07:20 +04:00
parent a2b04c9d71
commit ef38572d5a
9 changed files with 137 additions and 5 deletions

View File

@@ -438,6 +438,8 @@ not_null<AuthSession*> DocumentData::session() const {
}
void DocumentData::setattributes(const QVector<MTPDocumentAttribute> &attributes) {
_isImage = false;
_supportsStreaming = false;
for (int32 i = 0, l = attributes.size(); i < l; ++i) {
switch (attributes[i].type()) {
case mtpc_documentAttributeImageSize: {
@@ -467,6 +469,7 @@ void DocumentData::setattributes(const QVector<MTPDocumentAttribute> &attributes
type = d.is_round_message() ? RoundVideoDocument : VideoDocument;
}
_duration = d.vduration.v;
_supportsStreaming = d.is_supports_streaming();
dimensions = QSize(d.vw.v, d.vh.v);
} break;
case mtpc_documentAttributeAudio: {
@@ -1295,14 +1298,17 @@ int32 DocumentData::duration() const {
}
bool DocumentData::isImage() const {
return !isAnimation() && !isVideoFile() && (_duration > 0);
return _isImage;
}
bool DocumentData::supportsStreaming() const {
return _supportsStreaming;
}
void DocumentData::recountIsImage() {
if (isAnimation() || isVideoFile()) {
return;
}
_duration = fileIsImage(filename(), mimeString()) ? 1 : -1; // hack
_isImage = !isAnimation()
&& !isVideoFile()
&& fileIsImage(filename(), mimeString());
}
bool DocumentData::hasGoodStickerThumb() const {