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

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

#include <MpDecoderBase.h>

Collaboration diagram for MpDecoderBase:
Collaboration graph
[legend]

Public Member Functions

Creators
 MpDecoderBase (int payloadType, const MpCodecCallInfoV1 &callInfo, const MppCodecInfoV1_1 &codecInfo, const char *defaultFmtp)
 Constructor. More...
 
 ~MpDecoderBase ()
 Destructor. More...
 
OsStatus initDecode (const char *codecFmtString)
 Initializes a codec data structure for use as a decoder. More...
 
OsStatus initDecode ()
 Initializes a codec data structure for use as a decoder using default fmtp. More...
 
OsStatus freeDecode ()
 Frees all memory allocated to the decoder by initDecode() More...
 
Manipulators
int decode (const MpRtpBufPtr &pPacket, unsigned decodedBufferLength, MpAudioSample *samplesBuffer)
 Decode incoming RTP packet. More...
 
Accessors
const MpCodecInfogetInfo () const
 Get information about the decoder. More...
 
int getPayloadType ()
 Returns the RTP payload type associated with this decoder. More...
 
OsStatus getSignalingData (uint8_t &event, UtlBoolean &isStarted, UtlBoolean &isStopped, uint16_t &duration)
 Get signaling data from last decoded packet. More...
 

Private Member Functions

bool isInitialized () const
 Is codec initialized? More...
 
 MpDecoderBase (const MpDecoderBase &rMpDecoderBase)
 Copy constructor. More...
 
MpDecoderBaseoperator= (const MpDecoderBase &rhs)
 Assignment operator. More...
 

Private Attributes

int mPayloadType
 RTP payload type associated with this decoder. More...
 
MpCodecInfo mCodecInfo
 Info structure for this codec. More...
 
const MpCodecCallInfoV1mCallInfo
 this codec. More...
 
void * plgHandle
 Codec internal handle. More...
 
const char * mDefaultFmtp
 Fmtp to use if not passed to initDecode(). More...
 

Detailed Description

Base class for all media processing decoders.

Constructor & Destructor Documentation

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

Constructor.

Parameters
[in]payloadType- RTP payload type associated with this decoder

Destructor.

MpDecoderBase ( const MpDecoderBase rMpDecoderBase)
private

Copy constructor.

Member Function Documentation

OsStatus initDecode ( const char *  codecFmtString)

Initializes a codec data structure for use as a decoder.

Return values
OS_SUCCESS- Success
OS_NO_MEMORY- Memory allocation failure
OsStatus initDecode ( )

Initializes a codec data structure for use as a decoder using default fmtp.

Return values
OS_SUCCESS- Success
OS_NO_MEMORY- Memory allocation failure
OsStatus freeDecode ( )

Frees all memory allocated to the decoder by initDecode()

Return values
OS_SUCCESS- Success.
OS_INVALID_STATE- Object has already been freed.
int decode ( const MpRtpBufPtr pPacket,
unsigned  decodedBufferLength,
MpAudioSample samplesBuffer 
)

Decode incoming RTP packet.

This method is called by MprDecode for every incoming RTP packet. If codec have internal PLC, then this method is also called for every lost packet with pPacket=NULL to leverage codec's internal PLC. For signaling codecs (namely RFC2833/4733) right after decode() MprDecode calls getSignalingData() to retrieve decoded signaling data. That is decoder should cache this data internally between decode() and getSignalingData() calls.

See also
getSignalingData()
Parameters
[in]pPacket- Pointer to a RTP packet. May be NULL if packet was lost.
[in]decodedBufferLength- Length of the samplesBuffer (in samples).
[out]samplesBuffer- Buffer for decoded samples.
Returns
Number of decoded samples.
const MpCodecInfo * getInfo ( ) const

Get information about the decoder.

Returns
A pointer to a MpCodecInfo object that provides information about the decoder. For codecs with only one mode supported (like G.711 and GSM) it may return pointer to static class member. More complex codecs (like Speex) may return pointer to usual class member.
int getPayloadType ( void  )

Returns the RTP payload type associated with this decoder.

OsStatus getSignalingData ( uint8_t &  event,
UtlBoolean &  isStarted,
UtlBoolean &  isStopped,
uint16_t &  duration 
)

Get signaling data from last decoded packet.

If codec is signaling, that is it is able to carry signaling data, this function is called right after decode() to get signaling data from last decoded RTP packet.

Note
Only DTMF digits are supported. Other signaling data is not yet supported.
Default implementation just return OS_NOT_SUPPORTED.
See also
decode()
Return values
OS_SUCCESS- Last decoded packet had signaling data, key, pressState and duration were filled with decoded values.
OS_NO_MORE_DATA- Last packet had no meaningful signaling data.
OS_NOT_SUPPORTED- This codec is pure audio codec and could not carry any signaling data.
bool isInitialized ( ) const
inlineprivate

Is codec initialized?

MpDecoderBase& operator= ( const MpDecoderBase rhs)
private

Assignment operator.

Member Data Documentation

int mPayloadType
private

RTP payload type associated with this decoder.

MpCodecInfo mCodecInfo
private

Info structure for this codec.

const MpCodecCallInfoV1& mCallInfo
private

this codec.

Pointers to actual methods of

void* plgHandle
private

Codec internal handle.

const char* mDefaultFmtp
private

Fmtp to use if not passed to initDecode().