nettoyage du repertoire debian/
[asterisk-app-conference.git] / member.h
CommitLineData
c575c500
TN
1
2// $Id: member.h 872 2007-03-05 23:43:10Z sbalea $
3
4/*
5 * app_conference
6 *
7 * A channel independent conference application for Asterisk
8 *
9 * Copyright (C) 2002, 2003 Junghanns.NET GmbH
10 * Copyright (C) 2003, 2004 HorizonLive.com, Inc.
11 * Copyright (C) 2005, 2006 HorizonWimba, Inc.
12 * Copyright (C) 2007 Wimba, Inc.
13 *
14 * Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
15 *
16 * Video Conferencing support added by
17 * Neil Stratford <neils@vipadia.com>
18 * Copyright (C) 2005, 2005 Vipadia Limited
19 *
20 * VAD driven video conferencing, text message support
21 * and miscellaneous enhancements added by
22 * Mihai Balea <mihai at hates dot ms>
23 *
24 * This program may be modified and distributed under the
25 * terms of the GNU General Public License. You should have received
26 * a copy of the GNU General Public License along with this
27 * program; if not, write to the Free Software Foundation, Inc.
28 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 */
30
31#ifndef _APP_CONF_MEMBER_H
32#define _APP_CONF_MEMBER_H
33
34//
35// includes
36//
37
38#include "app_conference.h"
39#include "common.h"
40
41//
42// struct declarations
43//
44
45struct ast_conf_soundq
46{
47 char name[256];
48 struct ast_filestream *stream; // the stream
49 int muted; // should incoming audio be muted while we play?
50 struct ast_conf_soundq *next;
51};
52
53struct ast_conf_member
54{
55 ast_mutex_t lock ; // member data mutex
56
57 struct ast_channel* chan ; // member's channel
58 char* channel_name ; // member's channel name
59
60 // values passed to create_member () via *data
61 int priority ; // highest priority gets the channel
62 char* flags ; // raw member-type flags
63 char type ; // L = ListenOnly, M = Moderator, S = Standard (Listen/Talk)
64 char* conf_name ; // name of the conference that own this member
65
66 char *callerid;
67 char *callername;
68
69 // voice flags
70 int vad_flag;
71 int denoise_flag;
72 int agc_flag;
73 int via_telephone;
74
75 // video conference params
76 int id;
77 int initial_id;
78 int req_id;
79
80 // muting options - this member will not be heard/seen
81 int mute_audio;
82 int mute_video;
83
84 // this member will not hear/see
85 int norecv_audio;
86 int norecv_video;
87
88 // this member does not have a camera
89 int no_camera;
90
91 // is this person a moderator?
92 int ismoderator;
93
94 // determine by flags and channel name
95 char connection_type ; // T = telephone, X = iaxclient, S = sip
96
97 // vad voice probability thresholds
98 float vad_prob_start ;
99 float vad_prob_continue ;
100
101 // ready flag
102 short ready_for_outgoing ;
103
104 // input frame queue
105 conf_frame* inFrames ;
106 conf_frame* inFramesTail ;
107 unsigned int inFramesCount ;
108 conf_frame* inVideoFrames ;
109 conf_frame* inVideoFramesTail ;
110 unsigned int inVideoFramesCount ;
111 conf_frame* inDTMFFrames ;
112 conf_frame* inDTMFFramesTail ;
113 unsigned int inDTMFFramesCount ;
114 conf_frame* inTextFrames ;
115 conf_frame* inTextFramesTail ;
116 unsigned int inTextFramesCount ;
117
118
119 // input/output smoother
120 struct ast_smoother *inSmoother;
121 struct ast_packer *outPacker;
122 int smooth_size_in;
123 int smooth_size_out;
124 int smooth_multiple;
125
126 // frames needed by conference_exec
127 unsigned int inFramesNeeded ;
128 unsigned int inVideoFramesNeeded ;
129
130 // used when caching last frame
131 conf_frame* inFramesLast ;
132 unsigned int inFramesRepeatLast ;
133 unsigned short okayToCacheLast ;
134
135 // LL output frame queue
136 conf_frame* outFrames ;
137 conf_frame* outFramesTail ;
138 unsigned int outFramesCount ;
139 conf_frame* outVideoFrames ;
140 conf_frame* outVideoFramesTail ;
141 unsigned int outVideoFramesCount ;
142 conf_frame* outDTMFFrames ;
143 conf_frame* outDTMFFramesTail ;
144 unsigned int outDTMFFramesCount ;
145 conf_frame* outTextFrames ;
146 conf_frame* outTextFramesTail ;
147 unsigned int outTextFramesCount ;
148
149 // LL video switched flag
150 short conference;
151
152 // switch video by VAD?
153 short vad_switch;
154 // switch by dtmf?
155 short dtmf_switch;
156 // relay dtmf to manager?
157 short dtmf_relay;
158 // initial nat delay flag
159 short first_frame_received;
160 // does text messages?
161 short does_text;
162
163
164 // time we last dropped a frame
165 struct timeval last_in_dropped ;
166 struct timeval last_out_dropped ;
167
168 // ( not currently used )
169 // int samplesperframe ;
170
171 // used for determining need to mix frames
172 // and for management interface notification
173 // and for VAD based video switching
174 short speaking_state_notify ;
175 short speaking_state ; // This flag will be true if this member or any of its drivers is speaking
176 short local_speaking_state; // This flag will be true only if this member is speaking
177 struct timeval last_state_change;
178 int speaker_count; // Number of drivers (including this member) that are speaking
179
180 // pointer to next member in single-linked list
181 struct ast_conf_member* next ;
182
183 // accounting values
184 unsigned long frames_in ;
185 unsigned long frames_in_dropped ;
186 unsigned long frames_out ;
187 unsigned long frames_out_dropped ;
188
189 unsigned long video_frames_in ;
190 unsigned long video_frames_in_dropped ;
191 unsigned long video_frames_out ;
192 unsigned long video_frames_out_dropped ;
193
194 unsigned long dtmf_frames_in ;
195 unsigned long dtmf_frames_in_dropped ;
196 unsigned long dtmf_frames_out ;
197 unsigned long dtmf_frames_out_dropped ;
198
199 unsigned long text_frames_in ;
200 unsigned long text_frames_in_dropped ;
201 unsigned long text_frames_out ;
202 unsigned long text_frames_out_dropped ;
203
204 // for counting sequentially dropped frames
205 unsigned int sequential_drops ;
206 unsigned long since_dropped ;
207
208 // start time
209 struct timeval time_entered ;
210 struct timeval lastsent_timeval ;
211
212 // flag indicating we should remove this member
213 short remove_flag ;
214 short kick_flag ;
215
216#if ( SILDET == 2 )
217 // pointer to speex preprocessor dsp
218 SpeexPreprocessState *dsp ;
219 // number of frames to ignore speex_preprocess()
220 int ignore_speex_count;
221#else
222 // placeholder when preprocessing is not enabled
223 void* dsp ;
224#endif
225
226 // audio format this member is using
227 int write_format ;
228 int read_format ;
229
230 int write_format_index ;
231 int read_format_index ;
232
233 // member frame translators
234 struct ast_trans_pvt* to_slinear ;
235 struct ast_trans_pvt* from_slinear ;
236
237 // For playing sounds
238 struct ast_conf_soundq *soundq;
239 struct ast_conf_soundq *videoq;
240
241 // Pointer to another member that will be driven from this member's audio
242 struct ast_conf_member *driven_member;
243} ;
244
245struct conf_member
246{
247 struct ast_conf_member* realmember ;
248 struct conf_member* next ;
249} ;
250
251//
252// function declarations
253//
254
255int member_exec( struct ast_channel* chan, void* data ) ;
256
257struct ast_conf_member* check_active_video( int id, struct ast_conference *conf );
258
259struct ast_conf_member* create_member( struct ast_channel* chan, const char* data ) ;
260struct ast_conf_member* delete_member( struct ast_conf_member* member ) ;
261
262// incoming queue
263int queue_incoming_frame( struct ast_conf_member* member, struct ast_frame* fr ) ;
264int queue_incoming_video_frame( struct ast_conf_member* member, const struct ast_frame* fr ) ;
265int queue_incoming_dtmf_frame( struct ast_conf_member* member, const struct ast_frame* fr ) ;
266conf_frame* get_incoming_frame( struct ast_conf_member* member ) ;
267conf_frame* get_incoming_video_frame( struct ast_conf_member* member ) ;
268conf_frame* get_incoming_dtmf_frame( struct ast_conf_member* member ) ;
269
270// outgoing queue
271int queue_outgoing_frame( struct ast_conf_member* member, const struct ast_frame* fr, struct timeval delivery ) ;
272int __queue_outgoing_frame( struct ast_conf_member* member, const struct ast_frame* fr, struct timeval delivery ) ;
273conf_frame* get_outgoing_frame( struct ast_conf_member* member ) ;
274
275int queue_outgoing_video_frame( struct ast_conf_member* member, const struct ast_frame* fr, struct timeval delivery ) ;
276conf_frame* get_outgoing_video_frame( struct ast_conf_member* member ) ;
277int queue_outgoing_dtmf_frame( struct ast_conf_member* member, const struct ast_frame* fr ) ;
278int queue_outgoing_text_frame( struct ast_conf_member* member, const struct ast_frame* fr ) ;
279conf_frame* get_outgoing_dtmf_frame( struct ast_conf_member* member ) ;
280conf_frame* get_outgoing_text_frame( struct ast_conf_member* member ) ;
281
282void send_state_change_notifications( struct ast_conf_member* member ) ;
283
284int increment_speaker_count(struct ast_conf_member *member, int lock);
285int decrement_speaker_count(struct ast_conf_member *member, int lock);
286
287void member_process_spoken_frames(struct ast_conference* conf,
288 struct ast_conf_member *member,
289 struct conf_frame **spoken_frames,
290 long time_diff,
291 int *listener_count,
292 int *speaker_count);
293
294void member_process_outgoing_frames(struct ast_conference* conf,
295 struct ast_conf_member *member,
296 struct conf_frame *send_frames);
297
298//
299// packer functions
300//
301
302struct ast_packer;
303
304extern struct ast_packer *ast_packer_new(int bytes);
305extern void ast_packer_set_flags(struct ast_packer *packer, int flags);
306extern int ast_packer_get_flags(struct ast_packer *packer);
307extern void ast_packer_free(struct ast_packer *s);
308extern void ast_packer_reset(struct ast_packer *s, int bytes);
309extern int ast_packer_feed(struct ast_packer *s, const struct ast_frame *f);
310extern struct ast_frame *ast_packer_read(struct ast_packer *s);
311#endif