From 74db759ddbed32127ae763ab72be552cff2aebcc Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sat, 3 Feb 2018 18:32:38 +0100 Subject: 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 --- modules/mpa/decode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'modules/mpa/decode.c') 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 +#include #include #include #include @@ -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, -- cgit v1.2.3