calls_controller.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include <TgVoip.h>
  9. namespace Calls {
  10. class Controller {
  11. public:
  12. virtual ~Controller() = default;
  13. [[nodiscard]] virtual std::string version() = 0;
  14. virtual void setNetworkType(TgVoipNetworkType networkType) = 0;
  15. virtual void setMuteMicrophone(bool muteMicrophone) = 0;
  16. virtual void setAudioOutputGainControlEnabled(bool enabled) = 0;
  17. virtual void setEchoCancellationStrength(int strength) = 0;
  18. virtual void setAudioInputDevice(std::string id) = 0;
  19. virtual void setAudioOutputDevice(std::string id) = 0;
  20. virtual void setInputVolume(float level) = 0;
  21. virtual void setOutputVolume(float level) = 0;
  22. virtual void setAudioOutputDuckingEnabled(bool enabled) = 0;
  23. virtual bool receiveSignalingData(const QByteArray &data) = 0;
  24. virtual std::string getLastError() = 0;
  25. virtual std::string getDebugInfo() = 0;
  26. virtual int64_t getPreferredRelayId() = 0;
  27. virtual TgVoipTrafficStats getTrafficStats() = 0;
  28. virtual TgVoipPersistentState getPersistentState() = 0;
  29. virtual void setOnStateUpdated(Fn<void(TgVoipState)> onStateUpdated) = 0;
  30. virtual void setOnSignalBarsUpdated(
  31. Fn<void(int)> onSignalBarsUpdated) = 0;
  32. virtual TgVoipFinalState stop() = 0;
  33. };
  34. [[nodiscard]] std::unique_ptr<Controller> MakeController(
  35. const std::string &version,
  36. const TgVoipConfig &config,
  37. const TgVoipPersistentState &persistentState,
  38. const std::vector<TgVoipEndpoint> &endpoints,
  39. const TgVoipProxy *proxy,
  40. TgVoipNetworkType initialNetworkType,
  41. const TgVoipEncryptionKey &encryptionKey,
  42. Fn<void(QByteArray)> sendSignalingData,
  43. Fn<void(QImage)> displayNextFrame);
  44. [[nodiscard]] std::vector<std::string> CollectControllerVersions();
  45. [[nodiscard]] int ControllerMaxLayer();
  46. } // namespace Calls