summary refs log tree commit diff
path: root/src/CallDevices.h
diff options
context:
space:
mode:
authortrilene <trilene@runbox.com>2021-02-07 11:47:47 -0500
committertrilene <trilene@runbox.com>2021-02-07 11:47:47 -0500
commitf1bc3ba587baacce84acbdb04343d5c4b74d18a2 (patch)
tree42145d02819224a70926ba0aa91d22b14161c0f7 /src/CallDevices.h
parentNative rendering breaks kerning (diff)
downloadnheko-f1bc3ba587baacce84acbdb04343d5c4b74d18a2.tar.xz
Move call device handling out of WebRTCSession
Diffstat (limited to 'src/CallDevices.h')
-rw-r--r--src/CallDevices.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/CallDevices.h b/src/CallDevices.h
new file mode 100644
index 00000000..2b4129f1
--- /dev/null
+++ b/src/CallDevices.h
@@ -0,0 +1,45 @@
+#pragma once
+
+#include <string>
+#include <utility>
+#include <vector>
+
+#include <QObject>
+
+typedef struct _GstDevice GstDevice;
+
+class CallDevices : public QObject
+{
+        Q_OBJECT
+
+public:
+        static CallDevices &instance()
+        {
+                static CallDevices instance;
+                return instance;
+        }
+
+        void refresh();
+        bool haveMic() const;
+        bool haveCamera() const;
+        std::vector<std::string> names(bool isVideo, const std::string &defaultDevice) const;
+        std::vector<std::string> resolutions(const std::string &cameraName) const;
+        std::vector<std::string> frameRates(const std::string &cameraName,
+                                            const std::string &resolution) const;
+
+signals:
+        void devicesChanged();
+
+private:
+        CallDevices();
+
+        friend class WebRTCSession;
+        void init();
+        GstDevice *audioDevice() const;
+        GstDevice *videoDevice(std::pair<int, int> &resolution,
+                               std::pair<int, int> &frameRate) const;
+
+public:
+        CallDevices(CallDevices const &) = delete;
+        void operator=(CallDevices const &) = delete;
+};