From 6cd4ad721f94b5b2c4e5136bad179eb83585f150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Mayer?= Date: Sun, 1 Dec 2013 09:18:19 +0000 Subject: SBC -> sbc On Unix case is relevant, so fix it. Please try to avoid filenames starting with Upper case, it makes completion so much easier as I only need to remember the name and not the case. svn path=/trunk/; revision=53689 --- codecs/CMakeLists.txt | 2 +- codecs/Makefile.am | 4 +- codecs/Makefile.nmake | 8 +-- codecs/SBC/sbc.c | 138 -------------------------------------------------- codecs/SBC/sbc.h | 37 -------------- codecs/sbc/sbc.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++ codecs/sbc/sbc.h | 37 ++++++++++++++ 7 files changed, 182 insertions(+), 182 deletions(-) delete mode 100644 codecs/SBC/sbc.c delete mode 100644 codecs/SBC/sbc.h create mode 100644 codecs/sbc/sbc.c create mode 100644 codecs/sbc/sbc.h (limited to 'codecs') diff --git a/codecs/CMakeLists.txt b/codecs/CMakeLists.txt index 8af9897dfa..442b50f8e5 100644 --- a/codecs/CMakeLists.txt +++ b/codecs/CMakeLists.txt @@ -27,7 +27,7 @@ set(CODECS_FILES G711u/G711udecode.c G722/G722decode.c G726/G726decode.c - SBC/SBC.c + sbc/sbc.c ) add_library(codecs STATIC diff --git a/codecs/Makefile.am b/codecs/Makefile.am index 96cdf18676..73f9612864 100644 --- a/codecs/Makefile.am +++ b/codecs/Makefile.am @@ -40,7 +40,7 @@ libcodec_a_SOURCES = \ G711u/G711udecode.c G711u/G711udecode.h G711u/G711utable.h \ G722/G722decode.c G722/G722decode.h \ G726/G726decode.c G726/G726decode.h \ - SBC/SBC.c SBC/SBC.h + sbc/sbc.c sbc/sbc.h libcodec_a_DEPENDENCIES = @@ -55,4 +55,4 @@ checkapi: G711u/G711udecode.c \ G722/G722decode.c \ G726/G726decode.c \ - SBC/SBC.c + sbc/sbc.c diff --git a/codecs/Makefile.nmake b/codecs/Makefile.nmake index fd1e638d4e..b768f16235 100644 --- a/codecs/Makefile.nmake +++ b/codecs/Makefile.nmake @@ -19,7 +19,7 @@ CODEC_OBJECTS= \ G711adecode.obj \ G722decode.obj \ G726decode.obj \ - SBC.obj + sbc.obj codecs.lib : $(CODEC_OBJECTS) @@ -41,8 +41,8 @@ G722decode.obj: G722\G722decode.c G722\G722decode.h G726decode.obj: G726\G726decode.c G726\G726decode.h $(CC) $(CFLAGS) -Fd.\ -c G726\G726decode.c /Fo%|fF.obj -SBC.obj: SBC\SBC.c SBC\SBC.h - $(CC) $(CFLAGS) -Fd.\ -c SBC\SBC.c /Fo%|fF.obj +sbc.obj: sbc\sbc.c sbc\sbc.h + $(CC) $(CFLAGS) -Fd.\ -c sbc\sbc.c /Fo%|fF.obj clean: rm -f $(CODEC_OBJECTS) codecs.lib *.pdb *.sbr @@ -58,4 +58,4 @@ checkapi: G711u/G711udecode.c \ G722/G722decode.c \ G726/G726decode.c \ - SBC/SBC.c + sbc/sbc.c diff --git a/codecs/SBC/sbc.c b/codecs/SBC/sbc.c deleted file mode 100644 index b14b5bb681..0000000000 --- a/codecs/SBC/sbc.c +++ /dev/null @@ -1,138 +0,0 @@ -/* sbc.c - * Support for external Bluetooth SBC codec - * - * Copyright 2012, Michal Labedzki for Tieto Corporation - * - * $Id$ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "config.h" - -#ifdef HAVE_SBC - -#include -#include - -#include "sbc.h" - -#define SBC_BUFFER 8192 - -void * -codec_sbc_init(void) -{ - sbc_t *sbc; - - sbc = g_malloc(sizeof(sbc_t)); - sbc_init(sbc, 0L); - - return sbc; -} - -void -codec_sbc_release(void *ctx) -{ - sbc_t *sbc = (sbc_t *) ctx; - - sbc_finish(sbc); - g_free(sbc); -} - -int -codec_sbc_get_channels(void *ctx) -{ - sbc_t *sbc = (sbc_t *) ctx; - if (sbc->mode == SBC_MODE_MONO) - return 1; - - return 2; -} - -int -codec_sbc_get_frequency(void *ctx) -{ - sbc_t *sbc = (sbc_t *) ctx; - int frequency; - - switch (sbc->frequency) { - case SBC_FREQ_16000: - frequency = 16000; - break; - - case SBC_FREQ_32000: - frequency = 32000; - break; - - case SBC_FREQ_44100: - frequency = 44100; - break; - - case SBC_FREQ_48000: - frequency = 48000; - break; - default: - frequency = 0; - } - - return frequency; -} - -int -codec_sbc_decode(void *ctx, const void *input, int inputSizeBytes, void *output, - int *outputSizeBytes) -{ - size_t size_in = (size_t) inputSizeBytes; - size_t size_out = SBC_BUFFER; - size_t len; - int framelen; - int xframe_pos = 0; - guint8 *data_in = (guint8 *) input; - guint8 *data_out = (guint8 *) output; - sbc_t *sbc = (sbc_t *) ctx; - guint8 *i_data; - guint8 tmp; - - if (!output || !outputSizeBytes) { - return size_out; - } - - sbc->endian = SBC_BE; - - framelen = 0; - *outputSizeBytes = 0; - while (xframe_pos < inputSizeBytes) { - framelen = sbc_decode(sbc, data_in, size_in, data_out, size_out, &len); - xframe_pos += framelen; - data_in += framelen; - *outputSizeBytes += len; - - for (i_data = data_out; i_data < data_out + len; i_data += 2) { - tmp = i_data[0]; - i_data[0] = i_data[1]; - i_data[1] = tmp; - } - - data_out += len; - } - - return *outputSizeBytes; -} - -#endif diff --git a/codecs/SBC/sbc.h b/codecs/SBC/sbc.h deleted file mode 100644 index 5cc8ad0927..0000000000 --- a/codecs/SBC/sbc.h +++ /dev/null @@ -1,37 +0,0 @@ -/* sbc.h - * Definitions for Bluetooth SBC codec - * - * Copyright 2012, Michal Labedzki for Tieto Corporation - * - * $Id$ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __CODECS_SBC_H__ -#define __CODECS_SBC_H__ - -void *codec_sbc_init(void); -void codec_sbc_release(void *ctx); -int codec_sbc_get_channels(void *ctx); -int codec_sbc_get_frequency(void *ctx); -int codec_sbc_decode(void *ctx, const void *input, int inputSizeBytes, void *output, - int *outputSizeBytes); - -#endif /* sbc.h */ diff --git a/codecs/sbc/sbc.c b/codecs/sbc/sbc.c new file mode 100644 index 0000000000..b14b5bb681 --- /dev/null +++ b/codecs/sbc/sbc.c @@ -0,0 +1,138 @@ +/* sbc.c + * Support for external Bluetooth SBC codec + * + * Copyright 2012, Michal Labedzki for Tieto Corporation + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#ifdef HAVE_SBC + +#include +#include + +#include "sbc.h" + +#define SBC_BUFFER 8192 + +void * +codec_sbc_init(void) +{ + sbc_t *sbc; + + sbc = g_malloc(sizeof(sbc_t)); + sbc_init(sbc, 0L); + + return sbc; +} + +void +codec_sbc_release(void *ctx) +{ + sbc_t *sbc = (sbc_t *) ctx; + + sbc_finish(sbc); + g_free(sbc); +} + +int +codec_sbc_get_channels(void *ctx) +{ + sbc_t *sbc = (sbc_t *) ctx; + if (sbc->mode == SBC_MODE_MONO) + return 1; + + return 2; +} + +int +codec_sbc_get_frequency(void *ctx) +{ + sbc_t *sbc = (sbc_t *) ctx; + int frequency; + + switch (sbc->frequency) { + case SBC_FREQ_16000: + frequency = 16000; + break; + + case SBC_FREQ_32000: + frequency = 32000; + break; + + case SBC_FREQ_44100: + frequency = 44100; + break; + + case SBC_FREQ_48000: + frequency = 48000; + break; + default: + frequency = 0; + } + + return frequency; +} + +int +codec_sbc_decode(void *ctx, const void *input, int inputSizeBytes, void *output, + int *outputSizeBytes) +{ + size_t size_in = (size_t) inputSizeBytes; + size_t size_out = SBC_BUFFER; + size_t len; + int framelen; + int xframe_pos = 0; + guint8 *data_in = (guint8 *) input; + guint8 *data_out = (guint8 *) output; + sbc_t *sbc = (sbc_t *) ctx; + guint8 *i_data; + guint8 tmp; + + if (!output || !outputSizeBytes) { + return size_out; + } + + sbc->endian = SBC_BE; + + framelen = 0; + *outputSizeBytes = 0; + while (xframe_pos < inputSizeBytes) { + framelen = sbc_decode(sbc, data_in, size_in, data_out, size_out, &len); + xframe_pos += framelen; + data_in += framelen; + *outputSizeBytes += len; + + for (i_data = data_out; i_data < data_out + len; i_data += 2) { + tmp = i_data[0]; + i_data[0] = i_data[1]; + i_data[1] = tmp; + } + + data_out += len; + } + + return *outputSizeBytes; +} + +#endif diff --git a/codecs/sbc/sbc.h b/codecs/sbc/sbc.h new file mode 100644 index 0000000000..5cc8ad0927 --- /dev/null +++ b/codecs/sbc/sbc.h @@ -0,0 +1,37 @@ +/* sbc.h + * Definitions for Bluetooth SBC codec + * + * Copyright 2012, Michal Labedzki for Tieto Corporation + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __CODECS_SBC_H__ +#define __CODECS_SBC_H__ + +void *codec_sbc_init(void); +void codec_sbc_release(void *ctx); +int codec_sbc_get_channels(void *ctx); +int codec_sbc_get_frequency(void *ctx); +int codec_sbc_decode(void *ctx, const void *input, int inputSizeBytes, void *output, + int *outputSizeBytes); + +#endif /* sbc.h */ -- cgit v1.2.3