pcss.h
Go to the documentation of this file.
/*
* pcss.h
*
* PC Sound System support.
*
* Open Phone Abstraction Library (OPAL)
* Formally known as the Open H323 project.
*
* Copyright (c) 2001 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Open Phone Abstraction Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Contributor(s): ______________________________________.
*
* $Revision: 28276 $
* $Author: rjongbloed $
* $Date: 2012-08-29 21:50:30 -0500 (Wed, 29 Aug 2012) $
*/
#ifndef OPAL_OPAL_PCSS_H
#define OPAL_OPAL_PCSS_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <opal/buildopts.h>
#if OPAL_HAS_PCSS
#include <ptlib/sound.h>
#include <opal/localep.h>
class OpalPCSSConnection;
class OpalPCSSEndPoint : public OpalLocalEndPoint
{
PCLASSINFO(OpalPCSSEndPoint, OpalLocalEndPoint);
public:
OpalPCSSEndPoint(
OpalManager & manager,
const char * prefix = "pc"
);
~OpalPCSSEndPoint();
virtual PSafePtr<OpalConnection> MakeConnection(
OpalCall & call,
const PString & party,
void * userData = NULL,
unsigned options = 0,
OpalConnection::StringOptions * stringOptions = NULL
);
virtual bool OnOutgoingCall(
const OpalLocalConnection & connection
);
virtual bool OnIncomingCall(
OpalLocalConnection & connection
);
virtual bool OnUserInput(
const OpalLocalConnection & connection,
const PString & indication
);
virtual OpalPCSSConnection * CreateConnection(
OpalCall & call,
const PString & playDevice,
const PString & recordDevice,
void * userData,
unsigned options,
OpalConnection::StringOptions * stringOptions
);
virtual PSoundChannel * CreateSoundChannel(
const OpalPCSSConnection & connection,
const OpalMediaFormat & mediaFormat,
PBoolean isSource
);
PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
const PString & token,
PSafetyMode mode = PSafeReadWrite
) { return GetConnectionWithLockAs<OpalPCSSConnection>(token, mode); }
virtual PBoolean OnShowIncoming(
const OpalPCSSConnection & connection
) = 0;
virtual PBoolean AcceptIncomingConnection(
const PString & connectionToken
);
virtual PBoolean RejectIncomingConnection(
const PString & connectionToken,
const OpalConnection::CallEndReason & reason = OpalConnection::EndedByAnswerDenied
);
virtual PBoolean OnShowOutgoing(
const OpalPCSSConnection & connection
) = 0;
virtual PBoolean OnShowUserInput(
const OpalPCSSConnection & connection,
const PString & indication
);
virtual PBoolean SetSoundChannelPlayDevice(const PString & name);
const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
virtual PBoolean SetSoundChannelRecordDevice(const PString & name);
const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
void SetSoundChannelBufferDepth(
unsigned depth
);
unsigned GetSoundChannelBufferTime() const { return m_soundChannelBufferTime; }
void SetSoundChannelBufferTime(
unsigned depth
);
protected:
PString soundChannelPlayDevice;
PString soundChannelRecordDevice;
unsigned soundChannelBuffers;
unsigned m_soundChannelBufferTime;
private:
P_REMOVE_VIRTUAL(OpalPCSSConnection *, CreateConnection(OpalCall &, const PString &, const PString &, void *), 0)
};
class OpalPCSSConnection : public OpalLocalConnection
{
PCLASSINFO(OpalPCSSConnection, OpalLocalConnection);
public:
OpalPCSSConnection(
OpalCall & call,
OpalPCSSEndPoint & endpoint,
const PString & playDevice,
const PString & recordDevice,
unsigned options = 0,
OpalConnection::StringOptions * stringOptions = NULL
);
~OpalPCSSConnection();
virtual bool TransferConnection(
const PString & remoteParty
);
virtual OpalMediaStream * CreateMediaStream(
const OpalMediaFormat & mediaFormat,
unsigned sessionID,
PBoolean isSource
);
virtual PBoolean SetAudioVolume(
PBoolean source,
unsigned percentage
);
virtual PBoolean GetAudioVolume(
PBoolean source,
unsigned & percentage
);
virtual bool SetAudioMute(
bool source,
bool mute
);
virtual bool GetAudioMute(
bool source,
bool & mute
);
virtual unsigned GetAudioSignalLevel(
PBoolean source
);
virtual PSoundChannel * CreateSoundChannel(
const OpalMediaFormat & mediaFormat,
PBoolean isSource
);
const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
unsigned GetSoundChannelBufferTime() const { return m_soundChannelBufferTime; }
protected:
OpalPCSSEndPoint & endpoint;
PString soundChannelPlayDevice;
PString soundChannelRecordDevice;
unsigned soundChannelBuffers;
unsigned m_soundChannelBufferTime;
};
#else
#ifdef _MSC_VER
#pragma message("PTLib soundcard support not available")
#else
#warning "PTLib soundcard support not available"
#endif
#endif // OPAL_HAS_PCSS
#endif // OPAL_OPAL_PCSS_H
// End of File ///////////////////////////////////////////////////////////////
OpalManager
Definition: manager.h:74
OpalPCSSEndPoint::SetSoundChannelRecordDevice
virtual PBoolean SetSoundChannelRecordDevice(const PString &name)
OpalPCSSEndPoint::m_soundChannelBufferTime
unsigned m_soundChannelBufferTime
Definition: pcss.h:296
OpalPCSSConnection::GetAudioVolume
virtual PBoolean GetAudioVolume(PBoolean source, unsigned &percentage)
OpalPCSSConnection::m_soundChannelBufferTime
unsigned m_soundChannelBufferTime
Definition: pcss.h:440
buildopts.h
OpalPCSSEndPoint::SetSoundChannelBufferTime
void SetSoundChannelBufferTime(unsigned depth)
OpalPCSSConnection::GetSoundChannelRecordDevice
const PString & GetSoundChannelRecordDevice() const
Definition: pcss.h:419
OpalLocalConnection
Definition: localep.h:360
OpalPCSSEndPoint::OnOutgoingCall
virtual bool OnOutgoingCall(const OpalLocalConnection &connection)
OpalPCSSEndPoint::OnShowOutgoing
virtual PBoolean OnShowOutgoing(const OpalPCSSConnection &connection)=0
OpalPCSSEndPoint::CreateSoundChannel
virtual PSoundChannel * CreateSoundChannel(const OpalPCSSConnection &connection, const OpalMediaFormat &mediaFormat, PBoolean isSource)
OpalPCSSEndPoint::GetSoundChannelBufferTime
unsigned GetSoundChannelBufferTime() const
Definition: pcss.h:281
OpalPCSSEndPoint::OnIncomingCall
virtual bool OnIncomingCall(OpalLocalConnection &connection)
OpalPCSSEndPoint::RejectIncomingConnection
virtual PBoolean RejectIncomingConnection(const PString &connectionToken, const OpalConnection::CallEndReason &reason=OpalConnection::EndedByAnswerDenied)
OpalPCSSConnection::~OpalPCSSConnection
~OpalPCSSConnection()
OpalPCSSConnection::soundChannelRecordDevice
PString soundChannelRecordDevice
Definition: pcss.h:438
OpalPCSSEndPoint::GetSoundChannelRecordDevice
const PString & GetSoundChannelRecordDevice() const
Definition: pcss.h:261
OpalPCSSEndPoint::CreateConnection
virtual OpalPCSSConnection * CreateConnection(OpalCall &call, const PString &playDevice, const PString &recordDevice, void *userData, unsigned options, OpalConnection::StringOptions *stringOptions)
OpalPCSSConnection::CreateMediaStream
virtual OpalMediaStream * CreateMediaStream(const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
OpalPCSSEndPoint::soundChannelRecordDevice
PString soundChannelRecordDevice
Definition: pcss.h:294
OpalConnection::EndedByAnswerDenied
Local endpoint did not accept call OnIncomingCall()=false.
Definition: connection.h:364
localep.h
OpalPCSSEndPoint::OpalPCSSEndPoint
OpalPCSSEndPoint(OpalManager &manager, const char *prefix="pc")
OpalPCSSConnection::TransferConnection
virtual bool TransferConnection(const PString &remoteParty)
OpalConnection::StringOptions
Definition: connection.h:462
OpalLocalEndPoint
Definition: localep.h:50
OpalPCSSConnection::GetSoundChannelBufferDepth
unsigned GetSoundChannelBufferDepth() const
Definition: pcss.h:425
OpalMediaFormat
Definition: mediafmt.h:724
OpalPCSSConnection
Definition: pcss.h:305
OpalPCSSEndPoint::GetPCSSConnectionWithLock
PSafePtr< OpalPCSSConnection > GetPCSSConnectionWithLock(const PString &token, PSafetyMode mode=PSafeReadWrite)
Definition: pcss.h:177
OpalPCSSConnection::soundChannelPlayDevice
PString soundChannelPlayDevice
Definition: pcss.h:437
OpalPCSSEndPoint::SetSoundChannelBufferDepth
void SetSoundChannelBufferDepth(unsigned depth)
OpalCall
Definition: call.h:65
OpalPCSSEndPoint
Definition: pcss.h:53
OpalPCSSConnection::GetAudioSignalLevel
virtual unsigned GetAudioSignalLevel(PBoolean source)
OpalPCSSEndPoint::soundChannelBuffers
unsigned soundChannelBuffers
Definition: pcss.h:295
OpalPCSSEndPoint::~OpalPCSSEndPoint
~OpalPCSSEndPoint()
OpalPCSSConnection::SetAudioVolume
virtual PBoolean SetAudioVolume(PBoolean source, unsigned percentage)
OpalPCSSConnection::CreateSoundChannel
virtual PSoundChannel * CreateSoundChannel(const OpalMediaFormat &mediaFormat, PBoolean isSource)
OpalPCSSEndPoint::AcceptIncomingConnection
virtual PBoolean AcceptIncomingConnection(const PString &connectionToken)
OpalEndPoint::manager
OpalManager & manager
Definition: endpoint.h:807
OpalPCSSConnection::GetAudioMute
virtual bool GetAudioMute(bool source, bool &mute)
OpalPCSSEndPoint::OnShowUserInput
virtual PBoolean OnShowUserInput(const OpalPCSSConnection &connection, const PString &indication)
OpalConnection::CallEndReason
Definition: connection.h:396
OpalPCSSEndPoint::GetSoundChannelPlayDevice
const PString & GetSoundChannelPlayDevice() const
Definition: pcss.h:246
OpalPCSSEndPoint::SetSoundChannelPlayDevice
virtual PBoolean SetSoundChannelPlayDevice(const PString &name)
OpalPCSSEndPoint::soundChannelPlayDevice
PString soundChannelPlayDevice
Definition: pcss.h:293
OpalPCSSConnection::OpalPCSSConnection
OpalPCSSConnection(OpalCall &call, OpalPCSSEndPoint &endpoint, const PString &playDevice, const PString &recordDevice, unsigned options=0, OpalConnection::StringOptions *stringOptions=NULL)
OpalMediaStream
Definition: mediastrm.h:111
OpalPCSSEndPoint::GetSoundChannelBufferDepth
unsigned GetSoundChannelBufferDepth() const
Definition: pcss.h:267
OpalPCSSEndPoint::OnShowIncoming
virtual PBoolean OnShowIncoming(const OpalPCSSConnection &connection)=0
OpalPCSSConnection::GetSoundChannelPlayDevice
const PString & GetSoundChannelPlayDevice() const
Definition: pcss.h:413
OpalPCSSConnection::SetAudioMute
virtual bool SetAudioMute(bool source, bool mute)
OpalPCSSEndPoint::MakeConnection
virtual PSafePtr< OpalConnection > MakeConnection(OpalCall &call, const PString &party, void *userData=NULL, unsigned options=0, OpalConnection::StringOptions *stringOptions=NULL)
OpalPCSSConnection::GetSoundChannelBufferTime
unsigned GetSoundChannelBufferTime() const
Definition: pcss.h:431
OpalPCSSConnection::soundChannelBuffers
unsigned soundChannelBuffers
Definition: pcss.h:439
OpalPCSSEndPoint::OnUserInput
virtual bool OnUserInput(const OpalLocalConnection &connection, const PString &indication)
OpalPCSSConnection::endpoint
OpalPCSSEndPoint & endpoint
Definition: pcss.h:436