~ubuntu-branches/ubuntu/raring/sflphone/raring

« back to all changes in this revision

Viewing changes to sflphone-common/src/iax/iaxcall.h

  • Committer: Package Import Robot
  • Author(s): Francois Marier
  • Date: 2011-11-25 13:24:12 UTC
  • mfrom: (4.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20111125132412-dc4qvhyosk74cd42
Tags: 1.0.1-4
Don't assume that arch:all packages will get built (closes: #649726)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
3
 
 *  Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
4
 
 *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; either version 3 of the License, or
9
 
 *  (at your option) any later version.
10
 
 *
11
 
 *  This program is distributed in the hope that it will be useful,
12
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 *  GNU General Public License for more details.
15
 
 *
16
 
 *  You should have received a copy of the GNU General Public License
17
 
 *  along with this program; if not, write to the Free Software
18
 
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
 
 *
20
 
 *  Additional permission under GNU GPL version 3 section 7:
21
 
 *
22
 
 *  If you modify this program, or any covered work, by linking or
23
 
 *  combining it with the OpenSSL project's OpenSSL library (or a
24
 
 *  modified version of that library), containing parts covered by the
25
 
 *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
26
 
 *  grants you additional permission to convey the resulting work.
27
 
 *  Corresponding Source for a non-source form of such a combination
28
 
 *  shall include the source code for the parts of OpenSSL used as well
29
 
 *  as that of the covered work.
30
 
 */
31
 
#ifndef IAXCALL_H
32
 
#define IAXCALL_H
33
 
 
34
 
#include "call.h"
35
 
#include "audio/codecs/codecDescriptor.h"
36
 
 
37
 
#include <iax-client.h>
38
 
#include <frame.h>
39
 
 
40
 
/**
41
 
 * @file: iaxcall.h
42
 
 * @brief IAXCall are IAX implementation of a normal Call
43
 
 */
44
 
 
45
 
class IAXCall : public Call
46
 
{
47
 
    public:
48
 
        /**
49
 
         * Constructor
50
 
         * @param id  The unique ID of the call
51
 
         * @param type  The type of the call
52
 
         */
53
 
        IAXCall (const CallID& id, Call::CallType type);
54
 
 
55
 
        /**
56
 
         * Destructor
57
 
         */
58
 
        ~IAXCall();
59
 
 
60
 
        /**
61
 
         * @return iax_session* The session pointer or NULL
62
 
         */
63
 
        struct iax_session* getSession() {
64
 
            return _session;
65
 
        }
66
 
 
67
 
        /**
68
 
         * Set the session pointer
69
 
         * @param session the session pointer to assign
70
 
         */
71
 
        void setSession (struct iax_session* session) {
72
 
            _session = session;
73
 
        }
74
 
 
75
 
        /**
76
 
         * Set format (one single bit)
77
 
         * This function sets the _audioCodec variable with the correct
78
 
         * codec.
79
 
         * @param format  The format representing the codec
80
 
         */
81
 
        void setFormat (int format);
82
 
 
83
 
        /**
84
 
         * Get format for the voice codec used
85
 
         * @return int  Bitmask for codecs defined in iax/frame.h
86
 
         */
87
 
        int getFormat() {
88
 
            return _format;
89
 
        }
90
 
 
91
 
 
92
 
        /**
93
 
         * @return int  The bitwise list of supported formats
94
 
         */
95
 
        int getSupportedFormat (std::string accountID);
96
 
 
97
 
        /**
98
 
         * Return a format (int) with the first matching codec selected.
99
 
         *
100
 
         * This considers the order of the appearance in the CodecMap,
101
 
         * thus, the order of preference.
102
 
         *
103
 
         * NOTE: Everything returned is bound to the content of the local
104
 
         *       CodecMap, so it won't return format values that aren't valid
105
 
         *       in this call context.
106
 
         *
107
 
         * @param needles  The format(s) (bitwise) you are looking for to match
108
 
         * @return int  The matching format, thus 0 if none matches
109
 
         */
110
 
        int getFirstMatchingFormat (int needles, std::string accountID);
111
 
 
112
 
        // AUDIO
113
 
        /**
114
 
         * Set internal codec Map: initialization only, not protected
115
 
         * @param map The codec map
116
 
         */
117
 
        void setCodecMap (const CodecDescriptor& map) {
118
 
            _codecMap = map;
119
 
        }
120
 
 
121
 
        /**
122
 
         * Get internal codec Map: initialization only, not protected
123
 
         * @return CodecDescriptor      The codec map
124
 
         */
125
 
        CodecDescriptor& getCodecMap();
126
 
 
127
 
        /**
128
 
         * Return audio codec [mutex protected]
129
 
         * @return AudioCodecType The payload of the codec
130
 
         */
131
 
        AudioCodecType getAudioCodec();
132
 
 
133
 
    private:
134
 
        /** Each call is associated with an iax_session */
135
 
        struct iax_session* _session;
136
 
 
137
 
        /**
138
 
         * Set the audio codec used.  [not protected]
139
 
         * @param audioCodec  The payload of the codec
140
 
         */
141
 
        void setAudioCodec (AudioCodecType audioCodec) {
142
 
            _audioCodec = audioCodec;
143
 
        }
144
 
 
145
 
        /** Codec Map */
146
 
        CodecDescriptor _codecMap;
147
 
 
148
 
        /** Codec pointer */
149
 
        AudioCodecType _audioCodec;
150
 
 
151
 
        /**
152
 
         * Format currently in use in the conversation,
153
 
         * sent in each outgoing voice packet.
154
 
         */
155
 
        int _format;
156
 
};
157
 
 
158
 
#endif