Add separate class td_api::storyVideo.
This commit is contained in:
parent
71faaae22f
commit
a4bd45bd53
@ -422,9 +422,8 @@ sticker id:int64 set_id:int64 width:int32 height:int32 emoji:string format:Stick
|
||||
//@supports_streaming True, if the video is supposed to be streamed
|
||||
//@minithumbnail Video minithumbnail; may be null
|
||||
//@thumbnail Video thumbnail in JPEG or MPEG4 format; as defined by the sender; may be null
|
||||
//@preload_prefix_size Number of bytes from the video file beginning, which is enough to load to play the video for one second; 0 if unknown. Currently, it is expected to be known only for video stories
|
||||
//@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:thumbnail preload_prefix_size:int32 video:file = Video;
|
||||
video duration:int32 width:int32 height:int32 file_name:string mime_type:string has_stickers:Bool supports_streaming:Bool minithumbnail:minithumbnail thumbnail:thumbnail 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
|
||||
@ -4834,13 +4833,25 @@ messageLink link:string is_public:Bool = MessageLink;
|
||||
messageLinkInfo is_public:Bool chat_id:int53 message_thread_id:int53 message:message media_timestamp:int32 for_album:Bool = MessageLinkInfo;
|
||||
|
||||
|
||||
//@description Describes a video file sent in a story
|
||||
//@duration Duration of the video, in seconds
|
||||
//@width Video width
|
||||
//@height Video height
|
||||
//@has_stickers True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets
|
||||
//@minithumbnail Video minithumbnail; may be null
|
||||
//@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null
|
||||
//@preload_prefix_size Number of bytes from the video file beginning, which is enough to load to play the video for one second; 0 if unknown
|
||||
//@video File containing the video
|
||||
storyVideo duration:double width:int32 height:int32 has_stickers:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 video:file = StoryVideo;
|
||||
|
||||
|
||||
//@class StoryContent @description Contains the content of a story
|
||||
|
||||
//@description A photo story @photo The photo
|
||||
storyContentPhoto photo:photo = StoryContent;
|
||||
|
||||
//@description A video story @video The video in MPEG4 format, encoded by x265 codec @alternative_video Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null
|
||||
storyContentVideo video:video alternative_video:video = StoryContent;
|
||||
//@description A video story @video The video in MPEG4 format @alternative_video Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null
|
||||
storyContentVideo video:storyVideo alternative_video:storyVideo = StoryContent;
|
||||
|
||||
//@description A story content that is not supported in the current TDLib version
|
||||
storyContentUnsupported = StoryContent;
|
||||
|
@ -1322,7 +1322,7 @@ template <>
|
||||
tl_object_ptr<td_api::video> copy(const td_api::video &obj) {
|
||||
return td_api::make_object<td_api::video>(obj.duration_, obj.width_, obj.height_, obj.file_name_, obj.mime_type_,
|
||||
obj.has_stickers_, obj.supports_streaming_, copy(obj.minithumbnail_),
|
||||
copy(obj.thumbnail_), obj.preload_prefix_size_, copy(obj.video_));
|
||||
copy(obj.thumbnail_), copy(obj.video_));
|
||||
}
|
||||
|
||||
template <>
|
||||
|
@ -359,8 +359,9 @@ td_api::object_ptr<td_api::StoryContent> get_story_content_object(Td *td, const
|
||||
}
|
||||
case StoryContentType::Video: {
|
||||
const auto *s = static_cast<const StoryContentVideo *>(content);
|
||||
return td_api::make_object<td_api::storyContentVideo>(td->videos_manager_->get_video_object(s->file_id_),
|
||||
td->videos_manager_->get_video_object(s->alt_file_id_));
|
||||
return td_api::make_object<td_api::storyContentVideo>(
|
||||
td->videos_manager_->get_story_video_object(s->file_id_),
|
||||
td->videos_manager_->get_story_video_object(s->alt_file_id_));
|
||||
}
|
||||
case StoryContentType::Unsupported:
|
||||
return td_api::make_object<td_api::storyContentUnsupported>();
|
||||
|
@ -36,7 +36,7 @@ int32 VideosManager::get_video_duration(FileId file_id) const {
|
||||
return video->duration;
|
||||
}
|
||||
|
||||
tl_object_ptr<td_api::video> VideosManager::get_video_object(FileId file_id) const {
|
||||
td_api::object_ptr<td_api::video> VideosManager::get_video_object(FileId file_id) const {
|
||||
if (!file_id.is_valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -46,10 +46,26 @@ tl_object_ptr<td_api::video> VideosManager::get_video_object(FileId file_id) con
|
||||
auto thumbnail = video->animated_thumbnail.file_id.is_valid()
|
||||
? get_thumbnail_object(td_->file_manager_.get(), video->animated_thumbnail, PhotoFormat::Mpeg4)
|
||||
: get_thumbnail_object(td_->file_manager_.get(), video->thumbnail, PhotoFormat::Jpeg);
|
||||
return make_tl_object<td_api::video>(
|
||||
video->duration, video->dimensions.width, video->dimensions.height, video->file_name, video->mime_type,
|
||||
video->has_stickers, video->supports_streaming, get_minithumbnail_object(video->minithumbnail),
|
||||
std::move(thumbnail), video->preload_prefix_size, td_->file_manager_->get_file_object(file_id));
|
||||
return td_api::make_object<td_api::video>(video->duration, video->dimensions.width, video->dimensions.height,
|
||||
video->file_name, video->mime_type, video->has_stickers,
|
||||
video->supports_streaming, get_minithumbnail_object(video->minithumbnail),
|
||||
std::move(thumbnail), td_->file_manager_->get_file_object(file_id));
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::storyVideo> VideosManager::get_story_video_object(FileId file_id) const {
|
||||
if (!file_id.is_valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto video = get_video(file_id);
|
||||
CHECK(video != nullptr);
|
||||
auto thumbnail = video->animated_thumbnail.file_id.is_valid()
|
||||
? get_thumbnail_object(td_->file_manager_.get(), video->animated_thumbnail, PhotoFormat::Mpeg4)
|
||||
: get_thumbnail_object(td_->file_manager_.get(), video->thumbnail, PhotoFormat::Jpeg);
|
||||
return td_api::make_object<td_api::storyVideo>(
|
||||
video->precise_duration, video->dimensions.width, video->dimensions.height, video->has_stickers,
|
||||
get_minithumbnail_object(video->minithumbnail), std::move(thumbnail), video->preload_prefix_size,
|
||||
td_->file_manager_->get_file_object(file_id));
|
||||
}
|
||||
|
||||
FileId VideosManager::on_get_video(unique_ptr<Video> new_video, bool replace) {
|
||||
|
@ -32,7 +32,9 @@ class VideosManager {
|
||||
|
||||
int32 get_video_duration(FileId file_id) const;
|
||||
|
||||
tl_object_ptr<td_api::video> get_video_object(FileId file_id) const;
|
||||
td_api::object_ptr<td_api::video> get_video_object(FileId file_id) const;
|
||||
|
||||
td_api::object_ptr<td_api::storyVideo> get_story_video_object(FileId file_id) const;
|
||||
|
||||
void create_video(FileId file_id, string minithumbnail, PhotoSize thumbnail, AnimationSize animated_thumbnail,
|
||||
bool has_stickers, vector<FileId> &&sticker_file_ids, string file_name, string mime_type,
|
||||
|
Loading…
Reference in New Issue
Block a user