sipxmedialib  Version 3.3
Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Friends | List of all members
MpOss Class Reference

Wrapper for OSS device that use file descriptor to communicate. More...

#include <MpOss.h>

Inheritance diagram for MpOss:
Inheritance graph
[legend]
Collaboration diagram for MpOss:
Collaboration graph
[legend]

Public Member Functions

Creators
 MpOss ()
 Constructor. More...
 
 ~MpOss ()
 Destructor. More...
 
Manipulators
OsStatus setInputDevice (MpidOss *pIDD)
 Connect MpidOss class driver. More...
 
OsStatus setOutputDevice (MpodOss *pODD)
 Connect MpodOss class driver. More...
 
OsStatus freeInputDevice ()
 Disconnect Input driver. More...
 
OsStatus freeOutputDevice ()
 Disconnect Output driver. More...
 
OsStatus attachReader ()
 Enable input device. More...
 
OsStatus attachWriter ()
 Enable output device. More...
 
OsStatus detachReader ()
 Disable input device. More...
 
OsStatus detachWriter ()
 Disable output device. More...
 
Inquiry
UtlBoolean isDeviceValid ()
 Inquire if the device is valid. More...
 
UtlBoolean isReaderAttached ()
 Inquire if the input device is connected. More...
 
UtlBoolean isWriterAttached ()
 Inquire if the output device is connected. More...
 
UtlBoolean isDevCapBatch ()
 
UtlBoolean isDevCapDuplex ()
 
UtlBoolean isDevCapMmap ()
 
UtlBoolean isDevCapTrigger ()
 
UtlBoolean isNotUsed ()
 Inquire if OSS device is free, i.e. neither input nor output is connected. More...
 

Protected Member Functions

OsStatus initDevice (const char *devname)
 Pre initializations for OSS device. More...
 
OsStatus initDeviceFinal (unsigned samplesPerSec, unsigned samplerPerFrame)
 Final initializations for OSS device. More...
 
OsStatus freeDevice ()
 Free OSS device. More...
 
OsStatus setSampleRate (unsigned samplesPerSec, unsigned samplerPerFrame)
 Because OSS device works in duplex mode we must ensure that input and output driver use one sample rate and perfrom final init. More...
 
OsStatus doInput (char *buffer, int size)
 Perform input operation of OSS device. More...
 
OsStatus doOutput (const char *buffer, int size)
 Perform output operation of OSS device. More...
 
OsStatus doInputRs (MpAudioSample *buffer, unsigned size)
 Perform input operation of OSS device with siutable resampler. More...
 
OsStatus doOutputRs (const MpAudioSample *buffer, unsigned size)
 Perform output operation of OSS device with siutable resampler. More...
 
void noMoreNeeded ()
 Deinitialization and freeing sequences. More...
 
void soundIoThread ()
 Thread subroutine. More...
 

Protected Attributes

int mfdDevice
 The fd of the POSIX device (e.g. /dev/dsp) More...
 
UtlBoolean mbReadCap
 Device is able to play audio. More...
 
UtlBoolean mbWriteCap
 Device is able to capture audio. More...
 
MpidOssmReader
 Input driver. More...
 
MpodOssmWriter
 Output driver. More...
 
int mDeviceCap
 Device capabilities. More...
 
volatile UtlBoolean mStReader
 Input device is enabled. More...
 
volatile UtlBoolean mStWriter
 Output device is enabled. More...
 
volatile UtlBoolean mStShutdown
 Thread exit flag. More...
 
volatile UtlBoolean mModeChanged
 IO settings has changed. More...
 
unsigned mUsedSamplesPerSec
 Used samples rate either for IO. More...
 
unsigned mUsedSamplesPerFrame
 Used frame size for IO. More...
 
MpAudioSamplemResamplerBuffer
 Buffer for conversions. More...
 
UtlBoolean mStereoOps
 Use stereo output. More...
 
pthread_t mIoThread
 Internal IO thread. More...
 
sem_t mSleepSem
 Control IO thread sleeping. More...
 
sem_t mSignalSem
 Use for parameters synchronization. More...
 

Private Member Functions

void threadIoStatusChanged ()
 
void threadWakeUp ()
 
void threadKill ()
 
UtlBoolean ossSetTrigger (bool turnOn)
 
