sipxmedialib  Version 3.3
MpEncoderBase.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006-2011 SIPez LLC. All rights reserved.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2004-2008 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
9 // Licensed to SIPfoundry under a Contributor Agreement.
10 //
11 // $$
13 
14 #ifndef _MpEncoderBase_h_
15 #define _MpEncoderBase_h_
16 
17 // SYSTEM INCLUDES
18 
19 // APPLICATION INCLUDES
20 #include "os/OsStatus.h"
21 #include "mp/MpAudioBuf.h"
22 #include "mp/MpCodecInfo.h"
23 #include "mp/MpPlgStaffV1.h"
24 
25 // DEFINES
26 // MACROS
27 // EXTERNAL FUNCTIONS
28 // EXTERNAL VARIABLES
29 // CONSTANTS
30 // STRUCTS
31 // TYPEDEFS
32 // FORWARD DECLARATIONS
33 
36 {
37 /* //////////////////////////// PUBLIC //////////////////////////////////// */
38 public:
39 
40 /* ============================ CREATORS ================================== */
42 
43 
45  MpEncoderBase(int payloadType,
46  const MpCodecCallInfoV1& callInfo,
47  const MppCodecInfoV1_1& codecInfo,
48  const char* defaultFmtp);
58 
60  OsStatus initEncode(const char* fmt);
66  OsStatus initEncode();
73  OsStatus freeEncode();
81 
82 /* ============================ MANIPULATORS ============================== */
84 
85 
87  OsStatus encode(const MpAudioSample* pAudioSamples,
88  const int numSamples,
89  int& rSamplesConsumed,
90  unsigned char* pCodeBuf,
91  const int bytesLeft,
92  int& rSizeInBytes,
93  UtlBoolean& isPacketReady,
94  UtlBoolean& isPacketSilent,
95  UtlBoolean& shouldSetMarker);
123 
124 /* ============================ ACCESSORS ================================= */
126 
127 
129  const MpCodecInfo* getInfo() const;
135  int getPayloadType();
137 
139 
140 /* ============================ INQUIRY =================================== */
142 
143 
145 
146 /* //////////////////////////// PROTECTED ///////////////////////////////// */
147 
148 /* //////////////////////////// PRIVATE /////////////////////////////////// */
149 private:
152  void* plgHandle;
154  UtlBoolean mInitialized;
155  const char* mDefaultFmtp;
156 
158  MpEncoderBase(const MpEncoderBase& rMpEncoderBase);
159 
162 
163 };
164 
165 /* ============================ INLINE METHODS ============================ */
166 
167 #endif // _MpEncoderBase_h_
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.
Definition: MpEncoderBase.cpp:93
~MpEncoderBase()
Destructor.
Definition: MpEncoderBase.cpp:34
Object-oriented wrapper for codec.
Definition: MpPlgStaffV1.h:94
Base class for all media processing encoders.
Definition: MpEncoderBase.h:35
int getPayloadType()
Returns the RTP payload type associated with this encoder.
Definition: MpEncoderBase.cpp:158
MpEncoderBase(int payloadType, const MpCodecCallInfoV1 &callInfo, const MppCodecInfoV1_1 &codecInfo, const char *defaultFmtp)
Constructor.
Definition: MpEncoderBase.cpp:22
int16_t MpAudioSample
Definition: MpTypes.h:44
const MpCodecCallInfoV1 & mCallInfo
Actual codec's manipulator functions.
Definition: MpEncoderBase.h:153
void * plgHandle
Internal codec handle.
Definition: MpEncoderBase.h:152
Static information describing a codec.
Definition: MpCodecInfo.h:35
const MpCodecInfo * getInfo() const
Get static information about the encoder.
Definition: MpEncoderBase.cpp:149
OsStatus initEncode()
Initializes encoder with default fmtp parameters.
Definition: MpEncoderBase.cpp:76
MpEncoderBase & operator=(const MpEncoderBase &rhs)
Assignment operator.
const char * mDefaultFmtp
Default fmtp string.
Definition: MpEncoderBase.h:155
OsStatus freeEncode()
Frees all memory allocated to the encoder by initEncode()
Definition: MpEncoderBase.cpp:81
int mPayloadType
RTP payload type, associated with this codec.
Definition: MpEncoderBase.h:150
UtlBoolean mInitialized
Is codec initialized?
Definition: MpEncoderBase.h:154
MpCodecInfo mCodecInfo
Codec info structure.
Definition: MpEncoderBase.h:151
Generic information about codec.
Definition: PlgDefsV1.h:169