summaryrefslogtreecommitdiff
path: root/modules/mpa/decode.c
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/mpa/decode.c
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/mpa/decode.c')
-rw-r--r--modules/mpa/decode.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/mpa/decode.c b/modules/mpa/decode.c
index 4e2a720..b7aaf41 100644
--- a/modules/mpa/decode.c
+++ b/modules/mpa/decode.c
@@ -5,6 +5,7 @@
*/
#include <re.h>
+#include <rem.h>
#include <baresip.h>
#include <mpg123.h>
#include <speex/speex_resampler.h>
@@ -110,7 +111,8 @@ int mpa_decode_update(struct audec_state **adsp, const struct aucodec *ac,
}
-int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
+int mpa_decode_frm(struct audec_state *ads,
+ int fmt, void *sampv_void, size_t *sampc,
const uint8_t *buf, size_t len)
{
int result, channels, encoding, i;
@@ -118,6 +120,7 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
size_t n;
spx_uint32_t intermediate_len;
spx_uint32_t out_len;
+ int16_t *sampv = sampv_void;
#ifdef DEBUG
debug("MPA dec start %d %ld\n",len, *sampc);
@@ -132,6 +135,9 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
return EPROTO;
}
+ if (fmt != AUFMT_S16LE)
+ return ENOTSUP;
+
n = 0;
result = mpg123_decode(ads->dec, buf+4, len-4,
(unsigned char*)ads->intermediate_buffer,