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

Container for device specific input ALSA driver. More...

#include <MpidAlsa.h>

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

Public Member Functions

Creators
 MpidAlsa (const UtlString &name, MpInputDeviceManager &deviceManager)
 Default constructor. More...
 
virtual ~MpidAlsa ()
 Destructor. More...
 
Manipulators
OsStatus enableDevice (unsigned samplesPerFrame, unsigned samplesPerSec, MpFrameTime currentFrameTime)
 Initialize device driver and state. More...
 
OsStatus disableDevice ()
 Uninitialize device driver. More...
 
Inquiry
Returns
the number of input devices found
UtlBoolean isDeviceValid ()
 Inquire if the ALSA device is valid. More...
 
- Public Member Functions inherited from MpInputDeviceDriver
 MpInputDeviceDriver (const UtlString &name, MpInputDeviceManager &deviceManager)
 Default constructor. More...
 
virtual ~MpInputDeviceDriver ()
 Destructor. More...
 
virtual OsStatus setDeviceId (MpInputDeviceHandle deviceId)
 Set device ID associated with this device in parent input device manager. More...
 
virtual OsStatus clearDeviceId ()
 Clear the device ID associated with this device. More...
 
virtual MpInputDeviceHandle getDeviceId () const
 Get device ID associated with this device in parent input device manager. More...
 
uint32_t getSamplesPerSec () const
 Get the sample rate of this device driver, if enabled. More...
 
uint32_t getSamplesPerFrame () const
 Get the samples per frame of this device driver, if enabled. More...
 
MpFrameTime getFramePeriod ()
 Calculate the number of milliseconds that a frame occupies in time. More...
 
MpFrameTime getCurrentFrameTime () const
 Get timestamp for the next frame to be pushed to input device manager. More...
 
const UtlString & getDeviceName () const
 Get device name. More...
 
virtual UtlBoolean isEnabled ()
 Inquire if this driver is enabled. More...
 

Static Public Member Functions

Accessors
static const char * getDefaultDeviceName ()
 Get the name of the default input ALSA PCM audio device. More...
 
static int getDeviceNames (UtlContainer &devicesNames)
 Get the list of names of the available input ALSA PCM audio device(s) More...
 
- Static Public Member Functions inherited from MpInputDeviceDriver
static MpFrameTime getFramePeriod (unsigned samplesPerFrame, unsigned samplesPerSec)
 Calculate the number of milliseconds that a frame occupies in time. More...
 

Protected Member Functions

OsStatus initBuffers ()
 Allocate internal ALSA buffers. More...
 
void freeBuffers ()
 Free internal ALSA buffers. More...
 
MpAudioSamplegetBuffer ()
 Get buffer from internal buffers. More...
 
void pushFrame ()
 Push audio frame to InputDeviceManager. More...
 
void skipFrame ()
 Add frame time to mCurrentFrameTime. More...
 

Protected Attributes

MpAudioSamplemAudioFrame
 Wave buffer. More...
 
MpAlsaContainermpCont
 Pointer to Wrapper container. More...
 
- Protected Attributes inherited from MpInputDeviceDriver
MpInputDeviceManagermpInputDeviceManager
 this device driver. More...
 
UtlBoolean mIsEnabled
 Whether this device driver is enabled or not. More...
 
MpInputDeviceHandle mDeviceId
 this device, as supplied by the InputDeviceManager. More...
 
unsigned mSamplesPerFrame
 number of samples. More...
 
unsigned mSamplesPerSec
 of samples per second. More...
 
MpFrameTime mCurrentFrameTime
 pushed to input device manager. More...
 

Private Member Functions

 MpidAlsa (const MpidAlsa &rMpInputDeviceDriver)
 Copy constructor (not implemented for this class). More...
 
MpidAlsaoperator= (const MpidAlsa &rhs)
 Assignment operator (not implemented for this class). More...
 

Private Attributes

MpAlsapDevWrapper
 

Static Private Attributes

static char spDefaultDeviceName [MAX_DEVICE_NAME_SIZE]
 

Friends

class MpAlsa
 

Detailed Description

Container for device specific input ALSA driver.

Constructor & Destructor Documentation

MpidAlsa ( const UtlString &  name,
MpInputDeviceManager deviceManager 
)

Default constructor.

Parameters
name- (in) unique device driver name (e.g. "/dev/dsp", "YAMAHA AC-XG WDM Audio", etc.).
deviceManager- (in) MpInputDeviceManager this device is to push frames to via pushFrame method.
~MpidAlsa ( )
virtual

Destructor.

MpidAlsa ( const MpidAlsa rMpInputDeviceDriver)
private

Copy constructor (not implemented for this class).

Member Function Documentation

OsStatus enableDevice ( unsigned  samplesPerFrame,
unsigned  samplesPerSec,
MpFrameTime  currentFrameTime 
)
virtual

Initialize device driver and state.

This method enables the device driver.

this SHOULD NOT be used to mute/unmute a device. Disabling and enabling a device results in state and buffer queues being cleared.

Parameters
samplesPerFrame- (in) the number of samples in a frame of media
samplesPerSec- (in) sample rate for media frame in samples per second
currentFrameTime- (in) time in milliseconds for beginning of frame relative to the MpInputDeviceManager reference time

Implements MpInputDeviceDriver.

OsStatus disableDevice ( )
virtual

Uninitialize device driver.

This method disables the device driver and should release any platform device resources so that the device might be used else where.

this SHOULD NOT be used to mute/unmute a device. Disabling and enabling a device results in state and buffer queues being cleared.

Implements MpInputDeviceDriver.

const char * getDefaultDeviceName ( )
static

Get the name of the default input ALSA PCM audio device.

int getDeviceNames ( UtlContainer &  devicesNames)
static

Get the list of names of the available input ALSA PCM audio device(s)

UtlBoolean isDeviceValid ( )
inlinevirtual

Inquire if the ALSA device is valid.

Implements MpInputDeviceDriver.

OsStatus initBuffers ( )
protected

Allocate internal ALSA buffers.

void freeBuffers ( )
protected

Free internal ALSA buffers.

MpAudioSample* getBuffer ( )
protected

Get buffer from internal buffers.

void pushFrame ( )
protected

Push audio frame to InputDeviceManager.

void skipFrame ( )
protected

Add frame time to mCurrentFrameTime.

MpidAlsa& operator= ( const MpidAlsa rhs)
private

Assignment operator (not implemented for this class).

Friends And Related Function Documentation

friend class MpAlsa
friend

Member Data Documentation

MpAudioSample* mAudioFrame
protected

Wave buffer.

MpAlsaContainer* mpCont
protected

Pointer to Wrapper container.

MpAlsa* pDevWrapper
private
char spDefaultDeviceName
staticprivate