From 62688b60c29225d557da8844d7259ce3eee962c5 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 28 May 2017 10:20:26 +0200 Subject: introduce #defines for canonical length + use them --- include/gapk/codecs.h | 5 +++++ src/codec_efr.c | 2 +- src/codec_fr.c | 2 +- src/codec_hr.c | 2 +- src/codec_pcm.c | 2 +- src/fmt_rawpcm.c | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/gapk/codecs.h b/include/gapk/codecs.h index cc6bc30..1699347 100644 --- a/include/gapk/codecs.h +++ b/include/gapk/codecs.h @@ -22,6 +22,11 @@ #include +#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 */ diff --git a/src/codec_efr.c b/src/codec_efr.c index 55bbd11..a42b2a7 100644 --- a/src/codec_efr.c +++ b/src/codec_efr.c @@ -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, diff --git a/src/codec_fr.c b/src/codec_fr.c index 1bda210..182eb73 100644 --- a/src/codec_fr.c +++ b/src/codec_fr.c @@ -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, diff --git a/src/codec_hr.c b/src/codec_hr.c index d0e09ce..4377f19 100644 --- a/src/codec_hr.c +++ b/src/codec_hr.c @@ -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, diff --git a/src/codec_pcm.c b/src/codec_pcm.c index 34517b5..9fa8c1b 100644 --- a/src/codec_pcm.c +++ b/src/codec_pcm.c @@ -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, }; diff --git a/src/fmt_rawpcm.c b/src/fmt_rawpcm.c index 185d0ca..e20fcaf 100644 --- a/src/fmt_rawpcm.c +++ b/src/fmt_rawpcm.c @@ -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, }; -- cgit v1.2.3