aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-05-28 10:20:26 +0200
committerHarald Welte <laforge@gnumonks.org>2017-05-28 10:20:26 +0200
commit62688b60c29225d557da8844d7259ce3eee962c5 (patch)
treed090e61b91290ca842fa14c08b134e95d9a3542e
parent2ae47af0be4152447e3fd5317d9dffa8c1cdf211 (diff)
introduce #defines for canonical length + use them
-rw-r--r--include/gapk/codecs.h5
-rw-r--r--src/codec_efr.c2
-rw-r--r--src/codec_fr.c2
-rw-r--r--src/codec_hr.c2
-rw-r--r--src/codec_pcm.c2
-rw-r--r--src/fmt_rawpcm.c2
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 <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 */
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,
};