28 # define CODEC_API __declspec(dllexport) 46 # define CODEC_TYPE_FRAME_BASED 0 48 # define CODEC_TYPE_SAMPLE_BASED 1 54 # define CODEC_FRAME_PACKING_NONE 0 56 # define CODEC_FRAME_PACKING_SPECIAL 1 63 # define CODEC_PLC_NONE 0 65 # define CODEC_PLC_INTERNAL 1 71 # define CODEC_CNG_NONE 0 73 # define CODEC_CNG_INTERNAL 1 79 # define RPLG_SUCCESS 0 80 # define RPLG_INVALID_ARGUMENT (-1) 81 # define RPLG_FAILED (-2) 82 # define RPLG_NOT_SUPPORTED (-3) 83 # define RPLG_CORRUPTED_DATA (-4) 84 # define RPLG_BAD_HANDLE (-5) 85 # define RPLG_NO_MORE_DATA (-6) 86 # define RPLG_BUFFER_TOO_SMALL (-7) 92 # define CODEC_DECODER 1 93 # define CODEC_ENCODER 0 100 static inline int analizeParamEqValue(
const char* parsingString,
const char* paramName,
int* value)
105 int digitFound =
FALSE;
111 strstr(parsingString, paramName);
115 res += strlen(paramName);
117 for (; (c = *res) != 0; res++)
134 for (res++; isdigit(c = *res); res++) {
135 tmp = tmp * 10 + (c -
'0');
155 static inline int getFmtpValueRange(
const char* fmtp,
const char* paramName,
int defaultValue,
int minValue,
int maxValue)
158 int res = (!fmtp) ? (-1) : analizeParamEqValue(fmtp, paramName, &value);
159 if ((res == 0) && (value >= minValue) && (value <= maxValue))
211 unsigned minFrameBytes;
216 unsigned maxFrameBytes;
218 unsigned packetLossConcealment;
229 #define DECLARE_FUNCS_V1(x) \ 230 CODEC_API int PLG_GET_INFO_V1_1(x)(const struct MppCodecInfoV1_1 **codecInfo); \ 231 CODEC_API void* PLG_INIT_V1_2(x)(const char* fmtp, int isDecoder, \ 232 struct MppCodecFmtpInfoV1_2* pCodecFmtpInfo); \ 233 CODEC_API int PLG_FREE_V1(x)(void* handle, int isDecoder); \ 234 CODEC_API int PLG_GET_PACKET_SAMPLES_V1_2(x)(void* handle, \ 235 const uint8_t* pPacketData, \ 236 unsigned packetSize, \ 237 unsigned *pNumSamples, \ 238 const struct RtpHeader* pRtpHeader);\ 239 CODEC_API int PLG_DECODE_V1(x)(void* handle, const void* pCodedData, \ 240 unsigned cbCodedPacketSize, void* pAudioBuffer, \ 241 unsigned cbBufferSize, unsigned *pcbDecodedSize, \ 242 const struct RtpHeader* pRtpHeader); \ 243 CODEC_API int PLG_ENCODE_V1(x)(void* handle, const void* pAudioBuffer, \ 244 unsigned cbAudioSamples, int* rSamplesConsumed, \ 245 void* pCodedData, unsigned cbMaxCodedData, \ 246 int* pcbCodedSize, unsigned* pbSendNow); 248 #define CPP_DECLARE_FUNCS_V1(x) \ 249 extern "C" DECLARE_FUNCS_V1(x) 251 #define PLG_GET_CODEC_NAME get_codecs_v1 252 #define PLG_GET_INFO_V1_1(x) x##_get_info_v1_1 253 #define PLG_INIT_V1_2(x) x##_init_v1_2 254 #define PLG_GET_PACKET_SAMPLES_V1_2(x) x##_get_packet_samples_v1_2 255 #define PLG_DECODE_V1(x) x##_decode_v1 256 #define PLG_ENCODE_V1(x) x##_encode_v1 257 #define PLG_FREE_V1(x) x##_free_v1 258 #define PLG_SIGNALING_V1(x) x##_signaling_v1 260 #define MSK_GET_CODEC_NAME_V1 "get_codecs_v1" 261 #define MSK_GET_INFO_V1_1 "_get_info_v1_1" 262 #define MSK_INIT_V1_2 "_init_v1_2" 263 #define MSK_GET_PACKET_SAMPLES_V1_2 "_get_packet_samples_v1_2" 264 #define MSK_DECODE_V1 "_decode_v1" 265 #define MSK_ENCODE_V1 "_encode_v1" 266 #define MSK_FREE_V1 "_free_v1" 267 #define MSK_SIGNALING_V1 "_signaling_v1" 274 uint32_t* startStatus, uint32_t *stopStatus);
276 const uint8_t* pPacketData,
278 unsigned *pNumSamples,
280 typedef int (*
dlPlgDecodeV1)(
void* handle,
const void* pCodedData,
unsigned cbCodedPacketSize,
281 void* pAudioBuffer,
unsigned cbBufferSize,
unsigned *pcbDecodedSize,
283 typedef int (*
dlPlgEncodeV1)(
void* handle,
const void* pAudioBuffer,
unsigned cbAudioSamples,
284 int* rSamplesConsumed,
void* pCodedData,
unsigned cbMaxCodedData,
285 int* pcbCodedSize,
unsigned* pbSendNow);
289 #define IPLG_ENUM_CODEC_NAME plugin_enum_codec 290 #define IPLG_ENUM_CODEC_START static const char* IPLG_ENUM_CODEC_NAME [] = { 291 #define IPLG_ENUM_CODEC(x) #x , 292 #define IPLG_ENUM_CODEC_END NULL}; 293 #define IPLG_ENUM_CODEC_FUNC \ 294 CODEC_API int PLG_GET_CODEC_NAME (int iNum, const char** pCodecModuleName); \ 295 CODEC_API int PLG_GET_CODEC_NAME (int iNum, const char** pCodecModuleName) \ 297 int i = (sizeof ( IPLG_ENUM_CODEC_NAME ) / sizeof ( IPLG_ENUM_CODEC_NAME[0] )) - 1; \ 298 if ((iNum < 0) || (iNum > i)) return RPLG_FAILED; \ 299 *pCodecModuleName = IPLG_ENUM_CODEC_NAME [iNum]; return RPLG_SUCCESS; \ 302 #define DEFINE_STATIC_REGISTRATOR \ 303 void callbackRegisterStaticCodec(const char* moduleName, \ 304 const char* codecModuleName, \ 305 dlPlgInitV1_2 plgInit, \ 306 dlPlgGetInfoV1_1 plgGetInfo, \ 307 dlPlgDecodeV1 plgDecode, \ 308 dlPlgEncodeV1 plgEncode, \ 309 dlPlgFreeV1 plgFree, \ 310 dlPlgGetPacketSamplesV1_2 plgGetPacketSamples, \ 311 dlPlgGetSignalingDataV1 plgSignaling); 313 #define REG_STATIC_NAME(y) registerStatic_##y 315 #define REGISTER_STATIC_PLG(x) void REG_STATIC_NAME(x)(void); \ 316 REG_STATIC_NAME(x)(); 318 #define SPLG_ENUM_CODEC_START(y) \ 319 void REG_STATIC_NAME(y) (void) { 320 #define SPLG_ENUM_CODEC(x) \ 321 callbackRegisterStaticCodec(__FILE__, #x, \ 323 PLG_GET_INFO_V1_1(x), \ 327 #define SPLG_ENUM_CODEC_SPECIAL_PACKING(x) \ 328 PLG_GET_PACKET_SAMPLES_V1_2(x), 329 #define SPLG_ENUM_CODEC_NO_SPECIAL_PACKING(x) \ 331 #define SPLG_ENUM_CODEC_SIGNALING(x) \ 332 PLG_SIGNALING_V1(x)); 333 #define SPLG_ENUM_CODEC_NO_SIGNALING(x) \ 335 #define SPLG_ENUM_CODEC_END } 338 # define PLG_ENUM_CODEC_START(y) IPLG_ENUM_CODEC_START 339 # define PLG_ENUM_CODEC(x) IPLG_ENUM_CODEC(x) 340 # define PLG_ENUM_CODEC_SPECIAL_PACKING(x) 341 # define PLG_ENUM_CODEC_NO_SPECIAL_PACKING(x) 342 # define PLG_ENUM_CODEC_SIGNALING(x) 343 # define PLG_ENUM_CODEC_NO_SIGNALING(x) 344 # define PLG_ENUM_CODEC_END IPLG_ENUM_CODEC_END \ 347 # define PLG_ENUM_CODEC_START(y) DEFINE_STATIC_REGISTRATOR \ 348 SPLG_ENUM_CODEC_START(y) 349 # define PLG_ENUM_CODEC(x) SPLG_ENUM_CODEC(x) 350 # define PLG_ENUM_CODEC_SPECIAL_PACKING(x) SPLG_ENUM_CODEC_SPECIAL_PACKING(x) 351 # define PLG_ENUM_CODEC_NO_SPECIAL_PACKING(x) SPLG_ENUM_CODEC_NO_SPECIAL_PACKING(x) 352 # define PLG_ENUM_CODEC_SIGNALING(x) SPLG_ENUM_CODEC_SIGNALING(x) 353 # define PLG_ENUM_CODEC_NO_SIGNALING(x) SPLG_ENUM_CODEC_NO_SIGNALING(x) 354 # define PLG_ENUM_CODEC_END SPLG_ENUM_CODEC_END 358 #define PLG_SINGLE_CODEC_SIG(x) \ 359 PLG_ENUM_CODEC_START(x) \ 360 PLG_ENUM_CODEC_SIG(x) \ 363 #define PLG_SINGLE_CODEC(x) \ 364 PLG_ENUM_CODEC_START(x) \ 368 #define PLG_DOUBLE_CODECS(x,y) \ 369 PLG_ENUM_CODEC_START(x##y) \ 376 #define SIZE_OF_SAMPLE 2 377 #define SIZE_OF_SAMPLE_BITS (SIZE_OF_SAMPLE * 8) 383 #define PLG_MAX(a, b) (((a) > (b)) ? (a) : (b)) 387 #define PLG_MIN(a, b) (((a) < (b)) ? (a) : (b)) int(* dlPlgDecodeV1)(void *handle, const void *pCodedData, unsigned cbCodedPacketSize, void *pAudioBuffer, unsigned cbBufferSize, unsigned *pcbDecodedSize, const struct RtpHeader *pRtpHeader)
Definition: PlgDefsV1.h:280
int(* dlPlgEncodeV1)(void *handle, const void *pAudioBuffer, unsigned cbAudioSamples, int *rSamplesConsumed, void *pCodedData, unsigned cbMaxCodedData, int *pcbCodedSize, unsigned *pbSendNow)
Definition: PlgDefsV1.h:283
unsigned maxBitrate
Maximum bit rate for this codec (in bits per second).
Definition: PlgDefsV1.h:209
unsigned fmtpsNum
Definition: PlgDefsV1.h:186
unsigned minBitrate
Minimum bit rate for this codec (in bits per second).
Definition: PlgDefsV1.h:208
unsigned numChannels
Definition: PlgDefsV1.h:193
unsigned sampleRate
Definition: PlgDefsV1.h:190
unsigned numSamplesPerFrame
Definition: PlgDefsV1.h:210
int(* dlPlgGetInfoV1_1)(const struct MppCodecInfoV1_1 **codecInfo)
Definition: PlgDefsV1.h:271
unsigned algorithmicDelay
Definition: PlgDefsV1.h:221
unsigned vadCng
See CODEC_CNG_* for details.
Definition: PlgDefsV1.h:220
unsigned codecType
See CODEC_TYPE_* defines above.
Definition: PlgDefsV1.h:180
const char * codecManufacturer
< characters and underscores.
Definition: PlgDefsV1.h:177
const char * codecVersion
Codec version (human readable).
Definition: PlgDefsV1.h:179
int(* dlGetCodecsV1)(int iNum, const char **pCodecModuleName)
Definition: PlgDefsV1.h:269
const char * mimeSubtype
MIME subtype.
Definition: PlgDefsV1.h:185
const char * codecName
Codec name (human readable).
Definition: PlgDefsV1.h:178
const char ** fmtps
Definition: PlgDefsV1.h:188
int(* dlPlgFreeV1)(void *handle, int isDecoder)
Definition: PlgDefsV1.h:286
unsigned signalingCodec
TRUE if codec could carry DTMF tones, FALSE otherwise.
Definition: PlgDefsV1.h:206
Information about concrete codec instance (i.e. with selected fmtp).
Definition: PlgDefsV1.h:202
int(* dlPlgGetPacketSamplesV1_2)(void *handle, const uint8_t *pPacketData, unsigned packetSize, unsigned *pNumSamples, const struct RtpHeader *pRtpHeader)
Definition: PlgDefsV1.h:275
int16_t audio_sample_t
Definition: PlgDefsV1.h:379
unsigned framePacking
See CODEC_FRAME_PACKING_* for details.
Definition: PlgDefsV1.h:195
void mppLogError(const char *format,...)
Definition: MpPlgStaffV1.cpp:43
int(* dlPlgGetSignalingDataV1)(void *handle, uint32_t *outEvent, uint32_t *outDuration, uint32_t *startStatus, uint32_t *stopStatus)
Definition: PlgDefsV1.h:273
#define TRUE
Definition: PlgDefsV1.h:41
#define FALSE
Definition: PlgDefsV1.h:37
Generic information about codec.
Definition: PlgDefsV1.h:169