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  * $Log: pcss.h,v $
00028  * Revision 2.19  2005/12/28 20:03:00  dsandras
00029  * Attach the silence detector in OnPatchMediaStream so that it can be attached
00030  * before the echo cancellation filter.
00031  *
00032  * Revision 2.18  2005/12/27 22:25:55  dsandras
00033  * Added propagation of the callback to the pcss endpoint.
00034  *
00035  * Revision 2.17  2005/12/27 20:48:01  dsandras
00036  * Added media format parameter when opening the sound channel so that its
00037  * parameters can be used in the body of the method.
00038  *
00039  * Revision 2.16  2005/11/30 13:35:26  csoutheren
00040  * Changed tags for Doxygen
00041  *
00042  * Revision 2.15  2005/11/24 20:31:54  dsandras
00043  * Added support for echo cancelation using Speex.
00044  * Added possibility to add a filter to an OpalMediaPatch for all patches of a connection.
00045  *
00046  * Revision 2.14  2005/10/12 21:11:21  dsandras
00047  * Control if the video streams are started or not from this class.
00048  *
00049  * Revision 2.13  2004/08/14 07:56:29  rjongbloed
00050  * Major revision to utilise the PSafeCollection classes for the connections and calls.
00051  *
00052  * Revision 2.12  2004/07/11 12:42:10  rjongbloed
00053  * Added function on endpoints to get the list of all media formats any
00054  *   connection the endpoint may create can support.
00055  *
00056  * Revision 2.11  2004/05/17 13:24:18  rjongbloed
00057  * Added silence suppression.
00058  *
00059  * Revision 2.10  2004/03/11 06:54:27  csoutheren
00060  * Added ability to disable SIP or H.323 stacks
00061  *
00062  * Revision 2.9  2003/03/17 10:11:05  robertj
00063  * Added call back functions for creating sound channel.
00064  * Added video support.
00065  *
00066  * Revision 2.8  2003/03/06 03:57:47  robertj
00067  * IVR support (work in progress) requiring large changes everywhere.
00068  *
00069  * Revision 2.7  2002/09/16 02:52:35  robertj
00070  * Added #define so can select if #pragma interface/implementation is used on
00071  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00072  *
00073  * Revision 2.6  2002/06/16 02:19:31  robertj
00074  * Fixed and clarified function for initiating call, thanks Ted Szoczei
00075  *
00076  * Revision 2.5  2002/01/22 05:05:16  robertj
00077  * Revamp of user input API triggered by RFC2833 support
00078  *
00079  * Revision 2.4  2001/11/13 06:25:56  robertj
00080  * Changed SetUpConnection() so returns BOOL as returning
00081  *   pointer to connection is not useful.
00082  *
00083  * Revision 2.3  2001/10/15 04:29:26  robertj
00084  * Removed answerCall signal and replaced with state based functions.
00085  *
00086  * Revision 2.2  2001/08/17 08:33:38  robertj
00087  * More implementation.
00088  *
00089  * Revision 2.1  2001/08/01 05:52:24  robertj
00090  * Moved media formats list from endpoint to connection.
00091  *
00092  * Revision 2.0  2001/07/27 15:48:24  robertj
00093  * Conversion of OpenH323 to Open Phone Abstraction Library (OPAL)
00094  *
00095  */
00096 
00097 #ifndef __OPAL_PCSS_H
00098 #define __OPAL_PCSS_H
00099 
00100 #ifdef P_USE_PRAGMA
00101 #pragma interface
00102 #endif
00103 
00104 #include <opal/buildopts.h>
00105 
00106 #include <opal/endpoint.h>
00107 
00108 
00109 class OpalPCSSConnection;
00110 
00111 
00114 class OpalPCSSEndPoint : public OpalEndPoint
00115 {
00116     PCLASSINFO(OpalPCSSEndPoint, OpalEndPoint);
00117   public:
00122     OpalPCSSEndPoint(
00123       OpalManager & manager,  
00124       const char * prefix = "pc" 
00125     );
00126 
00129     ~OpalPCSSEndPoint();
00131 
00163     virtual BOOL MakeConnection(
00164       OpalCall & call,        
00165       const PString & party,  
00166       void * userData = NULL  
00167     );
00168 
00178     virtual OpalMediaFormatList GetMediaFormats() const;
00180 
00186     virtual OpalPCSSConnection * CreateConnection(
00187       OpalCall & call,    
00188       const PString & playDevice, 
00189       const PString & recordDevice, 
00190       void * userData     
00191     );
00192 
00195     virtual PSoundChannel * CreateSoundChannel(
00196       const OpalPCSSConnection & connection, 
00197       const OpalMediaFormat & mediaFormat,   
00198       BOOL isSource                          
00199     );
00201 
00208     PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
00209       const PString & token,     
00210       PSafetyMode mode = PSafeReadWrite
00211     ) { return PSafePtrCast<OpalConnection, OpalPCSSConnection>(GetConnectionWithLock(token, mode)); }
00212 
00218     virtual PString OnGetDestination(
00219       const OpalPCSSConnection & connection 
00220     ) = 0;
00221 
00227     virtual void OnShowIncoming(
00228       const OpalPCSSConnection & connection 
00229     ) = 0;
00230 
00233     virtual void AcceptIncomingConnection(
00234       const PString & connectionToken 
00235     );
00236 
00242     virtual BOOL OnShowOutgoing(
00243       const OpalPCSSConnection & connection 
00244     ) = 0;
00245 
00251     virtual BOOL OnShowUserInput(
00252       const OpalPCSSConnection & connection, 
00253       const PString & indication
00254     );
00255 
00256     
00261     virtual void OnPatchMediaStream(
00262       const OpalPCSSConnection & connection, 
00263       BOOL isSource,                         
00264       OpalMediaPatch & patch                 
00265     );
00267 
00277     virtual BOOL SetSoundChannelPlayDevice(const PString & name);
00278 
00283     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00284 
00292     virtual BOOL SetSoundChannelRecordDevice(const PString & name);
00293 
00298     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00299 
00302     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00303 
00306     void SetSoundChannelBufferDepth(
00307       unsigned depth    
00308     );
00310 
00311   protected:
00312     PString  soundChannelPlayDevice;
00313     PString  soundChannelRecordDevice;
00314     unsigned soundChannelBuffers;
00315 };
00316 
00317 
00320 class OpalPCSSConnection : public OpalConnection
00321 {
00322     PCLASSINFO(OpalPCSSConnection, OpalConnection);
00323   public:
00328     OpalPCSSConnection(
00329       OpalCall & call,              
00330       OpalPCSSEndPoint & endpoint,  
00331       const PString & playDevice,   
00332       const PString & recordDevice  
00333     );
00334 
00337     ~OpalPCSSConnection();
00339 
00348     virtual BOOL SetUpConnection();
00349 
00360     virtual BOOL SetAlerting(
00361       const PString & calleeName,   
00362       BOOL withMedia                
00363     );
00364 
00369     virtual BOOL SetConnected();
00370 
00377     virtual PString GetDestinationAddress();
00378 
00386     virtual OpalMediaFormatList GetMediaFormats() const;
00387 
00402     virtual OpalMediaStream * CreateMediaStream(
00403       const OpalMediaFormat & mediaFormat, 
00404       unsigned sessionID,                  
00405       BOOL isSource                        
00406     );
00407 
00415     virtual void OnPatchMediaStream(
00416       BOOL isSource,
00417       OpalMediaPatch & patch    
00418     );
00419 
00422     virtual BOOL OpenSourceMediaStream(
00423       const OpalMediaFormatList & mediaFormats, 
00424       unsigned sessionID                   
00425     );
00426 
00429     virtual OpalMediaStream * OpenSinkMediaStream(
00430       OpalMediaStream & source    
00431     );
00432 
00440     virtual BOOL SendUserInputString(
00441       const PString & value                   
00442     );
00444 
00449     virtual void InitiateCall();
00450 
00453     virtual void AcceptIncoming();
00454 
00457     virtual PSoundChannel * CreateSoundChannel(
00458       const OpalMediaFormat & mediaFormat, 
00459       BOOL isSource                        
00460     );
00462 
00469     const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00470 
00475     const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00476 
00479     unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00481 
00482 
00483   protected:
00484     OpalPCSSEndPoint & endpoint;
00485     PString            soundChannelPlayDevice;
00486     PString            soundChannelRecordDevice;
00487     unsigned           soundChannelBuffers;
00488 };
00489 
00490 
00491 #endif // __OPAL_PCSS_H
00492 
00493 
00494 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Sep 25 16:20:10 2006 for OPAL by  doxygen 1.4.7