2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Allow WebDocument video thumbnails.

This commit is contained in:
John Preston
2020-05-22 19:23:19 +04:00
parent 0834920db8
commit 3f26fc9f55
5 changed files with 40 additions and 16 deletions

View File

@@ -2482,15 +2482,20 @@ void Session::documentConvert(
DocumentData *Session::documentFromWeb(
const MTPWebDocument &data,
const ImageLocation &thumbnailLocation) {
const ImageLocation &thumbnailLocation,
const ImageLocation &videoThumbnailLocation) {
return data.match([&](const auto &data) {
return documentFromWeb(data, thumbnailLocation);
return documentFromWeb(
data,
thumbnailLocation,
videoThumbnailLocation);
});
}
DocumentData *Session::documentFromWeb(
const MTPDwebDocument &data,
const ImageLocation &thumbnailLocation) {
const ImageLocation &thumbnailLocation,
const ImageLocation &videoThumbnailLocation) {
const auto result = document(
rand_value<DocumentId>(),
uint64(0),
@@ -2500,7 +2505,7 @@ DocumentData *Session::documentFromWeb(
data.vmime_type().v,
QByteArray(),
ImageWithLocation{ .location = thumbnailLocation },
ImageWithLocation(),
ImageWithLocation{ .location = videoThumbnailLocation },
MTP::maindc(),
int32(0)); // data.vsize().v
result->setWebLocation(WebFileLocation(
@@ -2511,7 +2516,8 @@ DocumentData *Session::documentFromWeb(
DocumentData *Session::documentFromWeb(
const MTPDwebDocumentNoProxy &data,
const ImageLocation &thumbnailLocation) {
const ImageLocation &thumbnailLocation,
const ImageLocation &videoThumbnailLocation) {
const auto result = document(
rand_value<DocumentId>(),
uint64(0),
@@ -2521,7 +2527,7 @@ DocumentData *Session::documentFromWeb(
data.vmime_type().v,
QByteArray(),
ImageWithLocation{ .location = thumbnailLocation },
ImageWithLocation(),
ImageWithLocation{ .location = videoThumbnailLocation },
MTP::maindc(),
int32(0)); // data.vsize().v
result->setContentUrl(qs(data.vurl()));