aboutsummaryrefslogtreecommitdiffstats
path: root/codecs/G726
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-30 15:42:14 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-30 15:42:14 +0000
commitd1e4422a4abc3667351286b13a4224fda65ba26b (patch)
tree7e930d553c4e4179e4936dbfb37fbec76991f456 /codecs/G726
parent021efe411cab62e2757c04d6a84e459ede7ef35d (diff)
Add G.722, G.726 and SBC codecs. G.722 and G.726 are from bug 5619 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5619) and SBC is from bug 7893 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7893).
Codecs are added, but (intentionally) not hooked to the RTP player as a "more generic architecture" is desired. There are some discussions in bug 7893 on how to do this. One thing to add would be how to handle codecs that may not be supported on all platforms. Should the codec not be "registered" at all (with a #define over the whole module) or should it's register functions be stubbed (with a #define in each function that requires a non-supported library) svn path=/trunk/; revision=53676
Diffstat (limited to 'codecs/G726')
-rw-r--r--codecs/G726/G726decode.c59
-rw-r--r--codecs/G726/G726decode.h34
2 files changed, 93 insertions, 0 deletions
diff --git a/codecs/G726/G726decode.c b/codecs/G726/G726decode.c
new file mode 100644
index 0000000000..d97e386272
--- /dev/null
+++ b/codecs/G726/G726decode.c
@@ -0,0 +1,59 @@
+/* G726decode.c
+ * G.726 codec
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+#ifdef HAVE_SPANDSP
+#include "telephony.h"
+#include "bitstream.h"
+#include "g726.h"
+#endif
+#include "G726decode.h"
+
+#ifdef HAVE_SPANDSP
+/* this isn't reentrant. Making it might involve quite a few changes to be able to pass a g726 state
+ * variable to the various functions involved in G.726 decoding.
+ */
+static g726_state_t state;
+#endif
+
+/* Currently, only G.726-32, linear encoding, left packed is supported */
+void initG726_32(void)
+{
+#ifdef HAVE_SPANDSP
+ memset (&state, 0, sizeof (state));
+ g726_init(&state, 32000, 0, 1);
+#endif
+}
+
+/* Packing should be user defined (via the decode dialog) since due to historical reasons two diverging
+ * de facto standards are in use today (see RFC3551).
+ */
+int
+decodeG726_32(void *input, int inputSizeBytes, void *output, int *outputSizeBytes)
+{
+#ifdef HAVE_SPANDSP
+ *outputSizeBytes = 2 * g726_decode(&state, output, (void*) input, inputSizeBytes);
+#endif
+ return 0;
+}
diff --git a/codecs/G726/G726decode.h b/codecs/G726/G726decode.h
new file mode 100644
index 0000000000..4c139d008b
--- /dev/null
+++ b/codecs/G726/G726decode.h
@@ -0,0 +1,34 @@
+/* G726decode.h
+ * Definitions for A-law G.722 codec
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __CODECS_G726DECODE_H__
+#define __CODECS_G726DECODE_H__
+
+void
+initG726_32(void);
+
+int
+decodeG726_32(void *input, int inputSizeBytes, void *output, int *outputSizeBytes);
+
+#endif /* G726decode.h */