Merge branch 'master' of git.sv.gnu.org:/srv/git/linphone into dev_sal

This commit is contained in:
Simon Morlat 2010-01-18 15:10:35 +01:00
commit 2c352368f9
25 changed files with 4770 additions and 4342 deletions

Binary file not shown.

View file

@ -4,9 +4,6 @@ Microsoft Visual Studio Solution File, Format Version 10.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblinphone", "liblinphone.vcproj", "{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "linphonec", "linphonec\linphonec.vcproj", "{92574924-BF59-4DAA-994B-9978B80E5797}"
ProjectSection(ProjectDependencies) = postProject
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7} = {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

Binary file not shown.

View file

@ -178,6 +178,7 @@
OutputDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
IntermediateDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@ -199,9 +200,9 @@
Name="VCCLCompilerTool"
ExecutionBucket="7"
AdditionalOptions="&#x0D;&#x0A;"
Optimization="0"
Optimization="2"
AdditionalIncludeDirectories="..\..\oRTP\include;..\..\mediastreamer2\include;&quot;..\..\..\..\linphone-builder\speex\include&quot;;&quot;..\..\..\..\linphone-builder\eXosip\include&quot;;&quot;..\..\..\..\linphone-builder\osip\include&quot;"
PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);LIBLINPHONE_EXPORTS;OSIP_MT;ENABLE_TRACE;LOG_DOMAIN=\&quot;LinphoneCore\&quot;;IN_LINPHONE;LINPHONE_PLUGINS_DIR=\&quot;\&quot;;LINPHONE_VERSION=\&quot;3.1.2\&quot;;_UNICODE;UNICODE"
PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);LIBLINPHONE_EXPORTS;OSIP_MT;ENABLE_TRACE;LOG_DOMAIN=\&quot;LinphoneCore\&quot;;IN_LINPHONE;LINPHONE_PLUGINS_DIR=\&quot;\&quot;;LINPHONE_VERSION=\&quot;3.1.2\&quot;;_UNICODE;UNICODE;PACKAGE_SOUND_DIR=\&quot;\\Program Files\\Linphone\&quot;"
MinimalRebuild="true"
RuntimeLibrary="3"
UsePrecompiledHeader="0"

View file

@ -21,6 +21,7 @@
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="0"
CharacterSet="1"
>
<Tool
@ -43,9 +44,9 @@
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories="&quot;..\..\..\..\..\linphone-builder\osip\include&quot;;..\..\..\mediastreamer2\include;..\..\..\oRTP\include;..\..\..\coreapi"
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;IN_LINPHONE"
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);IN_LINPHONE;PACKAGE_DIR=\&quot;\\Program Files\\Linphone\&quot;"
MinimalRebuild="true"
RuntimeLibrary="1"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
@ -101,7 +102,7 @@
ForceDirty="-1"
RemoteDirectory="%CSIDL_PROGRAM_FILES%\linphone"
RegisterOutput="0"
AdditionalFiles="..\..\..\oRTP\build\wince\$(PlatformName)\$(ConfigurationName)\oRTP.dll;..\..\..\mediastreamer2\build\wince\$(PlatformName)\$(ConfigurationName)\mediastreamer2.dll"
AdditionalFiles=""
/>
<DebuggerTool
/>

View file

