diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index b98875b0..e889f20e 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -170,6 +170,9 @@ inputFileGenerated original_path:string conversion:string expected_size:int32 = //@description Photo description @type Thumbnail type (see https://core.telegram.org/constructor/photoSize) @photo Information about the photo file @width Photo width @height Photo height photoSize type:string photo:file width:int32 height:int32 = PhotoSize; +//@description A very poor quality and low resolution image thumbnail @width Thumbnail width, usually doesn't exceed 40 @height Thumbnail height, usually doesn't exceed 40 @data The thumbnail +minithumbnail width:int32 height:int32 data:bytes = Minithumbnail; + //@class MaskPoint @description Part of the face, relative to which a mask should be placed @@ -198,19 +201,20 @@ pollOption text:string voter_count:int32 vote_percentage:int32 is_chosen:Bool is //@description Describes an animation file. The animation must be encoded in GIF or MPEG4 format @duration Duration of the animation, in seconds; as defined by the sender @width Width of the animation @height Height of the animation -//@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file, usually "image/gif" or "video/mp4" @thumbnail Animation thumbnail; may be null @animation File containing the animation -animation duration:int32 width:int32 height:int32 file_name:string mime_type:string thumbnail:photoSize animation:file = Animation; +//@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file, usually "image/gif" or "video/mp4" +//@minithumbnail Animation minithumbnail; may be null @thumbnail Animation thumbnail; may be null @animation File containing the animation +animation duration:int32 width:int32 height:int32 file_name:string mime_type:string minithumbnail:minithumbnail thumbnail:photoSize animation:file = Animation; //@description Describes an audio file. Audio is usually in MP3 format @duration Duration of the audio, in seconds; as defined by the sender @title Title of the audio; as defined by the sender @performer Performer of the audio; as defined by the sender -//@file_name Original name of the file; as defined by the sender @mime_type The MIME type of the file; as defined by the sender @album_cover_thumbnail The thumbnail of the album cover; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null @audio File containing the audio -audio duration:int32 title:string performer:string file_name:string mime_type:string album_cover_thumbnail:photoSize audio:file = Audio; +//@file_name Original name of the file; as defined by the sender @mime_type The MIME type of the file; as defined by the sender @album_cover_minithumbnail The minithumbnail of the album cover; may be null @album_cover_thumbnail The thumbnail of the album cover; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null @audio File containing the audio +audio duration:int32 title:string performer:string file_name:string mime_type:string album_cover_minithumbnail:minithumbnail album_cover_thumbnail:photoSize audio:file = Audio; //@description Describes a document of any type @file_name Original name of the file; as defined by the sender @mime_type MIME type of the file; as defined by the sender -//@thumbnail Document thumbnail; as defined by the sender; may be null @document File containing the document -document file_name:string mime_type:string thumbnail:photoSize document:file = Document; +//@minithumbnail Document minithumbnail; may be null @thumbnail Document thumbnail; as defined by the sender; may be null @document File containing the document +document file_name:string mime_type:string minithumbnail:minithumbnail thumbnail:photoSize document:file = Document; -//@description Describes a photo @has_stickers True, if stickers were added to the photo @sizes Available variants of the photo, in different sizes -photo has_stickers:Bool sizes:vector = Photo; +//@description Describes a photo @has_stickers True, if stickers were added to the photo @minithumbnail Photo minithumbnail; may be null @sizes Available variants of the photo, in different sizes +photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector = Photo; //@description Describes a sticker @set_id The identifier of the sticker set to which the sticker belongs; 0 if none @width Sticker width; as defined by the sender @height Sticker height; as defined by the sender //@emoji Emoji corresponding to the sticker @is_mask True, if the sticker is a mask @mask_position Position where the mask should be placed; may be null @thumbnail Sticker thumbnail in WEBP or JPEG format; may be null @sticker File containing the sticker @@ -218,11 +222,11 @@ sticker set_id:int64 width:int32 height:int32 emoji:string is_mask:Bool mask_pos //@description Describes a video file @duration Duration of the video, in seconds; as defined by the sender @width Video width; as defined by the sender @height Video height; as defined by the sender //@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file; as defined by the sender @has_stickers True, if stickers were added to the photo -//@supports_streaming True, if the video should be tried to be streamed @thumbnail Video thumbnail; as defined by the sender; may be null @video File containing the video -video duration:int32 width:int32 height:int32 file_name:string mime_type:string has_stickers:Bool supports_streaming:Bool thumbnail:photoSize video:file = Video; +//@supports_streaming True, if the video should be tried to be streamed @minithumbnail Video minithumbnail; may be null @thumbnail Video thumbnail; as defined by the sender; may be null @video File containing the video +video duration:int32 width:int32 height:int32 file_name:string mime_type:string has_stickers:Bool supports_streaming:Bool minithumbnail:minithumbnail thumbnail:photoSize video:file = Video; -//@description Describes a video note. The video must be equal in width and height, cropped to a circle, and stored in MPEG4 format @duration Duration of the video, in seconds; as defined by the sender @length Video width and height; as defined by the sender @thumbnail Video thumbnail; as defined by the sender; may be null @video File containing the video -videoNote duration:int32 length:int32 thumbnail:photoSize video:file = VideoNote; +//@description Describes a video note. The video must be equal in width and height, cropped to a circle, and stored in MPEG4 format @duration Duration of the video, in seconds; as defined by the sender @length Video width and height; as defined by the sender @minithumbnail Video minithumbnail; may be null @thumbnail Video thumbnail; as defined by the sender; may be null @video File containing the video +videoNote duration:int32 length:int32 minithumbnail:minithumbnail thumbnail:photoSize video:file = VideoNote; //@description Describes a voice note. The voice note must be encoded with the Opus codec, and stored inside an OGG container. Voice notes can have only a single audio channel @duration Duration of the voice note, in seconds; as defined by the sender //@waveform A waveform representation of the voice note in 5-bit format @mime_type MIME type of the file; as defined by the sender @voice File containing the voice note diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index db20bdfc..709733fa 100644 Binary files a/td/generate/scheme/td_api.tlo and b/td/generate/scheme/td_api.tlo differ diff --git a/td/generate/scheme/telegram_api.tl b/td/generate/scheme/telegram_api.tl index 030aa5d5..5fa86fbb 100644 --- a/td/generate/scheme/telegram_api.tl +++ b/td/generate/scheme/telegram_api.tl @@ -172,6 +172,7 @@ photo#9c477dd8 flags:# has_stickers:flags.0?true id:long access_hash:long file_r photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; +photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint; @@ -230,7 +231,7 @@ messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector< messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; -messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; +messages.messagesSlice#a6c47aaa flags:# inexact:flags.1?true count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# inexact:flags.1?true pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; diff --git a/td/generate/scheme/telegram_api.tlo b/td/generate/scheme/telegram_api.tlo index 237cc4cd..fa1af615 100644 Binary files a/td/generate/scheme/telegram_api.tlo and b/td/generate/scheme/telegram_api.tlo differ diff --git a/td/telegram/AnimationsManager.cpp b/td/telegram/AnimationsManager.cpp index 50883f76..119606e5 100644 --- a/td/telegram/AnimationsManager.cpp +++ b/td/telegram/AnimationsManager.cpp @@ -162,6 +162,7 @@ tl_object_ptr AnimationsManager::get_animation_object(FileId animation->is_changed = false; return make_tl_object(animation->duration, animation->dimensions.width, animation->dimensions.height, animation->file_name, animation->mime_type, + get_minithumbnail_object(animation->minithumbnail), get_photo_size_object(td_->file_manager_.get(), &animation->thumbnail), td_->file_manager_->get_file_object(file_id)); } @@ -195,6 +196,10 @@ FileId AnimationsManager::on_get_animation(unique_ptr new_animation, a->duration = new_animation->duration; a->is_changed = true; } + if (a->minithumbnail != new_animation->minithumbnail) { + a->minithumbnail = std::move(new_animation->minithumbnail); + a->is_changed = true; + } if (a->thumbnail != new_animation->thumbnail) { if (!a->thumbnail.file_id.is_valid()) { LOG(DEBUG) << "Animation " << file_id << " thumbnail has changed"; @@ -283,14 +288,15 @@ bool AnimationsManager::merge_animations(FileId new_id, FileId old_id, bool can_ return true; } -void AnimationsManager::create_animation(FileId file_id, PhotoSize thumbnail, string file_name, string mime_type, - int32 duration, Dimensions dimensions, bool replace) { +void AnimationsManager::create_animation(FileId file_id, string minithumbnail, PhotoSize thumbnail, string file_name, + string mime_type, int32 duration, Dimensions dimensions, bool replace) { auto a = make_unique(); a->file_id = file_id; a->file_name = std::move(file_name); a->mime_type = std::move(mime_type); a->duration = max(duration, 0); a->dimensions = dimensions; + a->minithumbnail = std::move(minithumbnail); a->thumbnail = std::move(thumbnail); on_get_animation(std::move(a), replace); } diff --git a/td/telegram/AnimationsManager.h b/td/telegram/AnimationsManager.h index d52dc264..102f4409 100644 --- a/td/telegram/AnimationsManager.h +++ b/td/telegram/AnimationsManager.h @@ -35,8 +35,8 @@ class AnimationsManager : public Actor { tl_object_ptr get_animation_object(FileId file_id, const char *source); - void create_animation(FileId file_id, PhotoSize thumbnail, string file_name, string mime_type, int32 duration, - Dimensions dimensions, bool replace); + void create_animation(FileId file_id, string minithumbnail, PhotoSize thumbnail, string file_name, string mime_type, + int32 duration, Dimensions dimensions, bool replace); tl_object_ptr get_input_media(FileId file_id, tl_object_ptr input_file, @@ -95,6 +95,7 @@ class AnimationsManager : public Actor { string mime_type; int32 duration = 0; Dimensions dimensions; + string minithumbnail; PhotoSize thumbnail; FileId file_id; diff --git a/td/telegram/AnimationsManager.hpp b/td/telegram/AnimationsManager.hpp index 8ca977bc..204f844e 100644 --- a/td/telegram/AnimationsManager.hpp +++ b/td/telegram/AnimationsManager.hpp @@ -26,6 +26,7 @@ void AnimationsManager::store_animation(FileId file_id, StorerT &storer) const { store(animation->dimensions, storer); store(animation->file_name, storer); store(animation->mime_type, storer); + store(animation->minithumbnail, storer); store(animation->thumbnail, storer); store(file_id, storer); } @@ -39,6 +40,9 @@ FileId AnimationsManager::parse_animation(ParserT &parser) { parse(animation->dimensions, parser); parse(animation->file_name, parser); parse(animation->mime_type, parser); + if (parser.version() >= static_cast(Version::SupportMinithumbnails)) { + parse(animation->minithumbnail, parser); + } parse(animation->thumbnail, parser); parse(animation->file_id, parser); return on_get_animation(std::move(animation), false); diff --git a/td/telegram/AudiosManager.cpp b/td/telegram/AudiosManager.cpp index d93a3502..7471436f 100644 --- a/td/telegram/AudiosManager.cpp +++ b/td/telegram/AudiosManager.cpp @@ -36,9 +36,10 @@ tl_object_ptr AudiosManager::get_audio_object(FileId file_id) { auto &audio = audios_[file_id]; CHECK(audio != nullptr); audio->is_changed = false; - return make_tl_object( - audio->duration, audio->title, audio->performer, audio->file_name, audio->mime_type, - get_photo_size_object(td_->file_manager_.get(), &audio->thumbnail), td_->file_manager_->get_file_object(file_id)); + return make_tl_object(audio->duration, audio->title, audio->performer, audio->file_name, + audio->mime_type, get_minithumbnail_object(audio->minithumbnail), + get_photo_size_object(td_->file_manager_.get(), &audio->thumbnail), + td_->file_manager_->get_file_object(file_id)); } FileId AudiosManager::on_get_audio(unique_ptr