1 /*
2 This file is part of Telegram Desktop,
3 the official desktop application for the Telegram messaging service.
4 
5 For license and copyright information please follow this link:
6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
7 */
8 #pragma once
9 
10 class DocumentData;
11 
12 class AudioMsgId final {
13 public:
14 	enum class Type {
15 		Unknown,
16 		Voice,
17 		Song,
18 		Video,
19 	};
20 
21 	AudioMsgId();
22 	AudioMsgId(
23 		not_null<DocumentData*> audio,
24 		FullMsgId msgId,
25 		uint32 externalPlayId = 0);
26 
27 	[[nodiscard]] static uint32 CreateExternalPlayId();
28 	[[nodiscard]] static AudioMsgId ForVideo();
29 
30 	[[nodiscard]] Type type() const;
31 	[[nodiscard]] DocumentData *audio() const;
32 	[[nodiscard]] FullMsgId contextId() const;
33 	[[nodiscard]] uint32 externalPlayId() const;
34 	[[nodiscard]] bool changeablePlaybackSpeed() const;
35 	[[nodiscard]] explicit operator bool() const;
36 
37 	bool operator<(const AudioMsgId &other) const;
38 	bool operator==(const AudioMsgId &other) const;
39 	bool operator!=(const AudioMsgId &other) const;
40 
41 private:
42 	void setTypeFromAudio();
43 
44 	DocumentData *_audio = nullptr;
45 	Type _type = Type::Unknown;
46 	FullMsgId _contextId;
47 	uint32 _externalPlayId = 0;
48 	bool _changeablePlaybackSpeed = false;
49 
50 };
51