sipxmedialib  Version 3.3
MpDecoderBase.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006-2013 SIPez LLC. All rights reserved.
3 //
4 // Copyright (C) 2004-2008 SIPfoundry Inc.
5 // Licensed by SIPfoundry under the LGPL license.
6 //
7 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
8 // Licensed to SIPfoundry under a Contributor Agreement.
9 //
10 // $$
12 
13 #ifndef _MpDecoderBase_h_
14 #define _MpDecoderBase_h_
15 
16 // SYSTEM INCLUDES
17 
18 // APPLICATION INCLUDES
19 #include "mp/MpCodecInfo.h"
20 #include "mp/MpRtpBuf.h"
21 #include "mp/MpTypes.h"
22 #include "os/OsStatus.h"
23 #include "mp/MpPlgStaffV1.h"
24 
25 // DEFINES
26 // MACROS
27 // EXTERNAL FUNCTIONS
28 // EXTERNAL VARIABLES
29 // CONSTANTS
30 // STRUCTS
31 // TYPEDEFS
32 
33 // FORWARD DECLARATIONS
34 class OsNotification;
35 
38 {
39 /* //////////////////////////// PUBLIC //////////////////////////////////// */
40 public:
41 
42 /* ============================ CREATORS ================================== */
44 
45 
47  MpDecoderBase(int payloadType,
48  const MpCodecCallInfoV1& callInfo,
49  const MppCodecInfoV1_1& codecInfo,
50  const char* defaultFmtp);
57 
59  OsStatus initDecode(const char* codecFmtString);
65  OsStatus initDecode();
72  OsStatus freeDecode();
80 
81 /* ============================ MANIPULATORS ============================== */
83 
84 
86  int decode(const MpRtpBufPtr &pPacket,
87  unsigned decodedBufferLength,
88  MpAudioSample *samplesBuffer);
109 
110 /* ============================ ACCESSORS ================================= */
112 
113 
115  const MpCodecInfo* getInfo() const;
124  int getPayloadType();
126 
128  OsStatus getSignalingData(uint8_t &event,
129  UtlBoolean &isStarted,
130  UtlBoolean &isStopped,
131  uint16_t &duration);
151 
152 /* ============================ INQUIRY =================================== */
154 
155 
157 
158 protected:
159 /* //////////////////////////// PROTECTED ///////////////////////////////// */
160 
161 /* //////////////////////////// PRIVATE /////////////////////////////////// */
162 private:
166  void* plgHandle;
168  const char* mDefaultFmtp;
169 
170  bool isInitialized() const;
171 
173  MpDecoderBase(const MpDecoderBase& rMpDecoderBase);
174 
177 };
178 
179 /* ============================ INLINE METHODS ============================ */
180 
181 inline bool MpDecoderBase::isInitialized() const
182 {
183  return (NULL != plgHandle);
184 }
185 
186 #endif // _MpDecoderBase_h_
OsStatus freeDecode()
Frees all memory allocated to the decoder by initDecode()
Definition: MpDecoderBase.cpp:61
MpDecoderBase & operator=(const MpDecoderBase &rhs)
Assignment operator.
~MpDecoderBase()
Destructor.
Definition: MpDecoderBase.cpp:33
OsStatus getSignalingData(uint8_t &event, UtlBoolean &isStarted, UtlBoolean &isStopped, uint16_t &duration)
Get signaling data from last decoded packet.
Definition: MpDecoderBase.cpp:165
const MpCodecInfo * getInfo() const
Get information about the decoder.
Definition: MpDecoderBase.cpp:150
Base class for all media processing decoders.
Definition: MpDecoderBase.h:37
Object-oriented wrapper for codec.
Definition: MpPlgStaffV1.h:94
int getPayloadType()
Returns the RTP payload type associated with this decoder.
Definition: MpDecoderBase.cpp:160
Smart pointer to MpRtpBuf.
Definition: MpRtpBuf.h:348
int16_t MpAudioSample
Definition: MpTypes.h:44
Static information describing a codec.
Definition: MpCodecInfo.h:35
int mPayloadType
RTP payload type associated with this decoder.
Definition: MpDecoderBase.h:163
bool isInitialized() const
Is codec initialized?
Definition: MpDecoderBase.h:181
MpDecoderBase(int payloadType, const MpCodecCallInfoV1 &callInfo, const MppCodecInfoV1_1 &codecInfo, const char *defaultFmtp)
Constructor.
Definition: MpDecoderBase.cpp:21
OsStatus initDecode()
Initializes a codec data structure for use as a decoder using default fmtp.
Definition: MpDecoderBase.cpp:56
int decode(const MpRtpBufPtr &pPacket, unsigned decodedBufferLength, MpAudioSample *samplesBuffer)
Decode incoming RTP packet.
Definition: MpDecoderBase.cpp:76
const MpCodecCallInfoV1 & mCallInfo
this codec.
Definition: MpDecoderBase.h:165
void * plgHandle
Codec internal handle.
Definition: MpDecoderBase.h:167
MpCodecInfo mCodecInfo
Info structure for this codec.
Definition: MpDecoderBase.h:164
const char * mDefaultFmtp
Fmtp to use if not passed to initDecode().
Definition: MpDecoderBase.h:168
Generic information about codec.
Definition: PlgDefsV1.h:169