OPAL  Version 3.10.10
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: 28276 $
28  * $Author: rjongbloed $
29  * $Date: 2012-08-29 21:50:30 -0500 (Wed, 29 Aug 2012) $
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 
54 {
56  public:
63  const char * prefix = "pc"
64  );
65 
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 
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,
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 
274  unsigned depth
275  );
276 
282 
288  unsigned depth
289  );
291 
292  protected:
297 
298  private:
299  P_REMOVE_VIRTUAL(OpalPCSSConnection *, CreateConnection(OpalCall &, const PString &, const PString &, void *), 0)
300 };
301 
302 
306 {
308  public:
314  OpalCall & call,
316  const PString & playDevice,
317  const PString & recordDevice,
318  unsigned options = 0,
319  OpalConnection::StringOptions * stringOptions = NULL
320  );
321 
326 
335  virtual bool TransferConnection(
336  const PString & remoteParty
337  );
338 
354  const OpalMediaFormat & mediaFormat,
355  unsigned sessionID,
356  PBoolean isSource
357  );
358 
362  virtual PBoolean SetAudioVolume(
363  PBoolean source,
364  unsigned percentage
365  );
366 
370  virtual PBoolean GetAudioVolume(
371  PBoolean source,
372  unsigned & percentage
373  );
374 
377  virtual bool SetAudioMute(
378  bool source,
379  bool mute
380  );
381 
384  virtual bool GetAudioMute(
385  bool source,
386  bool & mute
387  );
388 
392  virtual unsigned GetAudioSignalLevel(
393  PBoolean source
394  );
396 
401  virtual PSoundChannel * CreateSoundChannel(
402  const OpalMediaFormat & mediaFormat,
403  PBoolean isSource
404  );
406 
413  const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
414 
419  const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
420 
425  unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
426 
433 
434 
435  protected:
441 };
442 
443 #else
444 
445 #ifdef _MSC_VER
446 #pragma message("PTLib soundcard support not available")
447 #else
448 #warning "PTLib soundcard support not available"
449 #endif
450 
451 
452 #endif // OPAL_HAS_PCSS
453 
454 #endif // OPAL_OPAL_PCSS_H
455 
456 
457 // End of File ///////////////////////////////////////////////////////////////
Definition: manager.h:74
virtual PBoolean SetSoundChannelRecordDevice(const PString &name)
unsigned m_soundChannelBufferTime
Definition: pcss.h:296
virtual PBoolean GetAudioVolume(PBoolean source, unsigned &percentage)
unsigned m_soundChannelBufferTime
Definition: pcss.h:440
void SetSoundChannelBufferTime(unsigned depth)
const PString & GetSoundChannelRecordDevice() const
Definition: pcss.h:419
Definition: localep.h:360
virtual bool OnOutgoingCall(const OpalLocalConnection &connection)
virtual PBoolean OnShowOutgoing(const OpalPCSSConnection &connection)=0
virtual PSoundChannel * CreateSoundChannel(const OpalPCSSConnection &connection, const OpalMediaFormat &mediaFormat, PBoolean isSource)
unsigned GetSoundChannelBufferTime() const
Definition: pcss.h:281
virtual bool OnIncomingCall(OpalLocalConnection &connection)
virtual PBoolean RejectIncomingConnection(const PString &connectionToken, const OpalConnection::CallEndReason &reason=OpalConnection::EndedByAnswerDenied)
PString soundChannelRecordDevice
Definition: pcss.h:438
const PString & GetSoundChannelRecordDevice() const
Definition: pcss.h:261
virtual OpalPCSSConnection * CreateConnection(OpalCall &call, const PString &playDevice, const PString &recordDevice, void *userData, unsigned options, OpalConnection::StringOptions *stringOptions)
virtual OpalMediaStream * CreateMediaStream(const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
PString soundChannelRecordDevice
Definition: pcss.h:294
Local endpoint did not accept call OnIncomingCall()=false.
Definition: connection.h:364
OpalPCSSEndPoint(OpalManager &manager, const char *prefix="pc")
virtual bool TransferConnection(const PString &remoteParty)
Definition: connection.h:462
Definition: localep.h:50
unsigned GetSoundChannelBufferDepth() const
Definition: pcss.h:425
Definition: mediafmt.h:724
Definition: pcss.h:305
PSafePtr< OpalPCSSConnection > GetPCSSConnectionWithLock(const PString &token, PSafetyMode mode=PSafeReadWrite)
Definition: pcss.h:177
PString soundChannelPlayDevice
Definition: pcss.h:437
void SetSoundChannelBufferDepth(unsigned depth)
Definition: call.h:65
Definition: pcss.h:53
virtual unsigned GetAudioSignalLevel(PBoolean source)
unsigned soundChannelBuffers
Definition: pcss.h:295
virtual PBoolean SetAudioVolume(PBoolean source, unsigned percentage)
virtual PSoundChannel * CreateSoundChannel(const OpalMediaFormat &mediaFormat, PBoolean isSource)
virtual PBoolean AcceptIncomingConnection(const PString &connectionToken)
OpalManager & manager
Definition: endpoint.h:807
virtual bool GetAudioMute(bool source, bool &mute)
virtual PBoolean OnShowUserInput(const OpalPCSSConnection &connection, const PString &indication)
Definition: connection.h:396
const PString & GetSoundChannelPlayDevice() const
Definition: pcss.h:246
virtual PBoolean SetSoundChannelPlayDevice(const PString &name)
PString soundChannelPlayDevice
Definition: pcss.h:293
OpalPCSSConnection(OpalCall &call, OpalPCSSEndPoint &endpoint, const PString &playDevice, const PString &recordDevice, unsigned options=0, OpalConnection::StringOptions *stringOptions=NULL)
Definition: mediastrm.h:111
unsigned GetSoundChannelBufferDepth() const
Definition: pcss.h:267
virtual PBoolean OnShowIncoming(const OpalPCSSConnection &connection)=0
const PString & GetSoundChannelPlayDevice() const
Definition: pcss.h:413
virtual bool SetAudioMute(bool source, bool mute)
virtual PSafePtr< OpalConnection > MakeConnection(OpalCall &call, const PString &party, void *userData=NULL, unsigned options=0, OpalConnection::StringOptions *stringOptions=NULL)
unsigned GetSoundChannelBufferTime() const
Definition: pcss.h:431
unsigned soundChannelBuffers
Definition: pcss.h:439
virtual bool OnUserInput(const OpalLocalConnection &connection, const PString &indication)
OpalPCSSEndPoint & endpoint
Definition: pcss.h:436