spandsp: gsm0610_encode.c File Reference

spandsp 0.0.6

gsm0610_encode.c File Reference
`#include <assert.h>`
`#include <inttypes.h>`
`#include "floating_fudge.h"`
`#include <stdlib.h>`
`#include <memory.h>`
`#include "spandsp/telephony.h"`
`#include "spandsp/fast_convert.h"`
`#include "spandsp/bitstream.h"`
`#include "spandsp/saturated.h"`
`#include "spandsp/gsm0610.h"`
`#include "gsm0610_local.h"`

## Functions
int | gsm0610_set_packing (gsm0610_state_t *s, int packing)
gsm0610_state_t * | gsm0610_init (gsm0610_state_t *s, int packing)
int | gsm0610_release (gsm0610_state_t *s)
int | gsm0610_free (gsm0610_state_t *s)
int | gsm0610_pack_none (uint8_t c[], const gsm0610_frame_t *s)
int | gsm0610_pack_wav49 (uint8_t c[], const gsm0610_frame_t *s)
int | gsm0610_pack_voip (uint8_t c[33], const gsm0610_frame_t *s)
int | gsm0610_encode (gsm0610_state_t *s, uint8_t code[], const int16_t amp[], int len)

## Function Documentation

## ◆ gsm0610_encode()

int gsm0610_encode | ( | gsm0610_state_t * | s,
|  | uint8_t | code[],
|  | const int16_t | amp[],
|  | int | len )

Encode a buffer of linear PCM data to GSM 06.10.

Parameters

  s | The GSM 06.10 context.
  code | The GSM 06.10 data produced.
  amp | The audio sample buffer.
  len | The number of samples in the buffer.

Returns
  The number of bytes of GSM 06.10 data produced.

References gsm0610_pack_wav49(), and gsm0610_state_s::packing.

## ◆ gsm0610_free()

int gsm0610_free | ( | gsm0610_state_t * | s | ) |

Free a GSM 06.10 encode or decode context.

Parameters

  s | The GSM 06.10 context

Returns
  0 for success, else -1.

## ◆ gsm0610_init()

gsm0610_state_t * gsm0610_init | ( | gsm0610_state_t * | s,
|  | int | packing )

Initialise a GSM 06.10 encode or decode context.

Parameters

  s | The GSM 06.10 context
  packing | One of the GSM0610_PACKING_xxx options.

Returns
  A pointer to the GSM 06.10 context, or NULL for error.

References gsm0610_state_s::nrp, and gsm0610_state_s::packing.

## ◆ gsm0610_pack_wav49()

int gsm0610_pack_wav49 | ( | uint8_t | c[],
|  | const gsm0610_frame_t * | s )

Pack a pair of GSM 06.10 frames in the format used for wave files (wave type 49).

Parameters

  c | The buffer for the packed data. This must be at least 65 bytes long.
  s | A pointer to the frames to be packed.

Returns
  The number of bytes generated.

Referenced by gsm0610_encode().

## ◆ gsm0610_release()

int gsm0610_release | ( | gsm0610_state_t * | s | ) |

Release a GSM 06.10 encode or decode context.

Parameters

  s | The GSM 06.10 context

Returns
  0 for success, else -1.

## ◆ gsm0610_set_packing()

int gsm0610_set_packing | ( | gsm0610_state_t * | s,
|  | int | packing )

Set the packing format for a GSM 06.10 encode or decode context.

Parameters

  s | The GSM 06.10 context
  packing | One of the GSM0610_PACKING_xxx options.

Returns
  0 for success, else -1.

References gsm0610_state_s::packing.