mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-15 08:29:45 +00:00
move L16 and g711 into the core
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7670 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
bdeecad176
commit
983a0ba3df
@ -78,6 +78,8 @@ src/switch_config.c\
|
|||||||
src/switch_time.c\
|
src/switch_time.c\
|
||||||
libs/stfu/stfu.c\
|
libs/stfu/stfu.c\
|
||||||
src/switch_cpp.cpp\
|
src/switch_cpp.cpp\
|
||||||
|
src/g711.c\
|
||||||
|
src/switch_pcm.c\
|
||||||
libs/libteletone/src/libteletone_detect.c\
|
libs/libteletone/src/libteletone_detect.c\
|
||||||
libs/libteletone/src/libteletone_generate.c
|
libs/libteletone/src/libteletone_generate.c
|
||||||
|
|
||||||
|
@ -15,14 +15,12 @@ applications/mod_fsv
|
|||||||
#applications/mod_rss
|
#applications/mod_rss
|
||||||
#asr_tts/mod_cepstral
|
#asr_tts/mod_cepstral
|
||||||
#asr_tts/mod_openmrcp
|
#asr_tts/mod_openmrcp
|
||||||
#codecs/mod_g711
|
|
||||||
codecs/mod_g723_1
|
codecs/mod_g723_1
|
||||||
codecs/mod_amr
|
codecs/mod_amr
|
||||||
codecs/mod_g729
|
codecs/mod_g729
|
||||||
codecs/mod_h26x
|
codecs/mod_h26x
|
||||||
codecs/mod_voipcodecs
|
codecs/mod_voipcodecs
|
||||||
codecs/mod_ilbc
|
codecs/mod_ilbc
|
||||||
codecs/mod_l16
|
|
||||||
codecs/mod_speex
|
codecs/mod_speex
|
||||||
#dialplans/mod_dialplan_directory
|
#dialplans/mod_dialplan_directory
|
||||||
dialplans/mod_dialplan_xml
|
dialplans/mod_dialplan_xml
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "g7xx/g711.h"
|
#include "g711.h"
|
||||||
|
|
||||||
/* Copied from the CCITT G.711 specification */
|
/* Copied from the CCITT G.711 specification */
|
||||||
static const uint8_t ulaw_to_alaw_table[256] =
|
static const uint8_t ulaw_to_alaw_table[256] =
|
@ -321,7 +321,7 @@ static inline void switch_core_codec_add_implementation(switch_memory_pool_t *po
|
|||||||
/*! the IANA code number */
|
/*! the IANA code number */
|
||||||
switch_payload_t ianacode,
|
switch_payload_t ianacode,
|
||||||
/*! the IANA code name */
|
/*! the IANA code name */
|
||||||
char *iananame,
|
const char *iananame,
|
||||||
/*! default fmtp to send (can be overridden by the init function) */
|
/*! default fmtp to send (can be overridden by the init function) */
|
||||||
char *fmtp,
|
char *fmtp,
|
||||||
/*! samples transferred per second */
|
/*! samples transferred per second */
|
||||||
@ -357,7 +357,7 @@ static inline void switch_core_codec_add_implementation(switch_memory_pool_t *po
|
|||||||
switch_codec_implementation_t *impl = (switch_codec_implementation_t *) switch_core_alloc(pool, sizeof(*impl));
|
switch_codec_implementation_t *impl = (switch_codec_implementation_t *) switch_core_alloc(pool, sizeof(*impl));
|
||||||
impl->codec_type = codec_type;
|
impl->codec_type = codec_type;
|
||||||
impl->ianacode = ianacode;
|
impl->ianacode = ianacode;
|
||||||
impl->iananame = iananame;
|
impl->iananame = switch_core_strdup(pool, iananame);
|
||||||
impl->fmtp = fmtp;
|
impl->fmtp = fmtp;
|
||||||
impl->samples_per_second = samples_per_second;
|
impl->samples_per_second = samples_per_second;
|
||||||
impl->actual_samples_per_second = actual_samples_per_second;
|
impl->actual_samples_per_second = actual_samples_per_second;
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
BASE=../../../..
|
|
||||||
LOCAL_CFLAGS=-I.
|
|
||||||
include $(BASE)/build/modmake.rules
|
|
||||||
|
|
||||||
|
|
@ -1,158 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="9.00"
|
|
||||||
Name="mod_g711"
|
|
||||||
ProjectGUID="{B1FE4613-3F4B-4DAF-9714-2472BF8F56AE}"
|
|
||||||
RootNamespace="mod_g711"
|
|
||||||
Keyword="Win32Proj"
|
|
||||||
TargetFrameworkVersion="131072"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
ConfigurationType="2"
|
|
||||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
ConfigurationType="2"
|
|
||||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath=".\g711.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\mod_g711.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
@ -1,216 +0,0 @@
|
|||||||
/*
|
|
||||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
||||||
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
|
||||||
*
|
|
||||||
* Version: MPL 1.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
|
||||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Anthony Minessale II <anthmct@yahoo.com>
|
|
||||||
* Portions created by the Initial Developer are Copyright (C)
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Anthony Minessale II <anthmct@yahoo.com>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* mod_g711.c -- G.711 Ulaw/Alaw Codec Module
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <switch.h>
|
|
||||||
#include <g711.h>
|
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_g711_load);
|
|
||||||
SWITCH_MODULE_DEFINITION(mod_g711, mod_g711_load, NULL, NULL);
|
|
||||||
|
|
||||||
static switch_status_t switch_g711u_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
|
||||||
{
|
|
||||||
int encoding, decoding;
|
|
||||||
|
|
||||||
encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
|
|
||||||
decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
|
|
||||||
|
|
||||||
if (!(encoding || decoding)) {
|
|
||||||
return SWITCH_STATUS_FALSE;
|
|
||||||
} else {
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static switch_status_t switch_g711u_encode(switch_codec_t *codec,
|
|
||||||
switch_codec_t *other_codec,
|
|
||||||
void *decoded_data,
|
|
||||||
uint32_t decoded_data_len,
|
|
||||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
|
|
||||||
unsigned int *flag)
|
|
||||||
{
|
|
||||||
short *dbuf;
|
|
||||||
unsigned char *ebuf;
|
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
dbuf = decoded_data;
|
|
||||||
ebuf = encoded_data;
|
|
||||||
|
|
||||||
for (i = 0; i < decoded_data_len / sizeof(short); i++) {
|
|
||||||
ebuf[i] = linear_to_ulaw(dbuf[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
*encoded_data_len = i;
|
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static switch_status_t switch_g711u_decode(switch_codec_t *codec,
|
|
||||||
switch_codec_t *other_codec,
|
|
||||||
void *encoded_data,
|
|
||||||
uint32_t encoded_data_len,
|
|
||||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
|
|
||||||
unsigned int *flag)
|
|
||||||
{
|
|
||||||
short *dbuf;
|
|
||||||
unsigned char *ebuf;
|
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
dbuf = decoded_data;
|
|
||||||
ebuf = encoded_data;
|
|
||||||
|
|
||||||
if (*flag & SWITCH_CODEC_FLAG_SILENCE) {
|
|
||||||
memset(dbuf, 0, codec->implementation->bytes_per_frame);
|
|
||||||
*decoded_data_len = codec->implementation->bytes_per_frame;
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < encoded_data_len; i++) {
|
|
||||||
dbuf[i] = ulaw_to_linear(ebuf[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
*decoded_data_len = i * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static switch_status_t switch_g711u_destroy(switch_codec_t *codec)
|
|
||||||
{
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static switch_status_t switch_g711a_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
|
||||||
{
|
|
||||||
int encoding, decoding;
|
|
||||||
|
|
||||||
encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
|
|
||||||
decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
|
|
||||||
|
|
||||||
if (!(encoding || decoding)) {
|
|
||||||
return SWITCH_STATUS_FALSE;
|
|
||||||
} else {
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static switch_status_t switch_g711a_encode(switch_codec_t *codec,
|
|
||||||
switch_codec_t *other_codec,
|
|
||||||
void *decoded_data,
|
|
||||||
uint32_t decoded_data_len,
|
|
||||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
|
|
||||||
unsigned int *flag)
|
|
||||||
{
|
|
||||||
short *dbuf;
|
|
||||||
unsigned char *ebuf;
|
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
dbuf = decoded_data;
|
|
||||||
ebuf = encoded_data;
|
|
||||||
|
|
||||||
for (i = 0; i < decoded_data_len / sizeof(short); i++) {
|
|
||||||
ebuf[i] = linear_to_alaw(dbuf[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
*encoded_data_len = i;
|
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static switch_status_t switch_g711a_decode(switch_codec_t *codec,
|
|
||||||
switch_codec_t *other_codec,
|
|
||||||
void *encoded_data,
|
|
||||||
uint32_t encoded_data_len,
|
|
||||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
|
|
||||||
unsigned int *flag)
|
|
||||||
{
|
|
||||||
short *dbuf;
|
|
||||||
unsigned char *ebuf;
|
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
dbuf = decoded_data;
|
|
||||||
ebuf = encoded_data;
|
|
||||||
|
|
||||||
if (*flag & SWITCH_CODEC_FLAG_SILENCE) {
|
|
||||||
memset(dbuf, 0, codec->implementation->bytes_per_frame);
|
|
||||||
*decoded_data_len = codec->implementation->bytes_per_frame;
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < encoded_data_len; i++) {
|
|
||||||
dbuf[i] = alaw_to_linear(ebuf[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
*decoded_data_len = i * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static switch_status_t switch_g711a_destroy(switch_codec_t *codec)
|
|
||||||
{
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_g711_load)
|
|
||||||
{
|
|
||||||
switch_codec_interface_t *codec_interface;
|
|
||||||
int mpf = 10000, spf = 80, bpf = 160, ebpf = 80, count;
|
|
||||||
|
|
||||||
/* connect my internal structure to the blank pointer passed to me */
|
|
||||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
|
||||||
SWITCH_ADD_CODEC(codec_interface, "G.711 ulaw");
|
|
||||||
for (count = 12; count > 0; count--) {
|
|
||||||
switch_core_codec_add_implementation(pool, codec_interface,
|
|
||||||
SWITCH_CODEC_TYPE_AUDIO, 0, "PCMU", NULL, 8000, 8000, 64000,
|
|
||||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
|
||||||
switch_g711u_init, switch_g711u_encode, switch_g711u_decode, switch_g711u_destroy);
|
|
||||||
}
|
|
||||||
|
|
||||||
SWITCH_ADD_CODEC(codec_interface, "G.711 alaw");
|
|
||||||
for (count = 12; count > 0; count--) {
|
|
||||||
switch_core_codec_add_implementation(pool, codec_interface,
|
|
||||||
SWITCH_CODEC_TYPE_AUDIO, 8, "PCMA", NULL, 8000, 8000, 64000,
|
|
||||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
|
||||||
switch_g711a_init, switch_g711a_encode, switch_g711a_decode, switch_g711a_destroy);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* indicate that the module should continue to be loaded */
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For Emacs:
|
|
||||||
* Local Variables:
|
|
||||||
* mode:c
|
|
||||||
* indent-tabs-mode:t
|
|
||||||
* tab-width:4
|
|
||||||
* c-basic-offset:4
|
|
||||||
* End:
|
|
||||||
* For VIM:
|
|
||||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
|
|
||||||
*/
|
|
@ -1,57 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="8.00"
|
|
||||||
Name="mod_g711"
|
|
||||||
ProjectGUID="{B1FE4613-3F4B-4DAF-9714-2472BF8F56AE}"
|
|
||||||
RootNamespace="mod_g711"
|
|
||||||
Keyword="Win32Proj"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
ConfigurationType="2"
|
|
||||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
ConfigurationType="2"
|
|
||||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath=".\g711.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\mod_g711.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
@ -1,156 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="9.00"
|
|
||||||
Name="mod_l16"
|
|
||||||
ProjectGUID="{5844AFE1-AA3E-4BDB-A9EF-119AEF19DF88}"
|
|
||||||
RootNamespace="mod_l16"
|
|
||||||
Keyword="Win32Proj"
|
|
||||||
TargetFrameworkVersion="131072"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
ConfigurationType="2"
|
|
||||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\libresample\include""
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalLibraryDirectories=""$(InputDir)..\..\..\..\libs\libresample\win""
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
ConfigurationType="2"
|
|
||||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\libresample\include""
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalLibraryDirectories=""$(InputDir)..\..\..\..\libs\libresample\win""
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath=".\mod_l16.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
@ -1,137 +0,0 @@
|
|||||||
/*
|
|
||||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
||||||
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
|
||||||
*
|
|
||||||
* Version: MPL 1.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
|
||||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Anthony Minessale II <anthmct@yahoo.com>
|
|
||||||
* Portions created by the Initial Developer are Copyright (C)
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* Anthony Minessale II <anthmct@yahoo.com>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* mod_l16.c -- Raw Signed Linear Codec
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <switch.h>
|
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_l16_load);
|
|
||||||
SWITCH_MODULE_DEFINITION(mod_l16, mod_l16_load, NULL, NULL);
|
|
||||||
|
|
||||||
static switch_status_t switch_raw_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
|
||||||
{
|
|
||||||
int encoding, decoding;
|
|
||||||
|
|
||||||
encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
|
|
||||||
decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
|
|
||||||
|
|
||||||
if (!(encoding || decoding)) {
|
|
||||||
return SWITCH_STATUS_FALSE;
|
|
||||||
} else {
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static switch_status_t switch_raw_encode(switch_codec_t *codec,
|
|
||||||
switch_codec_t *other_codec,
|
|
||||||
void *decoded_data,
|
|
||||||
uint32_t decoded_data_len,
|
|
||||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
|
|
||||||
unsigned int *flag)
|
|
||||||
{
|
|
||||||
/* NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary. */
|
|
||||||
if (codec && other_codec && codec->implementation && other_codec->implementation &&
|
|
||||||
codec->implementation->actual_samples_per_second != other_codec->implementation->actual_samples_per_second) {
|
|
||||||
memcpy(encoded_data, decoded_data, decoded_data_len);
|
|
||||||
*encoded_data_len = decoded_data_len;
|
|
||||||
return SWITCH_STATUS_RESAMPLE;
|
|
||||||
}
|
|
||||||
return SWITCH_STATUS_NOOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
static switch_status_t switch_raw_decode(switch_codec_t *codec,
|
|
||||||
switch_codec_t *other_codec,
|
|
||||||
void *encoded_data,
|
|
||||||
uint32_t encoded_data_len,
|
|
||||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
|
|
||||||
unsigned int *flag)
|
|
||||||
{
|
|
||||||
if (codec && other_codec && codec->implementation && other_codec->implementation &&
|
|
||||||
codec->implementation->actual_samples_per_second != other_codec->implementation->actual_samples_per_second) {
|
|
||||||
memcpy(decoded_data, encoded_data, encoded_data_len);
|
|
||||||
*decoded_data_len = encoded_data_len;
|
|
||||||
return SWITCH_STATUS_RESAMPLE;
|
|
||||||
}
|
|
||||||
return SWITCH_STATUS_NOOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
static switch_status_t switch_raw_destroy(switch_codec_t *codec)
|
|
||||||
{
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_l16_load)
|
|
||||||
{
|
|
||||||
switch_codec_interface_t *codec_interface;
|
|
||||||
int mpf = 10000, spf = 80, bpf = 160, ebpf = 160, bps = 128000, rate = 8000, counta, countb;
|
|
||||||
switch_payload_t ianacode[4] = { 0, 10, 117, 119 };
|
|
||||||
|
|
||||||
/* connect my internal structure to the blank pointer passed to me */
|
|
||||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
|
||||||
SWITCH_ADD_CODEC(codec_interface, "RAW Signed Linear (16 bit)");
|
|
||||||
for (counta = 1; counta <= 3; counta++) {
|
|
||||||
for (countb = 12; countb > 0; countb--) {
|
|
||||||
switch_core_codec_add_implementation(pool, codec_interface,
|
|
||||||
SWITCH_CODEC_TYPE_AUDIO, ianacode[counta], "L16", NULL, rate, rate, bps,
|
|
||||||
mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, 1, 12,
|
|
||||||
switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
|
|
||||||
}
|
|
||||||
rate = rate * 2;
|
|
||||||
bps = bps * 2;
|
|
||||||
spf = spf * 2;
|
|
||||||
bpf = bpf * 2;
|
|
||||||
ebpf = ebpf * 2;
|
|
||||||
}
|
|
||||||
/* these formats below are for file playing. */
|
|
||||||
|
|
||||||
switch_core_codec_add_implementation(pool, codec_interface,
|
|
||||||
SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 22050, 22050, 352800,
|
|
||||||
20000, 441, 882, 882, 1, 1, 1,
|
|
||||||
switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
|
|
||||||
|
|
||||||
switch_core_codec_add_implementation(pool, codec_interface,
|
|
||||||
SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 11025, 11025, 176400,
|
|
||||||
40000, 441, 882, 882, 1, 1, 1,
|
|
||||||
switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
|
|
||||||
|
|
||||||
/* indicate that the module should continue to be loaded */
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For Emacs:
|
|
||||||
* Local Variables:
|
|
||||||
* mode:c
|
|
||||||
* indent-tabs-mode:t
|
|
||||||
* tab-width:4
|
|
||||||
* c-basic-offset:4
|
|
||||||
* End:
|
|
||||||
* For VIM:
|
|
||||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
|
|
||||||
*/
|
|
@ -1,61 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="8.00"
|
|
||||||
Name="mod_l16"
|
|
||||||
ProjectGUID="{5844AFE1-AA3E-4BDB-A9EF-119AEF19DF88}"
|
|
||||||
RootNamespace="mod_l16"
|
|
||||||
Keyword="Win32Proj"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
ConfigurationType="2"
|
|
||||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\libresample\include""
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalLibraryDirectories=""$(InputDir)..\..\..\..\libs\libresample\win""
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
ConfigurationType="2"
|
|
||||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\libresample\include""
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalLibraryDirectories=""$(InputDir)..\..\..\..\libs\libresample\win""
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath=".\mod_l16.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
@ -189,6 +189,7 @@ static switch_status_t switch_gsm_destroy(switch_codec_t *codec)
|
|||||||
}
|
}
|
||||||
/* GSM - END */
|
/* GSM - END */
|
||||||
|
|
||||||
|
#ifdef ENABLE_G711
|
||||||
/* G711 - START */
|
/* G711 - START */
|
||||||
static switch_status_t switch_g711u_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
static switch_status_t switch_g711u_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||||
{
|
{
|
||||||
@ -332,6 +333,8 @@ static switch_status_t switch_g711a_destroy(switch_codec_t *codec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* G711 - END */
|
/* G711 - END */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* G722 - START */
|
/* G722 - START */
|
||||||
|
|
||||||
@ -656,6 +659,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_voipcodecs_load)
|
|||||||
switch_g722_init, switch_g722_encode, switch_g722_decode, switch_g722_destroy);
|
switch_g722_init, switch_g722_encode, switch_g722_decode, switch_g722_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_G711
|
||||||
/* G711 */
|
/* G711 */
|
||||||
mpf = 10000, spf = 80, bpf = 160, ebpf = 80;
|
mpf = 10000, spf = 80, bpf = 160, ebpf = 80;
|
||||||
SWITCH_ADD_CODEC(codec_interface, "G.711 ulaw");
|
SWITCH_ADD_CODEC(codec_interface, "G.711 ulaw");
|
||||||
@ -673,6 +677,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_voipcodecs_load)
|
|||||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
||||||
switch_g711a_init, switch_g711a_encode, switch_g711a_decode, switch_g711a_destroy);
|
switch_g711a_init, switch_g711a_encode, switch_g711a_decode, switch_g711a_destroy);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* GSM */
|
/* GSM */
|
||||||
mpf = 20000, spf = 160, bpf = 320, ebpf = 33;
|
mpf = 20000, spf = 160, bpf = 320, ebpf = 33;
|
||||||
|
@ -978,6 +978,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init()
|
|||||||
switch_mutex_init(&loadable_modules.mutex, SWITCH_MUTEX_NESTED, loadable_modules.pool);
|
switch_mutex_init(&loadable_modules.mutex, SWITCH_MUTEX_NESTED, loadable_modules.pool);
|
||||||
|
|
||||||
switch_loadable_module_load_module("", "softtimer", SWITCH_FALSE, &err);
|
switch_loadable_module_load_module("", "softtimer", SWITCH_FALSE, &err);
|
||||||
|
switch_loadable_module_load_module("", "PCM", SWITCH_FALSE, &err);
|
||||||
|
|
||||||
if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
||||||
switch_xml_t mods, ld;
|
switch_xml_t mods, ld;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user