提交 e40c1064 authored 作者: Michael Jerris's avatar Michael Jerris

fix fmtp pass through in pass through mode for amr and g729, add pass through…

fix fmtp pass through in pass through mode for amr and g729, add pass through mode for mod_amr, and add mod_amr to the windows build (in pass through mode)  To build mod_amr in NON pass through mode you must now have the lib in libs/amr dir in your src tree.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4381 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 9eaac73b
差异被折叠。
ifeq ($(shell ls -d $(BASE)/libs/anr),$(BASE)/libs/amr)
CFLAGS += -I$(PREFIX)/include/amr
LDFLAGS +=-lamr
else
CFLAGS += -DAMR_PASSTHROUGH
endif
all: $(MODNAME).$(DYNAMIC_LIB_EXTEN)
depends:
......
......@@ -32,6 +32,9 @@
*
*/
#include "switch.h"
static const char modname[] = "mod_amr";
#ifndef AMR_PASSTHROUGH
#include "amr/interf_enc.h"
#include "amr/interf_dec.h"
......@@ -59,8 +62,6 @@
*
*/
static const char modname[] = "mod_amr";
typedef enum {
AMR_OPT_OCTET_ALIGN = (1 << 0),
AMR_OPT_CRC = (1 << 1),
......@@ -110,10 +111,19 @@ static struct {
switch_byte_t default_bitrate;
} globals;
#endif
static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_t flags,
const switch_codec_settings_t *codec_settings)
{
#ifdef AMR_PASSTHROUGH
codec->flags |= SWITCH_CODEC_FLAG_PASSTHROUGH;
if (codec->fmtp_in) {
codec->fmtp_out = switch_core_strdup(codec->memory_pool, codec->fmtp_in);
}
return SWITCH_STATUS_SUCCESS;
#else
struct amr_context *context = NULL;
int encoding, decoding;
int x, i, argc;
......@@ -211,10 +221,12 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
return SWITCH_STATUS_SUCCESS;
}
#endif
}
static switch_status_t switch_amr_destroy(switch_codec_t *codec)
{
#ifndef AMR_PASSTHROUGH
struct amr_context *context = codec->private_info;
if (context->encoder_state) {
......@@ -224,6 +236,7 @@ static switch_status_t switch_amr_destroy(switch_codec_t *codec)
Decoder_Interface_exit(context->decoder_state);
}
codec->private_info = NULL;
#endif
return SWITCH_STATUS_SUCCESS;
}
......@@ -239,6 +252,10 @@ static switch_status_t switch_amr_encode(switch_codec_t *codec,
uint32_t *encoded_rate,
unsigned int *flag)
{
#ifdef AMR_PASSTHROUGH
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
return SWITCH_STATUS_FALSE;
#else
struct amr_context *context = codec->private_info;
if (!context) {
......@@ -248,6 +265,7 @@ static switch_status_t switch_amr_encode(switch_codec_t *codec,
*encoded_data_len = Encoder_Interface_Encode( context->encoder_state, context->enc_mode, (int16_t *)decoded_data, (switch_byte_t *) encoded_data, 0);
return SWITCH_STATUS_SUCCESS;
#endif
}
static switch_status_t switch_amr_decode(switch_codec_t *codec,
......@@ -262,6 +280,10 @@ static switch_status_t switch_amr_decode(switch_codec_t *codec,
uint32_t *decoded_rate,
unsigned int *flag)
{
#ifdef AMR_PASSTHROUGH
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
return SWITCH_STATUS_FALSE;
#else
struct amr_context *context = codec->private_info;
if (!context) {
......@@ -272,6 +294,7 @@ static switch_status_t switch_amr_decode(switch_codec_t *codec,
*decoded_data_len = codec->implementation->bytes_per_frame;
return SWITCH_STATUS_SUCCESS;
#endif
}
/* Registration */
......@@ -313,6 +336,7 @@ static switch_loadable_module_interface_t amr_module_interface = {
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
char *filename)
{
#ifndef AMR_PASSTHROUGH
char *cf = "amr.conf";
switch_xml_t cfg, xml, settings, param;
......@@ -331,6 +355,8 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
}
}
#endif
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &amr_module_interface;
......
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="mod_amr"
ProjectGUID="{8DEB383C-4091-4F42-A56F-C9E46D552D79}"
RootNamespace="mod_amr"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\codec\libamr\src\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libamr.lib FreeSwitchCore.lib"
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/mod_amr.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\codec\libamr\src\include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libamr.lib FreeSwitchCore.lib"
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/mod_amr.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug Passthrough|Win32"
OutputDirectory="Debug"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\codec\libamr\src\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;AMR_PASSTHROUGH"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/mod_amr.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release Passthrough|Win32"
OutputDirectory="Release"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\codec\libamr\src\include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;AMR_PASSTHROUGH"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/mod_amr.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="mod_amr.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
......@@ -50,6 +50,9 @@ static switch_status_t switch_g729_init(switch_codec_t *codec, switch_codec_flag
{
#ifdef G729_PASSTHROUGH
codec->flags |= SWITCH_CODEC_FLAG_PASSTHROUGH;
if (codec->fmtp_in) {
codec->fmtp_out = switch_core_strdup(codec->memory_pool, codec->fmtp_in);
}
return SWITCH_STATUS_SUCCESS;
#else
struct g729_context *context = NULL;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论