sipxmedialib
Version 3.3
|
Audio input driver for Android OS. More...
#include <MpidAndroid.h>
Protected Types | |
enum | DriverState { DRIVER_IDLE, DRIVER_INIT, DRIVER_STARTING, DRIVER_RECORDING, DRIVER_STOPPING, DRIVER_STOPPED } |
Protected Member Functions | |
bool | initAudioRecord () |
Prepare AudioRecord stream for recording. More... | |
bool | probeSampleRate (int targetRate, int targetFrameSize, const int *ratesList, int ratesListLen, bool probeDefault=true) |
Call initAudioRecord() with frequencies listed until we find working one. More... | |
Static Protected Member Functions | |
static void | audioCallback (int event, void *user, void *info) |
Callback function to be called by OS. More... | |
Protected Attributes | |
audio_source | mStreamSource |
Source of a stream we're recording. More... | |
DriverState | mState |
Driver internal state. More... | |
MpAndroidAudioRecord * | mpAudioRecord |
Pointer to audio track used for record. More... | |
int | mSamplesPerSecInternal |
Sample rate of AudioRecord. More... | |
int | mSamplesPerFrameInternal |
Number of sample per frame we use with AudioRecord. More... | |
MpAudioSample * | mpBufInternal |
full buffer. Have mSamplesPerFrameInternal size. More... | |
int | mBufInternalSamples |
Number of samples currently stored in mpBufInternal. More... | |
Mutex | mLock |
Condition | mWaitCbkCond |
MpResamplerBase * | mpResampler |
to output samplerate. More... | |
MpAudioSample * | mpResampleBuf |
resampler. More... | |
Protected Attributes inherited from MpInputDeviceDriver | |
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... | |
Static Protected Attributes | |
static const int | mpSampleRatesList [] |
AudioRecord initialization. More... | |
static const int | mSampleRatesListLen |
Number of entries in mpSampleRatesList. More... | |
Private Member Functions | |
MpidAndroid (const MpidAndroid &rMpidAndroid) | |
Copy constructor (not implemented for this class) More... | |
MpidAndroid & | operator= (const MpidAndroid &rhs) |
Assignment operator (not implemented for this class) More... | |
Creators | |
enum | audio_source { AUDIO_SOURCE_DEFAULT = 0, AUDIO_SOURCE_MIC = 1, AUDIO_SOURCE_VOICE_UPLINK = 2, AUDIO_SOURCE_VOICE_DOWNLINK = 3, AUDIO_SOURCE_VOICE_CALL = 4, AUDIO_SOURCE_CAMCORDER = 5, AUDIO_SOURCE_VOICE_RECOGNITION = 6, AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_RECOGNITION, AUDIO_SOURCE_LIST_END } |
Audio input source. Refer to Android OS sources. More... | |
MpidAndroid (audio_source source, MpInputDeviceManager &deviceManager) | |
Default constructor. More... | |
virtual | ~MpidAndroid () |
Destructor. More... | |
Manipulators | |
virtual OsStatus | enableDevice (unsigned samplesPerFrame, unsigned samplesPerSec, MpFrameTime currentFrameTime=0) |
Initialize device driver and state. More... | |
virtual OsStatus | disableDevice () |
Uninitialize device driver. More... | |
Inquiry | |
virtual UtlBoolean | isDeviceValid () |
Inquire if the device is valid. More... | |
Additional Inherited Members | |
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 inherited from MpInputDeviceDriver | |
static MpFrameTime | getFramePeriod (unsigned samplesPerFrame, unsigned samplesPerSec) |
Calculate the number of milliseconds that a frame occupies in time. More... | |
Audio input driver for Android OS.
enum audio_source |
|
protected |
MpidAndroid | ( | audio_source | source, |
MpInputDeviceManager & | deviceManager | ||
) |
Default constructor.
[in] | source | - what audio source to record. |
[in] | deviceManager | - MpInputDeviceManager this device is to push frames to via pushFrame method |
|
virtual |
Destructor.
|
private |
Copy constructor (not implemented for this class)
|
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 |
Implements MpInputDeviceDriver.
|
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.
|
virtual |
Inquire if the device is valid.
Implements MpInputDeviceDriver.
|
protected |
Prepare AudioRecord stream for recording.
|
protected |
Call initAudioRecord() with frequencies listed until we find working one.
|
staticprotected |
Callback function to be called by OS.
|
private |
Assignment operator (not implemented for this class)
|
protected |
Source of a stream we're recording.
|
protected |
Driver internal state.
|
protected |
Pointer to audio track used for record.
|
protected |
Sample rate of AudioRecord.
|
protected |
Number of sample per frame we use with AudioRecord.
|
protected |
full buffer. Have mSamplesPerFrameInternal size.
Temporary audio buffer to save data if don't receive
|
protected |
Number of samples currently stored in mpBufInternal.
|
protected |
Mutex to control concurrent access to driver object from audio callback and application API
|
protected |
condition enabling interface to wait for audio callback completion after a change is requested
|
protected |
to output samplerate.
Resampler used to resample from hardware samplerate
|
protected |
resampler.
Buffer of size mSamplesPerFrameInternal used by
|
staticprotected |
AudioRecord initialization.
List of sampling rates to probe during
|
staticprotected |
Number of entries in mpSampleRatesList.