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: 22716 $
00028  * $Author: rjongbloed $
00029  * $Date: 2009-05-25 05:56:25 +0000 (Mon, 25 May 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       unsigned options,
00127       OpalConnection::StringOptions * stringOptions
00128     );
00129 
00132     virtual PSoundChannel * CreateSoundChannel(
00133       const OpalPCSSConnection & connection, 
00134       const OpalMediaFormat & mediaFormat,   
00135       PBoolean isSource                          
00136     );
00138 
00147     PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
00148       const PString & token,     
00149       PSafetyMode mode = PSafeReadWrite
00150     ) { return GetConnectionWithLockAs<OpalPCSSConnection>(token, mode); }
00151 
00157     virtual PBoolean OnShowIncoming(
00158       const OpalPCSSConnection & connection 
00159     ) = 0;
00160 
00165     virtual PBoolean AcceptIncomingConnection(
00166       const PString & connectionToken 
00167     );
00168 
00173     virtual PBoolean RejectIncomingConnection(
00174       const PString & connectionToken 
00175     );
00176 
00182     virtual PBoolean OnShowOutgoing(
00183       const OpalPCSSConnection & connection 
00184     ) = 0;
00185 
00191     virtual PBoolean OnShowUserInput(
00192       const OpalPCSSConnection & connection, 
00193       const PString & indication
00194     );
00195 
00196     
00201     virtual void OnPatchMediaStream(
00202       const OpalPCSSConnection & connection, 
00203       PBoolean isSource,                         
00204       OpalMediaPatch & patch                 
00205     );
00207 
00217     virtual PBoolean SetSoundChannelPlayDevice(const PString & name);
00218 
00223     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00224 
00232     virtual PBoolean SetSoundChannelRecordDevice(const PString & name);
00233 
00238     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00239 
00242     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00243 
00246     void SetSoundChannelBufferDepth(
00247       unsigned depth    
00248     );
00250 
00251     OpalMediaFormatList GetMediaFormats() const;
00252 
00253   protected:
00254     PString  soundChannelPlayDevice;
00255     PString  soundChannelRecordDevice;
00256     unsigned soundChannelBuffers;
00257 
00258   private:
00259     P_REMOVE_VIRTUAL(OpalPCSSConnection *, CreateConnection(OpalCall &, const PString &, const PString &, void *), 0)
00260 };
00261 
00262 
00265 class OpalPCSSConnection : public OpalConnection
00266 {
00267     PCLASSINFO(OpalPCSSConnection, OpalConnection);
00268   public:
00273     OpalPCSSConnection(
00274       OpalCall & call,              
00275       OpalPCSSEndPoint & endpoint,  
00276       const PString & playDevice,   
00277       const PString & recordDevice,  
00278       unsigned options = 0,
00279       OpalConnection::StringOptions * stringOptions = NULL
00280     );
00281 
00284     ~OpalPCSSConnection();
00286 
00297     virtual bool IsNetworkConnection() const { return false; }
00298 
00305     virtual PBoolean SetUpConnection();
00306 
00317     virtual PBoolean SetAlerting(
00318       const PString & calleeName,   
00319       PBoolean withMedia                
00320     );
00321 
00328     virtual bool TransferConnection(
00329       const PString & remoteParty   
00330     );
00331 
00346     virtual OpalMediaStream * CreateMediaStream(
00347       const OpalMediaFormat & mediaFormat, 
00348       unsigned sessionID,                  
00349       PBoolean isSource                        
00350     );
00351 
00359     virtual void OnPatchMediaStream(
00360       PBoolean isSource,
00361       OpalMediaPatch & patch    
00362     );
00363 
00366     virtual OpalMediaStreamPtr OpenMediaStream(
00367       const OpalMediaFormat & mediaFormat, 
00368       unsigned sessionID,                  
00369       bool isSource                        
00370     );
00371 
00374     virtual PBoolean SetAudioVolume(
00375       PBoolean source,                  
00376       unsigned percentage           
00377     );
00378 
00382     virtual unsigned GetAudioSignalLevel(
00383       PBoolean source                   
00384     );
00385 
00393     virtual PBoolean SendUserInputString(
00394       const PString & value                   
00395     );
00397 
00402     virtual void AcceptIncoming();
00403 
00406     virtual PSoundChannel * CreateSoundChannel(
00407       const OpalMediaFormat & mediaFormat, 
00408       PBoolean isSource                        
00409     );
00411 
00418     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00419 
00424     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00425 
00428     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00430 
00431 
00432   protected:
00433     OpalPCSSEndPoint & endpoint;
00434     PString            soundChannelPlayDevice;
00435     PString            soundChannelRecordDevice;
00436     unsigned           soundChannelBuffers;
00437 };
00438 
00439 #endif // OPAL_PTLIB_AUDIO
00440 
00441 #endif // OPAL_OPAL_PCSS_H
00442 
00443 
00444 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Feb 1 00:25:53 2010 for OPAL by  doxygen 1.5.1