diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2019-02-03 01:07:26 +0000 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-06-11 20:27:21 +0000 |
commit | 57bb2b2a099fd1df57a37b3a93a07212167c59aa (patch) | |
tree | 1066544c6480123d022f77e76b508ef4e2c248e2 /codecs/G726 | |
parent | de4463066667e5b3582eb7943c6bbd42d23059bf (diff) |
Move codec plugins to /plugins
Change-Id: I56d61e2ef737e4326080d75a2302c73a4075e8a1
Reviewed-on: https://code.wireshark.org/review/33067
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'codecs/G726')
-rw-r--r-- | codecs/G726/G726decode.c | 116 | ||||
-rw-r--r-- | codecs/G726/G726decode.h | 41 |
2 files changed, 0 insertions, 157 deletions
diff --git a/codecs/G726/G726decode.c b/codecs/G726/G726decode.c deleted file mode 100644 index 4810cc6d30..0000000000 --- a/codecs/G726/G726decode.c +++ /dev/null @@ -1,116 +0,0 @@ -/* G726decode.c - * G.726 codec - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#include "config.h" - -#include <glib.h> -#ifdef HAVE_SPANDSP -#include "spandsp.h" -#include "G726decode.h" - -#include "ws_attributes.h" - -typedef struct _g726_codec_ctx { - g726_state_t *state; - int bit_rate; -} g726_codec_ctx; - -static inline void * -codec_g726_init(int bit_rate, int packing) -{ - g726_state_t *decoder = g726_init(NULL, bit_rate, G726_ENCODING_LINEAR, packing); - - if (!decoder) { - return NULL; /* out-of-memory; */ - } - - g726_codec_ctx *state = g_new(g726_codec_ctx, 1); - state->state = decoder; - state->bit_rate = bit_rate; - - return state; -} - -void *codec_g726_16_init(void) { return codec_g726_init(16000, G726_PACKING_RIGHT); } -void *codec_g726_24_init(void) { return codec_g726_init(24000, G726_PACKING_RIGHT); } -void *codec_g726_32_init(void) { return codec_g726_init(32000, G726_PACKING_RIGHT); } -void *codec_g726_40_init(void) { return codec_g726_init(40000, G726_PACKING_RIGHT); } -void *codec_aal2_g726_16_init(void) { return codec_g726_init(16000, G726_PACKING_LEFT); } -void *codec_aal2_g726_24_init(void) { return codec_g726_init(24000, G726_PACKING_LEFT); } -void *codec_aal2_g726_32_init(void) { return codec_g726_init(32000, G726_PACKING_LEFT); } -void *codec_aal2_g726_40_init(void) { return codec_g726_init(40000, G726_PACKING_LEFT); } - -void -codec_g726_release(void *ctx) -{ - g726_codec_ctx *state = (g726_codec_ctx *)ctx; - - if (!state) { - return; /* out-of-memory; */ - } - - /* Note: replaces g726_release since SpanDSP 20090211 */ - g726_free(state->state); - g_free(state); -} - -unsigned -codec_g726_get_channels(void *ctx _U_) -{ - return 1; -} - -unsigned -codec_g726_get_frequency(void *ctx _U_) -{ - return 8000; -} - -size_t -codec_g726_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output, - size_t *outputSizeBytes) -{ - g726_codec_ctx *state = (g726_codec_ctx *)ctx; - - if (!state) { - return 0; /* out-of-memory; */ - } - - if (!output || !outputSizeBytes) { - /* - * sample rate 8kHz, for bitrate 16kHz we have 16/8 = 2 bits/sample, so - * 1 input byte (8 bits) will expand to four 16-bit samples. Likewise, - * for bitrate 40kHz we have 40/8 = 5 bits/sample. Alternatively: - * bitsPerSample = bitRate / sampleRate (8kHz). - * outputBytes = (inputBits / bitsPerSample) * sizeof(sample) - */ - return inputSizeBytes * 8 / (state->bit_rate / 8000) * 2; - } - - /* g726_decode returns the number of 16-bit samples. */ - *outputSizeBytes = 2 * g726_decode(state->state, (int16_t *)output, (const uint8_t *) input, (int)inputSizeBytes); - return *outputSizeBytes; -} - -#endif - -/* - * 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: - */ - diff --git a/codecs/G726/G726decode.h b/codecs/G726/G726decode.h deleted file mode 100644 index 10e69bfe84..0000000000 --- a/codecs/G726/G726decode.h +++ /dev/null @@ -1,41 +0,0 @@ -/* G726decode.h - * Definitions for G.726 codec - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#ifndef __CODECS_G726DECODE_H__ -#define __CODECS_G726DECODE_H__ - -void *codec_g726_16_init(void); -void *codec_g726_24_init(void); -void *codec_g726_32_init(void); -void *codec_g726_40_init(void); -void *codec_aal2_g726_16_init(void); -void *codec_aal2_g726_24_init(void); -void *codec_aal2_g726_32_init(void); -void *codec_aal2_g726_40_init(void); -void codec_g726_release(void *ctx); -unsigned codec_g726_get_channels(void *ctx); -unsigned codec_g726_get_frequency(void *ctx); -size_t codec_g726_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output, - size_t *outputSizeBytes); - -#endif /* G726decode.h */ - -/* - * 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: - */ |