1
0

AutoConfig.hpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #pragma once
  2. #include <QWizard>
  3. class AutoConfigStreamPage;
  4. class AutoConfig : public QWizard {
  5. Q_OBJECT
  6. friend class AutoConfigStartPage;
  7. friend class AutoConfigVideoPage;
  8. friend class AutoConfigStreamPage;
  9. friend class AutoConfigTestPage;
  10. enum class Type {
  11. Invalid,
  12. Streaming,
  13. Recording,
  14. VirtualCam,
  15. };
  16. enum class Service {
  17. Twitch,
  18. YouTube,
  19. AmazonIVS,
  20. Other,
  21. };
  22. enum class Encoder {
  23. x264,
  24. NVENC,
  25. QSV,
  26. AMD,
  27. Apple,
  28. Stream,
  29. };
  30. enum class Quality {
  31. Stream,
  32. High,
  33. };
  34. enum class FPSType : int {
  35. PreferHighFPS,
  36. PreferHighRes,
  37. UseCurrent,
  38. fps30,
  39. fps60,
  40. };
  41. struct StreamServer {
  42. std::string name;
  43. std::string address;
  44. };
  45. static inline const char *GetEncoderId(Encoder enc);
  46. AutoConfigStreamPage *streamPage = nullptr;
  47. Service service = Service::Other;
  48. Quality recordingQuality = Quality::Stream;
  49. Encoder recordingEncoder = Encoder::Stream;
  50. Encoder streamingEncoder = Encoder::x264;
  51. Type type = Type::Streaming;
  52. FPSType fpsType = FPSType::PreferHighFPS;
  53. int idealBitrate = 2500;
  54. struct {
  55. std::optional<int> targetBitrate;
  56. std::optional<int> bitrate;
  57. bool testSuccessful = false;
  58. } multitrackVideo;
  59. int baseResolutionCX = 1920;
  60. int baseResolutionCY = 1080;
  61. int idealResolutionCX = 1280;
  62. int idealResolutionCY = 720;
  63. int idealFPSNum = 60;
  64. int idealFPSDen = 1;
  65. std::string serviceName;
  66. std::string serverName;
  67. std::string server;
  68. std::vector<StreamServer> serviceConfigServers;
  69. std::string key;
  70. bool hardwareEncodingAvailable = false;
  71. bool nvencAvailable = false;
  72. bool qsvAvailable = false;
  73. bool vceAvailable = false;
  74. bool appleAvailable = false;
  75. int startingBitrate = 2500;
  76. bool customServer = false;
  77. bool bandwidthTest = false;
  78. bool testMultitrackVideo = false;
  79. bool testRegions = true;
  80. bool twitchAuto = false;
  81. bool amazonIVSAuto = false;
  82. bool regionUS = true;
  83. bool regionEU = true;
  84. bool regionAsia = true;
  85. bool regionOther = true;
  86. bool preferHighFPS = false;
  87. bool preferHardware = false;
  88. int specificFPSNum = 0;
  89. int specificFPSDen = 0;
  90. void TestHardwareEncoding();
  91. bool CanTestServer(const char *server);
  92. virtual void done(int result) override;
  93. void SaveStreamSettings();
  94. void SaveSettings();
  95. public:
  96. AutoConfig(QWidget *parent);
  97. ~AutoConfig();
  98. enum Page {
  99. StartPage,
  100. VideoPage,
  101. StreamPage,
  102. TestPage,
  103. };
  104. };