Remove all $Id$ from top of file
[metze/wireshark/wip.git] / codecs / G711a / G711adecode.c
1 /* G711adecode.c
2  * A-law G.711 codec
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #include "config.h"
24
25 #include <glib.h>
26
27 #include "G711adecode.h"
28 #include "G711atable.h"
29
30 void *
31 codec_g711a_init(void)
32 {
33     return NULL;
34 }
35
36 void
37 codec_g711a_release(void *ctx _U_)
38 {
39
40 }
41
42 int
43 codec_g711a_get_channels(void *ctx _U_)
44 {
45     return 1;
46 }
47
48 int
49 codec_g711a_get_frequency(void *ctx _U_)
50 {
51     return 8000;
52 }
53
54 int
55 codec_g711a_decode(void *ctx _U_, const void *input, int inputSizeBytes, void *output,
56         int *outputSizeBytes)
57 {
58     const guint8 *dataIn = (const guint8 *) input;
59     gint16       *dataOut = (gint16 *) output;
60     int           i;
61
62     if (!output || !outputSizeBytes) {
63         return inputSizeBytes * 2;
64     }
65
66     for (i = 0; i < inputSizeBytes; i++)
67     {
68         dataOut[i] = alaw_exp_table[dataIn[i]];
69     }
70
71     *outputSizeBytes = inputSizeBytes * 2;
72     return inputSizeBytes * 2;
73 }
74
75 /*
76  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
77  *
78  * Local variables:
79  * c-basic-offset: 4
80  * tab-width: 8
81  * indent-tabs-mode: nil
82  * End:
83  *
84  * vi: set shiftwidth=4 tabstop=8 expandtab:
85  * :indentSize=4:tabSize=8:noTabs=true:
86  */