summaryrefslogtreecommitdiff
path: root/modules/g722/g722.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/g722/g722.c')
-rw-r--r--modules/g722/g722.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/g722/g722.c b/modules/g722/g722.c
index 16d1f98..dd2a943 100644
--- a/modules/g722/g722.c
+++ b/modules/g722/g722.c
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <string.h>
#include <re.h>
+#include <rem_au.h>
#include <baresip.h>
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES 1
#include <spandsp.h>
@@ -125,10 +126,13 @@ static int decode_update(struct audec_state **adsp,
static int encode(struct auenc_state *st, uint8_t *buf, size_t *len,
- const int16_t *sampv, size_t sampc)
+ int fmt, const void *sampv, size_t sampc)
{
int n;
+ if (fmt != AUFMT_S16LE)
+ return ENOTSUP;
+
n = g722_encode(&st->enc, buf, sampv, (int)sampc);
if (n <= 0) {
return EPROTO;
@@ -143,7 +147,7 @@ static int encode(struct auenc_state *st, uint8_t *buf, size_t *len,
}
-static int decode(struct audec_state *st, int16_t *sampv, size_t *sampc,
+static int decode(struct audec_state *st, int fmt, void *sampv, size_t *sampc,
const uint8_t *buf, size_t len)
{
int n;
@@ -151,6 +155,9 @@ static int decode(struct audec_state *st, int16_t *sampv, size_t *sampc,
if (!st || !sampv || !buf)
return EINVAL;
+ if (fmt != AUFMT_S16LE)
+ return ENOTSUP;
+
n = g722_decode(&st->dec, sampv, buf, (int)len);
if (n < 0)
return EPROTO;