media_common.h 954 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 "base/algorithm.h"
  9. #include <compare>
  10. namespace Media {
  11. enum class RepeatMode {
  12. None,
  13. One,
  14. All,
  15. };
  16. enum class OrderMode {
  17. Default,
  18. Reverse,
  19. Shuffle,
  20. };
  21. struct VideoQuality {
  22. uint32 manual : 1 = 0;
  23. uint32 height : 31 = 0;
  24. friend inline constexpr auto operator<=>(
  25. VideoQuality,
  26. VideoQuality) = default;
  27. friend inline constexpr bool operator==(
  28. VideoQuality,
  29. VideoQuality) = default;
  30. };
  31. inline constexpr auto kSpeedMin = 0.5;
  32. inline constexpr auto kSpeedMax = 2.5;
  33. inline constexpr auto kSpedUpDefault = 1.7;
  34. [[nodiscard]] inline bool EqualSpeeds(float64 a, float64 b) {
  35. return int(base::SafeRound(a * 10.)) == int(base::SafeRound(b * 10.));
  36. }
  37. } // namespace Media