| 1 | /* |
|---|
| 2 | * QuteCom, a voice over Internet phone |
|---|
| 3 | * Copyright (C) Wengo Wengo |
|---|
| 4 | * |
|---|
| 5 | * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | * (at your option) any later version. |
|---|
| 9 | * |
|---|
| 10 | * This program is distributed in the hope that it will be useful, |
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| 14 | * |
|---|
| 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with this program; if not, write to the Free Software |
|---|
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 | */ |
|---|
| 19 | |
|---|
| 20 | #ifndef OWCALLSESSION_H |
|---|
| 21 | #define OWCALLSESSION_H |
|---|
| 22 | |
|---|
| 23 | #include <coipmanager/callsessionmanager/ICallSession.h> |
|---|
| 24 | #include <coipmanager/session/Session.h> |
|---|
| 25 | |
|---|
| 26 | #include <pixertool/pixertool.h> |
|---|
| 27 | |
|---|
| 28 | class ICallSessionPlugin; |
|---|
| 29 | |
|---|
| 30 | /** |
|---|
| 31 | * Manages a call session between 2 peers. |
|---|
| 32 | * |
|---|
| 33 | * @ingroup CoIpManager |
|---|
| 34 | * @author Philippe Bernery |
|---|
| 35 | * @author Tanguy Krotoff |
|---|
| 36 | */ |
|---|
| 37 | class COIPMANAGER_API CallSession : public Session, public ICallSession { |
|---|
| 38 | Q_OBJECT |
|---|
| 39 | friend class CallSessionManager; |
|---|
| 40 | public: |
|---|
| 41 | |
|---|
| 42 | virtual ~CallSession(); |
|---|
| 43 | |
|---|
| 44 | // Inherited from Session |
|---|
| 45 | virtual void start(); |
|---|
| 46 | |
|---|
| 47 | virtual void stop(); |
|---|
| 48 | |
|---|
| 49 | virtual void pause(); |
|---|
| 50 | |
|---|
| 51 | virtual void resume(); |
|---|
| 52 | //// |
|---|
| 53 | |
|---|
| 54 | virtual EnumPhoneCallState::PhoneCallState getState() const; |
|---|
| 55 | |
|---|
| 56 | virtual void playTone(EnumTone::Tone tone); |
|---|
| 57 | |
|---|
| 58 | virtual void playSoundFile(const std::string & soundFile); |
|---|
| 59 | |
|---|
| 60 | virtual CodecList::AudioCodec getAudioCodecUsed() const; |
|---|
| 61 | |
|---|
| 62 | virtual CodecList::VideoCodec getVideoCodecUsed() const; |
|---|
| 63 | |
|---|
| 64 | virtual void enableVideo(bool enable); |
|---|
| 65 | |
|---|
| 66 | virtual bool isVideoEnabled() const; |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | virtual bool addConfMember(ICallSession* member); |
|---|
| 70 | |
|---|
| 71 | virtual int getMemberCount() const; |
|---|
| 72 | |
|---|
| 73 | virtual bool splitConf(ICallSession* member); |
|---|
| 74 | |
|---|
| 75 | virtual CallSession *getConfMember(int i) const; |
|---|
| 76 | |
|---|
| 77 | /** |
|---|
| 78 | * TODO |
|---|
| 79 | * This should be put inside Session since a duration can be computed |
|---|
| 80 | * for file transfert, chat session... |
|---|
| 81 | * A start time + end time should be computed too with methods like: |
|---|
| 82 | * Session::getStartedTime() Session::getEndedTime() |
|---|
| 83 | * This can be usefull for the history part of the graphical interface. |
|---|
| 84 | * |
|---|
| 85 | * @return duration of this CallSession in seconds |
|---|
| 86 | */ |
|---|
| 87 | virtual int getDuration() const; |
|---|
| 88 | |
|---|
| 89 | Q_SIGNALS: |
|---|
| 90 | |
|---|
| 91 | /** |
|---|
| 92 | * Emitted when the state of the CallSession has changed. |
|---|
| 93 | * |
|---|
| 94 | * @param state new state |
|---|
| 95 | */ |
|---|
| 96 | void phoneCallStateChangedSignal(EnumPhoneCallState::PhoneCallState state); |
|---|
| 97 | |
|---|
| 98 | /** |
|---|
| 99 | * A video frame has been received from the network. |
|---|
| 100 | * |
|---|
| 101 | * @param remoteVideoFrame remote video frame |
|---|
| 102 | * @param localVideoFrame local video frame from the webcam |
|---|
| 103 | */ |
|---|
| 104 | void videoFrameReceivedSignal(piximage * remoteVideoFrame, piximage * localVideoFrame); |
|---|
| 105 | |
|---|
| 106 | private Q_SLOTS: |
|---|
| 107 | |
|---|
| 108 | /** |
|---|
| 109 | * Slot from signal emitted by ICallSession. |
|---|
| 110 | */ |
|---|
| 111 | void phoneCallStateChangedSlot(EnumPhoneCallState::PhoneCallState state); |
|---|
| 112 | |
|---|
| 113 | private: |
|---|
| 114 | |
|---|
| 115 | virtual bool canCreateISession(const Account & account, const ContactList & contactList) const; |
|---|
| 116 | |
|---|
| 117 | /** |
|---|
| 118 | * Constructor used for user created CallSession |
|---|
| 119 | */ |
|---|
| 120 | CallSession(CoIpManager & coIpManager); |
|---|
| 121 | |
|---|
| 122 | /** |
|---|
| 123 | * Constructor used when receiving a call session from outside. |
|---|
| 124 | */ |
|---|
| 125 | CallSession(CoIpManager & coIpManager, ICallSessionPlugin * currentCallSession); |
|---|
| 126 | |
|---|
| 127 | /** Current ICallSession. */ |
|---|
| 128 | ICallSessionPlugin * _currentCallSession; |
|---|
| 129 | |
|---|
| 130 | /** True if video is enabled. */ |
|---|
| 131 | bool _videoEnabled; |
|---|
| 132 | |
|---|
| 133 | protected: |
|---|
| 134 | CallSession* confMember; |
|---|
| 135 | |
|---|
| 136 | }; |
|---|
| 137 | |
|---|
| 138 | #endif //OWCALLSESSION_H |
|---|