All pastes #32183 Raw Edit

Miscellany

public text v1 · immutable
#32183 ·published 2005-12-03 00:28 UTC
rendered paste body
static switch_status switch_g711u_encode(switch_codec *codec,
                                   switch_codec *other_codec,
                                   void *decoded_data,
                                   size_t decoded_data_len,
                                   void *encoded_data,
                                   size_t *encoded_data_len,
                                   unsigned int *flag)
{
    short *dbuf;
    unsigned char *ebuf;
    size_t i;

    dbuf = decoded_data;
    ebuf = encoded_data;

    for (i = 0; i < decoded_data_len / sizeof(short); i++) {
        ebuf[i] = linear2ulaw(dbuf[i]);
    }

    *encoded_data_len = i;

    return SWITCH_STATUS_SUCCESS;
}