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: 21936 $
00028  * $Author: rjongbloed $
00029  * $Date: 2009-01-17 08:02:24 +0000 (Sat, 17 Jan 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/endpoint.h>
00052 
00053 class OpalPCSSConnection;
00054 
00055 
00058 class OpalPCSSEndPoint : public OpalEndPoint
00059 {
00060     PCLASSINFO(OpalPCSSEndPoint, OpalEndPoint);
00061   public:
00066     OpalPCSSEndPoint(
00067       OpalManager & manager,  
00068       const char * prefix = "pc" 
00069     );
00070 
00073     ~OpalPCSSEndPoint();
00075 
00107     virtual PBoolean MakeConnection(
00108       OpalCall & call,           
00109       const PString & party,     
00110       void * userData = NULL,    
00111       unsigned int options = 0,  
00112       OpalConnection::StringOptions * stringOptions  = NULL
00113     );
00115 
00121     virtual OpalPCSSConnection * CreateConnection(
00122       OpalCall & call,    
00123       const PString & playDevice, 
00124       const PString & recordDevice, 
00125       void * userData     
00126     );
00127     virtual OpalPCSSConnection * CreateConnection(
00128       OpalCall & call,    
00129       const PString & playDevice, 
00130       const PString & recordDevice, 
00131       void * userData,    
00132       unsigned options,
00133       OpalConnection::StringOptions * stringOptions
00134     );
00135 
00138     virtual PSoundChannel * CreateSoundChannel(
00139       const OpalPCSSConnection & connection, 
00140       const OpalMediaFormat & mediaFormat,   
00141       PBoolean isSource                          
00142     );
00144 
00153     PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
00154       const PString & token,     
00155       PSafetyMode mode = PSafeReadWrite
00156     ) { return GetConnectionWithLockAs<OpalPCSSConnection>(token, mode); }
00157 
00163     virtual PBoolean OnShowIncoming(
00164       const OpalPCSSConnection & connection 
00165     ) = 0;
00166 
00171     virtual PBoolean AcceptIncomingConnection(
00172       const PString & connectionToken 
00173     );
00174 
00179     virtual PBoolean RejectIncomingConnection(
00180       const PString & connectionToken 
00181     );
00182 
00188     virtual PBoolean OnShowOutgoing(
00189       const OpalPCSSConnection & connection 
00190     ) = 0;
00191 
00197     virtual PBoolean OnShowUserInput(
00198       const OpalPCSSConnection & connection, 
00199       const PString & indication
00200     );
00201 
00202     
00207     virtual void OnPatchMediaStream(
00208       const OpalPCSSConnection & connection, 
00209       PBoolean isSource,                         
00210       OpalMediaPatch & patch                 
00211     );
00213 
00223     virtual PBoolean SetSoundChannelPlayDevice(const PString & name);
00224 
00229     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00230 
00238     virtual PBoolean SetSoundChannelRecordDevice(const PString & name);
00239 
00244     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00245 
00248     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00249 
00252     void SetSoundChannelBufferDepth(
00253       unsigned depth    
00254     );
00256 
00257     OpalMediaFormatList GetMediaFormats() const;
00258 
00259   protected:
00260     PString  soundChannelPlayDevice;
00261     PString  soundChannelRecordDevice;
00262     unsigned soundChannelBuffers;
00263 };
00264 
00265 
00268 class OpalPCSSConnection : public OpalConnection
00269 {
00270     PCLASSINFO(OpalPCSSConnection, OpalConnection);
00271   public:
00276     OpalPCSSConnection(
00277       OpalCall & call,              
00278       OpalPCSSEndPoint & endpoint,  
00279       const PString & playDevice,   
00280       const PString & recordDevice,  
00281       unsigned options = 0,
00282       OpalConnection::StringOptions * stringOptions = NULL
00283     );
00284 
00287     ~OpalPCSSConnection();
00289 
00300     virtual bool IsNetworkConnection() const { return false; }
00301 
00308     virtual PBoolean SetUpConnection();
00309 
00320     virtual PBoolean SetAlerting(
00321       const PString & calleeName,   
00322       PBoolean withMedia                
00323     );
00324 
00331     virtual bool TransferConnection(
00332       const PString & remoteParty   
00333     );
00334 
00349     virtual OpalMediaStream * CreateMediaStream(
00350       const OpalMediaFormat & mediaFormat, 
00351       unsigned sessionID,                  
00352       PBoolean isSource                        
00353     );
00354 
00362     virtual void OnPatchMediaStream(
00363       PBoolean isSource,
00364       OpalMediaPatch & patch    
00365     );
00366 
00369     virtual OpalMediaStreamPtr OpenMediaStream(
00370       const OpalMediaFormat & mediaFormat, 
00371       unsigned sessionID,                  
00372       bool isSource                        
00373     );
00374 
00377     virtual PBoolean SetAudioVolume(
00378       PBoolean source,                  
00379       unsigned percentage           
00380     );
00381 
00385     virtual unsigned GetAudioSignalLevel(
00386       PBoolean source                   
00387     );
00388 
00396     virtual PBoolean SendUserInputString(
00397       const PString & value                   
00398     );
00400 
00405     virtual void AcceptIncoming();
00406 
00409     virtual PSoundChannel * CreateSoundChannel(
00410       const OpalMediaFormat & mediaFormat, 
00411       PBoolean isSource                        
00412     );
00414 
00421     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00422 
00427     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00428 
00431     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00433 
00434 
00435   protected:
00436     OpalPCSSEndPoint & endpoint;
00437     PString            soundChannelPlayDevice;
00438     PString            soundChannelRecordDevice;
00439     unsigned           soundChannelBuffers;
00440 };
00441 
00442 #endif // OPAL_PTLIB_AUDIO
00443 
00444 #endif // OPAL_OPAL_PCSS_H
00445 
00446 
00447 // End of File ///////////////////////////////////////////////////////////////

Generated on Tue May 19 09:56:26 2009 for OPAL by  doxygen 1.5.1