00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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 #if OPAL_PTLIB_AUDIO
00045
00046 #include <ptlib/sound.h>
00047 #include <opal/localep.h>
00048
00049
00050 class OpalPCSSConnection;
00051
00052
00055 class OpalPCSSEndPoint : public OpalLocalEndPoint
00056 {
00057 PCLASSINFO(OpalPCSSEndPoint, OpalLocalEndPoint);
00058 public:
00063 OpalPCSSEndPoint(
00064 OpalManager & manager,
00065 const char * prefix = "pc"
00066 );
00067
00070 ~OpalPCSSEndPoint();
00072
00104 virtual PSafePtr<OpalConnection> MakeConnection(
00105 OpalCall & call,
00106 const PString & party,
00107 void * userData = NULL,
00108 unsigned int options = 0,
00109 OpalConnection::StringOptions * stringOptions = NULL
00110 );
00112
00120 virtual bool OnOutgoingCall(
00121 const OpalLocalConnection & connection
00122 );
00123
00129 virtual bool OnIncomingCall(
00130 OpalLocalConnection & connection
00131 );
00132
00138 virtual bool OnUserInput(
00139 const OpalLocalConnection & connection,
00140 const PString & indication
00141 );
00143
00149 virtual OpalPCSSConnection * CreateConnection(
00150 OpalCall & call,
00151 const PString & playDevice,
00152 const PString & recordDevice,
00153 void * userData,
00154 unsigned options,
00155 OpalConnection::StringOptions * stringOptions
00156 );
00157
00160 virtual PSoundChannel * CreateSoundChannel(
00161 const OpalPCSSConnection & connection,
00162 const OpalMediaFormat & mediaFormat,
00163 PBoolean isSource
00164 );
00166
00175 PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
00176 const PString & token,
00177 PSafetyMode mode = PSafeReadWrite
00178 ) { return GetConnectionWithLockAs<OpalPCSSConnection>(token, mode); }
00179
00185 virtual PBoolean OnShowIncoming(
00186 const OpalPCSSConnection & connection
00187 ) = 0;
00188
00193 virtual PBoolean AcceptIncomingConnection(
00194 const PString & connectionToken
00195 );
00196
00201 virtual PBoolean RejectIncomingConnection(
00202 const PString & connectionToken
00203 );
00204
00210 virtual PBoolean OnShowOutgoing(
00211 const OpalPCSSConnection & connection
00212 ) = 0;
00213
00219 virtual PBoolean OnShowUserInput(
00220 const OpalPCSSConnection & connection,
00221 const PString & indication
00222 );
00224
00234 virtual PBoolean SetSoundChannelPlayDevice(const PString & name);
00235
00240 const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00241
00249 virtual PBoolean SetSoundChannelRecordDevice(const PString & name);
00250
00255 const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00256
00261 unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00262
00267 void SetSoundChannelBufferDepth(
00268 unsigned depth
00269 );
00270
00275 unsigned GetSoundChannelBufferTime() const { return m_soundChannelBufferTime; }
00276
00281 void SetSoundChannelBufferTime(
00282 unsigned depth
00283 );
00285
00286 protected:
00287 PString soundChannelPlayDevice;
00288 PString soundChannelRecordDevice;
00289 unsigned soundChannelBuffers;
00290 unsigned m_soundChannelBufferTime;
00291
00292 private:
00293 P_REMOVE_VIRTUAL(OpalPCSSConnection *, CreateConnection(OpalCall &, const PString &, const PString &, void *), 0)
00294 };
00295
00296
00299 class OpalPCSSConnection : public OpalLocalConnection
00300 {
00301 PCLASSINFO(OpalPCSSConnection, OpalLocalConnection);
00302 public:
00307 OpalPCSSConnection(
00308 OpalCall & call,
00309 OpalPCSSEndPoint & endpoint,
00310 const PString & playDevice,
00311 const PString & recordDevice,
00312 unsigned options = 0,
00313 OpalConnection::StringOptions * stringOptions = NULL
00314 );
00315
00318 ~OpalPCSSConnection();
00320
00329 virtual bool TransferConnection(
00330 const PString & remoteParty
00331 );
00332
00347 virtual OpalMediaStream * CreateMediaStream(
00348 const OpalMediaFormat & mediaFormat,
00349 unsigned sessionID,
00350 PBoolean isSource
00351 );
00352
00355 virtual PBoolean SetAudioVolume(
00356 PBoolean source,
00357 unsigned percentage
00358 );
00359
00363 virtual unsigned GetAudioSignalLevel(
00364 PBoolean source
00365 );
00367
00372 virtual PSoundChannel * CreateSoundChannel(
00373 const OpalMediaFormat & mediaFormat,
00374 PBoolean isSource
00375 );
00377
00384 const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00385
00390 const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00391
00396 unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00397
00402 unsigned GetSoundChannelBufferTime() const { return m_soundChannelBufferTime; }
00404
00405
00406 protected:
00407 OpalPCSSEndPoint & endpoint;
00408 PString soundChannelPlayDevice;
00409 PString soundChannelRecordDevice;
00410 unsigned soundChannelBuffers;
00411 unsigned m_soundChannelBufferTime;
00412 };
00413
00414 #else
00415
00416 #ifdef _MSC_VER
00417 #pragma message("PTLib soundcard support not available")
00418 #else
00419 #warning "PTLib soundcard support not available"
00420 #endif
00421
00422 #endif // OPAL_PTLIB_AUDIO
00423
00424 #endif // OPAL_HAS_PCSS
00425
00426 #endif // OPAL_OPAL_PCSS_H
00427
00428
00429