sipxmedialib
Version 3.3
|
Container for device specific output driver. More...
#include <MpodBufferRecorder.h>
Public Member Functions | |
Creators | |
MpodBufferRecorder (const UtlString &name, MpFrameTime bufferLength) | |
Default constructor. More... | |
virtual | ~MpodBufferRecorder () |
Destructor. More... | |
Manipulators | |
virtual OsStatus | enableDevice (unsigned samplesPerFrame, unsigned samplesPerSec, MpFrameTime currentFrameTime, OsCallback &frameTicker) |
Initialize device driver and state. More... | |
virtual OsStatus | disableDevice () |
Uninitialize device driver. More... | |
virtual OsStatus | pushFrame (unsigned int numSamples, const MpAudioSample *samples, MpFrameTime frameTime) |
Send data to output device. More... | |
Accessors | |
const MpAudioSample * | getBufferData () const |
unsigned | getBufferLength () const |
unsigned | getBufferEnd () const |
Public Member Functions inherited from MpOutputDeviceDriver | |
MpOutputDeviceDriver (const UtlString &name) | |
Default constructor. More... | |
virtual | ~MpOutputDeviceDriver () |
Destructor. More... | |
MpFrameTime | getFramePeriod () const |
Calculate the number of milliseconds that a frame occupies in time. More... | |
unsigned | getSamplesPerFrame () const |
Get number of samples in a frame. More... | |
unsigned | getSamplesPerSec () const |
Get number of samples per second. More... | |
const UtlString & | getDeviceName () const |
Get device name. More... | |
virtual OsStatus | canEnable () |
Check if this device can connect. More... | |
virtual UtlBoolean | isEnabled () const |
Inquire if this driver is enabled. More... | |
Protected Attributes | |
MpFrameTime | mBufferLengthMS |
unsigned | mBufferLength |
MpAudioSample * | mpBuffer |
unsigned | mBufferEnd |
OsTimer * | mpTickerTimer |
Protected Attributes inherited from MpOutputDeviceDriver | |
OsAtomicLightBool | mIsEnabled |
Whether this device driver is enabled or not. More... | |
OsAtomicLightUInt | mSamplesPerFrame |
number of samples. More... | |
OsAtomicLightUInt | mSamplesPerSec |
of samples per second. More... | |
OsCallback * | mpTickerNotification |
is ready to accept more data. See enableDevice() for details. More... | |
Private Member Functions | |
MpodBufferRecorder (const MpodBufferRecorder &rMpodBufferRecorder) | |
Copy constructor (not implemented for this class) More... | |
MpodBufferRecorder & | operator= (const MpodBufferRecorder &rhs) |
Assignment operator (not implemented for this class) More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from MpOutputDeviceDriver | |
static MpFrameTime | getFramePeriod (unsigned samplesPerFrame, unsigned samplesPerSec) |
Calculate the number of milliseconds that a frame occupies in time. More... | |
Container for device specific output driver.
|
explicit |
Default constructor.
name | - (in) unique device driver name (e.g. "/dev/dsp", "YAMAHA AC-XG WDM Audio", etc.) |
bufferLength | - (in) length of buffer for recorded data (in milliseconds). |
|
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.
[in] | samplesPerFrame | - the number of samples in a frame of media |
[in] | samplesPerSec | - sample rate for media frame in samples per second |
[in] | currentFrameTime | - time in milliseconds for beginning of frame relative to the MpOutputDeviceManager reference time |
[in] | frameTicker | - notification to signal when device become ready. Device driver MUST signal this notification as soon as it become ready to receive next portion of data to play back. Note, it is a callback which in turn calls pushFrame() method of this device driver. Also notification may be used to signal begin of frame interval for one or several flowgraphs, so it should be as uniform as possible, i.e. it should not burst or hold over, driver should signal this notification after equal intervals of time. |
This method is supposed to be used from MpAudioOutputConnection only. If you want enable device, use MpOutputDeviceManager or MpAudioOutputConnection methods.
Implements MpOutputDeviceDriver.
|
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.
This method is supposed to be used from MpAudioOutputConnection only. If you want disable device, use MpOutputDeviceManager or MpAudioOutputConnection methods.
Implements MpOutputDeviceDriver.
|
virtual |
Send data to output device.
This method is called from a callback which is called when we fire ticker notification. See enableDevice() for details.
[in] | numSamples | - Number of samples in samples array. |
[in] | samples | - Array of samples to push to device. |
[in] | frameTime | - Time of pushed frame. Device may consider does it want it or not internally. If frame come too late driver should return OS_SUCCESS and throw out it silently. Common problem is when MediaTask queue is jammed - no frames are processed for some time and then they are processed bursty. Using given frameTime driver may keep its internal queue short. It is guaranteed that frame time would increase monotonically. |
Implements MpOutputDeviceDriver.
|
inline |
|
inline |
|
inline |
|
private |
Assignment operator (not implemented for this class)
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |