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
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 #ifndef __OPAL_PCSS_H
00144 #define __OPAL_PCSS_H
00145
00146 #ifdef P_USE_PRAGMA
00147 #pragma interface
00148 #endif
00149
00150 #include <ptbuildopts.h>
00151
00152 #ifndef P_AUDIO
00153 #warning "PTLib soundcard support not available"
00154 #else
00155
00156 #include <ptlib/sound.h>
00157 #include <opal/buildopts.h>
00158 #include <opal/endpoint.h>
00159
00160 class OpalPCSSConnection;
00161
00162
00165 class OpalPCSSEndPoint : public OpalEndPoint
00166 {
00167 PCLASSINFO(OpalPCSSEndPoint, OpalEndPoint);
00168 public:
00173 OpalPCSSEndPoint(
00174 OpalManager & manager,
00175 const char * prefix = "pc"
00176 );
00177
00180 ~OpalPCSSEndPoint();
00182
00214 virtual BOOL MakeConnection(
00215 OpalCall & call,
00216 const PString & party,
00217 void * userData = NULL,
00218 unsigned int options = 0,
00219 OpalConnection::StringOptions * stringOptions = NULL
00220 );
00221
00231 virtual OpalMediaFormatList GetMediaFormats() const;
00233
00239 virtual OpalPCSSConnection * CreateConnection(
00240 OpalCall & call,
00241 const PString & playDevice,
00242 const PString & recordDevice,
00243 void * userData
00244 );
00245
00248 virtual PSoundChannel * CreateSoundChannel(
00249 const OpalPCSSConnection & connection,
00250 const OpalMediaFormat & mediaFormat,
00251 BOOL isSource
00252 );
00254
00261 PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
00262 const PString & token,
00263 PSafetyMode mode = PSafeReadWrite
00264 ) { return PSafePtrCast<OpalConnection, OpalPCSSConnection>(GetConnectionWithLock(token, mode)); }
00265
00271 virtual BOOL OnShowIncoming(
00272 const OpalPCSSConnection & connection
00273 ) = 0;
00274
00279 virtual BOOL AcceptIncomingConnection(
00280 const PString & connectionToken
00281 );
00282
00288 virtual BOOL OnShowOutgoing(
00289 const OpalPCSSConnection & connection
00290 ) = 0;
00291
00297 virtual BOOL OnShowUserInput(
00298 const OpalPCSSConnection & connection,
00299 const PString & indication
00300 );
00301
00302
00307 virtual void OnPatchMediaStream(
00308 const OpalPCSSConnection & connection,
00309 BOOL isSource,
00310 OpalMediaPatch & patch
00311 );
00313
00323 virtual BOOL SetSoundChannelPlayDevice(const PString & name);
00324
00329 const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00330
00338 virtual BOOL SetSoundChannelRecordDevice(const PString & name);
00339
00344 const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00345
00348 unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00349
00352 void SetSoundChannelBufferDepth(
00353 unsigned depth
00354 );
00356
00357
00358 protected:
00359 PString soundChannelPlayDevice;
00360 PString soundChannelRecordDevice;
00361 unsigned soundChannelBuffers;
00362 };
00363
00364
00367 class OpalPCSSConnection : public OpalConnection
00368 {
00369 PCLASSINFO(OpalPCSSConnection, OpalConnection);
00370 public:
00375 OpalPCSSConnection(
00376 OpalCall & call,
00377 OpalPCSSEndPoint & endpoint,
00378 const PString & playDevice,
00379 const PString & recordDevice
00380 );
00381
00384 ~OpalPCSSConnection();
00386
00395 virtual BOOL SetUpConnection();
00396
00407 virtual BOOL SetAlerting(
00408 const PString & calleeName,
00409 BOOL withMedia
00410 );
00411
00416 virtual BOOL SetConnected();
00417
00425 virtual OpalMediaFormatList GetMediaFormats() const;
00426
00441 virtual OpalMediaStream * CreateMediaStream(
00442 const OpalMediaFormat & mediaFormat,
00443 unsigned sessionID,
00444 BOOL isSource
00445 );
00446
00454 virtual void OnPatchMediaStream(
00455 BOOL isSource,
00456 OpalMediaPatch & patch
00457 );
00458
00461 virtual BOOL OpenSourceMediaStream(
00462 const OpalMediaFormatList & mediaFormats,
00463 unsigned sessionID
00464 );
00465
00468 virtual OpalMediaStream * OpenSinkMediaStream(
00469 OpalMediaStream & source
00470 );
00471
00474 virtual BOOL SetAudioVolume(
00475 BOOL source,
00476 unsigned percentage
00477 );
00478
00482 virtual unsigned GetAudioSignalLevel(
00483 BOOL source
00484 );
00485
00493 virtual BOOL SendUserInputString(
00494 const PString & value
00495 );
00497
00502 virtual void AcceptIncoming();
00503
00506 virtual PSoundChannel * CreateSoundChannel(
00507 const OpalMediaFormat & mediaFormat,
00508 BOOL isSource
00509 );
00511
00518 const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
00519
00524 const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
00525
00528 unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
00530
00531
00532 protected:
00533 OpalPCSSEndPoint & endpoint;
00534 PString soundChannelPlayDevice;
00535 PString soundChannelRecordDevice;
00536 unsigned soundChannelBuffers;
00537 };
00538
00539 #endif // P_AUDIO
00540
00541 #endif // __OPAL_PCSS_H
00542
00543
00544