2019-12-11 12:09:21 +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/streaming/media_streaming_common.h"
|
|
|
|
|
|
|
|
class DocumentData;
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
struct RadialState;
|
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
struct FileOrigin;
|
|
|
|
} // namespace Data
|
|
|
|
|
|
|
|
namespace Media {
|
|
|
|
namespace Streaming {
|
|
|
|
|
|
|
|
class Document;
|
|
|
|
class Player;
|
|
|
|
|
|
|
|
class Instance {
|
|
|
|
public:
|
|
|
|
Instance(
|
|
|
|
std::shared_ptr<Document> shared,
|
|
|
|
Fn<void()> waitingCallback);
|
|
|
|
Instance(
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
Data::FileOrigin origin,
|
|
|
|
Fn<void()> waitingCallback);
|
2020-07-03 10:48:55 +00:00
|
|
|
Instance(
|
|
|
|
not_null<PhotoData*> photo,
|
|
|
|
Data::FileOrigin origin,
|
|
|
|
Fn<void()> waitingCallback);
|
2019-12-11 12:09:21 +00:00
|
|
|
~Instance();
|
|
|
|
|
2019-12-18 18:26:17 +00:00
|
|
|
[[nodiscard]] bool valid() const;
|
2020-01-03 11:18:38 +00:00
|
|
|
[[nodiscard]] std::shared_ptr<Document> shared() const;
|
2019-12-18 18:26:17 +00:00
|
|
|
|
2019-12-11 12:09:21 +00:00
|
|
|
[[nodiscard]] const Player &player() const;
|
|
|
|
[[nodiscard]] const Information &info() const;
|
|
|
|
|
|
|
|
void play(const PlaybackOptions &options);
|
|
|
|
void pause();
|
|
|
|
void resume();
|
|
|
|
void stop();
|
2019-12-18 18:26:17 +00:00
|
|
|
void stopAudio();
|
2019-12-11 12:09:21 +00:00
|
|
|
void saveFrameToCover();
|
|
|
|
|
|
|
|
[[nodiscard]] bool active() const;
|
|
|
|
[[nodiscard]] bool ready() const;
|
2019-12-12 13:26:53 +00:00
|
|
|
[[nodiscard]] std::optional<Error> failed() const;
|
2019-12-11 12:09:21 +00:00
|
|
|
|
|
|
|
[[nodiscard]] bool paused() const;
|
|
|
|
|
|
|
|
[[nodiscard]] float64 speed() const;
|
2023-03-17 17:18:31 +00:00
|
|
|
void setSpeed(float64 speed);
|
2019-12-11 12:09:21 +00:00
|
|
|
|
|
|
|
[[nodiscard]] bool waitingShown() const;
|
|
|
|
[[nodiscard]] float64 waitingOpacity() const;
|
|
|
|
[[nodiscard]] Ui::RadialState waitingState() const;
|
|
|
|
|
|
|
|
void callWaitingCallback();
|
|
|
|
|
|
|
|
[[nodiscard]] QImage frame(const FrameRequest &request) const;
|
2022-02-10 16:10:42 +00:00
|
|
|
[[nodiscard]] FrameWithInfo frameWithInfo(
|
|
|
|
const FrameRequest &request) const;
|
2021-06-03 12:57:48 +00:00
|
|
|
[[nodiscard]] FrameWithInfo frameWithInfo() const;
|
2021-06-06 06:18:25 +00:00
|
|
|
bool markFrameShown() const;
|
2019-12-11 12:09:21 +00:00
|
|
|
|
2019-12-17 14:30:14 +00:00
|
|
|
void lockPlayer();
|
|
|
|
void unlockPlayer();
|
|
|
|
[[nodiscard]] bool playerLocked() const;
|
|
|
|
|
2019-12-23 10:27:20 +00:00
|
|
|
void setPriority(int priority);
|
|
|
|
[[nodiscard]] int priority() const;
|
|
|
|
|
2019-12-12 13:26:53 +00:00
|
|
|
[[nodiscard]] rpl::lifetime &lifetime();
|
2019-12-11 12:09:21 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const std::shared_ptr<Document> _shared;
|
|
|
|
Fn<void()> _waitingCallback;
|
2019-12-23 10:27:20 +00:00
|
|
|
int _priority = 1;
|
2019-12-17 14:30:14 +00:00
|
|
|
bool _playerLocked = false;
|
2019-12-11 12:09:21 +00:00
|
|
|
rpl::lifetime _lifetime;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Streaming
|
|
|
|
} // namespace Media
|