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: 24557 $
00028  * $Author: rjongbloed $
00029  * $Date: 2010-07-04 23:35:23 -0500 (Sun, 04 Jul 2010) $
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 #if OPAL_HAS_PCSS
00043 
00044 #include <ptlib/sound.h>
00045 #include <opal/localep.h>
00046 
00047 
00048 class OpalPCSSConnection;
00049 
00050 
00053 class OpalPCSSEndPoint : public OpalLocalEndPoint
00054 {
00055     PCLASSINFO(OpalPCSSEndPoint, OpalLocalEndPoint);
00056   public:
00061     OpalPCSSEndPoint(
00062       OpalManager & manager,  
00063       const char * prefix = "pc" 
00064     );
00065 
00068     ~OpalPCSSEndPoint();
00070 
00102     virtual PSafePtr<OpalConnection> MakeConnection(
00103       OpalCall & call,           
00104       const PString & party,     
00105       void * userData = NULL,    
00106       unsigned options = 0,                    
00107       OpalConnection::StringOptions * stringOptions = NULL 
00108     );
00110 
00118     virtual bool OnOutgoingCall(
00119       const OpalLocalConnection & connection 
00120     );
00121 
00127     virtual bool OnIncomingCall(
00128       OpalLocalConnection & connection 
00129     );
00130 
00136     virtual bool OnUserInput(
00137       const OpalLocalConnection & connection, 
00138       const PString & indication              
00139     );
00141 
00147     virtual OpalPCSSConnection * CreateConnection(
00148       OpalCall & call,    
00149       const PString & playDevice, 
00150       const PString & recordDevice, 
00151       void * userData,    
00152       unsigned options,                    
00153       OpalConnection::StringOptions * stringOptions 
00154     );
00155 
00158     virtual PSoundChannel * CreateSoundChannel(
00159       const OpalPCSSConnection & connection, 
00160       const OpalMediaFormat & mediaFormat,   
00161       PBoolean isSource                          
00162     );
00164 
00173     PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
00174       const PString & token,     
00175       PSafetyMode mode = PSafeReadWrite 
00176     ) { return GetConnectionWithLockAs<OpalPCSSConnection>(token, mode); }
00177 
00183     virtual PBoolean OnShowIncoming(
00184       const OpalPCSSConnection & connection 
00185     ) = 0;
00186 
00191     virtual PBoolean AcceptIncomingConnection(
00192       const PString & connectionToken 
00193     );
00194 
00199     virtual PBoolean RejectIncomingConnection(
00200       const PString & connectionToken,       
00201       const OpalConnection::CallEndReason & reason = OpalConnection::EndedByAnswerDenied 
00202     );
00203 
00209     virtual PBoolean OnShowOutgoing(
00210       const OpalPCSSConnection & connection 
00211     ) = 0;
00212 
00218     virtual PBoolean OnShowUserInput(
00219       const OpalPCSSConnection & connection, 
00220       const PString & indication             
00221     );
00223 
00233     virtual PBoolean SetSoundChannelPlayDevice(const PString & name);
00234 
00239     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00240 
00248     virtual PBoolean SetSoundChannelRecordDevice(const PString & name);
00249 
00254     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00255 
00260     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00261 
00266     void SetSoundChannelBufferDepth(
00267       unsigned depth    
00268     );
00269 
00274     unsigned GetSoundChannelBufferTime() const { return m_soundChannelBufferTime; }
00275 
00280     void SetSoundChannelBufferTime(
00281       unsigned depth    
00282     );
00284 
00285   protected:
00286     PString  soundChannelPlayDevice;
00287     PString  soundChannelRecordDevice;
00288     unsigned soundChannelBuffers;
00289     unsigned m_soundChannelBufferTime;
00290 
00291   private:
00292     P_REMOVE_VIRTUAL(OpalPCSSConnection *, CreateConnection(OpalCall &, const PString &, const PString &, void *), 0)
00293 };
00294 
00295 
00298 class OpalPCSSConnection : public OpalLocalConnection
00299 {
00300     PCLASSINFO(OpalPCSSConnection, OpalLocalConnection);
00301   public:
00306     OpalPCSSConnection(
00307       OpalCall & call,              
00308       OpalPCSSEndPoint & endpoint,  
00309       const PString & playDevice,   
00310       const PString & recordDevice,  
00311       unsigned options = 0,                    
00312       OpalConnection::StringOptions * stringOptions = NULL 
00313     );
00314 
00317     ~OpalPCSSConnection();
00319 
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 
00354     virtual PBoolean SetAudioVolume(
00355       PBoolean source,                  
00356       unsigned percentage           
00357     );
00358 
00362     virtual unsigned GetAudioSignalLevel(
00363       PBoolean source                   
00364     );
00366 
00371     virtual PSoundChannel * CreateSoundChannel(
00372       const OpalMediaFormat & mediaFormat, 
00373       PBoolean isSource                        
00374     );
00376 
00383     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00384 
00389     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00390 
00395     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00396 
00401     unsigned GetSoundChannelBufferTime() const { return m_soundChannelBufferTime; }
00403 
00404 
00405   protected:
00406     OpalPCSSEndPoint & endpoint;
00407     PString            soundChannelPlayDevice;
00408     PString            soundChannelRecordDevice;
00409     unsigned           soundChannelBuffers;
00410     unsigned           m_soundChannelBufferTime;
00411 };
00412 
00413 #else
00414 
00415 #ifdef _MSC_VER
00416 #pragma message("PTLib soundcard support not available")
00417 #else
00418 #warning "PTLib soundcard support not available"
00419 #endif
00420 
00421 
00422 #endif // OPAL_HAS_PCSS
00423 
00424 #endif // OPAL_OPAL_PCSS_H
00425 
00426 
00427 // End of File ///////////////////////////////////////////////////////////////

Generated on Sun Nov 21 20:20:50 2010 for OPAL by  doxygen 1.4.7