introduce #defines for canonical length + use them

This commit is contained in:
Harald Welte 2017-05-28 10:20:26 +02:00
parent 2ae47af0be
commit 62688b60c2
6 changed files with 10 additions and 5 deletions

View File

@ -22,6 +22,11 @@
#include <stdint.h>
#define FR_CANON_LEN 33
#define HR_CANON_LEN 14
#define EFR_CANON_LEN 31
#define PCM_CANON_LEN (160*sizeof(uint16_t))
enum codec_type {
CODEC_INVALID = 0,
CODEC_PCM, /* 16 bits PCM samples */

View File

@ -106,7 +106,7 @@ const struct codec_desc codec_efr_desc = {
.type = CODEC_EFR,
.name = "efr",
.description = "GSM 06.60 Enhanced Full Rate codec",
.canon_frame_len = 31,
.canon_frame_len = EFR_CANON_LEN,
#ifdef HAVE_OPENCORE_AMRNB
.codec_enc_format_type = FMT_AMR_EFR,
.codec_dec_format_type = FMT_AMR_EFR,

View File

@ -81,7 +81,7 @@ const struct codec_desc codec_fr_desc = {
.type = CODEC_FR,
.name = "fr",
.description = "GSM 06.10 Full Rate codec (classic gsm codec)",
.canon_frame_len = 33,
.canon_frame_len = FR_CANON_LEN,
#ifdef HAVE_LIBGSM
.codec_enc_format_type = FMT_GSM,
.codec_dec_format_type = FMT_GSM,

View File

@ -69,7 +69,7 @@ const struct codec_desc codec_hr_desc = {
.type = CODEC_HR,
.name = "hr",
.description = "GSM 06.20 Half Rate codec",
.canon_frame_len = 14,
.canon_frame_len = HR_CANON_LEN,
#ifdef HAVE_LIBGSMHR
.codec_enc_format_type = FMT_HR_REF_ENC,
.codec_dec_format_type = FMT_HR_REF_DEC,

View File

@ -23,5 +23,5 @@ const struct codec_desc codec_pcm_desc = {
.type = CODEC_PCM,
.name = "pcm",
.description = "Raw PCM signed 16 bits samples",
.canon_frame_len = 320,
.canon_frame_len = PCM_CANON_LEN,
};

View File

@ -54,7 +54,7 @@ const struct format_desc fmt_rawpcm_s16le = {
.name = "rawpcm-s16le",
.description = "Raw PCM samples Signed 16 bits little endian",
.frame_len = 320,
.frame_len = PCM_CANON_LEN,
.conv_from_canon = rawpcm_s16le_from_canon,
.conv_to_canon = rawpcm_s16le_to_canon,
};