~ubuntu-branches/ubuntu/oneiric/psi/oneiric

« back to all changes in this revision

Viewing changes to src/avcall/avcall.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2009-09-25 17:49:51 UTC
  • mfrom: (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090925174951-lvm7kdap82o8xhn3
Tags: 0.13-1
* Updated to upstream version 0.13
* Set Standards-Version to 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2009  Barracuda Networks, Inc.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation, either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 *
 
17
 */
 
18
 
 
19
#ifndef AVCALL_H
 
20
#define AVCALL_H
 
21
 
 
22
#include <QObject>
 
23
 
 
24
class QHostAddress;
 
25
 
 
26
namespace XMPP
 
27
{
 
28
        class Jid;
 
29
}
 
30
 
 
31
namespace PsiMedia
 
32
{
 
33
        class VideoWidget;
 
34
}
 
35
 
 
36
class PsiAccount;
 
37
 
 
38
class AvCallPrivate;
 
39
class AvCallManagerPrivate;
 
40
 
 
41
class AvCall : public QObject
 
42
{
 
43
        Q_OBJECT
 
44
 
 
45
public:
 
46
        enum Mode
 
47
        {
 
48
                Audio,
 
49
                Video,
 
50
                Both
 
51
        };
 
52
 
 
53
        AvCall(const AvCall &from);
 
54
        ~AvCall();
 
55
 
 
56
        XMPP::Jid jid() const;
 
57
        Mode mode() const;
 
58
 
 
59
        void connectToJid(const XMPP::Jid &jid, Mode mode, int kbps = -1);
 
60
        void accept(Mode mode, int kbps = -1);
 
61
        void reject();
 
62
 
 
63
        void setIncomingVideo(PsiMedia::VideoWidget *widget);
 
64
 
 
65
        QString errorString() const;
 
66
 
 
67
        // if we use deleteLater() on a call, then it won't detach from the
 
68
        //   manager until the deletion resolves.  use unlink() to immediately
 
69
        //   detach, and then call deleteLater().
 
70
        void unlink();
 
71
 
 
72
signals:
 
73
        void activated();
 
74
        void error();
 
75
 
 
76
private:
 
77
        friend class AvCallPrivate;
 
78
        friend class AvCallManager;
 
79
        friend class AvCallManagerPrivate;
 
80
        AvCall();
 
81
 
 
82
        AvCallPrivate *d;
 
83
};
 
84
 
 
85
class AvCallManager : public QObject
 
86
{
 
87
        Q_OBJECT
 
88
 
 
89
public:
 
90
        AvCallManager(PsiAccount *pa);
 
91
        ~AvCallManager();
 
92
 
 
93
        AvCall *createOutgoing();
 
94
        AvCall *takeIncoming();
 
95
 
 
96
        static void config();
 
97
        static bool isSupported();
 
98
        static bool isVideoSupported();
 
99
 
 
100
        void setSelfAddress(const QHostAddress &addr);
 
101
        void setStunHost(const QString &host, int port);
 
102
 
 
103
        static void setBasePort(int port);
 
104
        static void setExternalAddress(const QString &host);
 
105
        static void setAudioOutDevice(const QString &id);
 
106
        static void setAudioInDevice(const QString &id);
 
107
        static void setVideoInDevice(const QString &id);
 
108
 
 
109
signals:
 
110
        void incomingReady();
 
111
 
 
112
private:
 
113
        friend class AvCallManagerPrivate;
 
114
        friend class AvCall;
 
115
        friend class AvCallPrivate;
 
116
 
 
117
        AvCallManagerPrivate *d;
 
118
};
 
119
 
 
120
#endif