summaryrefslogtreecommitdiff
path: root/modules/g726
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2018-02-03 18:32:38 +0100
committerGitHub <noreply@github.com>2018-02-03 18:32:38 +0100
commit74db759ddbed32127ae763ab72be552cff2aebcc (patch)
tree123ceaaf86cf06a211d8dc29a97007f36cdaa236 /modules/g726
parent671f293bbdf8f234a73d8c2e6fb75a8ee3d039ce (diff)
Aucodec sample format (#352)
* aucodec: merge s16 and fmt encode/decode into one having 2 different encode functions for s16 and other formats turned out to be a bit impractical. better to have 1 function where the sample format (fmt) can be specified. * update some aucodec modules * update test * update codec2 * update g7221 module
Diffstat (limited to 'modules/g726')
-rw-r--r--modules/g726/g726.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/g726/g726.c b/modules/g726/g726.c
index fd4e462..8334b84 100644
--- a/modules/g726/g726.c
+++ b/modules/g726/g726.c
@@ -5,6 +5,7 @@
*/
#include <re.h>
+#include <rem_au.h>
#include <baresip.h>
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES 1
#include <spandsp.h>
@@ -119,11 +120,14 @@ 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)
+ size_t *len, int fmt, const void *sampv, size_t sampc)
{
if (!buf || !len || !sampv)
return EINVAL;
+ if (fmt != AUFMT_S16LE)
+ return ENOTSUP;
+
if (*len < MAX_PACKET)
return ENOMEM;
@@ -133,12 +137,15 @@ static int encode(struct auenc_state *st, uint8_t *buf,
}
-static int decode(struct audec_state *st, int16_t *sampv,
+static int decode(struct audec_state *st, int fmt, void *sampv,
size_t *sampc, const uint8_t *buf, size_t len)
{
if (!sampv || !sampc || !buf)
return EINVAL;
+ if (fmt != AUFMT_S16LE)
+ return ENOTSUP;
+
*sampc = g726_decode(&st->st, sampv, buf, (int)len);
return 0;