pcss.h

Go to the documentation of this file.
00001 /*
00002  * pcss.h
00003  *
00004  * PC Sound System support.
00005  *
00006  * Open Phone Abstraction Library (OPAL)
00007  * Formally known as the Open H323 project.
00008  *
00009  * Copyright (c) 2001 Equivalence Pty. Ltd.
00010  *
00011  * The contents of this file are subject to the Mozilla Public License
00012  * Version 1.0 (the "License"); you may not use this file except in
00013  * compliance with the License. You may obtain a copy of the License at
00014  * http://www.mozilla.org/MPL/
00015  *
00016  * Software distributed under the License is distributed on an "AS IS"
00017  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00018  * the License for the specific language governing rights and limitations
00019  * under the License.
00020  *
00021  * The Original Code is Open Phone Abstraction Library.
00022  *
00023  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00024  *
00025  * Contributor(s): ______________________________________.
00026  *
00027  * $Revision: 23008 $
00028  * $Author: rjongbloed $
00029  * $Date: 2009-06-29 04:24:23 +0000 (Mon, 29 Jun 2009) $
00030  */
00031 
00032 #ifndef OPAL_OPAL_PCSS_H
00033 #define OPAL_OPAL_PCSS_H
00034 
00035 #ifdef P_USE_PRAGMA
00036 #pragma interface
00037 #endif
00038 
00039 
00040 #include <opal/buildopts.h>
00041 
00042 #ifndef OPAL_PTLIB_AUDIO
00043 #ifdef _MSC_VER
00044 #pragma message("PTLib soundcard support not available")
00045 #else
00046 #warning "PTLib soundcard support not available"
00047 #endif
00048 #else
00049 
00050 #include <ptlib/sound.h>
00051 #include <opal/localep.h>
00052 
00053 
00054 class OpalPCSSConnection;
00055 
00056 
00059 class OpalPCSSEndPoint : public OpalLocalEndPoint
00060 {
00061     PCLASSINFO(OpalPCSSEndPoint, OpalLocalEndPoint);
00062   public:
00067     OpalPCSSEndPoint(
00068       OpalManager & manager,  
00069       const char * prefix = "pc" 
00070     );
00071 
00074     ~OpalPCSSEndPoint();
00076 
00108     virtual PSafePtr<OpalConnection> MakeConnection(
00109       OpalCall & call,           
00110       const PString & party,     
00111       void * userData = NULL,    
00112       unsigned int options = 0,  
00113       OpalConnection::StringOptions * stringOptions  = NULL
00114     );
00116 
00124     virtual bool OnOutgoingCall(
00125       const OpalLocalConnection & connection 
00126     );
00127 
00133     virtual bool OnIncomingCall(
00134       OpalLocalConnection & connection 
00135     );
00136 
00142     virtual bool OnUserInput(
00143       const OpalLocalConnection & connection, 
00144       const PString & indication
00145     );
00147 
00153     virtual OpalPCSSConnection * CreateConnection(
00154       OpalCall & call,    
00155       const PString & playDevice, 
00156       const PString & recordDevice, 
00157       void * userData,    
00158       unsigned options,
00159       OpalConnection::StringOptions * stringOptions
00160     );
00161 
00164     virtual PSoundChannel * CreateSoundChannel(
00165       const OpalPCSSConnection & connection, 
00166       const OpalMediaFormat & mediaFormat,   
00167       PBoolean isSource                          
00168     );
00170 
00179     PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
00180       const PString & token,     
00181       PSafetyMode mode = PSafeReadWrite
00182     ) { return GetConnectionWithLockAs<OpalPCSSConnection>(token, mode); }
00183 
00189     virtual PBoolean OnShowIncoming(
00190       const OpalPCSSConnection & connection 
00191     ) = 0;
00192 
00197     virtual PBoolean AcceptIncomingConnection(
00198       const PString & connectionToken 
00199     );
00200 
00205     virtual PBoolean RejectIncomingConnection(
00206       const PString & connectionToken 
00207     );
00208 
00214     virtual PBoolean OnShowOutgoing(
00215       const OpalPCSSConnection & connection 
00216     ) = 0;
00217 
00223     virtual PBoolean OnShowUserInput(
00224       const OpalPCSSConnection & connection, 
00225       const PString & indication
00226     );
00228 
00238     virtual PBoolean SetSoundChannelPlayDevice(const PString & name);
00239 
00244     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00245 
00253     virtual PBoolean SetSoundChannelRecordDevice(const PString & name);
00254 
00259     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00260 
00265     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00266 
00271     void SetSoundChannelBufferDepth(
00272       unsigned depth    
00273     );
00274 
00279     unsigned GetSoundChannelBufferTime() const { return m_soundChannelBufferTime; }
00280 
00285     void SetSoundChannelBufferTime(
00286       unsigned depth    
00287     );
00289 
00290   protected:
00291     PString  soundChannelPlayDevice;
00292     PString  soundChannelRecordDevice;
00293     unsigned soundChannelBuffers;
00294     unsigned m_soundChannelBufferTime;
00295 
00296   private:
00297     P_REMOVE_VIRTUAL(OpalPCSSConnection *, CreateConnection(OpalCall &, const PString &, const PString &, void *), 0)
00298 };
00299 
00300 
00303 class OpalPCSSConnection : public OpalLocalConnection
00304 {
00305     PCLASSINFO(OpalPCSSConnection, OpalLocalConnection);
00306   public:
00311     OpalPCSSConnection(
00312       OpalCall & call,              
00313       OpalPCSSEndPoint & endpoint,  
00314       const PString & playDevice,   
00315       const PString & recordDevice,  
00316       unsigned options = 0,
00317       OpalConnection::StringOptions * stringOptions = NULL
00318     );
00319 
00322     ~OpalPCSSConnection();
00324 
00333     virtual bool TransferConnection(
00334       const PString & remoteParty   
00335     );
00336 
00351     virtual OpalMediaStream * CreateMediaStream(
00352       const OpalMediaFormat & mediaFormat, 
00353       unsigned sessionID,                  
00354       PBoolean isSource                        
00355     );
00356 
00359     virtual PBoolean SetAudioVolume(
00360       PBoolean source,                  
00361       unsigned percentage           
00362     );
00363 
00367     virtual unsigned GetAudioSignalLevel(
00368       PBoolean source                   
00369     );
00371 
00376     virtual PSoundChannel * CreateSoundChannel(
00377       const OpalMediaFormat & mediaFormat, 
00378       PBoolean isSource                        
00379     );
00381 
00388     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00389 
00394     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00395 
00400     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00401 
00406     unsigned GetSoundChannelBufferTime() const { return m_soundChannelBufferTime; }
00408 
00409 
00410   protected:
00411     OpalPCSSEndPoint & endpoint;
00412     PString            soundChannelPlayDevice;
00413     PString            soundChannelRecordDevice;
00414     unsigned           soundChannelBuffers;
00415     unsigned           m_soundChannelBufferTime;
00416 };
00417 
00418 #endif // OPAL_PTLIB_AUDIO
00419 
00420 #endif // OPAL_OPAL_PCSS_H
00421 
00422 
00423 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Aug 3 20:50:24 2009 for OPAL by  doxygen 1.5.1