michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef _CC_SIPCCCALL_H michael@0: #define _CC_SIPCCCALL_H michael@0: michael@0: #include "CC_Call.h" michael@0: michael@0: #include michael@0: michael@0: #if defined(__cplusplus) && __cplusplus >= 201103L michael@0: typedef struct Timecard Timecard; michael@0: #else michael@0: #include "timecard.h" michael@0: #endif michael@0: michael@0: #include "common/Wrapper.h" michael@0: #include "common/csf_common.h" michael@0: #include "mozilla/Mutex.h" michael@0: #include "base/lock.h" michael@0: michael@0: namespace CSF michael@0: { michael@0: struct StreamInfo michael@0: { michael@0: // a bit of overkill having a structure just for video, but we may have other properties later michael@0: bool isVideo; michael@0: }; michael@0: typedef std::map StreamMapType; michael@0: michael@0: DECLARE_NS_PTR(CC_SIPCCCallMediaData); michael@0: michael@0: class CC_SIPCCCallMediaData michael@0: { michael@0: public: michael@0: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_SipCCCAllMediaData) michael@0: CC_SIPCCCallMediaData(): michael@0: remoteWindow(nullptr), michael@0: streamMapMutex("CC_SIPCCCallMediaData"), michael@0: audioMuteState(false), michael@0: videoMuteState(false), michael@0: volume(-1){} michael@0: CC_SIPCCCallMediaData(VideoWindowHandle remoteWindow, michael@0: bool audioMuteState, bool videoMuteState, int volume): michael@0: remoteWindow(remoteWindow), michael@0: streamMapMutex("CC_SIPCCCallMediaData"), michael@0: audioMuteState(audioMuteState), michael@0: videoMuteState(videoMuteState), michael@0: volume(volume) {} michael@0: VideoWindowHandle remoteWindow; michael@0: ExternalRendererHandle extRenderer; michael@0: VideoFormat videoFormat; michael@0: mozilla::Mutex streamMapMutex; michael@0: StreamMapType streamMap; michael@0: bool audioMuteState; michael@0: bool videoMuteState; michael@0: int volume; michael@0: private: michael@0: CC_SIPCCCallMediaData(const CC_SIPCCCallMediaData&); michael@0: CC_SIPCCCallMediaData& operator=(const CC_SIPCCCallMediaData&); michael@0: }; michael@0: michael@0: DECLARE_NS_PTR(CC_SIPCCCall); michael@0: class CC_SIPCCCall : public CC_Call michael@0: { michael@0: michael@0: CSF_DECLARE_WRAP(CC_SIPCCCall, cc_call_handle_t); michael@0: private: michael@0: cc_call_handle_t callHandle; michael@0: CC_SIPCCCall (cc_call_handle_t aCallHandle); michael@0: CC_SIPCCCallMediaDataPtr pMediaData; michael@0: std::string peerconnection; // The peerconnection handle michael@0: michael@0: public: michael@0: virtual inline std::string toString() { michael@0: std::string result; michael@0: char tmpString[11]; michael@0: csf_sprintf(tmpString, sizeof(tmpString), "%X", callHandle); michael@0: result = tmpString; michael@0: return result; michael@0: }; michael@0: michael@0: virtual void setRemoteWindow (VideoWindowHandle window); michael@0: virtual int setExternalRenderer(VideoFormat vFormat, ExternalRendererHandle renderer); michael@0: virtual void sendIFrame(); michael@0: michael@0: virtual CC_CallInfoPtr getCallInfo (); michael@0: michael@0: virtual bool originateCall (cc_sdp_direction_t video_pref, const std::string & digits); michael@0: virtual bool answerCall (cc_sdp_direction_t video_pref); michael@0: virtual bool hold (cc_hold_reason_t reason); michael@0: virtual bool resume (cc_sdp_direction_t video_pref); michael@0: virtual bool endCall(); michael@0: virtual bool sendDigit (cc_digit_t digit); michael@0: virtual bool backspace(); michael@0: virtual bool redial (cc_sdp_direction_t video_pref); michael@0: virtual bool initiateCallForwardAll(); michael@0: virtual bool endConsultativeCall(); michael@0: virtual bool conferenceStart (cc_sdp_direction_t video_pref); michael@0: virtual bool conferenceComplete (CC_CallPtr otherLog, cc_sdp_direction_t video_pref); michael@0: virtual bool transferStart (cc_sdp_direction_t video_pref); michael@0: virtual bool transferComplete (CC_CallPtr otherLeg, michael@0: cc_sdp_direction_t video_pref); michael@0: virtual bool cancelTransferOrConferenceFeature(); michael@0: virtual bool directTransfer (CC_CallPtr target); michael@0: virtual bool joinAcrossLine (CC_CallPtr target); michael@0: virtual bool blfCallPickup (cc_sdp_direction_t video_pref, const std::string & speed); michael@0: virtual bool select(); michael@0: virtual bool updateVideoMediaCap (cc_sdp_direction_t video_pref); michael@0: virtual bool sendInfo (const std::string & infopackage, const std::string & infotype, const std::string & infobody); michael@0: virtual bool muteAudio(); michael@0: virtual bool unmuteAudio(); michael@0: virtual bool muteVideo(); michael@0: virtual bool unmuteVideo(); michael@0: virtual void addStream(int streamId, bool isVideo); michael@0: virtual void removeStream(int streamId); michael@0: virtual bool setVolume(int volume); michael@0: virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip); michael@0: virtual void createOffer(cc_media_constraints_t *constraints, Timecard *); michael@0: virtual void createAnswer(cc_media_constraints_t *constraints, Timecard *); michael@0: virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp, Timecard *); michael@0: virtual void setRemoteDescription(cc_jsep_action_t action, const std::string & sdp, Timecard *); michael@0: virtual void setPeerConnection(const std::string& handle); michael@0: virtual const std::string& getPeerConnection() const; michael@0: virtual void addStream(cc_media_stream_id_t stream_id, michael@0: cc_media_track_id_t track_id, michael@0: cc_media_type_t media_type, michael@0: cc_media_constraints_t *constraints); michael@0: virtual void removeStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type); michael@0: virtual CC_SIPCCCallMediaDataPtr getMediaData(); michael@0: virtual void addICECandidate(const std::string & candidate, const std::string & mid, unsigned short level, Timecard *); michael@0: michael@0: private: michael@0: virtual bool setAudioMute(bool mute); michael@0: virtual bool setVideoMute(bool mute); michael@0: michael@0: mozilla::Mutex m_lock; michael@0: }; michael@0: michael@0: } michael@0: michael@0: michael@0: #endif