sipxmedialib
Version 3.3
|
Container for device specific input driver. More...
#include <MpInputDeviceDriver.h>
Protected Attributes | |
MpInputDeviceManager * | mpInputDeviceManager |
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 | |
MpInputDeviceDriver (const MpInputDeviceDriver &rMpInputDeviceDriver) | |
Copy constructor (not implemented for this class) More... | |
MpInputDeviceDriver & | operator= (const MpInputDeviceDriver &rhs) |
Assignment operator (not implemented for this class) More... | |
Creators | |
MpInputDeviceDriver (const UtlString &name, MpInputDeviceManager &deviceManager) | |
Default constructor. More... | |
virtual | ~MpInputDeviceDriver () |
Destructor. More... | |
Manipulators | |
virtual OsStatus | enableDevice (unsigned samplesPerFrame, unsigned samplesPerSec, MpFrameTime currentFrameTime=0)=0 |
Initialize device driver and state. More... | |
virtual OsStatus | disableDevice ()=0 |
Uninitialize device driver. 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... | |
Accessors | |
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... | |
static MpFrameTime | getFramePeriod (unsigned samplesPerFrame, unsigned samplesPerSec) |
Calculate the number of milliseconds that a frame occupies in time. More... | |
Inquiry | |
virtual UtlBoolean | isEnabled () |
Inquire if this driver is enabled. More... | |
virtual UtlBoolean | isDeviceValid ()=0 |
Inquire if the device is valid. More... | |
Container for device specific input driver.
The MpInputDeviceDriver is the abstract container for the implementation of input media drivers. An instance of MpInputDeviceDriver is created for every physical and logical input device (e.g. microphone). A driver is instantiated and then added to the MpInputDeviceManager. The driver must be enabled via the MpInputDeviceManager before it yields input frames.
The MpInputDeviceDriver obtains frames of audio from hardware and provides them to the MpInputDeviceManager which makes the frames available to MprFromInputDevice resources in flowgraphs. The MpInputDeviceDriver may be an OsTask which runs and gets frames for the OS and hardware specific device or MpInputDeviceDriver may be driven via callbacks from the OS/hardware input device driver. This is an implementation choice.
MpInputDeviceDriver has a text name which is defined upon construction. This name will typically be the same as the OS defined name for the input device. The name of the MpInputDeviceDriver is accessed via the data() method inherited from UtlString. This allows MpInputDeviceDriver to be contained and accessed by name.
MpInputDeviceDriver | ( | const UtlString & | name, |
MpInputDeviceManager & | deviceManager | ||
) |
Default constructor.
name | - unique device driver name (e.g. "/dev/dsp", "YAMAHA AC-XG WDM Audio", etc.) |
deviceManager | - MpInputDeviceManager this device is to push frames to via pushFrame method |
|
virtual |
Destructor.
|
private |
Copy constructor (not implemented for this class)
|
pure 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.
samplesPerFrame | - the number of samples in a frame of media |
samplesPerSec | - sample rate for media frame in samples per second |
currentFrameTime | - time in milliseconds for beginning of frame relative to the MpInputDeviceManager reference time |
Implemented in MpSineWaveGeneratorDeviceDriver, MpidAndroid, MpidWinMM, MpidOss, MpidCoreAudio, and MpidAlsa.
|
pure 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.
Implemented in MpSineWaveGeneratorDeviceDriver, MpidWinMM, MpidAndroid, MpidOss, MpidAlsa, and MpidCoreAudio.
|
virtual |
Set device ID associated with this device in parent input device manager.
|
virtual |
Clear the device ID associated with this device.
|
virtual |
Get device ID associated with this device in parent input device manager.
|
inline |
Get the sample rate of this device driver, if enabled.
|
inline |
Get the samples per frame of this device driver, if enabled.
|
inline |
Calculate the number of milliseconds that a frame occupies in time.
|
inlinestatic |
Calculate the number of milliseconds that a frame occupies in time.
|
inline |
Get timestamp for the next frame to be pushed to input device manager.
|
inline |
Get device name.
|
virtual |
Inquire if this driver is enabled.
|
pure virtual |
Inquire if the device is valid.
Implemented in MpSineWaveGeneratorDeviceDriver, MpidWinMM, MpidAlsa, MpidOss, MpidAndroid, and MpidCoreAudio.
|
private |
Assignment operator (not implemented for this class)
|
protected |
this device driver.
The object that manages
|
protected |
Whether this device driver is enabled or not.
|
protected |
this device, as supplied by the InputDeviceManager.
The logical device ID that identifies
|
protected |
number of samples.
Device produce audio frame with this
|
protected |
of samples per second.
Device produce audio with this number
|
protected |
pushed to input device manager.
Timestamp for the next frame to be