// G711Codec.cpp: implementation of the G711Codec class. // ////////////////////////////////////////////////////////////////////// #include "G711Codec.h" #include "G711Table.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// G711Codec::G711Codec() { SetULaw(); } G711Codec::~G711Codec() { } int G711Codec::Encode(void *input, int inputSizeBytes, void *output, int *outputSizeBytes) { char *dataIn = (char *)input; char *dataOut = (char *)output; if (*outputSizeBytes < inputSizeBytes/2) { *outputSizeBytes = 0; return -10; } else { unsigned char *compTable; if (GetCodecType() == CODECTYPE_ULAW) { compTable = ulaw_comp_table; } else { compTable = alaw_comp_table; } // convert the sample for (int i=0; i *outputSizeBytes) { *outputSizeBytes = 0; return -10; } else { short *expTable; if (GetCodecType() == CODECTYPE_ULAW) { expTable = ulaw_exp_table; } else { expTable = alaw_exp_table; } // convert the sample for (int i=0; i