OPAL  Version 3.14.3
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: 32505 $
28  * $Author: ededu $
29  * $Date: 2014-08-12 18:10:26 +1000 (Tue, 12 Aug 2014) $
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_config.h>
41 
42 #if OPAL_HAS_PCSS
43 
44 #include <ptlib/sound.h>
45 #include <ep/localep.h>
46 
47 
48 class OpalPCSSConnection;
49 
50 #define OPAL_PCSS_PREFIX "pc"
51 
52 
56 {
58  public:
65  const char * prefix = OPAL_PCSS_PREFIX
66  );
67 
72 
104  virtual PSafePtr<OpalConnection> MakeConnection(
105  OpalCall & call,
106  const PString & party,
107  void * userData = NULL,
108  unsigned options = 0,
109  OpalConnection::StringOptions * stringOptions = NULL
110  );
112 
120  virtual bool OnOutgoingCall(
121  const OpalLocalConnection & connection
122  );
123 
133  virtual bool OnIncomingCall(
134  OpalLocalConnection & connection
135  );
136 
142  virtual bool OnUserInput(
143  const OpalLocalConnection & connection,
144  const PString & indication
145  );
146 
147 #if OPAL_VIDEO
148 
150  virtual bool CreateVideoInputDevice(
151  const OpalConnection & connection,
152  const OpalMediaFormat & mediaFormat,
153  PVideoInputDevice * & device,
154  bool & autoDelete
155  );
156 #endif
157 
158 
165  OpalCall & call,
166  const PString & playDevice,
167  const PString & recordDevice,
168  void * userData,
169  unsigned options,
170  OpalConnection::StringOptions * stringOptions
171  );
172 
175  virtual PSoundChannel * CreateSoundChannel(
176  const OpalPCSSConnection & connection,
177  const OpalMediaFormat & mediaFormat,
178  PBoolean isSource
179  );
180 
183  virtual PSoundChannel * CreateSoundChannel(
184  const OpalPCSSConnection & connection,
185  const OpalMediaFormat & mediaFormat,
186  const PString & device,
187  bool isSource
188  );
190 
199  PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
200  const PString & token,
201  PSafetyMode mode = PSafeReadWrite
202  ) { return GetConnectionWithLockAs<OpalPCSSConnection>(token, mode); }
203 
212  virtual PBoolean OnShowIncoming(
213  const OpalPCSSConnection & connection
214  );
215 
220  virtual PBoolean AcceptIncomingConnection(
221  const PString & connectionToken
222  );
223 
228  virtual PBoolean RejectIncomingConnection(
229  const PString & connectionToken,
230  const OpalConnection::CallEndReason & reason = OpalConnection::EndedByAnswerDenied
231  );
232 
238  virtual PBoolean OnShowOutgoing(
239  const OpalPCSSConnection & connection
240  );
241 
247  virtual PBoolean OnShowUserInput(
248  const OpalPCSSConnection & connection,
249  const PString & indication
250  );
252 
264  const PString & tone
265  );
266 
270  const PString & GetLocalRingbackTone() const { return m_localRingbackTone; }
271 
279  virtual PBoolean SetSoundChannelPlayDevice(const PString & name);
280 
285  const PString & GetSoundChannelPlayDevice() const { return m_soundChannelPlayDevice; }
286 
294  virtual PBoolean SetSoundChannelRecordDevice(const PString & name);
295 
300  const PString & GetSoundChannelRecordDevice() const { return m_soundChannelRecordDevice; }
301 
308  virtual bool SetSoundChannelOnHoldDevice(const PString & name);
309 
313  const PString & GetSoundChannelOnHoldDevice() const { return m_soundChannelOnHoldDevice; }
314 
319  virtual bool SetSoundChannelOnRingDevice(const PString & name);
320 
324  const PString & GetSoundChannelOnRingDevice() const { return m_soundChannelOnRingDevice; }
325 
326 #if OPAL_VIDEO
327 
329  virtual bool SetVideoGrabberDevice(const PVideoDevice::OpenArgs & args);
330 
333  const PVideoDevice::OpenArgs & GetVideoGrabberDevice() const { return GetManager().GetVideoInputDevice(); }
334 
337  virtual bool SetVideoPreviewDevice(const PVideoDevice::OpenArgs & args);
338 
341  const PVideoDevice::OpenArgs & GetVideoPreviewDevice() const { return GetManager().GetVideoPreviewDevice(); }
342 
345  virtual bool SetVideoDisplayDevice(const PVideoDevice::OpenArgs & args);
346 
349  const PVideoDevice::OpenArgs & GetVideoDisplayDevice() const { return GetManager().GetVideoOutputDevice(); }
350 
354  virtual bool SetVideoOnHoldDevice(const PVideoDevice::OpenArgs & args);
355 
359  const PVideoDevice::OpenArgs & GetVideoOnHoldDevice() const { return m_videoOnHoldDevice; }
360 
364  virtual bool SetVideoOnRingDevice(const PVideoDevice::OpenArgs & args);
365 
369  const PVideoDevice::OpenArgs & GetVideoOnRingDevice() const { return m_videoOnRingDevice; }
370 #endif
371 
377 
383  unsigned depth
384  );
385 
391 
397  unsigned depth
398  );
400 
401  protected:
409 #if OPAL_VIDEO
410  PVideoDevice::OpenArgs m_videoOnHoldDevice;
411  PVideoDevice::OpenArgs m_videoOnRingDevice;
412 #endif
413 
414  private:
415  P_REMOVE_VIRTUAL(OpalPCSSConnection *, CreateConnection(OpalCall &, const PString &, const PString &, void *), 0)
416 };
417 
418 
422 {
424  public:
430  OpalCall & call,
432  const PString & playDevice,
433  const PString & recordDevice,
434  unsigned options = 0,
435  OpalConnection::StringOptions * stringOptions = NULL
436  );
437 
442 
462  virtual void OnReleased();
463 
474  virtual PBoolean SetAlerting(
475  const PString & calleeName,
476  PBoolean withMedia
477  );
478 
485  virtual bool TransferConnection(
486  const PString & remoteParty
487  );
488 
493  virtual void OnHold(
494  bool fromRemote,
495  bool onHold
496  );
497 
513  const OpalMediaFormat & mediaFormat,
514  unsigned sessionID,
515  PBoolean isSource
516  );
517 
522  virtual void OnStartMediaPatch(
523  OpalMediaPatch & patch
524  );
525 
529  virtual PBoolean SetAudioVolume(
530  PBoolean source,
531  unsigned percentage
532  );
533 
537  virtual PBoolean GetAudioVolume(
538  PBoolean source,
539  unsigned & percentage
540  );
541 
544  virtual bool SetAudioMute(
545  bool source,
546  bool mute
547  );
548 
551  virtual bool GetAudioMute(
552  bool source,
553  bool & mute
554  );
555 
559  virtual unsigned GetAudioSignalLevel(
560  PBoolean source
561  );
562 
567  virtual void AlertingIncoming(
568  bool withMedia = false
569  );
570 
573  virtual void AcceptIncoming();
575 
580  virtual PSoundChannel * CreateSoundChannel(
581  const OpalMediaFormat & mediaFormat,
582  PBoolean isSource
583  );
584 
587  virtual bool ChangeSoundChannel(
588  const PString & device,
589  bool isSource,
590  unsigned sessionID = 0
591  );
593 
599  const PString & GetLocalRingbackTone() const { return m_localRingbackTone; }
600 
605  const PString & GetSoundChannelPlayDevice() const { return m_soundChannelPlayDevice; }
606 
611  const PString & GetSoundChannelRecordDevice() const { return m_soundChannelRecordDevice; }
612 
616  const PString & GetSoundChannelOnHoldDevice() const { return m_soundChannelOnHoldDevice; }
617 
621  const PString & GetSoundChannelOnRingDevice() const { return m_soundChannelOnRingDevice; }
622 
623 #if OPAL_VIDEO
624 
627  const PVideoDevice::OpenArgs & GetVideoOnHoldDevice() const { return m_videoOnHoldDevice; }
628 
632  const PVideoDevice::OpenArgs & GetVideoOnRingDevice() const { return m_videoOnRingDevice; }
633 #endif
634 
640 
647 
648 
649  protected:
658 #if OPAL_VIDEO
659  PVideoDevice::OpenArgs m_videoOnHoldDevice;
660  PVideoDevice::OpenArgs m_videoOnRingDevice;
661 #endif
662 
663  PThread * m_ringbackThread;
664  PSyncPoint m_ringbackStop;
665  void RingbackMain();
666 };
667 #endif // OPAL_HAS_PCSS
668 #endif // OPAL_OPAL_PCSS_H