diff options
author | Michal Labedzki <michal.labedzki@tieto.com> | 2012-09-14 15:08:17 +0200 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-02-12 01:36:02 +0000 |
commit | 10084c344c89fdadc915e47bcece84a2ac511dc5 (patch) | |
tree | cf48eed191bfd99bd2087f2d7cb3a13fa3049047 /codecs/G711a/G711adecode.c | |
parent | ab3348eeb412d45acd89ffb7d0b39189b36399ce (diff) |
RTP: Add support for SBC codec in RTP Player
Add optional dependancy to libsbc to play Bluetooth SBC in
A2DP payload. Also simplify RTP Player and extent codec interface.
Change-Id: I52e1fce9c82e2885736354fe73c6c37168a4fda3
Reviewed-on: https://code.wireshark.org/review/19
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'codecs/G711a/G711adecode.c')
-rw-r--r-- | codecs/G711a/G711adecode.c | 68 |
1 files changed, 57 insertions, 11 deletions
diff --git a/codecs/G711a/G711adecode.c b/codecs/G711a/G711adecode.c index 10fe3e2cc1..e5518932cc 100644 --- a/codecs/G711a/G711adecode.c +++ b/codecs/G711a/G711adecode.c @@ -22,21 +22,67 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "config.h" + #include <glib.h> + #include "G711adecode.h" #include "G711atable.h" +void * +codec_g711a_init(void) +{ + return NULL; +} + +void +codec_g711a_release(void *ctx _U_) +{ + +} + +int +codec_g711a_get_channels(void *ctx _U_) +{ + return 1; +} + +int +codec_g711a_get_frequency(void *ctx _U_) +{ + return 8000; +} + int -decodeG711a(void *input, int inputSizeBytes, void *output, int *outputSizeBytes) +codec_g711a_decode(void *ctx _U_, const void *input, int inputSizeBytes, void *output, + int *outputSizeBytes) { - guint8 *dataIn = (guint8 *)input; - gint16 *dataOut = (gint16 *)output; - int i; - - for (i=0; i<inputSizeBytes; i++) - { - dataOut[i] = alaw_exp_table[dataIn[i]]; - } - *outputSizeBytes = inputSizeBytes * 2; - return 0; + const guint8 *dataIn = (const guint8 *) input; + gint16 *dataOut = (gint16 *) output; + int i; + + if (!output || !outputSizeBytes) { + return inputSizeBytes * 2; + } + + for (i = 0; i < inputSizeBytes; i++) + { + dataOut[i] = alaw_exp_table[dataIn[i]]; + } + + *outputSizeBytes = inputSizeBytes * 2; + return inputSizeBytes * 2; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ |