Move codec plugins to /plugins
Change-Id: I56d61e2ef737e4326080d75a2302c73a4075e8a1 Reviewed-on: https://code.wireshark.org/review/33067 Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
de44630666
commit
57bb2b2a09
|
@ -1433,9 +1433,26 @@ if(ENABLE_PLUGINS)
|
|||
plugins/epan/wimaxasncp
|
||||
plugins/epan/wimaxmacphy
|
||||
plugins/wiretap/usbdump
|
||||
plugins/codecs/G711
|
||||
plugins/codecs/l16_mono
|
||||
${CUSTOM_PLUGIN_SRC_DIR}
|
||||
)
|
||||
if(SPANDSP_FOUND)
|
||||
list(APPEND PLUGIN_SRC_DIRS
|
||||
plugins/codecs/G722
|
||||
plugins/codecs/G726
|
||||
)
|
||||
endif()
|
||||
if(BCG729_FOUND)
|
||||
list(APPEND PLUGIN_SRC_DIRS
|
||||
plugins/codecs/G729
|
||||
)
|
||||
endif()
|
||||
if(SBC_FOUND)
|
||||
list(APPEND PLUGIN_SRC_DIRS
|
||||
plugins/codecs/sbc
|
||||
)
|
||||
endif()
|
||||
|
||||
# Build demo plugin, only if asked explicitly
|
||||
if(ENABLE_PLUGIN_IFDEMO)
|
||||
|
|
|
@ -13,38 +13,17 @@ set(WSCODECS_PUBLIC_HEADERS
|
|||
|
||||
set(WSCODECS_FILES
|
||||
codecs.c
|
||||
G711a/G711adecode.c
|
||||
G711u/G711udecode.c
|
||||
)
|
||||
|
||||
# Enables visibility in IDEs
|
||||
file(GLOB EXTRA_CODEC_HEADERS
|
||||
codecs.h
|
||||
G711a/G711adecode.h G711a/G711atable.h
|
||||
G711u/G711udecode.h G711u/G711utable.h
|
||||
)
|
||||
|
||||
if(SBC_FOUND)
|
||||
set(WSCODECS_FILES ${WSCODECS_FILES} sbc/sbc.c)
|
||||
endif()
|
||||
|
||||
set(wscodecs_LIBS
|
||||
${M_LIBRARIES}
|
||||
${GMODULE2_LIBRARIES}
|
||||
${SBC_LIBRARIES}
|
||||
wsutil
|
||||
)
|
||||
|
||||
if(HAVE_SPANDSP)
|
||||
list(APPEND WSCODECS_FILES G722/G722decode.c G726/G726decode.c)
|
||||
list(APPEND wscodecs_LIBS ${SPANDSP_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(HAVE_BCG729)
|
||||
list(APPEND WSCODECS_FILES G729/G729decode.c)
|
||||
list(APPEND wscodecs_LIBS ${BCG729_LIBRARIES})
|
||||
endif()
|
||||
|
||||
add_library(wscodecs
|
||||
${WSCODECS_FILES}
|
||||
${CMAKE_BINARY_DIR}/image/libwscodecs.rc
|
||||
|
@ -61,13 +40,6 @@ set_target_properties(wscodecs PROPERTIES
|
|||
|
||||
target_link_libraries(wscodecs ${wscodecs_LIBS})
|
||||
|
||||
target_include_directories(wscodecs SYSTEM
|
||||
PRIVATE
|
||||
${SBC_INCLUDE_DIRS}
|
||||
${SPANDSP_INCLUDE_DIRS}
|
||||
${BCG729_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
install(TARGETS wscodecs
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
/* G711adecode.c
|
||||
* A-law G.711 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>
|
||||
|
||||
#include "G711adecode.h"
|
||||
#include "G711atable.h"
|
||||
|
||||
#include "ws_attributes.h"
|
||||
|
||||
void *
|
||||
codec_g711a_init(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
codec_g711a_release(void *ctx _U_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
unsigned
|
||||
codec_g711a_get_channels(void *ctx _U_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned
|
||||
codec_g711a_get_frequency(void *ctx _U_)
|
||||
{
|
||||
return 8000;
|
||||
}
|
||||
|
||||
size_t
|
||||
codec_g711a_decode(void *ctx _U_, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes)
|
||||
{
|
||||
const guint8 *dataIn = (const guint8 *) input;
|
||||
gint16 *dataOut = (gint16 *) output;
|
||||
size_t 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:
|
||||
*/
|
|
@ -1,34 +0,0 @@
|
|||
/* G711adecode.h
|
||||
* Definitions for A-law G.711 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_G711ADECODE_H__
|
||||
#define __CODECS_G711ADECODE_H__
|
||||
|
||||
void *codec_g711a_init(void);
|
||||
void codec_g711a_release(void *ctx);
|
||||
unsigned codec_g711a_get_channels(void *ctx);
|
||||
unsigned codec_g711a_get_frequency(void *ctx);
|
||||
size_t codec_g711a_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes);
|
||||
|
||||
#endif /* G711adecode.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:
|
||||
*/
|
|
@ -1,57 +0,0 @@
|
|||
/* G711atable.h
|
||||
* Exponent table for A-law G.711 codec
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
gint16 alaw_exp_table[256] = {
|
||||
-5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736,
|
||||
-7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784,
|
||||
-2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368,
|
||||
-3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392,
|
||||
-22016,-20992,-24064,-23040,-17920,-16896,-19968,-18944,
|
||||
-30208,-29184,-32256,-31232,-26112,-25088,-28160,-27136,
|
||||
-11008,-10496,-12032,-11520, -8960, -8448, -9984, -9472,
|
||||
-15104,-14592,-16128,-15616,-13056,-12544,-14080,-13568,
|
||||
-344, -328, -376, -360, -280, -264, -312, -296,
|
||||
-472, -456, -504, -488, -408, -392, -440, -424,
|
||||
-88, -72, -120, -104, -24, -8, -56, -40,
|
||||
-216, -200, -248, -232, -152, -136, -184, -168,
|
||||
-1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184,
|
||||
-1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696,
|
||||
-688, -656, -752, -720, -560, -528, -624, -592,
|
||||
-944, -912, -1008, -976, -816, -784, -880, -848,
|
||||
5504, 5248, 6016, 5760, 4480, 4224, 4992, 4736,
|
||||
7552, 7296, 8064, 7808, 6528, 6272, 7040, 6784,
|
||||
2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368,
|
||||
3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392,
|
||||
22016, 20992, 24064, 23040, 17920, 16896, 19968, 18944,
|
||||
30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136,
|
||||
11008, 10496, 12032, 11520, 8960, 8448, 9984, 9472,
|
||||
15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568,
|
||||
344, 328, 376, 360, 280, 264, 312, 296,
|
||||
472, 456, 504, 488, 408, 392, 440, 424,
|
||||
88, 72, 120, 104, 24, 8, 56, 40,
|
||||
216, 200, 248, 232, 152, 136, 184, 168,
|
||||
1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184,
|
||||
1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696,
|
||||
688, 656, 752, 720, 560, 528, 624, 592,
|
||||
944, 912, 1008, 976, 816, 784, 880, 848};
|
||||
|
||||
|
||||
/*
|
||||
* 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:
|
||||
*/
|
|
@ -1,77 +0,0 @@
|
|||
/* G711udecode.c
|
||||
* mu-law G.711 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>
|
||||
|
||||
#include "G711udecode.h"
|
||||
#include "G711utable.h"
|
||||
|
||||
#include "ws_attributes.h"
|
||||
|
||||
void *
|
||||
codec_g711u_init(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
codec_g711u_release(void *ctx _U_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
unsigned
|
||||
codec_g711u_get_channels(void *ctx _U_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned
|
||||
codec_g711u_get_frequency(void *ctx _U_)
|
||||
{
|
||||
return 8000;
|
||||
}
|
||||
|
||||
size_t
|
||||
codec_g711u_decode(void *ctx _U_, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes)
|
||||
{
|
||||
const guint8 *dataIn = (const guint8 *) input;
|
||||
gint16 *dataOut = (gint16 *) output;
|
||||
size_t i;
|
||||
|
||||
if (!output || !outputSizeBytes) {
|
||||
return inputSizeBytes * 2;
|
||||
}
|
||||
|
||||
for (i = 0; i < inputSizeBytes; i++)
|
||||
{
|
||||
dataOut[i] = ulaw_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:
|
||||
*/
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/* G711udecode.h
|
||||
* Definitions for mu-law G.711 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_G711UDECODE_H__
|
||||
#define __CODECS_G711UDECODE_H__
|
||||
|
||||
void *codec_g711u_init(void);
|
||||
void codec_g711u_release(void *ctx);
|
||||
unsigned codec_g711u_get_channels(void *ctx);
|
||||
unsigned codec_g711u_get_frequency(void *ctx);
|
||||
size_t codec_g711u_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes);
|
||||
|
||||
#endif /* G711udecode.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:
|
||||
*/
|
|
@ -1,56 +0,0 @@
|
|||
/* G711utable.h
|
||||
* Exponent table for mu-law G.711 codec
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
gint16 ulaw_exp_table[256] = {
|
||||
-32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956,
|
||||
-23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764,
|
||||
-15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412,
|
||||
-11900,-11388,-10876,-10364, -9852, -9340, -8828, -8316,
|
||||
-7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140,
|
||||
-5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092,
|
||||
-3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004,
|
||||
-2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980,
|
||||
-1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436,
|
||||
-1372, -1308, -1244, -1180, -1116, -1052, -988, -924,
|
||||
-876, -844, -812, -780, -748, -716, -684, -652,
|
||||
-620, -588, -556, -524, -492, -460, -428, -396,
|
||||
-372, -356, -340, -324, -308, -292, -276, -260,
|
||||
-244, -228, -212, -196, -180, -164, -148, -132,
|
||||
-120, -112, -104, -96, -88, -80, -72, -64,
|
||||
-56, -48, -40, -32, -24, -16, -8, 0,
|
||||
32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956,
|
||||
23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764,
|
||||
15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412,
|
||||
11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316,
|
||||
7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140,
|
||||
5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092,
|
||||
3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004,
|
||||
2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980,
|
||||
1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436,
|
||||
1372, 1308, 1244, 1180, 1116, 1052, 988, 924,
|
||||
876, 844, 812, 780, 748, 716, 684, 652,
|
||||
620, 588, 556, 524, 492, 460, 428, 396,
|
||||
372, 356, 340, 324, 308, 292, 276, 260,
|
||||
244, 228, 212, 196, 180, 164, 148, 132,
|
||||
120, 112, 104, 96, 88, 80, 72, 64,
|
||||
56, 48, 40, 32, 24, 16, 8, 0};
|
||||
|
||||
/*
|
||||
* 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:
|
||||
*/
|
|
@ -1,34 +0,0 @@
|
|||
/* G722decode.h
|
||||
* Definitions for G.722 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_G722DECODE_H__
|
||||
#define __CODECS_G722DECODE_H__
|
||||
|
||||
void *codec_g722_init(void);
|
||||
void codec_g722_release(void *ctx);
|
||||
unsigned codec_g722_get_channels(void *ctx);
|
||||
unsigned codec_g722_get_frequency(void *ctx);
|
||||
size_t codec_g722_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes);
|
||||
|
||||
#endif /* G722decode.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:
|
||||
*/
|
|
@ -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:
|
||||
*/
|
|
@ -1,34 +0,0 @@
|
|||
/* G729decode.h
|
||||
* Definitions for G.729 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_G729DECODE_H__
|
||||
#define __CODECS_G729DECODE_H__
|
||||
|
||||
void *codec_g729_init(void);
|
||||
void codec_g729_release(void *ctx);
|
||||
unsigned codec_g729_get_channels(void *ctx);
|
||||
unsigned codec_g729_get_frequency(void *ctx);
|
||||
size_t codec_g729_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes);
|
||||
|
||||
#endif /* G729decode.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:
|
||||
*/
|
|
@ -13,25 +13,8 @@
|
|||
#include <glib.h>
|
||||
#include "codecs.h"
|
||||
|
||||
#include "G711a/G711adecode.h"
|
||||
#include "G711u/G711udecode.h"
|
||||
|
||||
#ifdef HAVE_SBC
|
||||
#include "sbc/sbc_private.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SPANDSP
|
||||
#include "G722/G722decode.h"
|
||||
#include "G726/G726decode.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BCG729
|
||||
#include "G729/G729decode.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
|
||||
|
||||
static plugins_t *libwscodecs_plugins;
|
||||
static GSList *codecs_plugins = NULL;
|
||||
|
||||
|
@ -59,39 +42,6 @@ call_plugin_register_codec_module(gpointer data, gpointer user_data _U_)
|
|||
void
|
||||
codecs_init(void)
|
||||
{
|
||||
register_codec("g711U", codec_g711u_init, codec_g711u_release,
|
||||
codec_g711u_get_channels, codec_g711u_get_frequency, codec_g711u_decode);
|
||||
register_codec("g711A", codec_g711a_init, codec_g711a_release,
|
||||
codec_g711a_get_channels, codec_g711a_get_frequency, codec_g711a_decode);
|
||||
#ifdef HAVE_SPANDSP
|
||||
register_codec("g722", codec_g722_init, codec_g722_release,
|
||||
codec_g722_get_channels, codec_g722_get_frequency, codec_g722_decode);
|
||||
register_codec("G726-16", codec_g726_16_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("G726-24", codec_g726_24_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("G726-32", codec_g726_32_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("G726-40", codec_g726_40_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("AAL2-G726-16", codec_aal2_g726_16_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("AAL2-G726-24", codec_aal2_g726_24_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("AAL2-G726-32", codec_aal2_g726_32_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("AAL2-G726-40", codec_aal2_g726_40_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
#endif
|
||||
#ifdef HAVE_BCG729
|
||||
register_codec("g729", codec_g729_init, codec_g729_release,
|
||||
codec_g729_get_channels, codec_g729_get_frequency, codec_g729_decode);
|
||||
#endif
|
||||
#ifdef HAVE_SBC
|
||||
register_codec("SBC", codec_sbc_init, codec_sbc_release,
|
||||
codec_sbc_get_channels, codec_sbc_get_frequency, codec_sbc_decode);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
libwscodecs_plugins = plugins_init(WS_PLUGIN_CODEC);
|
||||
g_slist_foreach(codecs_plugins, call_plugin_register_codec_module, NULL);
|
||||
|
@ -204,33 +154,6 @@ size_t codec_decode(codec_handle_t codec, void *context, const void *input, size
|
|||
return (codec->decode_fn)(context, input, inputSizeBytes, output, outputSizeBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get compile-time information for libraries used by libwscodecs.
|
||||
*/
|
||||
void codec_get_compiled_version_info(GString *str)
|
||||
{
|
||||
/* SBC */
|
||||
#ifdef HAVE_SBC
|
||||
g_string_append(str, ", with SBC");
|
||||
#else
|
||||
g_string_append(str, ", without SBC");
|
||||
#endif
|
||||
|
||||
/* SpanDSP (G.722, G.726) */
|
||||
#ifdef HAVE_SPANDSP
|
||||
g_string_append(str, ", with SpanDSP");
|
||||
#else
|
||||
g_string_append(str, ", without SpanDSP");
|
||||
#endif
|
||||
|
||||
/* BCG729 (G.729) */
|
||||
#ifdef HAVE_BCG729
|
||||
g_string_append(str, ", with bcg729");
|
||||
#else
|
||||
g_string_append(str, ", without bcg729");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
/* sbc.h
|
||||
* Definitions for Bluetooth SBC codec
|
||||
*
|
||||
* Copyright 2012, Michal Labedzki for Tieto Corporation
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef __CODECS_SBC_H__
|
||||
#define __CODECS_SBC_H__
|
||||
|
||||
void *codec_sbc_init(void);
|
||||
void codec_sbc_release(void *ctx);
|
||||
unsigned codec_sbc_get_channels(void *ctx);
|
||||
unsigned codec_sbc_get_frequency(void *ctx);
|
||||
size_t codec_sbc_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes);
|
||||
|
||||
#endif /* sbc.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:
|
||||
*/
|
|
@ -0,0 +1,68 @@
|
|||
# CMakeLists.txt
|
||||
#
|
||||
# Wireshark - Network traffic analyzer
|
||||
# By Gerald Combs <gerald@wireshark.org>
|
||||
# Copyright 1998 Gerald Combs
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
|
||||
include(WiresharkPlugin)
|
||||
|
||||
# Plugin name and version info (major minor micro extra)
|
||||
set_module_info(g711 0 1 0 0)
|
||||
|
||||
set(CODEC_SRC
|
||||
G711decode.c
|
||||
)
|
||||
|
||||
set(PLUGIN_FILES
|
||||
plugin.c
|
||||
${CODEC_SRC}
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${PLUGIN_FILES}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/codecs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
register_plugin_files(plugin.c
|
||||
plugin_codec
|
||||
${CODEC_SRC}
|
||||
)
|
||||
|
||||
add_plugin_library(g711 codecs)
|
||||
|
||||
target_link_libraries(g711 wscodecs)
|
||||
|
||||
install_plugin(g711 codecs)
|
||||
|
||||
file(GLOB CODEC_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
|
||||
CHECKAPI(
|
||||
NAME
|
||||
g711
|
||||
SWITCHES
|
||||
-g abort -g termoutput -build
|
||||
SOURCES
|
||||
${CODEC_SRC}
|
||||
${CODEC_HEADERS}
|
||||
)
|
||||
|
||||
#
|
||||
# Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
#
|
||||
# Local variables:
|
||||
# c-basic-offset: 8
|
||||
# tab-width: 8
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
#
|
||||
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
||||
# :indentSize=8:tabSize=8:noTabs=false:
|
||||
#
|
|
@ -0,0 +1,198 @@
|
|||
/* G711adecode.c
|
||||
* A-law G.711 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>
|
||||
|
||||
#include "codecs/codecs.h"
|
||||
#include "ws_attributes.h"
|
||||
|
||||
static gint16 ulaw_exp_table[256] = {
|
||||
-32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956,
|
||||
-23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764,
|
||||
-15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412,
|
||||
-11900,-11388,-10876,-10364, -9852, -9340, -8828, -8316,
|
||||
-7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140,
|
||||
-5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092,
|
||||
-3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004,
|
||||
-2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980,
|
||||
-1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436,
|
||||
-1372, -1308, -1244, -1180, -1116, -1052, -988, -924,
|
||||
-876, -844, -812, -780, -748, -716, -684, -652,
|
||||
-620, -588, -556, -524, -492, -460, -428, -396,
|
||||
-372, -356, -340, -324, -308, -292, -276, -260,
|
||||
-244, -228, -212, -196, -180, -164, -148, -132,
|
||||
-120, -112, -104, -96, -88, -80, -72, -64,
|
||||
-56, -48, -40, -32, -24, -16, -8, 0,
|
||||
32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956,
|
||||
23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764,
|
||||
15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412,
|
||||
11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316,
|
||||
7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140,
|
||||
5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092,
|
||||
3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004,
|
||||
2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980,
|
||||
1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436,
|
||||
1372, 1308, 1244, 1180, 1116, 1052, 988, 924,
|
||||
876, 844, 812, 780, 748, 716, 684, 652,
|
||||
620, 588, 556, 524, 492, 460, 428, 396,
|
||||
372, 356, 340, 324, 308, 292, 276, 260,
|
||||
244, 228, 212, 196, 180, 164, 148, 132,
|
||||
120, 112, 104, 96, 88, 80, 72, 64,
|
||||
56, 48, 40, 32, 24, 16, 8, 0
|
||||
};
|
||||
|
||||
static gint16 alaw_exp_table[256] = {
|
||||
-5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736,
|
||||
-7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784,
|
||||
-2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368,
|
||||
-3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392,
|
||||
-22016,-20992,-24064,-23040,-17920,-16896,-19968,-18944,
|
||||
-30208,-29184,-32256,-31232,-26112,-25088,-28160,-27136,
|
||||
-11008,-10496,-12032,-11520, -8960, -8448, -9984, -9472,
|
||||
-15104,-14592,-16128,-15616,-13056,-12544,-14080,-13568,
|
||||
-344, -328, -376, -360, -280, -264, -312, -296,
|
||||
-472, -456, -504, -488, -408, -392, -440, -424,
|
||||
-88, -72, -120, -104, -24, -8, -56, -40,
|
||||
-216, -200, -248, -232, -152, -136, -184, -168,
|
||||
-1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184,
|
||||
-1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696,
|
||||
-688, -656, -752, -720, -560, -528, -624, -592,
|
||||
-944, -912, -1008, -976, -816, -784, -880, -848,
|
||||
5504, 5248, 6016, 5760, 4480, 4224, 4992, 4736,
|
||||
7552, 7296, 8064, 7808, 6528, 6272, 7040, 6784,
|
||||
2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368,
|
||||
3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392,
|
||||
22016, 20992, 24064, 23040, 17920, 16896, 19968, 18944,
|
||||
30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136,
|
||||
11008, 10496, 12032, 11520, 8960, 8448, 9984, 9472,
|
||||
15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568,
|
||||
344, 328, 376, 360, 280, 264, 312, 296,
|
||||
472, 456, 504, 488, 408, 392, 440, 424,
|
||||
88, 72, 120, 104, 24, 8, 56, 40,
|
||||
216, 200, 248, 232, 152, 136, 184, 168,
|
||||
1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184,
|
||||
1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696,
|
||||
688, 656, 752, 720, 560, 528, 624, 592,
|
||||
944, 912, 1008, 976, 816, 784, 880, 848
|
||||
};
|
||||
|
||||
static void *
|
||||
codec_g711u_init(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
codec_g711u_release(void *ctx _U_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static unsigned
|
||||
codec_g711u_get_channels(void *ctx _U_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
codec_g711u_get_frequency(void *ctx _U_)
|
||||
{
|
||||
return 8000;
|
||||
}
|
||||
|
||||
static size_t
|
||||
codec_g711u_decode(void *ctx _U_, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes)
|
||||
{
|
||||
const guint8 *dataIn = (const guint8 *) input;
|
||||
gint16 *dataOut = (gint16 *) output;
|
||||
size_t i;
|
||||
|
||||
if (!output || !outputSizeBytes) {
|
||||
return inputSizeBytes * 2;
|
||||
}
|
||||
|
||||
for (i = 0; i < inputSizeBytes; i++)
|
||||
{
|
||||
dataOut[i] = ulaw_exp_table[dataIn[i]];
|
||||
}
|
||||
|
||||
*outputSizeBytes = inputSizeBytes * 2;
|
||||
return inputSizeBytes * 2;
|
||||
}
|
||||
|
||||
static void *
|
||||
codec_g711a_init(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
codec_g711a_release(void *ctx _U_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static unsigned
|
||||
codec_g711a_get_channels(void *ctx _U_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
codec_g711a_get_frequency(void *ctx _U_)
|
||||
{
|
||||
return 8000;
|
||||
}
|
||||
|
||||
static size_t
|
||||
codec_g711a_decode(void *ctx _U_, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes)
|
||||
{
|
||||
const guint8 *dataIn = (const guint8 *) input;
|
||||
gint16 *dataOut = (gint16 *) output;
|
||||
size_t 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;
|
||||
}
|
||||
|
||||
void
|
||||
codec_register_g711(void)
|
||||
{
|
||||
register_codec("g711U", codec_g711u_init, codec_g711u_release,
|
||||
codec_g711u_get_channels, codec_g711u_get_frequency, codec_g711u_decode);
|
||||
register_codec("g711A", codec_g711a_init, codec_g711a_release,
|
||||
codec_g711a_get_channels, codec_g711a_get_frequency, codec_g711a_decode);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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:
|
||||
*/
|
|
@ -0,0 +1,70 @@
|
|||
# CMakeLists.txt
|
||||
#
|
||||
# Wireshark - Network traffic analyzer
|
||||
# By Gerald Combs <gerald@wireshark.org>
|
||||
# Copyright 1998 Gerald Combs
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
|
||||
include(WiresharkPlugin)
|
||||
|
||||
# Plugin name and version info (major minor micro extra)
|
||||
set_module_info(g722 0 1 0 0)
|
||||
|
||||
set(CODEC_SRC
|
||||
G722decode.c
|
||||
)
|
||||
|
||||
set(PLUGIN_FILES
|
||||
plugin.c
|
||||
${CODEC_SRC}
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${PLUGIN_FILES}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/codecs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
register_plugin_files(plugin.c
|
||||
plugin_codec
|
||||
${CODEC_SRC}
|
||||
)
|
||||
|
||||
add_plugin_library(g722 codecs)
|
||||
|
||||
target_link_libraries(g722 wscodecs ${SPANDSP_LIBRARIES})
|
||||
|
||||
target_include_directories(g722 SYSTEM PRIVATE ${SPANDSP_INCLUDE_DIRS})
|
||||
|
||||
install_plugin(g722 codecs)
|
||||
|
||||
file(GLOB CODEC_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
|
||||
CHECKAPI(
|
||||
NAME
|
||||
g722
|
||||
SWITCHES
|
||||
-g abort -g termoutput -build
|
||||
SOURCES
|
||||
${CODEC_SRC}
|
||||
${CODEC_HEADERS}
|
||||
)
|
||||
|
||||
#
|
||||
# Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
#
|
||||
# Local variables:
|
||||
# c-basic-offset: 8
|
||||
# tab-width: 8
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
#
|
||||
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
||||
# :indentSize=8:tabSize=8:noTabs=false:
|
||||
#
|
|
@ -12,13 +12,11 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef HAVE_SPANDSP
|
||||
#include "spandsp.h"
|
||||
#include "G722decode.h"
|
||||
|
||||
#include "codecs/codecs.h"
|
||||
#include "ws_attributes.h"
|
||||
|
||||
void *
|
||||
static void *
|
||||
codec_g722_init(void)
|
||||
{
|
||||
g722_decode_state_t *state;
|
||||
|
@ -30,7 +28,7 @@ codec_g722_init(void)
|
|||
return state;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
codec_g722_release(void *ctx)
|
||||
{
|
||||
g722_decode_state_t *state = (g722_decode_state_t *)ctx;
|
||||
|
@ -43,14 +41,14 @@ codec_g722_release(void *ctx)
|
|||
g722_decode_free(state);
|
||||
}
|
||||
|
||||
unsigned
|
||||
static unsigned
|
||||
codec_g722_get_channels(void *ctx _U_)
|
||||
{
|
||||
/* G.722 has only one channel. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned
|
||||
static unsigned
|
||||
codec_g722_get_frequency(void *ctx _U_)
|
||||
{
|
||||
/* Note: RTP Clock rate is 8kHz due to a historic error, but actual sampling
|
||||
|
@ -58,7 +56,7 @@ codec_g722_get_frequency(void *ctx _U_)
|
|||
return 16000;
|
||||
}
|
||||
|
||||
size_t
|
||||
static size_t
|
||||
codec_g722_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes)
|
||||
{
|
||||
|
@ -77,7 +75,12 @@ codec_g722_decode(void *ctx, const void *input, size_t inputSizeBytes, void *out
|
|||
return *outputSizeBytes;
|
||||
}
|
||||
|
||||
#endif
|
||||
void
|
||||
codec_register_g722(void)
|
||||
{
|
||||
register_codec("g722", codec_g722_init, codec_g722_release,
|
||||
codec_g722_get_channels, codec_g722_get_frequency, codec_g722_decode);
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
|
@ -91,4 +94,3 @@ codec_g722_decode(void *ctx, const void *input, size_t inputSizeBytes, void *out
|
|||
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
||||
* :indentSize=4:tabSize=8:noTabs=true:
|
||||
*/
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
# CMakeLists.txt
|
||||
#
|
||||
# Wireshark - Network traffic analyzer
|
||||
# By Gerald Combs <gerald@wireshark.org>
|
||||
# Copyright 1998 Gerald Combs
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
|
||||
include(WiresharkPlugin)
|
||||
|
||||
# Plugin name and version info (major minor micro extra)
|
||||
set_module_info(g726 0 1 0 0)
|
||||
|
||||
set(CODEC_SRC
|
||||
G726decode.c
|
||||
)
|
||||
|
||||
set(PLUGIN_FILES
|
||||
plugin.c
|
||||
${CODEC_SRC}
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${PLUGIN_FILES}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/codecs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
register_plugin_files(plugin.c
|
||||
plugin_codec
|
||||
${CODEC_SRC}
|
||||
)
|
||||
|
||||
add_plugin_library(g726 codecs)
|
||||
|
||||
target_link_libraries(g726 wscodecs ${SPANDSP_LIBRARIES})
|
||||
|
||||
target_include_directories(g726 SYSTEM PRIVATE ${SPANDSP_INCLUDE_DIRS})
|
||||
|
||||
install_plugin(g726 codecs)
|
||||
|
||||
file(GLOB CODEC_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
|
||||
CHECKAPI(
|
||||
NAME
|
||||
g726
|
||||
SWITCHES
|
||||
-g abort -g termoutput -build
|
||||
SOURCES
|
||||
${CODEC_SRC}
|
||||
${CODEC_HEADERS}
|
||||
)
|
||||
|
||||
#
|
||||
# Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
#
|
||||
# Local variables:
|
||||
# c-basic-offset: 8
|
||||
# tab-width: 8
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
#
|
||||
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
||||
# :indentSize=8:tabSize=8:noTabs=false:
|
||||
#
|
|
@ -11,10 +11,9 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#ifdef HAVE_SPANDSP
|
||||
#include "spandsp.h"
|
||||
#include "G726decode.h"
|
||||
|
||||
#include "spandsp.h"
|
||||
#include "codecs/codecs.h"
|
||||
#include "ws_attributes.h"
|
||||
|
||||
typedef struct _g726_codec_ctx {
|
||||
|
@ -22,7 +21,7 @@ typedef struct _g726_codec_ctx {
|
|||
int bit_rate;
|
||||
} g726_codec_ctx;
|
||||
|
||||
static inline void *
|
||||
static void *
|
||||
codec_g726_init(int bit_rate, int packing)
|
||||
{
|
||||
g726_state_t *decoder = g726_init(NULL, bit_rate, G726_ENCODING_LINEAR, packing);
|
||||
|
@ -38,16 +37,16 @@ codec_g726_init(int bit_rate, int packing)
|
|||
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); }
|
||||
static void *codec_g726_16_init(void) { return codec_g726_init(16000, G726_PACKING_RIGHT); }
|
||||
static void *codec_g726_24_init(void) { return codec_g726_init(24000, G726_PACKING_RIGHT); }
|
||||
static void *codec_g726_32_init(void) { return codec_g726_init(32000, G726_PACKING_RIGHT); }
|
||||
static void *codec_g726_40_init(void) { return codec_g726_init(40000, G726_PACKING_RIGHT); }
|
||||
static void *codec_aal2_g726_16_init(void) { return codec_g726_init(16000, G726_PACKING_LEFT); }
|
||||
static void *codec_aal2_g726_24_init(void) { return codec_g726_init(24000, G726_PACKING_LEFT); }
|
||||
static void *codec_aal2_g726_32_init(void) { return codec_g726_init(32000, G726_PACKING_LEFT); }
|
||||
static void *codec_aal2_g726_40_init(void) { return codec_g726_init(40000, G726_PACKING_LEFT); }
|
||||
|
||||
void
|
||||
static void
|
||||
codec_g726_release(void *ctx)
|
||||
{
|
||||
g726_codec_ctx *state = (g726_codec_ctx *)ctx;
|
||||
|
@ -61,19 +60,19 @@ codec_g726_release(void *ctx)
|
|||
g_free(state);
|
||||
}
|
||||
|
||||
unsigned
|
||||
static unsigned
|
||||
codec_g726_get_channels(void *ctx _U_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned
|
||||
static unsigned
|
||||
codec_g726_get_frequency(void *ctx _U_)
|
||||
{
|
||||
return 8000;
|
||||
}
|
||||
|
||||
size_t
|
||||
static size_t
|
||||
codec_g726_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes)
|
||||
{
|
||||
|
@ -99,7 +98,26 @@ codec_g726_decode(void *ctx, const void *input, size_t inputSizeBytes, void *out
|
|||
return *outputSizeBytes;
|
||||
}
|
||||
|
||||
#endif
|
||||
void
|
||||
codec_register_g726(void)
|
||||
{
|
||||
register_codec("G726-16", codec_g726_16_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("G726-24", codec_g726_24_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("G726-32", codec_g726_32_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("G726-40", codec_g726_40_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("AAL2-G726-16", codec_aal2_g726_16_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("AAL2-G726-24", codec_aal2_g726_24_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("AAL2-G726-32", codec_aal2_g726_32_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
register_codec("AAL2-G726-40", codec_aal2_g726_40_init, codec_g726_release,
|
||||
codec_g726_get_channels, codec_g726_get_frequency, codec_g726_decode);
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
|
@ -113,4 +131,3 @@ codec_g726_decode(void *ctx, const void *input, size_t inputSizeBytes, void *out
|
|||
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
||||
* :indentSize=4:tabSize=8:noTabs=true:
|
||||
*/
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
# CMakeLists.txt
|
||||
#
|
||||
# Wireshark - Network traffic analyzer
|
||||
# By Gerald Combs <gerald@wireshark.org>
|
||||
# Copyright 1998 Gerald Combs
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
|
||||
include(WiresharkPlugin)
|
||||
|
||||
# Plugin name and version info (major minor micro extra)
|
||||
set_module_info(g729 0 1 0 0)
|
||||
|
||||
set(CODEC_SRC
|
||||
G729decode.c
|
||||
)
|
||||
|
||||
set(PLUGIN_FILES
|
||||
plugin.c
|
||||
${CODEC_SRC}
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${PLUGIN_FILES}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/codecs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
register_plugin_files(plugin.c
|
||||
plugin_codec
|
||||
${CODEC_SRC}
|
||||
)
|
||||
|
||||
add_plugin_library(g729 codecs)
|
||||
|
||||
target_link_libraries(g729 wscodecs ${BCG729_LIBRARIES})
|
||||
|
||||
target_include_directories(g729 SYSTEM PRIVATE ${BCG729_INCLUDE_DIRS})
|
||||
|
||||
install_plugin(g729 codecs)
|
||||
|
||||
file(GLOB CODEC_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
|
||||
CHECKAPI(
|
||||
NAME
|
||||
g729
|
||||
SWITCHES
|
||||
-g abort -g termoutput -build
|
||||
SOURCES
|
||||
${CODEC_SRC}
|
||||
${CODEC_HEADERS}
|
||||
)
|
||||
|
||||
#
|
||||
# Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
#
|
||||
# Local variables:
|
||||
# c-basic-offset: 8
|
||||
# tab-width: 8
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
#
|
||||
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
||||
# :indentSize=8:tabSize=8:noTabs=false:
|
||||
#
|
|
@ -11,37 +11,36 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#ifdef HAVE_BCG729
|
||||
#include "bcg729/decoder.h"
|
||||
#include "G729decode.h"
|
||||
|
||||
#include "bcg729/decoder.h"
|
||||
#include "codecs/codecs.h"
|
||||
#include "ws_attributes.h"
|
||||
|
||||
void *
|
||||
static void *
|
||||
codec_g729_init(void)
|
||||
{
|
||||
return initBcg729DecoderChannel();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
codec_g729_release(void *ctx)
|
||||
{
|
||||
closeBcg729DecoderChannel((bcg729DecoderChannelContextStruct *)ctx);
|
||||
}
|
||||
|
||||
unsigned
|
||||
static unsigned
|
||||
codec_g729_get_channels(void *ctx _U_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned
|
||||
static unsigned
|
||||
codec_g729_get_frequency(void *ctx _U_)
|
||||
{
|
||||
return 8000;
|
||||
}
|
||||
|
||||
size_t
|
||||
static size_t
|
||||
codec_g729_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes)
|
||||
{
|
||||
|
@ -77,7 +76,12 @@ codec_g729_decode(void *ctx, const void *input, size_t inputSizeBytes, void *out
|
|||
return *outputSizeBytes;
|
||||
}
|
||||
|
||||
#endif
|
||||
void
|
||||
codec_register_g729(void)
|
||||
{
|
||||
register_codec("g729", codec_g729_init, codec_g729_release,
|
||||
codec_g729_get_channels, codec_g729_get_frequency, codec_g729_decode);
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
@ -0,0 +1,70 @@
|
|||
# CMakeLists.txt
|
||||
#
|
||||
# Wireshark - Network traffic analyzer
|
||||
# By Gerald Combs <gerald@wireshark.org>
|
||||
# Copyright 1998 Gerald Combs
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
|
||||
include(WiresharkPlugin)
|
||||
|
||||
# Plugin name and version info (major minor micro extra)
|
||||
set_module_info(sbc 0 1 0 0)
|
||||
|
||||
set(CODEC_SRC
|
||||
sbc.c
|
||||
)
|
||||
|
||||
set(PLUGIN_FILES
|
||||
plugin.c
|
||||
${CODEC_SRC}
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${PLUGIN_FILES}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/codecs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
register_plugin_files(plugin.c
|
||||
plugin_codec
|
||||
${CODEC_SRC}
|
||||
)
|
||||
|
||||
add_plugin_library(sbc codecs)
|
||||
|
||||
target_link_libraries(sbc wscodecs ${SBC_LIBRARIES})
|
||||
|
||||
target_include_directories(sbc SYSTEM PRIVATE ${SBC_INCLUDE_DIRS})
|
||||
|
||||
install_plugin(sbc codecs)
|
||||
|
||||
file(GLOB CODEC_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
|
||||
CHECKAPI(
|
||||
NAME
|
||||
sbc
|
||||
SWITCHES
|
||||
-g abort -g termoutput -build
|
||||
SOURCES
|
||||
${CODEC_SRC}
|
||||
${CODEC_HEADERS}
|
||||
)
|
||||
|
||||
#
|
||||
# Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
#
|
||||
# Local variables:
|
||||
# c-basic-offset: 8
|
||||
# tab-width: 8
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
#
|
||||
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
||||
# :indentSize=8:tabSize=8:noTabs=false:
|
||||
#
|
|
@ -12,16 +12,14 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_SBC
|
||||
|
||||
#include <glib.h>
|
||||
#include <sbc/sbc.h>
|
||||
|
||||
#include "sbc_private.h"
|
||||
#include "codecs/codecs.h"
|
||||
|
||||
#define SBC_BUFFER 8192
|
||||
|
||||
void *
|
||||
static void *
|
||||
codec_sbc_init(void)
|
||||
{
|
||||
sbc_t *sbc;
|
||||
|
@ -32,7 +30,7 @@ codec_sbc_init(void)
|
|||
return sbc;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
codec_sbc_release(void *ctx)
|
||||
{
|
||||
sbc_t *sbc = (sbc_t *) ctx;
|
||||
|
@ -41,7 +39,7 @@ codec_sbc_release(void *ctx)
|
|||
g_free(sbc);
|
||||
}
|
||||
|
||||
unsigned
|
||||
static unsigned
|
||||
codec_sbc_get_channels(void *ctx)
|
||||
{
|
||||
sbc_t *sbc = (sbc_t *) ctx;
|
||||
|
@ -51,7 +49,7 @@ codec_sbc_get_channels(void *ctx)
|
|||
return 2;
|
||||
}
|
||||
|
||||
unsigned
|
||||
static unsigned
|
||||
codec_sbc_get_frequency(void *ctx)
|
||||
{
|
||||
sbc_t *sbc = (sbc_t *) ctx;
|
||||
|
@ -80,7 +78,7 @@ codec_sbc_get_frequency(void *ctx)
|
|||
return frequency;
|
||||
}
|
||||
|
||||
size_t
|
||||
static size_t
|
||||
codec_sbc_decode(void *ctx, const void *input, size_t inputSizeBytes, void *output,
|
||||
size_t *outputSizeBytes)
|
||||
{
|
||||
|
@ -120,7 +118,12 @@ codec_sbc_decode(void *ctx, const void *input, size_t inputSizeBytes, void *outp
|
|||
return *outputSizeBytes;
|
||||
}
|
||||
|
||||
#endif
|
||||
void
|
||||
codec_register_sbc(void)
|
||||
{
|
||||
register_codec("SBC", codec_sbc_init, codec_sbc_release,
|
||||
codec_sbc_get_channels, codec_sbc_get_frequency, codec_sbc_decode);
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
@ -241,7 +241,26 @@ get_gui_compiled_info(GString *str)
|
|||
g_string_append(str, ", with SpeexDSP (using bundled resampler)");
|
||||
#endif
|
||||
|
||||
codec_get_compiled_version_info(str);
|
||||
/* SBC */
|
||||
#ifdef HAVE_SBC
|
||||
g_string_append(str, ", with SBC");
|
||||
#else
|
||||
g_string_append(str, ", without SBC");
|
||||
#endif
|
||||
|
||||
/* SpanDSP (G.722, G.726) */
|
||||
#ifdef HAVE_SPANDSP
|
||||
g_string_append(str, ", with SpanDSP");
|
||||
#else
|
||||
g_string_append(str, ", without SpanDSP");
|
||||
#endif
|
||||
|
||||
/* BCG729 (G.729) */
|
||||
#ifdef HAVE_BCG729
|
||||
g_string_append(str, ", with bcg729");
|
||||
#else
|
||||
g_string_append(str, ", without bcg729");
|
||||
#endif
|
||||
}
|
||||
|
||||
// xxx copied from ../gtk/main.c
|
||||
|
|
Loading…
Reference in New Issue