aboutsummaryrefslogtreecommitdiffstats
path: root/codecs/G711u
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2012-09-14 15:08:17 +0200
committerEvan Huus <eapache@gmail.com>2014-02-12 01:36:02 +0000
commit10084c344c89fdadc915e47bcece84a2ac511dc5 (patch)
treecf48eed191bfd99bd2087f2d7cb3a13fa3049047 /codecs/G711u
parentab3348eeb412d45acd89ffb7d0b39189b36399ce (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/G711u')
-rw-r--r--codecs/G711u/G711udecode.c69
-rw-r--r--codecs/G711u/G711udecode.h21
-rw-r--r--codecs/G711u/G711utable.h13
3 files changed, 90 insertions, 13 deletions
diff --git a/codecs/G711u/G711udecode.c b/codecs/G711u/G711udecode.c
index c56018ad32..369e47df3f 100644
--- a/codecs/G711u/G711udecode.c
+++ b/codecs/G711u/G711udecode.c
@@ -22,21 +22,68 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "config.h"
+
#include <glib.h>
+
#include "G711udecode.h"
#include "G711utable.h"
+void *
+codec_g711u_init(void)
+{
+ return NULL;
+}
+
+void
+codec_g711u_release(void *ctx _U_)
+{
+
+}
+
+int
+codec_g711u_get_channels(void *ctx _U_)
+{
+ return 1;
+}
+
int
-decodeG711u(void *input, int inputSizeBytes, void *output, int *outputSizeBytes)
+codec_g711u_get_frequency(void *ctx _U_)
{
- guint8 *dataIn = (guint8 *)input;
- gint16 *dataOut = (gint16 *)output;
- int i;
-
- for (i=0; i<inputSizeBytes; i++)
- {
- dataOut[i] = ulaw_exp_table[dataIn[i]];
- }
- *outputSizeBytes = inputSizeBytes * 2;
- return 0;
+ return 8000;
}
+
+int
+codec_g711u_decode(void *ctx _U_, const void *input, int inputSizeBytes, void *output,
+ int *outputSizeBytes)
+{
+ 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] = 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:
+ */
+
diff --git a/codecs/G711u/G711udecode.h b/codecs/G711u/G711udecode.h
index 529d6b31fe..81cd379139 100644
--- a/codecs/G711u/G711udecode.h
+++ b/codecs/G711u/G711udecode.h
@@ -25,7 +25,24 @@
#ifndef __CODECS_G711UDECODE_H__
#define __CODECS_G711UDECODE_H__
-int
-decodeG711u(void *input, int inputSizeBytes, void *output, int *outputSizeBytes);
+void *codec_g711u_init(void);
+void codec_g711u_release(void *ctx);
+int codec_g711u_get_channels(void *ctx);
+int codec_g711u_get_frequency(void *ctx);
+int codec_g711u_decode(void *ctx, const void *input, int inputSizeBytes, void *output,
+ int *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:
+ */
diff --git a/codecs/G711u/G711utable.h b/codecs/G711u/G711utable.h
index 58daff053c..7e11118aef 100644
--- a/codecs/G711u/G711utable.h
+++ b/codecs/G711u/G711utable.h
@@ -55,3 +55,16 @@ gint16 ulaw_exp_table[256] = {
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:
+ */