Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
100 lines
1.9 KiB
C++
100 lines
1.9 KiB
C++
// This file is part of Desktop App Toolkit,
|
|
// a set of libraries for developing nice desktop applications.
|
|
//
|
|
// For license and copyright information please follow this link:
|
|
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
|
//
|
|
#pragma once
|
|
|
|
#include "base/qt/qt_compare.h"
|
|
|
|
#include <QString>
|
|
|
|
namespace Webrtc {
|
|
|
|
enum class DeviceType : uchar {
|
|
Playback,
|
|
Capture,
|
|
Camera,
|
|
};
|
|
|
|
enum class DeviceStateChange : uchar {
|
|
Active,
|
|
Inactive,
|
|
Disconnected,
|
|
};
|
|
|
|
enum class DeviceChangeReason : uchar {
|
|
Manual,
|
|
Connected,
|
|
Disconnected,
|
|
};
|
|
|
|
struct DeviceInfo {
|
|
QString id;
|
|
QString name;
|
|
DeviceType type = DeviceType::Playback;
|
|
bool inactive = false;
|
|
|
|
explicit operator bool() const {
|
|
return !id.isEmpty();
|
|
}
|
|
friend inline bool operator==(
|
|
const DeviceInfo &a,
|
|
const DeviceInfo &b) = default;
|
|
};
|
|
|
|
struct DeviceChange {
|
|
QString wasId;
|
|
QString nowId;
|
|
DeviceChangeReason reason = DeviceChangeReason::Manual;
|
|
|
|
explicit operator bool() const {
|
|
return wasId != nowId;
|
|
}
|
|
friend inline bool operator==(
|
|
const DeviceChange &a,
|
|
const DeviceChange &b) = default;
|
|
};
|
|
|
|
struct DevicesChange {
|
|
DeviceChange defaultChange;
|
|
std::vector<DeviceInfo> nowList;
|
|
};
|
|
|
|
inline QString kDefaultDeviceId = u"default"_q;
|
|
|
|
struct DeviceResolvedId {
|
|
QString value;
|
|
DeviceType type = DeviceType::Playback;
|
|
bool computedFromDefault = false;
|
|
|
|
[[nodiscard]] bool isDefault() const {
|
|
return computedFromDefault
|
|
|| value.isEmpty()
|
|
|| value == kDefaultDeviceId;
|
|
}
|
|
|
|
friend inline auto operator<=>(
|
|
const DeviceResolvedId &a,
|
|
const DeviceResolvedId &b) = default;
|
|
friend inline bool operator==(
|
|
const DeviceResolvedId &a,
|
|
const DeviceResolvedId &b) = default;
|
|
};
|
|
|
|
class CaptureMuteTracker {
|
|
public:
|
|
virtual void captureMuteChanged(bool muted) = 0;
|
|
[[nodiscard]] virtual auto captureMuteDeviceId()
|
|
-> rpl::producer<DeviceResolvedId> = 0;
|
|
};
|
|
|
|
enum class RecordAvailability : uchar {
|
|
None,
|
|
Audio,
|
|
VideoAndAudio,
|
|
};
|
|
|
|
} // namespace Webrtc
|