sipxmedialib  Version 3.3
Private Member Functions | Private Attributes | List of all members
MpEncoderBase Class Reference

Base class for all media processing encoders. More...

#include <MpEncoderBase.h>

Collaboration diagram for MpEncoderBase:
Collaboration graph
[legend]

Public Member Functions

Creators
 MpEncoderBase (int payloadType, const MpCodecCallInfoV1 &callInfo, const MppCodecInfoV1_1 &codecInfo, const char *defaultFmtp)
 Constructor. More...
 
 ~MpEncoderBase ()
 Destructor. More...
 
OsStatus initEncode (const char *fmt)
 Initializes encoder with given fmtp parameters. More...
 
OsStatus initEncode ()
 Initializes encoder with default fmtp parameters. More...
 
OsStatus freeEncode ()
 Frees all memory allocated to the encoder by initEncode() More...
 
Manipulators
OsStatus encode (const MpAudioSample *pAudioSamples, const int numSamples, int &rSamplesConsumed, unsigned char *pCodeBuf, const int bytesLeft, int &rSizeInBytes, UtlBoolean &isPacketReady, UtlBoolean &isPacketSilent, UtlBoolean &shouldSetMarker)
 Encode audio samples. More...
 
Accessors
const MpCodecInfogetInfo () const
 Get static information about the encoder. More...
 
int getPayloadType ()
 Returns the RTP payload type associated with this encoder. More...
 

Private Member Functions

 MpEncoderBase (const MpEncoderBase &rMpEncoderBase)
 Copy constructor. More...
 
MpEncoderBaseoperator= (const MpEncoderBase &rhs)
 Assignment operator. More...
 

Private Attributes

int mPayloadType
 RTP payload type, associated with this codec. More...
 
MpCodecInfo mCodecInfo
 Codec info structure. More...
 
void * plgHandle
 Internal codec handle. More...
 
const MpCodecCallInfoV1mCallInfo
 Actual codec's manipulator functions. More...
 
UtlBoolean mInitialized
 Is codec initialized? More...
 
const char * mDefaultFmtp
 Default fmtp string. More...
 

Detailed Description

Base class for all media processing encoders.

Constructor & Destructor Documentation

MpEncoderBase ( int  payloadType,
const MpCodecCallInfoV1 callInfo,
const MppCodecInfoV1_1 codecInfo,
const char *  defaultFmtp 
)

Constructor.

Parameters
[in]payloadType- RTP payload type associated with this encoder.
[in]callInfo- codec manipulator functions.
[in]codecInfo- codec information struct.
[in]defaultFmtp- default codec fmtp string.

Destructor.

MpEncoderBase ( const MpEncoderBase rMpEncoderBase)
private

Copy constructor.

Member Function Documentation

OsStatus initEncode ( const char *  fmt)

Initializes encoder with given fmtp parameters.

Return values
OS_SUCCESS- Success.
OS_FAILED- Failure.
OsStatus initEncode ( )

Initializes encoder with default fmtp parameters.

Return values
OS_SUCCESS- Success.
OS_FAILED- Failure.
OsStatus freeEncode ( )

Frees all memory allocated to the encoder by initEncode()

Return values
OS_SUCCESS- Success.
OS_INVALID_STATE- Object has already been freed.
OsStatus encode ( const MpAudioSample pAudioSamples,
const int  numSamples,
int &  rSamplesConsumed,
unsigned char *  pCodeBuf,
const int  bytesLeft,
int &  rSizeInBytes,
UtlBoolean &  isPacketReady,
UtlBoolean &  isPacketSilent,
UtlBoolean &  shouldSetMarker 
)

Encode audio samples.

Processes the array of audio samples. If sufficient samples to encode a frame are now available, the encoded data will be written to the pCodeBuf array. The number of bytes written to the pCodeBuf array is returned in rSizeInBytes.

Parameters
[in]pAudioSamples- Pointer to array of PCM samples.
[in]numSamples- Number of samples at pAudioSamples.
[out]rSamplesConsumed- Number of samples encoded.
[out]pCodeBuf- Pointer to array for encoded data.
[in]bytesLeft- Number of bytes available at pCodeBuf.
[out]rSizeInBytes- Number of bytes written to the pCodeBuf array.
[out]isPacketReady- If TRUE, encoder finished encoding, so packet may be sent. If DTX is enabled, sendNow should be set to TRUE for all supressed packets too along with isPacketSilent set to TRUE.
[out]isPacketSilent- If TRUE, packet may be not transmitted if DTX is enabled, if FALSE, packet contain active voice data and should always be transmitted. Value of isPacketSilent is ignored with isPacketReady is set to FALSE.
Return values
OS_SUCCESS- Success.
const MpCodecInfo * getInfo ( ) const

Get static information about the encoder.

Returns
A pointer to an MpCodecInfo object that provides static information about the encoder.
int getPayloadType ( void  )

Returns the RTP payload type associated with this encoder.

MpEncoderBase& operator= ( const MpEncoderBase rhs)
private

Assignment operator.

Member Data Documentation

int mPayloadType
private

RTP payload type, associated with this codec.

MpCodecInfo mCodecInfo
private

Codec info structure.

void* plgHandle
private

Internal codec handle.

const MpCodecCallInfoV1& mCallInfo
private

Actual codec's manipulator functions.

UtlBoolean mInitialized
private

Is codec initialized?

const char* mDefaultFmtp
private

Default fmtp string.