2022-05-16 11:38:35 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "media/clip/media_clip_reader.h"
|
|
|
|
|
|
|
|
class Painter;
|
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
class PhotoMedia;
|
|
|
|
} // namespace Data
|
|
|
|
|
2022-12-05 12:18:10 +00:00
|
|
|
namespace Ui {
|
|
|
|
struct PeerUserpicView;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2023-07-18 08:15:19 +00:00
|
|
|
namespace Dialogs {
|
|
|
|
class Entry;
|
|
|
|
} // namespace Dialogs
|
|
|
|
|
2022-05-16 11:38:35 +00:00
|
|
|
namespace Dialogs::Ui {
|
|
|
|
|
|
|
|
using namespace ::Ui;
|
|
|
|
|
2023-07-18 08:15:19 +00:00
|
|
|
struct PaintContext;
|
|
|
|
|
2022-05-16 11:38:35 +00:00
|
|
|
class VideoUserpic final {
|
|
|
|
public:
|
|
|
|
VideoUserpic(not_null<PeerData*> peer, Fn<void()> repaint);
|
|
|
|
~VideoUserpic();
|
|
|
|
|
|
|
|
[[nodiscard]] int frameIndex() const;
|
|
|
|
|
|
|
|
void paintLeft(
|
|
|
|
Painter &p,
|
2022-12-05 12:18:10 +00:00
|
|
|
PeerUserpicView &view,
|
2022-05-16 11:38:35 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int w,
|
2022-05-16 12:32:24 +00:00
|
|
|
int size,
|
|
|
|
bool paused);
|
2022-05-16 11:38:35 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void clipCallback(Media::Clip::Notification notification);
|
|
|
|
[[nodiscard]] Media::Clip::FrameRequest request(int size) const;
|
|
|
|
bool startReady(int size = 0);
|
|
|
|
|
|
|
|
const not_null<PeerData*> _peer;
|
|
|
|
const Fn<void()> _repaint;
|
|
|
|
|
|
|
|
Media::Clip::ReaderPointer _video;
|
|
|
|
int _lastSize = 0;
|
|
|
|
std::shared_ptr<Data::PhotoMedia> _videoPhotoMedia;
|
|
|
|
PhotoId _videoPhotoId = 0;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2023-07-18 08:15:19 +00:00
|
|
|
void PaintUserpic(
|
|
|
|
Painter &p,
|
|
|
|
not_null<Entry*> entry,
|
|
|
|
PeerData *peer,
|
|
|
|
VideoUserpic *videoUserpic,
|
|
|
|
PeerUserpicView &view,
|
|
|
|
const Ui::PaintContext &context);
|
|
|
|
|
2022-05-16 12:32:24 +00:00
|
|
|
void PaintUserpic(
|
|
|
|
Painter &p,
|
|
|
|
not_null<PeerData*> peer,
|
2022-12-05 12:18:10 +00:00
|
|
|
VideoUserpic *videoUserpic,
|
|
|
|
PeerUserpicView &view,
|
2022-05-16 12:32:24 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int outerWidth,
|
|
|
|
int size,
|
|
|
|
bool paused);
|
|
|
|
|
2022-05-16 11:38:35 +00:00
|
|
|
} // namespace Dialogs::Ui
|