2022-04-10 00:15:49 +02:00
|
|
|
//
|
2022-12-31 22:28:08 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
2022-04-10 00:15:49 +02:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "td/telegram/DialogId.h"
|
2022-06-02 16:52:12 +02:00
|
|
|
#include "td/telegram/Dimensions.h"
|
2022-04-10 00:15:49 +02:00
|
|
|
#include "td/telegram/files/FileId.h"
|
|
|
|
#include "td/telegram/files/FileType.h"
|
|
|
|
#include "td/telegram/net/DcId.h"
|
|
|
|
#include "td/telegram/PhotoFormat.h"
|
|
|
|
#include "td/telegram/PhotoSizeSource.h"
|
2023-01-20 23:51:38 +01:00
|
|
|
#include "td/telegram/StickerPhotoSize.h"
|
2022-04-10 00:15:49 +02:00
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
|
|
|
|
|
|
|
#include "td/utils/buffer.h"
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/StringBuilder.h"
|
|
|
|
#include "td/utils/Variant.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class FileManager;
|
2023-01-20 15:31:33 +01:00
|
|
|
class Td;
|
2022-04-10 00:15:49 +02:00
|
|
|
|
|
|
|
struct PhotoSize {
|
|
|
|
int32 type = 0;
|
|
|
|
int32 size = 0;
|
2022-04-26 15:01:29 +02:00
|
|
|
Dimensions dimensions;
|
2022-04-10 00:15:49 +02:00
|
|
|
FileId file_id;
|
|
|
|
vector<int32> progressive_sizes;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AnimationSize final : public PhotoSize {
|
|
|
|
double main_frame_timestamp = 0.0;
|
|
|
|
};
|
|
|
|
|
2022-04-29 09:50:10 +02:00
|
|
|
bool need_update_dialog_photo_minithumbnail(const string &from, const string &to);
|
|
|
|
|
2022-04-10 00:15:49 +02:00
|
|
|
td_api::object_ptr<td_api::minithumbnail> get_minithumbnail_object(const string &packed);
|
|
|
|
|
|
|
|
FileId register_photo_size(FileManager *file_manager, const PhotoSizeSource &source, int64 id, int64 access_hash,
|
|
|
|
string file_reference, DialogId owner_dialog_id, int32 file_size, DcId dc_id,
|
2023-03-14 22:23:41 +01:00
|
|
|
PhotoFormat format, const char *call_source);
|
2022-04-10 00:15:49 +02:00
|
|
|
|
|
|
|
PhotoSize get_secret_thumbnail_photo_size(FileManager *file_manager, BufferSlice bytes, DialogId owner_dialog_id,
|
|
|
|
int32 width, int32 height);
|
|
|
|
|
|
|
|
Variant<PhotoSize, string> get_photo_size(FileManager *file_manager, PhotoSizeSource source, int64 id,
|
|
|
|
int64 access_hash, string file_reference, DcId dc_id,
|
|
|
|
DialogId owner_dialog_id, tl_object_ptr<telegram_api::PhotoSize> &&size_ptr,
|
|
|
|
PhotoFormat format);
|
|
|
|
|
2023-01-23 09:51:00 +01:00
|
|
|
AnimationSize get_animation_size(Td *td, PhotoSizeSource source, int64 id, int64 access_hash, string file_reference,
|
|
|
|
DcId dc_id, DialogId owner_dialog_id, tl_object_ptr<telegram_api::videoSize> &&size);
|
|
|
|
|
|
|
|
Variant<AnimationSize, unique_ptr<StickerPhotoSize>> process_video_size(
|
2023-01-22 22:57:40 +01:00
|
|
|
Td *td, PhotoSizeSource source, int64 id, int64 access_hash, string file_reference, DcId dc_id,
|
|
|
|
DialogId owner_dialog_id, tl_object_ptr<telegram_api::VideoSize> &&size_ptr);
|
2022-04-10 00:15:49 +02:00
|
|
|
|
|
|
|
PhotoSize get_web_document_photo_size(FileManager *file_manager, FileType file_type, DialogId owner_dialog_id,
|
|
|
|
tl_object_ptr<telegram_api::WebDocument> web_document_ptr);
|
|
|
|
|
|
|
|
td_api::object_ptr<td_api::thumbnail> get_thumbnail_object(FileManager *file_manager, const PhotoSize &photo_size,
|
|
|
|
PhotoFormat format);
|
|
|
|
|
|
|
|
bool operator==(const PhotoSize &lhs, const PhotoSize &rhs);
|
|
|
|
bool operator!=(const PhotoSize &lhs, const PhotoSize &rhs);
|
|
|
|
|
|
|
|
bool operator<(const PhotoSize &lhs, const PhotoSize &rhs);
|
|
|
|
|
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, const PhotoSize &photo_size);
|
|
|
|
|
|
|
|
bool operator==(const AnimationSize &lhs, const AnimationSize &rhs);
|
|
|
|
bool operator!=(const AnimationSize &lhs, const AnimationSize &rhs);
|
|
|
|
|
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, const AnimationSize &animation_size);
|
|
|
|
|
|
|
|
} // namespace td
|