Correctly detect Webm stickers.

This commit is contained in:
John Preston 2022-01-20 12:24:21 +03:00
parent 8b7d2c880e
commit 2f01efdd64
1 changed files with 13 additions and 7 deletions

View File

@ -321,21 +321,25 @@ void DocumentData::setattributes(
dimensions = QSize(data.vw().v, data.vh().v); dimensions = QSize(data.vw().v, data.vh().v);
}, [&](const MTPDdocumentAttributeAnimated &data) { }, [&](const MTPDdocumentAttributeAnimated &data) {
if (type == FileDocument if (type == FileDocument
|| type == StickerDocument || type == VideoDocument
|| type == VideoDocument) { || (sticker() && sticker()->type != StickerType::Webm)) {
type = AnimatedDocument; type = AnimatedDocument;
_additional = nullptr; _additional = nullptr;
} }
}, [&](const MTPDdocumentAttributeSticker &data) { }, [&](const MTPDdocumentAttributeSticker &data) {
if (type == FileDocument) { const auto was = type;
if (type == FileDocument || type == VideoDocument) {
type = StickerDocument; type = StickerDocument;
_additional = std::make_unique<StickerData>(); _additional = std::make_unique<StickerData>();
} }
if (sticker()) { if (const auto info = sticker()) {
sticker()->alt = qs(data.valt()); if (was == VideoDocument) {
if (!sticker()->set.id info->type = StickerType::Webm;
}
info->alt = qs(data.valt());
if (!info->set.id
|| data.vstickerset().type() == mtpc_inputStickerSetID) { || data.vstickerset().type() == mtpc_inputStickerSetID) {
sticker()->set = data.vstickerset().match([&]( info->set = data.vstickerset().match([&](
const MTPDinputStickerSetID &data) { const MTPDinputStickerSetID &data) {
return StickerSetIdentifier{ return StickerSetIdentifier{
.id = data.vid().v, .id = data.vid().v,
@ -355,6 +359,8 @@ void DocumentData::setattributes(
type = data.is_round_message() type = data.is_round_message()
? RoundVideoDocument ? RoundVideoDocument
: VideoDocument; : VideoDocument;
} else if (const auto info = sticker()) {
info->type = StickerType::Webm;
} }
_duration = data.vduration().v; _duration = data.vduration().v;
setMaybeSupportsStreaming(data.is_supports_streaming()); setMaybeSupportsStreaming(data.is_supports_streaming());