@ -61,10 +61,6 @@
#if !defined(strdup)
#define strdup _strdup
#endif /*strdup*/
/*
#if !defined(access)
#define access _access
#endif*/ /*access*/
#endif /*_WIN32_WCE*/
@ -77,6 +73,10 @@
#define _(something) (something)
#endif
#ifndef PACKAGE_DIR
#define PACKAGE_DIR ""
#endif
/***************************************************************************
*
* Types
@ -568,9 +568,22 @@ bool_t linphonec_get_autoanswer(){
* - char *histfile_name
* - FILE *mylogfile
*/
#if defined (_MSC_VER)
int _tmain(int argc, _TCHAR* argv[]) {
trace_level=1;
#if defined (_WIN32_WCE)
char **convert_args_to_ascii(int argc, _TCHAR **wargv){
int i;
char **result=malloc(argc*sizeof(char*));
char argtmp[128];
for(i=0;i<argc;++i){
wcstombs(argtmp,wargv[i],sizeof(argtmp));
result[i]=strdup(argtmp);
}
return result;
}
int _tmain(int argc, _TCHAR* wargv[]) {
char **argv=convert_args_to_ascii(argc,wargv);
trace_level=6;
linphonec_vtable.show =(ShowInterfaceCb) stub;
linphonec_vtable.inv_recv = linphonec_call_received;
linphonec_vtable.bye_recv = linphonec_bye_received;
@ -596,8 +609,6 @@ main (int argc, char *argv[]) {
#endif
if (! linphonec_init(argc, argv) ) exit(EXIT_FAILURE);
linphonec_main_loop (linphonec, sipAddr);
@ -620,14 +631,19 @@ linphonec_init(int argc, char **argv)
* Set initial values for global variables
*/
mylogfile = NULL;
#ifndef _WIN32
snprintf(configfile_name, PATH_MAX, "%s/.linphonerc",
#if !defined(_WIN32_WCE)
getenv("HOME"));
#elif defined(_WIN32_WCE)
strncpy(configfile_name,PACKAGE_DIR "\\linphonerc",PATH_MAX);
mylogfile=fopen(PACKAGE_DIR "\\" "linphonec.log","w");
printf("Logs are redirected in" PACKAGE_DIR "\\linphonec.log");
#else
".");
#endif /*_WIN32_WCE*/
snprintf(configfile_name, PATH_MAX, "%s/Linphone/linphonerc",
getenv("APPDATA"));
#endif
/* Handle configuration filename changes */
switch (handle_configfile_migration())
{

View file

@ -775,6 +775,7 @@ int linphone_core_get_local_ip_for(const char *dest, char *result){
struct addrinfo hints;
struct addrinfo *res=NULL;
struct sockaddr_storage addr;
struct sockaddr *p_addr=(struct sockaddr*)&addr;
ortp_socket_t sock;
socklen_t s;
@ -813,6 +814,13 @@ int linphone_core_get_local_ip_for(const char *dest, char *result){
close_socket(sock);
return -1;
}
if (p_addr->sa_family==AF_INET){
struct sockaddr_in *p_sin=(struct sockaddr_in*)p_addr;
if (p_sin->sin_addr.s_addr==0){
close_socket(sock);
return -1;
}
}
err=getnameinfo((struct sockaddr *)&addr,s,result,LINPHONE_IPADDR_SIZE,NULL,0,NI_NUMERICHOST);
if (err!=0){
ms_error("getnameinfo error: %s",strerror(errno));

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,227 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="echo"
ProjectGUID="{B616AC95-748E-4CD5-89AC-772DC3C069D9}"
RootNamespace="echo"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Windows Mobile 6 Professional SDK (ARMV4I)"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\oRTP\include"
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;ORTP_INET6"
MinimalRebuild="true"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions=" /subsystem:windowsce,5.02"
AdditionalDependencies="mediastreamer2.lib oRTP.lib"
OutputFile="$(OutDir)/echo.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;..\$(PlatformName)\$(ConfigurationName)&quot;;&quot;..\..\..\..\oRTP\build\wince\$(PlatformName)\$(ConfigurationName)&quot;"
DelayLoadDLLs="$(NOINHERIT)"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/echo.pdb"
SubSystem="0"
StackReserveSize="65536"
StackCommitSize="4096"
EntryPointSymbol="mainWCRTStartup"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="2"
FavorSizeOrSpeed="2"
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions=" /subsystem:windowsce,5.02"
OutputFile="$(OutDir)/echo.exe"
LinkIncremental="1"
DelayLoadDLLs="$(NOINHERIT)"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/echo.pdb"
SubSystem="0"
StackReserveSize="65536"
StackCommitSize="4096"
OptimizeReferences="2"
EnableCOMDATFolding="2"
EntryPointSymbol="mainWCRTStartup"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\tests\echo.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;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mediastreamer2", "mediastreamer2.vcproj", "{177F5AE2-A40C-4412-8F26-7F85FA32464E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "echo", "echo\echo.vcproj", "{B616AC95-748E-4CD5-89AC-772DC3C069D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
@ -39,6 +41,18 @@ Global
{177F5AE2-A40C-4412-8F26-7F85FA32464E}.Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Standard SDK (ARMV4I)
{177F5AE2-A40C-4412-8F26-7F85FA32464E}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
{177F5AE2-A40C-4412-8F26-7F85FA32464E}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{B616AC95-748E-4CD5-89AC-772DC3C069D9}.Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

File diff suppressed because it is too large Load diff

View file

@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MS_RTP_SEND_SET_RELAY_SESSION_ID MS_FILTER_METHOD(MS_RTP_SEND_ID,5,const char *)
#define MS_RTP_SEND_SET_DTMF_DURATION MS_FILTER_METHOD(MS_RTP_SEND_ID,1,int)
extern MSFilterDesc ms_rtp_send_desc;
extern MSFilterDesc ms_rtp_recv_desc;

View file

@ -560,6 +560,10 @@ void ring_stop(RingStream *stream){
ms_filter_destroy(stream->source);
ms_filter_destroy(stream->sndwrite);
ms_free(stream);
#ifdef _WIN32_WCE
ms_warning("Sleeping a bit after closing the audio device...");
ms_sleep(1);
#endif
}

View file

@ -17,11 +17,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define UNICODE
#include "mediastreamer2/msfileplayer.h"
#include "mediastreamer2/waveheader.h"
#include "mediastreamer2/msticker.h"
typedef enum {
CLOSED,
STARTED,
@ -128,13 +129,10 @@ static int player_open(MSFilter *f, void *arg){
PlayerData *d=(PlayerData*)f->data;
HANDLE fd;
const char *file=(const char*)arg;
#if defined(_WIN32_WCE)
fd = CreateFile((LPCWSTR)file, GENERIC_READ, FILE_SHARE_READ, NULL,
WCHAR wUnicode[1024];
MultiByteToWideChar(CP_UTF8, 0, file, -1, wUnicode, 1024);
fd = CreateFile(wUnicode, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, 0, NULL);
#else
fd = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, 0, NULL);
#endif
if (fd==INVALID_HANDLE_VALUE){
ms_warning("Failed to open %s",file);
return -1;

View file

@ -17,6 +17,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define UNICODE
#include "mediastreamer2/msfilerec.h"
#include "mediastreamer2/waveheader.h"
@ -84,6 +86,9 @@ static void write_wav_header(int rate,int size, char *filename){
wave_header_t header;
DWORD bytes_written=0;
HANDLE fd;
WCHAR wUnicode[1024];
MultiByteToWideChar(CP_UTF8, 0, filename, -1, wUnicode, 1024);
memcpy(&header.riff_chunk.riff,"RIFF",4);
header.riff_chunk.len=le_uint32(size+32);
memcpy(&header.riff_chunk.wave,"WAVE",4);
@ -101,11 +106,7 @@ static void write_wav_header(int rate,int size, char *filename){
header.data_chunk.len=le_uint32(size);
/* TODO: replace with "lseek" equivalent for windows */
#if defined(_WIN32_WCE)
fd=CreateFile((LPCWSTR)filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
#else
fd=CreateFile(filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
#endif
fd=CreateFile(wUnicode, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (fd==INVALID_HANDLE_VALUE){
#if !defined(_WIN32_WCE)
ms_warning("Cannot open %s: %s",filename,strerror(errno));
@ -127,13 +128,12 @@ static int rec_open(MSFilter *f, void *arg){
RecState *s=(RecState*)f->data;
const char *filename=(const char*)arg;
WCHAR wUnicode[1024];
MultiByteToWideChar(CP_UTF8, 0, filename, -1, wUnicode, 1024);
ms_mutex_lock(&f->lock);
snprintf(s->filename, sizeof(s->filename), "%s", filename);
#if defined(_WIN32_WCE)
s->fd=CreateFile((LPCWSTR)filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
#else
s->fd=CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
#endif
s->fd=CreateFile(wUnicode, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
if (s->fd==INVALID_HANDLE_VALUE){
#if !defined(_WIN32_WCE)
ms_warning("Cannot open %s: %s",filename,strerror(errno));

View file

@ -33,6 +33,8 @@ struct SenderData {
uint32_t skip_until;
int rate;
char dtmf;
bool_t dtmf_start;
int dtmf_duration;
char relay_session_id[64];
int relay_session_id_size;
uint64_t last_rsi_time;
@ -52,6 +54,8 @@ static void sender_init(MSFilter * f)
d->skip = FALSE;
d->rate = 8000;
d->dtmf = 0;
d->dtmf_start = FALSE;
d->dtmf_duration = 800;
d->mute_mic=FALSE;
d->relay_session_id_size=0;
d->last_rsi_time=0;
@ -71,11 +75,23 @@ static int sender_send_dtmf(MSFilter * f, void *arg)
SenderData *d = (SenderData *) f->data;
ms_filter_lock(f);
if (d->skip==TRUE)
{
ms_filter_unlock(f);
return -1;
}
d->dtmf = dtmf[0];
ms_filter_unlock(f);
return 0;
}
static int sender_set_dtmf_duration(MSFilter * f, void *arg)
{
SenderData *d = (SenderData *) f->data;
d->dtmf_duration = *((int*)arg);
return 0;
}
static int sender_set_session(MSFilter * f, void *arg)
{
SenderData *d = (SenderData *) f->data;
@ -159,6 +175,109 @@ static uint32_t get_cur_timestamp(MSFilter * f, uint32_t packet_ts)
return netts;
}
static int send_dtmf(MSFilter * f, uint32_t timestamp_start, uint32_t current_timestamp)
{
SenderData *d = (SenderData *) f->data;
mblk_t *m1;
int tev_type;
/* create the first telephony event packet */
switch (d->dtmf){
case '1':
tev_type=TEV_DTMF_1;
break;
case '2':
tev_type=TEV_DTMF_2;
break;
case '3':
tev_type=TEV_DTMF_3;
break;
case '4':
tev_type=TEV_DTMF_4;
break;
case '5':
tev_type=TEV_DTMF_5;
break;
case '6':
tev_type=TEV_DTMF_6;
break;
case '7':
tev_type=TEV_DTMF_7;
break;
case '8':
tev_type=TEV_DTMF_8;
break;
case '9':
tev_type=TEV_DTMF_9;
break;
case '*':
tev_type=TEV_DTMF_STAR;
break;
case '0':
tev_type=TEV_DTMF_0;
break;
case '#':
tev_type=TEV_DTMF_POUND;
break;
case 'A':
case 'a':
tev_type=TEV_DTMF_A;
break;
case 'B':
case 'b':
tev_type=TEV_DTMF_B;
break;
case 'C':
case 'c':
tev_type=TEV_DTMF_C;
break;
case 'D':
case 'd':
tev_type=TEV_DTMF_D;
break;
case '!':
tev_type=TEV_FLASH;
break;
default:
ms_warning("Bad dtmf: %c.",d->dtmf);
return -1;
}
if (d->dtmf_start == TRUE)
m1=rtp_session_create_telephone_event_packet(d->session,1);
else
m1=rtp_session_create_telephone_event_packet(d->session,0);
if (m1==NULL) return -1;
if (RTP_TIMESTAMP_IS_NEWER_THAN(current_timestamp, d->skip_until)) {
//retransmit end of rtp dtmf event
mblk_t *tmp;
rtp_session_add_telephone_event(d->session,m1,tev_type,1,10, (current_timestamp-timestamp_start));
tmp=copymsg(m1);
rtp_session_sendm_with_ts(d->session,tmp,timestamp_start);
d->session->rtp.snd_seq--;
tmp=copymsg(m1);
rtp_session_sendm_with_ts(d->session,tmp,timestamp_start);
d->session->rtp.snd_seq--;
rtp_session_sendm_with_ts(d->session,m1,timestamp_start);
}
else {
rtp_session_add_telephone_event(d->session,m1,tev_type,0,10, (current_timestamp-timestamp_start));
rtp_session_sendm_with_ts(d->session,m1,timestamp_start);
}
return 0;
}
static void sender_process(MSFilter * f)
{
SenderData *d = (SenderData *) f->data;
@ -184,32 +303,37 @@ static void sender_process(MSFilter * f)
timestamp = get_cur_timestamp(f, mblk_get_timestamp_info(im));
ms_filter_lock(f);
if (d->dtmf != 0) {
rtp_session_send_dtmf(s, d->dtmf, timestamp);
ms_debug("RFC2833 dtmf sent.");
d->dtmf = 0;
d->skip_until = timestamp + (3 * 160);
d->skip = TRUE;
freemsg(im);
}else if (d->skip) {
if (d->skip) {
ms_debug("skipping..");
if (RTP_TIMESTAMP_IS_NEWER_THAN(timestamp, d->skip_until)) {
d->skip = FALSE;
}
freemsg(im);
}else{
if (d->mute_mic==FALSE){
int pt = mblk_get_payload_type(im);
header = rtp_session_create_packet(s, 12, NULL, 0);
if (pt>0)
rtp_set_payload_type(header, pt);
rtp_set_markbit(header, mblk_get_marker_info(im));
header->b_cont = im;
rtp_session_sendm_with_ts(s, header, timestamp);
}
else{
send_dtmf(f, d->skip_until-d->dtmf_duration, timestamp);
d->dtmf_start = FALSE;
if (!RTP_TIMESTAMP_IS_NEWER_THAN(timestamp, d->skip_until)) {
freemsg(im);
ms_filter_unlock(f);
continue;
}
d->skip = FALSE;
d->dtmf = 0;
}
if (d->skip == FALSE && d->mute_mic==FALSE){
int pt = mblk_get_payload_type(im);
header = rtp_session_create_packet(s, 12, NULL, 0);
if (pt>0)
rtp_set_payload_type(header, pt);
rtp_set_markbit(header, mblk_get_marker_info(im));
header->b_cont = im;
rtp_session_sendm_with_ts(s, header, timestamp);
}
else{
freemsg(im);
}
if (d->dtmf != 0) {
ms_debug("prepare to send RFC2833 dtmf.");
d->skip_until = timestamp + d->dtmf_duration;
d->skip = TRUE;
d->dtmf_start = TRUE;
}
ms_filter_unlock(f);
}
@ -222,6 +346,7 @@ static MSFilterMethod sender_methods[] = {
{MS_RTP_SEND_SEND_DTMF, sender_send_dtmf},
{MS_RTP_SEND_SET_RELAY_SESSION_ID, sender_set_relay_session_id},
{MS_FILTER_GET_SAMPLE_RATE, sender_get_sr },
{MS_RTP_SEND_SET_DTMF_DURATION, sender_set_dtmf_duration },
{0, NULL}
};

View file

@ -266,7 +266,6 @@ static void sleepMs(int ms){
static int set_high_prio(void){
int precision=2;
int result=0;
struct sched_param param;
#ifdef WIN32
MMRESULT mm;
TIMECAPS ptc;
@ -289,6 +288,7 @@ static int set_high_prio(void){
ms_warning("SetThreadPriority() failed (%d)\n", GetLastError());
}
#else
struct sched_param param;
memset(&param,0,sizeof(param));
#ifdef TARGET_OS_MAC
int policy=SCHED_RR;

View file

@ -19,12 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef __DIRECTSOUND_ENABLED__
#define UNICODE
#include "mediastreamer2/mssndcard.h"
#include "mediastreamer2/msfilter.h"
#include "mediastreamer2/msticker.h"
#define UNICODE
#include <mmsystem.h>
#ifdef _MSC_VER
#include <mmreg.h>
@ -1045,7 +1045,7 @@ static void _winsnddscard_detect(MSSndCardManager *m){
if (ms_lib_instance==NULL)
{
ms_lib_instance = LoadLibrary("dsound.dll");
ms_lib_instance = LoadLibrary(L"dsound.dll");
if( ms_lib_instance == NULL )
{
/* error */

View file

@ -22,7 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2/mssndcard.h"
#include "mediastreamer2/msticker.h"
#ifndef _WIN32_WCE
#include <signal.h>
#elif defined(_MSC_VER)
#define main _tmain
#endif
static int run=1;
@ -37,11 +41,14 @@ int main(int argc, char *argv[]){
MSTicker *ticker;
char *card_id=NULL;
int rate = 16000;
ortp_init();
ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
ms_init();
#ifndef _WIN32_WCE
signal(SIGINT,stop);
#endif
if (argc>1)
card_id=argv[1];
@ -77,8 +84,12 @@ int main(int argc, char *argv[]){
ticker=ms_ticker_new();
ms_filter_link(f1,0,f2,0);
ms_ticker_attach(ticker,f1);
#ifndef _WIN32_WCE
while(run)
ms_sleep(1);
#else
ms_sleep(5);
#endif
ms_ticker_detach(ticker,f1);
ms_ticker_destroy(ticker);
ms_filter_unlink(f1,0,f2,0);

View file

@ -70,6 +70,8 @@ EXPORTS
rtp_add_csrc
rtp_session_send_dtmf
rtp_session_add_telephone_event
rtp_session_create_telephone_event_packet
rtp_session_set_source_description
rtp_session_set_symmetric_rtp

File diff suppressed because it is too large Load diff

View file

@ -70,6 +70,8 @@ EXPORTS
rtp_add_csrc
rtp_session_send_dtmf
rtp_session_add_telephone_event
rtp_session_create_telephone_event_packet
rtp_session_set_source_description
rtp_session_set_symmetric_rtp

File diff suppressed because it is too large Load diff

View file

@ -256,7 +256,7 @@ static void __ortp_logv_out(OrtpLogLevel lev, const char *fmt, va_list args){
ortp_fatal("Bad level !");
}
msg=ortp_strdup_vprintf(fmt,args);
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
OutputDebugString(msg);
OutputDebugString("\r\n");
#else

View file

@ -124,7 +124,7 @@ int close_socket(ortp_socket_t sock){
#endif
}
#if defined (_WIN32_WCE)
#if defined (_WIN32_WCE) || defined(_MSC_VER)
int ortp_file_exist(const char *pathname) {
FILE* fd;
if (pathname==NULL) return -1;