forked from traud/asterisk-alaw16
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alaw16_transcoding.patch
53 lines (50 loc) · 1.4 KB
/
alaw16_transcoding.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--- codecs/codec_alaw.c (Asterisk 13.13.1)
+++ codecs/codec_alaw.c (working copy)
@@ -96,2 +96,40 @@ static struct ast_translator alawtolin =
+static struct ast_translator alawtolin16 = {
+ .name = "alawtolin16",
+ .src_codec = {
+ .name = "alaw16",
+ .type = AST_MEDIA_TYPE_AUDIO,
+ .sample_rate = 16000,
+ },
+ .dst_codec = {
+ .name = "slin",
+ .type = AST_MEDIA_TYPE_AUDIO,
+ .sample_rate = 16000,
+ },
+ .format = "slin16",
+ .framein = alawtolin_framein,
+ //.sample = alaw16_sample,
+ .buffer_samples = BUFFER_SAMPLES,
+ .buf_size = BUFFER_SAMPLES * 2,
+};
+
+static struct ast_translator lin16toalaw = {
+ .name = "lin16toalaw",
+ .src_codec = {
+ .name = "slin",
+ .type = AST_MEDIA_TYPE_AUDIO,
+ .sample_rate = 16000,
+ },
+ .dst_codec = {
+ .name = "alaw16",
+ .type = AST_MEDIA_TYPE_AUDIO,
+ .sample_rate = 16000,
+ },
+ .format = "alaw16",
+ .framein = lintoalaw_framein,
+ .sample = slin16_sample,
+ .buffer_samples = BUFFER_SAMPLES,
+ .buf_size = BUFFER_SAMPLES,
+};
+
static struct ast_translator lintoalaw = {
@@ -121,2 +159,4 @@ static int unload_module(void)
res |= ast_unregister_translator(&alawtolin);
+ res |= ast_unregister_translator(&lin16toalaw);
+ res |= ast_unregister_translator(&alawtolin16);
@@ -131,2 +171,4 @@ static int load_module(void)
res |= ast_register_translator(&lintoalaw);
+ res |= ast_register_translator(&alawtolin16);
+ res |= ast_register_translator(&lin16toalaw);