OPAL Version 3.10.4

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

pcss.h
Go to the documentation of this file.
1 /*
2 * pcss.h
3 *
4 * PC Sound System support.
5 *
6 * Open Phone Abstraction Library (OPAL)
7 * Formally known as the Open H323 project.
8 *
9 * Copyright (c) 2001 Equivalence Pty. Ltd.
10 *
11 * The contents of this file are subject to the Mozilla Public License
12 * Version 1.0 (the "License"); you may not use this file except in
13 * compliance with the License. You may obtain a copy of the License at
14 * http://www.mozilla.org/MPL/
15 *
16 * Software distributed under the License is distributed on an "AS IS"
17 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18 * the License for the specific language governing rights and limitations
19 * under the License.
20 *
21 * The Original Code is Open Phone Abstraction Library.
22 *
23 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 *
25 * Contributor(s): ______________________________________.
26 *
27 * $Revision: 26069 $
28 * $Author: rjongbloed $
29 * $Date: 2011-06-23 19:56:50 -0500 (Thu, 23 Jun 2011) $
30 */
31
32 #ifndef OPAL_OPAL_PCSS_H
33 #define OPAL_OPAL_PCSS_H
34
35 #ifdef P_USE_PRAGMA
36 #pragma interface
37 #endif
38
39
40 #include <opal/buildopts.h>
41
42 #if OPAL_HAS_PCSS
43
44 #include <ptlib/sound.h>
45 #include <opal/localep.h>
46
47
48 class OpalPCSSConnection;
49
50
53 class OpalPCSSEndPoint : public OpalLocalEndPoint
54 {
55 PCLASSINFO(OpalPCSSEndPoint, OpalLocalEndPoint);
56 public:
61 OpalPCSSEndPoint(
62 OpalManager & manager,
63 const char * prefix = "pc"
64 );
65
68 ~OpalPCSSEndPoint();
70
102 virtual PSafePtr<OpalConnection> MakeConnection(
103 OpalCall & call,
104 const PString & party,
105 void * userData = NULL,
106 unsigned options = 0,
107 OpalConnection::StringOptions * stringOptions = NULL
108 );
110
118 virtual bool OnOutgoingCall(
119 const OpalLocalConnection & connection
120 );
121
131 virtual bool OnIncomingCall(
132 OpalLocalConnection & connection
133 );
134
140 virtual bool OnUserInput(
141 const OpalLocalConnection & connection,
142 const PString & indication
143 );
145
151 virtual OpalPCSSConnection * CreateConnection(
152 OpalCall & call,
153 const PString & playDevice,
154 const PString & recordDevice,
155 void * userData,
156 unsigned options,
157 OpalConnection::StringOptions * stringOptions
158 );
159
162 virtual PSoundChannel * CreateSoundChannel(
163 const OpalPCSSConnection & connection,
164 const OpalMediaFormat & mediaFormat,
165 PBoolean isSource
166 );
168
177 PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
178 const PString & token,
179 PSafetyMode mode = PSafeReadWrite
180 ) { return GetConnectionWithLockAs<OpalPCSSConnection>(token, mode); }
181
190 virtual PBoolean OnShowIncoming(
191 const OpalPCSSConnection & connection
192 ) = 0;
193
198 virtual PBoolean AcceptIncomingConnection(
199 const PString & connectionToken
200 );
201
206 virtual PBoolean RejectIncomingConnection(
207 const PString & connectionToken,
208 const OpalConnection::CallEndReason & reason = OpalConnection::EndedByAnswerDenied
209 );
210
216 virtual PBoolean OnShowOutgoing(
217 const OpalPCSSConnection & connection
218 ) = 0;
219
225 virtual PBoolean OnShowUserInput(
226 const OpalPCSSConnection & connection,
227 const PString & indication
228 );
230
240 virtual PBoolean SetSoundChannelPlayDevice(const PString & name);
241
246 const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
247
255 virtual PBoolean SetSoundChannelRecordDevice(const PString & name);
256
261 const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
262
267 unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
268
273 void SetSoundChannelBufferDepth(
274 unsigned depth
275 );
276
281 unsigned GetSoundChannelBufferTime() const { return m_soundChannelBufferTime; }
282
287 void SetSoundChannelBufferTime(
288 unsigned depth
289 );
291
292 protected:
293 PString soundChannelPlayDevice;
294 PString soundChannelRecordDevice;
295 unsigned soundChannelBuffers;
296 unsigned m_soundChannelBufferTime;
297
298 private:
299 P_REMOVE_VIRTUAL(OpalPCSSConnection *, CreateConnection(OpalCall &, const PString &, const PString &, void *), 0)
300 };
301
302
305 class OpalPCSSConnection : public OpalLocalConnection
306 {
307 PCLASSINFO(OpalPCSSConnection, OpalLocalConnection);
308 public:
313 OpalPCSSConnection(
314 OpalCall & call,
315 OpalPCSSEndPoint & endpoint,
316 const PString & playDevice,
317 const PString & recordDevice,
318 unsigned options = 0,
319 OpalConnection::StringOptions * stringOptions = NULL
320 );
321
324 ~OpalPCSSConnection();
326
335 virtual bool TransferConnection(
336 const PString & remoteParty
337 );
338
353 virtual OpalMediaStream * CreateMediaStream(
354 const OpalMediaFormat & mediaFormat,
355 unsigned sessionID,
356 PBoolean isSource
357 );
358
361 virtual PBoolean SetAudioVolume(
362 PBoolean source,
363 unsigned percentage
364 );
365
369 virtual unsigned GetAudioSignalLevel(
370 PBoolean source
371 );
373
378 virtual PSoundChannel * CreateSoundChannel(
379 const OpalMediaFormat & mediaFormat,
380 PBoolean isSource
381 );
383
390 const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
391
396 const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
397
402 unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
403
408 unsigned GetSoundChannelBufferTime() const { return m_soundChannelBufferTime; }
410
411
412 protected:
413 OpalPCSSEndPoint & endpoint;
414 PString soundChannelPlayDevice;
415 PString soundChannelRecordDevice;
416 unsigned soundChannelBuffers;
417 unsigned m_soundChannelBufferTime;
418 };
419
420 #else
421
422 #ifdef _MSC_VER
423 #pragma message("PTLib soundcard support not available")
424 #else
425 #warning "PTLib soundcard support not available"
426 #endif
427
428
429 #endif // OPAL_HAS_PCSS
430
431 #endif // OPAL_OPAL_PCSS_H
432
433
434 // End of File ///////////////////////////////////////////////////////////////