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: 19279 $
00028  * $Author: rjongbloed $
00029  * $Date: 2008-01-17 04:08:34 +0000 (Thu, 17 Jan 2008) $
00030  */
00031 
00032 #ifndef __OPAL_PCSS_H
00033 #define __OPAL_PCSS_H
00034 
00035 #ifdef P_USE_PRAGMA
00036 #pragma interface
00037 #endif
00038 
00039 #include <ptbuildopts.h>
00040 
00041 #ifndef P_AUDIO
00042 #warning "PTLib soundcard support not available"
00043 #else
00044 
00045 #include <ptlib/sound.h>
00046 #include <opal/buildopts.h>
00047 #include <opal/endpoint.h>
00048 
00049 class OpalPCSSConnection;
00050 
00051 
00054 class OpalPCSSEndPoint : public OpalEndPoint
00055 {
00056     PCLASSINFO(OpalPCSSEndPoint, OpalEndPoint);
00057   public:
00062     OpalPCSSEndPoint(
00063       OpalManager & manager,  
00064       const char * prefix = "pc" 
00065     );
00066 
00069     ~OpalPCSSEndPoint();
00071 
00103     virtual PBoolean MakeConnection(
00104       OpalCall & call,           
00105       const PString & party,     
00106       void * userData = NULL,    
00107       unsigned int options = 0,  
00108       OpalConnection::StringOptions * stringOptions  = NULL
00109     );
00110 
00120     virtual OpalMediaFormatList GetMediaFormats() const;
00122 
00128     virtual OpalPCSSConnection * CreateConnection(
00129       OpalCall & call,    
00130       const PString & playDevice, 
00131       const PString & recordDevice, 
00132       void * userData     
00133     );
00134 
00137     virtual PSoundChannel * CreateSoundChannel(
00138       const OpalPCSSConnection & connection, 
00139       const OpalMediaFormat & mediaFormat,   
00140       PBoolean isSource                          
00141     );
00143 
00150     PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
00151       const PString & token,     
00152       PSafetyMode mode = PSafeReadWrite
00153     ) { return PSafePtrCast<OpalConnection, OpalPCSSConnection>(GetConnectionWithLock(token, mode)); }
00154 
00160     virtual PBoolean OnShowIncoming(
00161       const OpalPCSSConnection & connection 
00162     ) = 0;
00163 
00168     virtual PBoolean AcceptIncomingConnection(
00169       const PString & connectionToken 
00170     );
00171 
00177     virtual PBoolean OnShowOutgoing(
00178       const OpalPCSSConnection & connection 
00179     ) = 0;
00180 
00186     virtual PBoolean OnShowUserInput(
00187       const OpalPCSSConnection & connection, 
00188       const PString & indication
00189     );
00190 
00191     
00196     virtual void OnPatchMediaStream(
00197       const OpalPCSSConnection & connection, 
00198       PBoolean isSource,                         
00199       OpalMediaPatch & patch                 
00200     );
00202 
00212     virtual PBoolean SetSoundChannelPlayDevice(const PString & name);
00213 
00218     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00219 
00227     virtual PBoolean SetSoundChannelRecordDevice(const PString & name);
00228 
00233     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00234 
00237     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00238 
00241     void SetSoundChannelBufferDepth(
00242       unsigned depth    
00243     );
00245 
00246 
00247   protected:
00248     PString  soundChannelPlayDevice;
00249     PString  soundChannelRecordDevice;
00250     unsigned soundChannelBuffers;
00251 };
00252 
00253 
00256 class OpalPCSSConnection : public OpalConnection
00257 {
00258     PCLASSINFO(OpalPCSSConnection, OpalConnection);
00259   public:
00264     OpalPCSSConnection(
00265       OpalCall & call,              
00266       OpalPCSSEndPoint & endpoint,  
00267       const PString & playDevice,   
00268       const PString & recordDevice  
00269     );
00270 
00273     ~OpalPCSSConnection();
00275 
00284     virtual PBoolean SetUpConnection();
00285 
00296     virtual PBoolean SetAlerting(
00297       const PString & calleeName,   
00298       PBoolean withMedia                
00299     );
00300 
00305     virtual PBoolean SetConnected();
00306 
00314     virtual OpalMediaFormatList GetMediaFormats() const;
00315 
00330     virtual OpalMediaStream * CreateMediaStream(
00331       const OpalMediaFormat & mediaFormat, 
00332       unsigned sessionID,                  
00333       PBoolean isSource                        
00334     );
00335 
00343     virtual void OnPatchMediaStream(
00344       PBoolean isSource,
00345       OpalMediaPatch & patch    
00346     );
00347 
00350     virtual OpalMediaStreamPtr OpenMediaStream(
00351       const OpalMediaFormat & mediaFormat, 
00352       unsigned sessionID,                  
00353       bool isSource                        
00354     );
00355 
00358     virtual PBoolean SetAudioVolume(
00359       PBoolean source,                  
00360       unsigned percentage           
00361     );
00362 
00366     virtual unsigned GetAudioSignalLevel(
00367       PBoolean source                   
00368     );
00369 
00377     virtual PBoolean SendUserInputString(
00378       const PString & value                   
00379     );
00381 
00386     virtual void AcceptIncoming();
00387 
00390     virtual PSoundChannel * CreateSoundChannel(
00391       const OpalMediaFormat & mediaFormat, 
00392       PBoolean isSource                        
00393     );
00395 
00402     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00403 
00408     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00409 
00412     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00414 
00415 
00416   protected:
00417     OpalPCSSEndPoint & endpoint;
00418     PString            soundChannelPlayDevice;
00419     PString            soundChannelRecordDevice;
00420     unsigned           soundChannelBuffers;
00421 };
00422 
00423 #endif // P_AUDIO
00424 
00425 #endif // __OPAL_PCSS_H
00426 
00427 
00428 // End of File ///////////////////////////////////////////////////////////////

Generated on Fri Mar 7 07:36:38 2008 for OPAL by  doxygen 1.5.1