summary refs log tree commit diff
path: root/src/WebRTCSession.h
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-09-25 19:29:21 +0200
committerGitHub <noreply@github.com>2020-09-25 19:29:21 +0200
commit5cce5b9999bd55d7b001ae6f65121bda105eb5a7 (patch)
tree27427ca1f640d64f6609d26638d0c88711e63188 /src/WebRTCSession.h
parentTranslated using Weblate (French) (diff)
parentAllow button colors override (diff)
downloadnheko-5cce5b9999bd55d7b001ae6f65121bda105eb5a7.tar.xz
Merge pull request #289 from trilene/master
Port ActiveCallBar to Qml
Diffstat (limited to 'src/WebRTCSession.h')
-rw-r--r--src/WebRTCSession.h42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/WebRTCSession.h b/src/WebRTCSession.h

index 653ec2cf..83cabf5c 100644 --- a/src/WebRTCSession.h +++ b/src/WebRTCSession.h
@@ -9,23 +9,30 @@ typedef struct _GstElement GstElement; +namespace webrtc { +Q_NAMESPACE + +enum class State +{ + DISCONNECTED, + ICEFAILED, + INITIATING, + INITIATED, + OFFERSENT, + ANSWERSENT, + CONNECTING, + CONNECTED + +}; +Q_ENUM_NS(State) + +} + class WebRTCSession : public QObject { Q_OBJECT public: - enum class State - { - DISCONNECTED, - ICEFAILED, - INITIATING, - INITIATED, - OFFERSENT, - ANSWERSENT, - CONNECTING, - CONNECTED - }; - static WebRTCSession &instance() { static WebRTCSession instance; @@ -33,14 +40,15 @@ public: } bool init(std::string *errorMessage = nullptr); - State state() const { return state_; } + webrtc::State state() const { return state_; } bool createOffer(); bool acceptOffer(const std::string &sdp); bool acceptAnswer(const std::string &sdp); void acceptICECandidates(const std::vector<mtx::events::msg::CallCandidates::Candidate> &); - bool toggleMuteAudioSrc(bool &isMuted); + bool isMicMuted() const; + bool toggleMicMute(); void end(); void setStunServer(const std::string &stunServer) { stunServer_ = stunServer; } @@ -55,16 +63,16 @@ signals: void answerCreated(const std::string &sdp, const std::vector<mtx::events::msg::CallCandidates::Candidate> &); void newICECandidate(const mtx::events::msg::CallCandidates::Candidate &); - void stateChanged(WebRTCSession::State); // explicit qualifier necessary for Qt + void stateChanged(webrtc::State); private slots: - void setState(State state) { state_ = state; } + void setState(webrtc::State state) { state_ = state; } private: WebRTCSession(); bool initialised_ = false; - State state_ = State::DISCONNECTED; + webrtc::State state_ = webrtc::State::DISCONNECTED; GstElement *pipe_ = nullptr; GstElement *webrtc_ = nullptr; unsigned int busWatchId_ = 0;