UtlBoolean ossReset ()
 

Static Private Member Functions

static void * soundCardIoWrapper (void *arg)
 Thread subroutine. More...
 

Friends

class MpidOss
 
class MpodOss
 

Detailed Description

Wrapper for OSS device that use file descriptor to communicate.

Constructor & Destructor Documentation

MpOss ( )

Constructor.

~MpOss ( )

Destructor.

Member Function Documentation

OsStatus setInputDevice ( MpidOss pIDD)

Connect MpidOss class driver.

OsStatus setOutputDevice ( MpodOss pODD)

Connect MpodOss class driver.

OsStatus freeInputDevice ( )

Disconnect Input driver.

OsStatus freeOutputDevice ( )

Disconnect Output driver.

OsStatus attachReader ( )

Enable input device.

OsStatus attachWriter ( )

Enable output device.

OsStatus detachReader ( )

Disable input device.

OsStatus detachWriter ( )

Disable output device.

UtlBoolean isDeviceValid ( )
inline

Inquire if the device is valid.

UtlBoolean isReaderAttached ( )
inline

Inquire if the input device is connected.

UtlBoolean isWriterAttached ( )
inline

Inquire if the output device is connected.

UtlBoolean isDevCapBatch ( )
inline
UtlBoolean isDevCapDuplex ( )
inline
UtlBoolean isDevCapMmap ( )
inline
UtlBoolean isDevCapTrigger ( )
inline
UtlBoolean isNotUsed ( )
inline

Inquire if OSS device is free, i.e. neither input nor output is connected.

OsStatus initDevice ( const char *  devname)
protected

Pre initializations for OSS device.

OsStatus initDeviceFinal ( unsigned  samplesPerSec,
unsigned  samplerPerFrame 
)
protected

Final initializations for OSS device.

OsStatus freeDevice ( )
protected

Free OSS device.

OsStatus setSampleRate ( unsigned  samplesPerSec,
unsigned  samplerPerFrame 
)
protected

Because OSS device works in duplex mode we must ensure that input and output driver use one sample rate and perfrom final init.

OsStatus doInput ( char *  buffer,
int  size 
)
protected

Perform input operation of OSS device.

OsStatus doOutput ( const char *  buffer,
int  size 
)
protected

Perform output operation of OSS device.

OsStatus doInputRs ( MpAudioSample buffer,
unsigned  size 
)
protected

Perform input operation of OSS device with siutable resampler.

OsStatus doOutputRs ( const MpAudioSample buffer,
unsigned  size 
)
protected

Perform output operation of OSS device with siutable resampler.

void noMoreNeeded ( )
protected

Deinitialization and freeing sequences.

void soundIoThread ( )
protected

Thread subroutine.

void threadIoStatusChanged ( )
private
void threadWakeUp ( )
private
void threadKill ( )
private
UtlBoolean ossSetTrigger ( bool  turnOn)
private
UtlBoolean ossReset ( )
private
static void* soundCardIoWrapper ( void *  arg)
staticprivate

Thread subroutine.

Friends And Related Function Documentation

friend class MpidOss
friend
friend class MpodOss
friend

Member Data Documentation

int mfdDevice
protected

The fd of the POSIX device (e.g. /dev/dsp)

UtlBoolean mbReadCap
protected

Device is able to play audio.

UtlBoolean mbWriteCap
protected

Device is able to capture audio.

MpidOss* mReader
protected

Input driver.

MpodOss* mWriter
protected

Output driver.

int mDeviceCap
protected

Device capabilities.

volatile UtlBoolean mStReader
protected

Input device is enabled.

volatile UtlBoolean mStWriter
protected

Output device is enabled.

volatile UtlBoolean mStShutdown
protected

Thread exit flag.

volatile UtlBoolean mModeChanged
protected

IO settings has changed.

unsigned mUsedSamplesPerSec
protected

Used samples rate either for IO.

unsigned mUsedSamplesPerFrame
protected

Used frame size for IO.

MpAudioSample* mResamplerBuffer
protected

Buffer for conversions.

UtlBoolean mStereoOps
protected

Use stereo output.

pthread_t mIoThread
protected

Internal IO thread.

sem_t mSleepSem
protected

Control IO thread sleeping.

sem_t mSignalSem
protected

Use for parameters synchronization.