first pass of stereo support

This commit is contained in:
Anthony Minessale
2014-06-12 22:06:33 +05:00
parent 7f36607ea5
commit 928a989de1
20 changed files with 592 additions and 205 deletions

View File

@@ -364,6 +364,25 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_proxy_decode, /* function to decode encoded data into raw data */
switch_proxy_destroy); /* deinitalize a codec handle using this implementation */
SWITCH_ADD_CODEC(codec_interface, "PROXY PASS-THROUGH");
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
0, /* the IANA code number */
"PROXY", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
8000, /* samples transferred per second */
8000, /* actual samples transferred per second */
0, /* bits transferred per second */
20000, /* number of microseconds per frame */
160, /* number of samples per frame */
320 * 2, /* number of bytes per frame decompressed */
320 * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_proxy_init, /* function to initialize a codec handle using this implementation */
switch_proxy_encode, /* function to encode raw data into encoded data */
switch_proxy_decode, /* function to decode encoded data into raw data */
switch_proxy_destroy); /* deinitalize a codec handle using this implementation */
SWITCH_ADD_CODEC(codec_interface, "RAW Signed Linear (16 bit)");
for (counta = 1; counta <= 3; counta++) {
@@ -377,6 +396,11 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
SWITCH_CODEC_TYPE_AUDIO, 70, "L16", NULL, rate, rate, bps,
mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, spf * countb,
switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 70, "L16", NULL, rate, rate, bps,
mpf * countb, spf * countb, bpf * countb * 2, ebpf * countb, 2, spf * countb,
switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
}
rate = rate * 2;
bps = bps * 2;
@@ -408,6 +432,24 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
12000, /* samples transferred per second */
12000, /* actual samples transferred per second */
192000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 240;
bytes_per_frame += 480;
ms_per_frame += 20000;
@@ -437,6 +479,24 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
24000, /* samples transferred per second */
24000, /* actual samples transferred per second */
384000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 480;
bytes_per_frame += 960;
ms_per_frame += 20000;
@@ -468,6 +528,24 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
48000, /* samples transferred per second */
48000, /* actual samples transferred per second */
768000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame * 2, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 96;
bytes_per_frame += 192;
ms_per_frame += 2000;
@@ -498,6 +576,24 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
8000, /* samples transferred per second */
8000, /* actual samples transferred per second */
128000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 16;
bytes_per_frame += 32;
ms_per_frame += 2000;
@@ -527,6 +623,24 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
16000, /* samples transferred per second */
16000, /* actual samples transferred per second */
256000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 32;
bytes_per_frame += 64;
ms_per_frame += 2000;
@@ -557,6 +671,24 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
32000, /* samples transferred per second */
32000, /* actual samples transferred per second */
512000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 64;
bytes_per_frame += 128;
ms_per_frame += 2000;
@@ -585,6 +717,25 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
48000, /* samples transferred per second */
48000, /* actual samples transferred per second */
768000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame * 2, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 480;
bytes_per_frame += 960;
ms_per_frame += 10000;
@@ -608,6 +759,24 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
22050, /* samples transferred per second */
22050, /* actual samples transferred per second */
352800 * 2, /* bits transferred per second */
20000, /* number of microseconds per frame */
441, /* number of samples per frame */
882 * 2, /* number of bytes per frame decompressed */
882 * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
"L16", /* the IANA code name */
@@ -626,6 +795,24 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
11025, /* samples transferred per second */
11025, /* actual samples transferred per second */
176400 * 2, /* bits transferred per second */
40000, /* number of microseconds per frame */
441, /* number of samples per frame */
882 * 2, /* number of bytes per frame decompressed */
882 * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
@@ -645,7 +832,23 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
70, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
11025, /* samples transferred per second */
11025, /* actual samples transferred per second */
176400 * 2, /* bits transferred per second */
32000, /* number of microseconds per frame */
256, /* number of samples per frame */
512 * 2, /* number of bytes per frame decompressed */
512 * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
/* indicate that the module should continue to be loaded */