summary refs log tree commit diff
path: root/src/CallDevices.h
blob: 69325f97b2c2070b5ffda9bb427c9d6dd45d37e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

#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;
        }

        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;
};