Index: pjproject/trunk/pjmedia/build/pjaut.dsp
===================================================================
--- pjproject/trunk/pjmedia/build/pjaut.dsp	(revision 121)
+++ pjproject/trunk/pjmedia/build/pjaut.dsp	(revision 121)
@@ -0,0 +1,102 @@
+# Microsoft Developer Studio Project File - Name="pjaut" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=pjaut - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "pjaut.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "pjaut.mak" CFG="pjaut - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "pjaut - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "pjaut - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""$/pjproject/pjmedia/build", TKAAAAAA"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "pjaut - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ".\output\pjaut_i386_win32_vc6_release"
+# PROP BASE Intermediate_Dir ".\output\pjaut_i386_win32_vc6_release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\output\pjaut_i386_win32_vc6_release"
+# PROP Intermediate_Dir ".\output\pjaut_i386_win32_vc6_release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../pjlib/src" /I "../src" /I "../../pjsdp/src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../bin/pjaut_vc6.exe"
+
+!ELSEIF  "$(CFG)" == "pjaut - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ".\output\pjaut_i386_win32_vc6_debug"
+# PROP BASE Intermediate_Dir ".\output\pjaut_i386_win32_vc6_debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\output\pjaut_i386_win32_vc6_debug"
+# PROP Intermediate_Dir ".\output\pjaut_i386_win32_vc6_debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../pjlib/src" /I "../src" /I "../../pjsdp/src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/pjaut_vc6d.exe" /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "pjaut - Win32 Release"
+# Name "pjaut - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\test\audio_tool.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
Index: pjproject/trunk/pjmedia/build/pjmedia.dsp
===================================================================
--- pjproject/trunk/pjmedia/build/pjmedia.dsp	(revision 120)
+++ pjproject/trunk/pjmedia/build/pjmedia.dsp	(revision 121)
@@ -33,14 +33,14 @@
 # PROP BASE Use_MFC 0
 # PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir ".\output\pjmedia_vc6_Release"
-# PROP BASE Intermediate_Dir ".\output\pjmedia_vc6_Release"
+# PROP BASE Output_Dir ".\output\pjmedia_i386_win32_vc6_release"
+# PROP BASE Intermediate_Dir ".\output\pjmedia_i386_win32_vc6_release"
 # PROP BASE Target_Dir ""
 # PROP Use_MFC 0
 # PROP Use_Debug_Libraries 0
-# PROP Output_Dir ".\output\pjmedia_vc6_Release"
-# PROP Intermediate_Dir ".\output\pjmedia_vc6_Release"
+# PROP Output_Dir ".\output\pjmedia_i386_win32_vc6_release"
+# PROP Intermediate_Dir ".\output\pjmedia_i386_win32_vc6_release"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /GX /O2 /I "../../pjlib/src" /I "../src" /I "../../pjsdp/src" /I "../src/pjmedia/portaudio" /D "NDEBUG" /D "PA_NO_ASIO" /D "WIN32" /D "_MBCS" /D "_LIB" /FD /c
+# ADD CPP /nologo /MD /W4 /GX /O2 /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../src/pjmedia/portaudio" /D "NDEBUG" /D "PA_NO_ASIO" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /FD /c
 # SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -57,14 +57,14 @@
 # PROP BASE Use_MFC 0
 # PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\output\pjmedia_vc6_Debug"
-# PROP BASE Intermediate_Dir ".\output\pjmedia_vc6_Debug"
+# PROP BASE Output_Dir ".\output\pjmedia_i386_win32_vc6_debug"
+# PROP BASE Intermediate_Dir ".\output\pjmedia_i386_win32_vc6_debug"
 # PROP BASE Target_Dir ""
 # PROP Use_MFC 0
 # PROP Use_Debug_Libraries 1
-# PROP Output_Dir ".\output\pjmedia_vc6_Debug"
-# PROP Intermediate_Dir ".\output\pjmedia_vc6_Debug"
+# PROP Output_Dir ".\output\pjmedia_i386_win32_vc6_debug"
+# PROP Intermediate_Dir ".\output\pjmedia_i386_win32_vc6_debug"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../../pjlib/src" /I "../src" /I "../../pjsdp/src" /I "../src/pjmedia/portaudio" /D "_DEBUG" /D "PA_NO_ASIO" /D "WIN32" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c
+# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../src/pjmedia/portaudio" /D "_DEBUG" /D "PA_NO_ASIO" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /FR /FD /GZ /c
 # SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -142,45 +142,45 @@
 # Begin Source File
 
-SOURCE=..\src\pjmedia\codec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjmedia\config.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjmedia\jbuf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjmedia\mediamgr.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjmedia.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjmedia\rtcp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjmedia\rtp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjmedia\sdp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjmedia\session.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjmedia\sound.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjmedia\stream.h
+SOURCE=..\include\pjmedia\codec.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\pjmedia\config.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\pjmedia\jbuf.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\pjmedia\mediamgr.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\pjmedia.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\pjmedia\rtcp.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\pjmedia\rtp.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\pjmedia\sdp.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\pjmedia\session.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\pjmedia\sound.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\pjmedia\stream.h
 # End Source File
 # End Group
Index: pjproject/trunk/pjmedia/build/pjmedia.dsw
===================================================================
--- pjproject/trunk/pjmedia/build/pjmedia.dsw	(revision 120)
+++ pjproject/trunk/pjmedia/build/pjmedia.dsw	(revision 121)
@@ -4,12 +4,8 @@
 ###############################################################################
 
-Project: "pjaudio_tool"=.\pjaudio_tool.dsp - Package Owner=<4>
+Project: "pjaut"=.\pjaut.dsp - Package Owner=<4>
 
 Package=<5>
 {{{
-    begin source code control
-    "$/pjproject/pjmedia/build", TKAAAAAA
-    .
-    end source code control
 }}}
 
@@ -30,8 +26,16 @@
 Package=<5>
 {{{
-    begin source code control
-    "$/pjproject/pjmedia/build", TKAAAAAA
-    .
-    end source code control
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "pjlib_util"="..\..\pjlib-util\build\pjlib_util.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
 }}}
 
@@ -46,8 +50,4 @@
 Package=<5>
 {{{
-    begin source code control
-    "$/pjproject/pjmedia/build", TKAAAAAA
-    .
-    end source code control
 }}}
 
@@ -65,8 +65,4 @@
 Package=<5>
 {{{
-    begin source code control
-    "$/pjproject/pjmedia/build", TKAAAAAA
-    .
-    end source code control
 }}}
 
@@ -90,8 +86,4 @@
 Package=<5>
 {{{
-    begin source code control
-    "$/pjproject/pjmedia/build", TKAAAAAA
-    .
-    end source code control
 }}}
 
Index: pjproject/trunk/pjmedia/build/pjmedia.sln
===================================================================
--- pjproject/trunk/pjmedia/build/pjmedia.sln	(revision 120)
+++ 	(revision )
@@ -1,90 +1,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsdp", "..\..\pjsdp\build\pjsdp.vcproj", "{CC953678-66FC-4C91-9DC7-2783B7427B19}"
-	ProjectSection(ProjectDependencies) = postProject
-		{72790D99-35BB-45AC-9A23-3BB60C901E63} = {72790D99-35BB-45AC-9A23-3BB60C901E63}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjaudio_tool", "pjaudio_tool.vcproj", "{B5DAC8A2-E01F-41B8-8FFE-7CD396C183DD}"
-	ProjectSection(ProjectDependencies) = postProject
-		{E6181719-4557-4EB5-8DBA-1E21C5183670} = {E6181719-4557-4EB5-8DBA-1E21C5183670}
-		{CC953678-66FC-4C91-9DC7-2783B7427B19} = {CC953678-66FC-4C91-9DC7-2783B7427B19}
-		{72790D99-35BB-45AC-9A23-3BB60C901E63} = {72790D99-35BB-45AC-9A23-3BB60C901E63}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjmedia", "pjmedia.vcproj", "{E6181719-4557-4EB5-8DBA-1E21C5183670}"
-	ProjectSection(ProjectDependencies) = postProject
-		{72790D99-35BB-45AC-9A23-3BB60C901E63} = {72790D99-35BB-45AC-9A23-3BB60C901E63}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjmedia_test", "pjmedia_test.vcproj", "{13EF030B-5BB9-48AC-8EAA-723B6BD1DD7D}"
-	ProjectSection(ProjectDependencies) = postProject
-		{E6181719-4557-4EB5-8DBA-1E21C5183670} = {E6181719-4557-4EB5-8DBA-1E21C5183670}
-		{CC953678-66FC-4C91-9DC7-2783B7427B19} = {CC953678-66FC-4C91-9DC7-2783B7427B19}
-		{72790D99-35BB-45AC-9A23-3BB60C901E63} = {72790D99-35BB-45AC-9A23-3BB60C901E63}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjlib", "..\..\pjlib\build\pjlib.vcproj", "{72790D99-35BB-45AC-9A23-3BB60C901E63}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Global
-	GlobalSection(SourceCodeControl) = preSolution
-		SccNumberOfProjects = 6
-		SccProjectUniqueName0 = ..\\..\\pjsdp\\build\\pjsdp.vcproj
-		SccLocalPath0 = ..\\..
-		CanCheckoutShared = false
-		SccProjectFilePathRelativizedFromConnection0 = pjsdp\\build\\
-		SccProjectUniqueName1 = pjmedia.vcproj
-		SccLocalPath1 = ..\\..
-		CanCheckoutShared = false
-		SccProjectFilePathRelativizedFromConnection1 = pjmedia\\build\\
-		SccProjectUniqueName2 = ..\\..\\pjlib\\build\\pjlib.vcproj
-		SccLocalPath2 = ..\\..
-		CanCheckoutShared = false
-		SccProjectFilePathRelativizedFromConnection2 = pjlib\\build\\
-		SccProjectName3 = \u0022$/pjproject\u0022,\u0020PIAAAAAA
-		SccLocalPath3 = ..\\..
-		SccProvider3 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe
-		CanCheckoutShared = false
-		SccProjectFilePathRelativizedFromConnection3 = pjmedia\\build\\
-		SolutionUniqueID = {ADA38C1E-12DE-4E20-AC46-530CA681F3E8}
-		SccProjectUniqueName4 = pjaudio_tool.vcproj
-		SccLocalPath4 = ..\\..
-		CanCheckoutShared = false
-		SccProjectFilePathRelativizedFromConnection4 = pjmedia\\build\\
-		SccProjectUniqueName5 = pjmedia_test.vcproj
-		SccLocalPath5 = ..\\..
-		CanCheckoutShared = false
-		SccProjectFilePathRelativizedFromConnection5 = pjmedia\\build\\
-	EndGlobalSection
-	GlobalSection(SolutionConfiguration) = preSolution
-		Debug = Debug
-		Release = Release
-	EndGlobalSection
-	GlobalSection(ProjectConfiguration) = postSolution
-		{CC953678-66FC-4C91-9DC7-2783B7427B19}.Debug.ActiveCfg = Debug|Win32
-		{CC953678-66FC-4C91-9DC7-2783B7427B19}.Debug.Build.0 = Debug|Win32
-		{CC953678-66FC-4C91-9DC7-2783B7427B19}.Release.ActiveCfg = Release|Win32
-		{CC953678-66FC-4C91-9DC7-2783B7427B19}.Release.Build.0 = Release|Win32
-		{B5DAC8A2-E01F-41B8-8FFE-7CD396C183DD}.Debug.ActiveCfg = Debug|Win32
-		{B5DAC8A2-E01F-41B8-8FFE-7CD396C183DD}.Debug.Build.0 = Debug|Win32
-		{B5DAC8A2-E01F-41B8-8FFE-7CD396C183DD}.Release.ActiveCfg = Release|Win32
-		{B5DAC8A2-E01F-41B8-8FFE-7CD396C183DD}.Release.Build.0 = Release|Win32
-		{E6181719-4557-4EB5-8DBA-1E21C5183670}.Debug.ActiveCfg = Debug|Win32
-		{E6181719-4557-4EB5-8DBA-1E21C5183670}.Debug.Build.0 = Debug|Win32
-		{E6181719-4557-4EB5-8DBA-1E21C5183670}.Release.ActiveCfg = Release|Win32
-		{E6181719-4557-4EB5-8DBA-1E21C5183670}.Release.Build.0 = Release|Win32
-		{13EF030B-5BB9-48AC-8EAA-723B6BD1DD7D}.Debug.ActiveCfg = Debug|Win32
-		{13EF030B-5BB9-48AC-8EAA-723B6BD1DD7D}.Debug.Build.0 = Debug|Win32
-		{13EF030B-5BB9-48AC-8EAA-723B6BD1DD7D}.Release.ActiveCfg = Release|Win32
-		{13EF030B-5BB9-48AC-8EAA-723B6BD1DD7D}.Release.Build.0 = Release|Win32
-		{72790D99-35BB-45AC-9A23-3BB60C901E63}.Debug.ActiveCfg = Debug|Win32
-		{72790D99-35BB-45AC-9A23-3BB60C901E63}.Debug.Build.0 = Debug|Win32
-		{72790D99-35BB-45AC-9A23-3BB60C901E63}.Release.ActiveCfg = Release|Win32
-		{72790D99-35BB-45AC-9A23-3BB60C901E63}.Release.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-	EndGlobalSection
-	GlobalSection(ExtensibilityAddIns) = postSolution
-	EndGlobalSection
-EndGlobal
Index: pjproject/trunk/pjmedia/build/pjmedia.vcproj
===================================================================
--- pjproject/trunk/pjmedia/build/pjmedia.vcproj	(revision 120)
+++ 	(revision )
@@ -1,629 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="pjmedia_lib"
-	ProjectGUID="{EB8559B2-D738-4987-8591-4D217F8B0099}"
-	SccProjectName="&quot;$/pjproject&quot;, PIAAAAAA"
-	SccAuxPath=""
-	SccLocalPath="..\.."
-	SccProvider="MSSCCI:Microsoft Visual SourceSafe">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\output\pjmedia_vc7_Release"
-			IntermediateDirectory=".\output\pjmedia_vc7_Release"
-			ConfigurationType="4"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../pjlib/src,../src,../../pjsdp/src,../src/pjmedia/portaudio"
-				PreprocessorDefinitions="PA_NO_ASIO;PA_NO_WMME;WIN32;NDEBUG;_LIB"
-				StringPooling="TRUE"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="TRUE"
-				PrecompiledHeaderFile=".\output\pjmedia_vc7_Release/pjmedia.pch"
-				AssemblerListingLocation=".\output\pjmedia_vc7_Release/"
-				ObjectFile=".\output\pjmedia_vc7_Release/"
-				ProgramDataBaseFileName=".\output\pjmedia_vc7_Release/"
-				WarningLevel="4"
-				SuppressStartupBanner="TRUE"
-				CompileAs="0"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="..\lib\pjmedia_vc7s.lib"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\output\pjmedia_vc7_Debug"
-			IntermediateDirectory=".\output\pjmedia_vc7_Debug"
-			ConfigurationType="4"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../pjlib/src,../src,../../pjsdp/src,../src/pjmedia/portaudio"
-				PreprocessorDefinitions="PA_NO_ASIO;PA_NO_WMME;WIN32;_DEBUG;_LIB"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				PrecompiledHeaderFile=".\output\pjmedia_vc7_Debug/pjmedia.pch"
-				AssemblerListingLocation=".\output\pjmedia_vc7_Debug/"
-				ObjectFile=".\output\pjmedia_vc7_Debug/"
-				ProgramDataBaseFileName=".\output\pjmedia_vc7_Debug/"
-				BrowseInformation="1"
-				WarningLevel="4"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"
-				CompileAs="0"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="..\lib\pjmedia_vc7sd.lib"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="..\src\pjmedia\codec.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\g711.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\jbuf.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\mediamgr.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\nullsound.c">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCLCompilerTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCLCompilerTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\pasound.c">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\rtcp.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\rtp.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\sdp.c">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\session.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\stream.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-			<File
-				RelativePath="..\src\pjmedia\codec.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\config.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\jbuf.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\mediamgr.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\rtcp.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\rtp.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\sdp.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\session.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\sound.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\stream.h">
-			</File>
-		</Filter>
-		<Filter
-			Name="PortAudio Files"
-			Filter="">
-			<File
-				RelativePath="..\src\pjmedia\portaudio\dsound_wrapper.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\dsound_wrapper.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_allocation.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_allocation.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_converters.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_converters.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_cpuload.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_cpuload.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_dither.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_dither.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_endianness.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_front.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_hostapi.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_process.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_process.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_skeleton.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_stream.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_stream.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_trace.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_trace.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_types.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_util.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_win_ds.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_win_hostapis.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_win_util.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_win_wmme.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_win_wmme.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_x86_plain_converters.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						WarningLevel="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\pa_x86_plain_converters.h">
-			</File>
-			<File
-				RelativePath="..\src\pjmedia\portaudio\portaudio.h">
-			</File>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: pjproject/trunk/pjmedia/build/pjmedia_audio_tool.dsp
===================================================================
--- pjproject/trunk/pjmedia/build/pjmedia_audio_tool.dsp	(revision 120)
+++ 	(revision )
@@ -1,102 +1,0 @@
-# Microsoft Developer Studio Project File - Name="pjmedia_audio_tool" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=pjmedia_audio_tool - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "pjmedia_audio_tool.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "pjmedia_audio_tool.mak" CFG="pjmedia_audio_tool - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "pjmedia_audio_tool - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "pjmedia_audio_tool - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""$/pjproject/pjmedia/build", TKAAAAAA"
-# PROP Scc_LocalPath "."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "pjmedia_audio_tool - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir ".\output\pjmedia_audio_tool_vc6_Release"
-# PROP BASE Intermediate_Dir ".\output\pjmedia_audio_tool_vc6_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ".\output\pjmedia_audio_tool_vc6_Release"
-# PROP Intermediate_Dir ".\output\pjmedia_audio_tool_vc6_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../pjlib/src" /I "../src" /I "../../pjsdp/src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../bin/pjaut_vc6.exe"
-
-!ELSEIF  "$(CFG)" == "pjmedia_audio_tool - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\output\pjmedia_audio_tool_vc6_Debug"
-# PROP BASE Intermediate_Dir ".\output\pjmedia_audio_tool_vc6_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ".\output\pjmedia_audio_tool_vc6_Debug"
-# PROP Intermediate_Dir ".\output\pjmedia_audio_tool_vc6_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../pjlib/src" /I "../src" /I "../../pjsdp/src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/pjaut_vc6d.exe" /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "pjmedia_audio_tool - Win32 Release"
-# Name "pjmedia_audio_tool - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\src\test\audio_tool.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: pjproject/trunk/pjmedia/build/pjmedia_audio_tool.vcproj
===================================================================
--- pjproject/trunk/pjmedia/build/pjmedia_audio_tool.vcproj	(revision 120)
+++ 	(revision )
@@ -1,177 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="pjmedia_audio_tool"
-	ProjectGUID="{5FD061CF-A0E8-43DF-990C-B046AA1BF5EE}"
-	SccProjectName="&quot;$/pjproject&quot;, PIAAAAAA"
-	SccAuxPath=""
-	SccLocalPath="..\.."
-	SccProvider="MSSCCI:Microsoft Visual SourceSafe">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\output\pjmedia_audio_tool_vc7_Release"
-			IntermediateDirectory=".\output\pjmedia_audio_tool_vc7_Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../pjlib/src,../src,../../pjsdp/src"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				StringPooling="TRUE"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\output\pjmedia_audio_tool_vc7_Release/pjmedia_audio_tool.pch"
-				AssemblerListingLocation=".\output\pjmedia_audio_tool_vc7_Release/"
-				ObjectFile=".\output\pjmedia_audio_tool_vc7_Release/"
-				ProgramDataBaseFileName=".\output\pjmedia_audio_tool_vc7_Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				CompileAs="0"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib"
-				OutputFile="../bin/pjaut_vc7.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\output\pjmedia_audio_tool_vc7_Release/pjaut.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\output\pjmedia_audio_tool_vc7_Release/pjmedia_audio_tool.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\output\pjmedia_audio_tool_vc7_Debug"
-			IntermediateDirectory=".\output\pjmedia_audio_tool_vc7_Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../pjlib/src,../src,../../pjsdp/src"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\output\pjmedia_audio_tool_vc7_Debug/pjmedia_audio_tool.pch"
-				AssemblerListingLocation=".\output\pjmedia_audio_tool_vc7_Debug/"
-				ObjectFile=".\output\pjmedia_audio_tool_vc7_Debug/"
-				ProgramDataBaseFileName=".\output\pjmedia_audio_tool_vc7_Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"
-				CompileAs="0"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib"
-				OutputFile="../bin/pjaut_vc7d.exe"
-				LinkIncremental="2"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\output\pjmedia_audio_tool_vc7_Debug/pjaut.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\output\pjmedia_audio_tool_vc7_Debug/pjmedia_audio_tool.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="..\src\test\audio_tool.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: pjproject/trunk/pjmedia/build/pjmedia_test.vcproj
===================================================================
--- pjproject/trunk/pjmedia/build/pjmedia_test.vcproj	(revision 120)
+++ 	(revision )
@@ -1,248 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="pjmedia_test"
-	ProjectGUID="{692B42C4-6888-4BF8-9613-E48A2F138005}"
-	SccProjectName="&quot;$/pjproject&quot;, PIAAAAAA"
-	SccAuxPath=""
-	SccLocalPath="..\.."
-	SccProvider="MSSCCI:Microsoft Visual SourceSafe">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\output\pjmedia_test_vc7_Debug"
-			IntermediateDirectory=".\output\pjmedia_test_vc7_Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../pjlib/src,../src,../../pjsdp/src"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\output\pjmedia_test_vc7_Debug/pjmedia_test.pch"
-				AssemblerListingLocation=".\output\pjmedia_test_vc7_Debug/"
-				ObjectFile=".\output\pjmedia_test_vc7_Debug/"
-				ProgramDataBaseFileName=".\output\pjmedia_test_vc7_Debug/"
-				BrowseInformation="1"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"
-				CompileAs="0"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib"
-				OutputFile="../bin/pjmedia_test_vc7d.exe"
-				LinkIncremental="2"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\output\pjmedia_test_vc7_Debug/pjmedia_test.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\output\pjmedia_test_vc7_Debug/pjmedia_test.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\output\pjmedia_test_vc7_Release"
-			IntermediateDirectory=".\output\pjmedia_test_vc7_Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../pjlib/src,../src,../../pjsdp/src"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				StringPooling="TRUE"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\output\pjmedia_test_vc7_Release/pjmedia_test.pch"
-				AssemblerListingLocation=".\output\pjmedia_test_vc7_Release/"
-				ObjectFile=".\output\pjmedia_test_vc7_Release/"
-				ProgramDataBaseFileName=".\output\pjmedia_test_vc7_Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				CompileAs="0"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib"
-				OutputFile="..\bin\pjmedia_test_vc7.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\output\pjmedia_test_vc7_Release/pjmedia_test.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\output\pjmedia_test_vc7_Release/pjmedia_test.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="..\src\test\jbuf_test.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\test\main.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\test\rtp_test.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\src\test\sdptest.c">
-			</File>
-			<File
-				RelativePath="..\src\test\session_test.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-		<File
-			RelativePath="JBTEST.DAT">
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: pjproject/trunk/pjmedia/include/pjmedia.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia.h	(revision 121)
+++ pjproject/trunk/pjmedia/include/pjmedia.h	(revision 121)
@@ -0,0 +1,32 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJMEDIA_H__
+#define __PJMEDIA_H__
+
+#include <pjmedia/codec.h>
+#include <pjmedia/jbuf.h>
+#include <pjmedia/mediamgr.h>
+#include <pjmedia/rtcp.h>
+#include <pjmedia/rtp.h>
+#include <pjmedia/session.h>
+#include <pjmedia/sound.h>
+#include <pjmedia/sdp.h>
+
+#endif	/* __PJMEDIA_H__ */
+
Index: pjproject/trunk/pjmedia/include/pjmedia/codec.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/codec.h	(revision 121)
+++ pjproject/trunk/pjmedia/include/pjmedia/codec.h	(revision 121)
@@ -0,0 +1,353 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJMEDIA_CODEC_H__
+#define __PJMEDIA_CODEC_H__
+
+
+/**
+ * @file codec.h
+ * @brief Codec framework.
+ */
+
+#include <pj/list.h>
+
+PJ_BEGIN_DECL
+
+
+/**
+ * @defgroup PJMED_CODEC Codec framework.
+ * @ingroup PJMEDIA
+ * @{
+ */
+
+/** Top most media type. */
+typedef enum pj_media_type
+{
+    /** No type. */
+    PJ_MEDIA_TYPE_NONE = 0,
+
+    /** The media is audio */
+    PJ_MEDIA_TYPE_AUDIO = 1,
+
+    /** The media is video. */
+    PJ_MEDIA_TYPE_VIDEO = 2,
+
+    /** Unknown media type, in this case the name will be specified in 
+     *  encoding_name.
+     */
+    PJ_MEDIA_TYPE_UNKNOWN = 3,
+
+} pj_media_type;
+
+
+/** Media direction. */
+typedef enum pj_media_dir_t
+{
+    /** None */
+    PJ_MEDIA_DIR_NONE = 0,
+
+    /** Encoding (outgoing to network) stream */
+    PJ_MEDIA_DIR_ENCODING = 1,
+
+    /** Decoding (incoming from network) stream. */
+    PJ_MEDIA_DIR_DECODING = 2,
+
+    /** Incoming and outgoing stream. */
+    PJ_MEDIA_DIR_ENCODING_DECODING = 3,
+
+} pj_media_dir_t;
+
+
+/** Standard RTP paylist types. */
+typedef enum pj_rtp_pt
+{
+    PJ_RTP_PT_PCMU = 0,		/* audio PCMU */
+    PJ_RTP_PT_GSM  = 3,		/* audio GSM */
+    PJ_RTP_PT_G723 = 4,		/* audio G723 */
+    PJ_RTP_PT_DVI4_8K = 5,	/* audio DVI4 8KHz */
+    PJ_RTP_PT_DVI4_16K = 6,	/* audio DVI4 16Khz */
+    PJ_RTP_PT_LPC = 7,		/* audio LPC */
+    PJ_RTP_PT_PCMA = 8,		/* audio PCMA */
+    PJ_RTP_PT_G722 = 9,		/* audio G722 */
+    PJ_RTP_PT_L16_2 = 10,	/* audio 16bit linear 44.1KHz stereo */
+    PJ_RTP_PT_L16_1 = 11,	/* audio 16bit linear 44.1KHz mono */
+    PJ_RTP_PT_QCELP = 12,	/* audio QCELP */
+    PJ_RTP_PT_CN = 13,		/* audio Comfort Noise */
+    PJ_RTP_PT_MPA = 14,		/* audio MPEG1 or MPEG2 as elementary streams */
+    PJ_RTP_PT_G728 = 15,	/* audio G728 */
+    PJ_RTP_PT_DVI4_11K = 16,	/* audio DVI4 11.025KHz mono */
+    PJ_RTP_PT_DVI4_22K = 17,	/* audio DVI4 22.050KHz mono */
+    PJ_RTP_PT_G729 = 18,	/* audio G729 */
+    PJ_RTP_PT_CELB = 25,	/* video/comb Cell-B by Sun Microsystems (RFC 2029) */
+    PJ_RTP_PT_JPEG = 26,	/* video JPEG */
+    PJ_RTP_PT_NV = 28,		/* video NV implemented by nv program by Xerox */
+    PJ_RTP_PT_H261 = 31,	/* video H261 */
+    PJ_RTP_PT_MPV = 32,		/* video MPEG1 or MPEG2 elementary streams */
+    PJ_RTP_PT_MP2T = 33,	/* video MPEG2 transport */
+    PJ_RTP_PT_H263 = 34,	/* video H263 */
+
+    PJ_RTP_PT_DYNAMIC = 96,	/* start of dynamic RTP payload */
+} pj_rtp_pt;
+
+
+/** Identification used to search for codec factory that supports specific 
+ *  codec specification. 
+ */
+typedef struct pj_codec_id
+{
+    /** Media type. */
+    pj_media_type   type;
+
+    /** Payload type (can be dynamic). */
+    unsigned	    pt;
+
+    /** Encoding name, must be present if the payload type is dynamic. */
+    pj_str_t	    encoding_name;
+
+    /** Sampling rate. */
+    unsigned	    sample_rate;
+} pj_codec_id;
+
+
+/** Detailed codec attributes used both to configure a codec and to query
+ *  the capability of codec factories.
+ */
+typedef struct pj_codec_attr
+{
+    pj_uint32_t	sample_rate;	    /* Sampling rate in Hz */
+    pj_uint32_t	avg_bps;	    /* Average bandwidth in bits per second */
+
+    pj_uint8_t	pcm_bits_per_sample;/* Bits per sample in the PCM side */
+    pj_uint16_t	ptime;		    /* Packet time in miliseconds */
+
+    unsigned	pt:8;		    /* Payload type. */
+    unsigned    vad_enabled:1;	    /* Voice Activity Detector. */
+    unsigned    cng_enabled:1;	    /* Comfort Noise Generator. */
+    unsigned    lpf_enabled:1;	    /* Low pass filter */
+    unsigned    hpf_enabled:1;	    /* High pass filter */
+    unsigned    penh_enabled:1;	    /* Perceptual Enhancement */
+    unsigned    concl_enabled:1;    /* Packet loss concealment */
+    unsigned    reserved_bit:1;
+
+} pj_codec_attr;
+
+/** Types of audio frame. */
+typedef enum pj_audio_frame_type
+{
+    /** The frame is a silence audio frame. */
+    PJ_AUDIO_FRAME_SILENCE,
+
+    /** The frame is a non-silence audio frame. */
+    PJ_AUDIO_FRAME_AUDIO,
+
+} pj_audio_frame_type;
+
+typedef struct pj_codec pj_codec;
+typedef struct pj_codec_factory pj_codec_factory;
+
+
+/** This structure describes an audio frame. */
+struct pj_audio_frame
+{
+    /** Type: silence or non-silence. */
+    pj_audio_frame_type type;
+
+    /** Pointer to buffer. */
+    void	*buf;
+
+    /** Frame size in bytes. */
+    unsigned	 size;
+};
+
+/**
+ * Operations that must be supported by the codec.
+ */
+typedef struct pj_codec_op
+{
+    /** Get default attributes. */
+    pj_status_t (*default_attr) (pj_codec *codec, pj_codec_attr *attr);
+
+    /** Open and initialize codec using the specified attribute.
+     *  @return zero on success.
+     */
+    pj_status_t	(*init)( pj_codec *codec, pj_pool_t *pool );
+
+    /** Close and shutdown codec.
+     */
+    pj_status_t	(*open)( pj_codec *codec, pj_codec_attr *attr );
+
+    /** Close and shutdown codec.
+     */
+    pj_status_t (*close)( pj_codec *codec );
+
+    /** Encode frame.
+     */
+    pj_status_t (*encode)( pj_codec *codec, const struct pj_audio_frame *input,
+			   unsigned output_buf_len, struct pj_audio_frame *output);
+
+    /** Decode frame.
+     */
+    pj_status_t (*decode)( pj_codec *codec, const struct pj_audio_frame *input,
+			   unsigned output_buf_len, struct pj_audio_frame *output);
+
+} pj_codec_op;
+
+/**
+ * A codec describes an instance to encode or decode media frames. 
+ */
+struct pj_codec
+{
+    /** Entries to put this codec instance in codec factory's list. */
+    PJ_DECL_LIST_MEMBER(struct pj_codec);
+
+    /** Codec's private data. */
+    void	*codec_data;
+
+    /** Codec factory where this codec was allocated. */
+    pj_codec_factory *factory;
+
+    /** Operations to codec. */
+    pj_codec_op	*op;
+};
+
+/**
+ * This structure describes operations that must be supported by codec factories.
+ */
+typedef struct pj_codec_factory_op
+{
+    /** Check whether the factory can create codec with the specified ID.
+     *  @param factory The codec factory.
+     *  @param id  The codec ID.
+     *  @return zero it matches.
+     */
+    pj_status_t	(*match_id)( pj_codec_factory *factory, const pj_codec_id *id );
+
+    /** Create default attributes for the specified codec ID. This function can
+     *  be called by application to get the capability of the codec.
+     *  @param factory The codec factory.
+     *  @param id  The codec ID.
+     *  @param attr The attribute to be initialized.
+     *  @return zero if success.
+     */
+    pj_status_t (*default_attr)( pj_codec_factory *factory, const pj_codec_id *id,
+				 pj_codec_attr *attr );
+
+    /** Enumerate supported codecs.
+     *  @param factory The codec factory.
+     *  @param count Number of entries in the array.
+     *  @param codecs The codec array.
+     *  @return the total number of supported codecs, which can be less or 
+     *          greater than requested.
+     */
+    unsigned (*enum_codecs) (pj_codec_factory *factory, unsigned count, pj_codec_id codecs[]);
+
+    /** This function is called by codec manager to instantiate one codec
+     *  instance.
+     *  @param factory The codec factory.
+     *  @param id  The codec ID.
+     *  @return the instance of the codec, or NULL if codec can not be created.
+     */
+    pj_codec* (*alloc_codec)( pj_codec_factory *factory, const pj_codec_id *id);
+
+    /** This function is called by codec manager to return a particular instance
+     *  of codec back to the codec factory.
+     *  @param factory The codec factory.
+     *  @param codec The codec instance to be returned.
+     */
+    void (*dealloc_codec)( pj_codec_factory *factory, pj_codec *codec );
+
+} pj_codec_factory_op;
+
+/**
+ * Codec factory describes a module that is able to create codec with specific
+ * capabilities. These capabilities can be queried by codec manager to create
+ * instances of codec.
+ */
+struct pj_codec_factory
+{
+    /** Entries to put this structure in the codec manager list. */
+    PJ_DECL_LIST_MEMBER(struct pj_codec_factory);
+
+    /** The factory's private data. */
+    void		*factory_data;
+
+    /** Operations to the factory. */
+    pj_codec_factory_op *op;
+
+};
+
+/**
+ * Declare maximum codecs
+ */
+#define PJ_CODEC_MGR_MAX_CODECS	    32
+
+/**
+ * Codec manager maintains codec factory etc.
+ */
+typedef struct pj_codec_mgr
+{
+    pj_codec_factory factory_list;
+    unsigned	     codec_cnt;
+    pj_codec_id	     codecs[PJ_CODEC_MGR_MAX_CODECS];
+} pj_codec_mgr;
+
+/**
+ * Init codec manager.
+ */
+PJ_DECL(pj_status_t) 
+pj_codec_mgr_init (pj_codec_mgr *mgr);
+
+/** 
+ * Register codec to codec manager. 
+ */
+PJ_DECL(pj_status_t) 
+pj_codec_mgr_register_factory (pj_codec_mgr *mgr, pj_codec_factory *factory);
+
+/**
+ * Unregister codec.
+ */
+PJ_DECL(void) 
+pj_codec_mgr_unregister_factory (pj_codec_mgr *mgr, pj_codec_factory *factory);
+
+/**
+ * Enumerate codecs.
+ */
+PJ_DECL(unsigned)
+pj_codec_mgr_enum_codecs (pj_codec_mgr *mgr, unsigned count, const pj_codec_id *codecs[]);
+
+/**
+ * Open codec.
+ */
+PJ_DECL(pj_codec*) 
+pj_codec_mgr_alloc_codec (pj_codec_mgr *mgr, const struct pj_codec_id *id);
+
+/**
+ * Close codec.
+ */
+PJ_DECL(void) 
+pj_codec_mgr_dealloc_codec (pj_codec_mgr *mgr, pj_codec *codec);
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+
+#endif	/* __PJMEDIA_CODEC_H__ */
Index: pjproject/trunk/pjmedia/include/pjmedia/config.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/config.h	(revision 121)
+++ pjproject/trunk/pjmedia/include/pjmedia/config.h	(revision 121)
@@ -0,0 +1,27 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJMED_CONFIG_H__
+#define __PJMED_CONFIG_H__
+
+/**
+ * @defgroup PJMEDIA Media Stack
+ */
+
+
+#endif	/* __PJMED_CONFIG_H__ */
Index: pjproject/trunk/pjmedia/include/pjmedia/jbuf.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/jbuf.h	(revision 121)
+++ pjproject/trunk/pjmedia/include/pjmedia/jbuf.h	(revision 121)
@@ -0,0 +1,142 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJMEDIA_JBUF_H__
+#define __PJMEDIA_JBUF_H__
+
+
+/**
+ * @file jbuf.h
+ * @brief Adaptive jitter buffer implementation.
+ */
+/**
+ * @defgroup PJMED_JBUF Adaptive jitter buffer
+ * @ingroup PJMEDIA
+ * @{
+ */
+
+#include <pj/types.h>
+
+
+PJ_BEGIN_DECL
+
+
+/**
+ * Opaque declaration of internal frame type used by jitter buffer. 
+ */
+struct pj_jbframe;
+
+
+/**
+ * Miscelaneous operation result/status. 
+ */ 
+typedef enum jb_op_status
+{
+    PJ_JB_STATUS_TOO_OLD = -2,		/** The packet is too old. */
+    PJ_JB_STATUS_TOO_SOON = -3,		/** The packet is too soon. */
+    PJ_JB_STATUS_FRAME_NULL = -4,	/** No packet can be retrieved */
+    PJ_JB_STATUS_FRAME_MISSING = -5,	/** The specified packet is missing/lost */
+} jb_op_status;
+
+
+/*
+ * Frame list, container abstraction for ordered list with fixed maximum
+ * size. It is used internally by the jitter buffer.
+ */  
+typedef struct pj_jbframelist
+{
+    unsigned		head, count, maxcount;
+    struct pj_jbframe  *frames;
+} pj_jbframelist;
+
+
+/**
+ * Jitter buffer implementation.
+ */ 
+typedef struct pj_jitter_buffer
+{
+    pj_jbframelist  lst;	    /** The frame list. */
+    int		    level;	    /** Current, real-time jitter level. */
+    int		    max_level;	    /** Maximum level for the period.	 */
+    unsigned	    prefetch;	    /** Prefetch count currently used. */
+    unsigned	    get_cnt;	    /** Number of get operation during prefetch state. */
+    unsigned	    min;	    /** Minimum jitter size, in packets. */
+    unsigned	    max;	    /** Maximum jitter size, in packets. */
+    pj_uint32_t	    lastseq;	    /** Last sequence number put to jitter buffer. */
+    unsigned	    upd_count;	    /** Internal counter to manage update interval. */
+    int		    state;	    /** Jitter buffer state (1==operational) */
+    int		    last_op;	    /** Last jitter buffer operation. */
+} pj_jitter_buffer;
+
+
+/**
+ * Initialize jitter buffer with the specified parameters.
+ * This function will allocate internal frame buffer from the specified pool.
+ * @param jb The jitter buffer to be initialized.
+ * @param pool Pool where memory will be allocated for the frame buffer.
+ * @param min The minimum value of jitter buffer, in packets.
+ * @param max The maximum value of jitter buffer, in packets.
+ * @param maxcount The maximum number of delay, in packets, which must be
+ *		   greater than max.
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pj_jb_init(pj_jitter_buffer *jb, pj_pool_t *pool, 
+				unsigned min, unsigned max, unsigned maxcount);
+
+/**
+ * Reset jitter buffer according to the parameters specified when the jitter
+ * buffer was initialized. Any packets currently in the buffer will be 
+ * discarded.
+ */
+PJ_DECL(void) pj_jb_reset(pj_jitter_buffer *jb);
+
+/**
+ * Put a pointer to the buffer with the specified sequence number. The pointer
+ * normally points to a buffer held by application, and this pointer will be
+ * returned later on when pj_jb_get() is called. The jitter buffer will not try
+ * to interpret the content of this pointer.
+ * @return:
+ *   - PJ_SUCCESS on success.
+ *   - PJ_JB_STATUS_TOO_OLD when the packet is too old.
+ *   - PJ_JB_STATUS_TOO_SOON when the packet is too soon.
+ */
+PJ_DECL(pj_status_t) pj_jb_put( pj_jitter_buffer *jb, pj_uint32_t extseq, void *buf );
+
+/**
+ * Get the earliest data from the jitter buffer. ONLY when the operation succeeds,
+ * the function returns both sequence number and a pointer in the parameters.
+ * This returned data corresponds to sequence number and pointer that were
+ * given to jitter buffer in the previous pj_jb_put operation.
+ * @return 
+ *  - PJ_SUCCESS on success
+ *  - PJ_JB_STATUS_FRAME_NULL when there is no frames to be returned.
+ *  - PJ_JB_STATUS_FRAME_MISSING if the jitter buffer detects that the packet 
+ *     is lost. Application may run packet concealment algorithm when it 
+ *     receives this status.
+ */
+PJ_DECL(pj_status_t) pj_jb_get( pj_jitter_buffer *jb, pj_uint32_t *extseq, void **buf );
+
+
+
+PJ_END_DECL
+
+/**
+ * @}
+ */
+
+#endif	/* __PJMEDIA_JBUF_H__ */
Index: pjproject/trunk/pjmedia/include/pjmedia/mediamgr.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/mediamgr.h	(revision 121)
+++ pjproject/trunk/pjmedia/include/pjmedia/mediamgr.h	(revision 121)
@@ -0,0 +1,100 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJMEDIA_MEDIAMGR_H__
+#define __PJMEDIA_MEDIAMGR_H__
+
+
+/**
+ * @file mediamgr.h
+ * @brief Media Manager.
+ */
+/**
+ * @defgroup PJMED_MGR Media Manager
+ * @ingroup PJMEDIA
+ * @{
+ *
+ * The media manager acts as placeholder for endpoint capabilities. Each 
+ * media manager will have a codec manager to manage list of codecs installed
+ * in the endpoint and a sound device factory.
+ *
+ * A reference to media manager instance is required when application wants
+ * to create a media session (#pj_media_session_create or 
+ * #pj_media_session_create_from_sdp).
+ */
+
+#include <pjmedia/sound.h>
+#include <pjmedia/codec.h>
+
+
+PJ_BEGIN_DECL
+
+
+/** Opague declaration of media manager. */
+typedef struct pj_med_mgr_t pj_med_mgr_t;
+
+/**
+ * Create an instance of media manager.
+ *
+ * @param pf		Pool factory.
+ * @param conn_addr	Connection address to be used by this media manager.
+ *
+ * @return A new instance of media manager, or NULL if failed.
+ */
+PJ_DECL(pj_med_mgr_t*) pj_med_mgr_create (pj_pool_factory *pf);
+
+/**
+ * Destroy media manager instance.
+ *
+ * @param mgr		Media manager instance.
+ *
+ * @return zero on success.
+ */
+PJ_DECL(pj_status_t) pj_med_mgr_destroy (pj_med_mgr_t *mgr);
+
+/**
+ * Get pool factory of the media manager as specified when the media
+ * manager was created.
+ *
+ * @param mgr		The media manager instance.
+ *
+ * @return Pool factory instance of the media manager.
+ */
+PJ_DECL(pj_pool_factory*) pj_med_mgr_get_pool_factory (pj_med_mgr_t *mgr);
+
+/**
+ * Get the codec manager instance.
+ *
+ * @param mgr		The media manager instance.
+ *
+ * @return The instance of codec manager.
+ */
+PJ_DECL(pj_codec_mgr*) pj_med_mgr_get_codec_mgr (pj_med_mgr_t *mgr);
+
+
+
+PJ_END_DECL
+
+
+/**
+ * @}
+ */
+
+
+
+#endif	/* __PJMEDIA_MEDIAMGR_H__ */
Index: pjproject/trunk/pjmedia/include/pjmedia/rtcp.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/rtcp.h	(revision 121)
+++ pjproject/trunk/pjmedia/include/pjmedia/rtcp.h	(revision 121)
@@ -0,0 +1,192 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJMEDIA_RTCP_H__
+#define __PJMEDIA_RTCP_H__
+
+/**
+ * @file rtcp.h
+ * @brief RTCP implementation.
+ */
+
+#include <pj/types.h>
+#include <pjmedia/rtp.h>
+
+PJ_BEGIN_DECL
+
+
+/**
+ * @defgroup PJMED_RTCP RTCP
+ * @ingroup PJMEDIA
+ * @{
+ */
+
+/**
+ * RTCP sender report.
+ */
+struct pj_rtcp_sr
+{
+    pj_uint32_t	    ssrc;
+    pj_uint32_t	    ntp_sec;
+    pj_uint32_t	    ntp_frac;
+    pj_uint32_t	    rtp_ts;
+    pj_uint32_t	    sender_pcount;
+    pj_uint32_t	    sender_bcount;
+};
+
+typedef struct pj_rtcp_sr pj_rtcp_sr;
+
+/**
+ * RTCP receiver report.
+ */
+struct pj_rtcp_rr
+{
+    pj_uint32_t	    ssrc;
+#if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN!=0
+    pj_uint32_t	    fract_lost:8;
+    pj_uint32_t	    total_lost_2:8;
+    pj_uint32_t	    total_lost_1:8;
+    pj_uint32_t	    total_lost_0:8;
+#else
+    pj_uint32_t	    fract_lost:8;
+    pj_uint32_t	    total_lost_0:8;
+    pj_uint32_t	    total_lost_1:8;
+    pj_uint32_t	    total_lost_2:8;
+#endif	
+    pj_uint32_t	    last_seq;
+    pj_uint32_t	    jitter;
+    pj_uint32_t	    lsr;
+    pj_uint32_t	    dlsr;
+};
+
+typedef struct pj_rtcp_rr pj_rtcp_rr;
+
+/**
+ * RTCP common header.
+ */
+struct pj_rtcp_common
+{
+#if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN!=0
+    unsigned	    version:2;	/* packet type            */
+    unsigned	    p:1;	/* padding flag           */
+    unsigned	    count:5;	/* varies by payload type */
+    unsigned	    pt:8;	/* payload type           */
+#else
+    unsigned	    count:5;	/* varies by payload type */
+    unsigned	    p:1;	/* padding flag           */
+    unsigned	    version:2;	/* packet type            */
+    unsigned	    pt:8;	/* payload type           */
+#endif
+    pj_uint16_t	    length;	/* packet length          */
+};
+
+typedef struct pj_rtcp_common pj_rtcp_common;
+
+/**
+ * RTCP packet.
+ */
+struct pj_rtcp_pkt
+{
+    pj_rtcp_common  common;	
+    pj_rtcp_sr	    sr;
+    pj_rtcp_rr	    rr;		/* variable-length list */
+};
+
+typedef struct pj_rtcp_pkt pj_rtcp_pkt;
+
+/**
+ * NTP time representation.
+ */
+struct pj_rtcp_ntp_rec
+{
+    pj_uint32_t	    hi;
+    pj_uint32_t	    lo;
+};
+
+typedef struct pj_rtcp_ntp_rec pj_rtcp_ntp_rec;
+
+/**
+ * RTCP session.
+ */
+struct pj_rtcp_session
+{
+    pj_rtcp_pkt		rtcp_pkt;
+    
+    pj_rtp_seq_session	seq_ctrl;
+
+    pj_uint32_t		received;       /* packets received */
+    pj_uint32_t		expected_prior; /* packet expected at last interval */
+    pj_uint32_t		received_prior; /* packet received at last interval */
+    pj_int32_t		transit;        /* relative trans time for prev pkt */
+    pj_uint32_t		jitter;		/* estimated jitter */
+    
+    pj_rtcp_ntp_rec	rtcp_lsr;	/* NTP timestamp in last sender report received */
+    unsigned 		rtcp_lsr_time;  /* Time when last RTCP SR is received. */
+    unsigned 		peer_ssrc;	/* Peer SSRC */
+    
+};
+
+typedef struct pj_rtcp_session pj_rtcp_session;
+
+/**
+ * Init RTCP session.
+ * @param session The session
+ * @param ssrc The SSRC used in to identify the session.
+ */
+PJ_DECL(void) pj_rtcp_init( pj_rtcp_session *session, pj_uint32_t ssrc );
+
+/**
+ * Deinit RTCP session.
+ * @param session The session.
+ */
+PJ_DECL(void) pj_rtcp_fini( pj_rtcp_session *session);
+
+/**
+ * Call this function everytime an RTP packet is received to let the RTCP
+ * session do its internal calculations.
+ * @param session The session.
+ * @param seq The RTP packet sequence number, in host byte order.
+ * @param ts The RTP packet timestamp, in host byte order.
+ */
+PJ_DECL(void) pj_rtcp_rx_rtp( pj_rtcp_session *session, pj_uint16_t seq, pj_uint32_t ts );
+
+/**
+ * Call this function everytime an RTP packet is sent to let the RTCP session
+ * do its internal calculations.
+ * @param session The session.
+ * @param bytes_payload_size The payload size of the RTP packet (ie packet minus
+ *             RTP header).
+ */
+PJ_DECL(void) pj_rtcp_tx_rtp( pj_rtcp_session *session, pj_uint16_t bytes_payload_size );
+
+/**
+ * Build a RTCP SR/RR packet to be transmitted to remote RTP peer.
+ * @param session The session.
+ * @param rtcp_pkt [output] Upon return, it will contain pointer to the RTCP packet.
+ * @param len [output] Upon return, it will indicate the size of the RTCP packet.
+ */
+PJ_DECL(void) pj_rtcp_build_rtcp( pj_rtcp_session *session, pj_rtcp_pkt **rtcp_pkt, int *len );
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+
+#endif	/* __PJMEDIA_RTCP_H__ */
Index: pjproject/trunk/pjmedia/include/pjmedia/rtp.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/rtp.h	(revision 121)
+++ pjproject/trunk/pjmedia/include/pjmedia/rtp.h	(revision 121)
@@ -0,0 +1,256 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJMEDIA_RTP_H__
+#define __PJMEDIA_RTP_H__
+
+#include <pj/types.h>
+
+/**
+ * @file rtp.h
+ * @brief RTP implementation.
+ */
+
+PJ_BEGIN_DECL
+
+
+/**
+ * @defgroup PJMED_RTP RTP
+ * @ingroup PJMEDIA
+ * @{
+ *
+ * The RTP module is designed to be dependent only to PJLIB, it does not depend
+ * on any other parts of PJMEDIA library. The RTP module does not even depend
+ * on any transports (sockets), to promote even more use.
+ *
+ * An RTCP implementation is also separated from this module.
+ *
+ * The functions that are provided by this module:
+ *  - creating RTP header for each outgoing packet.
+ *  - decoding RTP packet into RTP header and payload.
+ *  - provide simple RTP session management (sequence number, etc.)
+ *
+ * The RTP module does not use any dynamic memory at all.
+ *
+ * \section P1 How to Use the RTP Module
+ * 
+ * First application must call #pj_rtp_session_init to initialize the RTP 
+ * session.
+ *
+ * When application wants to send RTP packet, it needs to call 
+ * #pj_rtp_encode_rtp to build the RTP header. Note that this WILL NOT build
+ * the complete RTP packet, but instead only the header. Application can
+ * then either concatenate the header with the payload, or send the two
+ * fragments (the header and the payload) using scatter-gather transport API
+ * (e.g. \a sendv()).
+ *
+ * When application receives an RTP packet, first it should call
+ * #pj_rtp_decode_rtp to decode RTP header and payload, then it should call
+ * #pj_rtp_session_update to check whether we can process the RTP payload,
+ * and to let the RTP session updates its internal status. The decode function
+ * is guaranteed to point the payload to the correct position regardless of
+ * any options present in the RTP packet.
+ *
+ */
+
+
+#ifdef _MSC_VER
+#  pragma warning ( disable : 4214 )
+#endif
+
+
+/**
+ * Error codes.
+ */
+enum pj_rtp_error_t
+{
+    PJ_RTP_ERR_RTP_PACKING,	    /**< Invalid RTP packet. */
+    PJ_RTP_ERR_INVALID_VERSION,	    /**< Invalid RTP version. */
+    PJ_RTP_ERR_INVALID_SSRC,	    /**< Invalid SSRC. */
+    PJ_RTP_ERR_INVALID_PT,	    /**< Invalid payload type. */
+    PJ_RTP_ERR_INVALID_PACKET,	    /**< Invalid packet. */
+    PJ_RTP_ERR_SESSION_RESTARTED,   /**< Session has just been restarted. */
+    PJ_RTP_ERR_SESSION_PROBATION,   /**< Session in probation. */
+    PJ_RTP_ERR_BAD_SEQUENCE,	    /**< Bad RTP sequence number. */
+};
+
+#pragma pack(1)
+/**
+ * RTP packet header.
+ */
+struct pj_rtp_hdr
+{
+#if defined(PJ_IS_BIG_ENDIAN) && (PJ_IS_BIG_ENDIAN!=0)
+    pj_uint16_t v:2;	/**< packet type/version	    */
+    pj_uint16_t p:1;	/**< padding flag		    */
+    pj_uint16_t x:1;	/**< extension flag	    */
+    pj_uint16_t cc:4;	/**< CSRC count		    */
+    pj_uint16_t m:1;	/**< marker bit		    */
+    pj_uint16_t pt:7;	/**< payload type		    */
+#else
+    pj_uint16_t cc:4;	/**< CSRC count		    */
+    pj_uint16_t x:1;	/**< header extension flag    */ 
+    pj_uint16_t p:1;	/**< padding flag		    */
+    pj_uint16_t v:2;	/**< packet type/version	    */
+    pj_uint16_t pt:7;	/**< payload type		    */
+    pj_uint16_t m:1;	/**< marker bit		    */
+#endif
+    pj_uint16_t seq;	/**< sequence number	    */
+    pj_uint32_t ts;	/**< timestamp		    */
+    pj_uint32_t ssrc;	/**< synchronization source   */
+};
+#pragma pack()
+
+typedef struct pj_rtp_hdr pj_rtp_hdr;
+
+/**
+ * RTP extendsion header.
+ */
+struct pj_rtp_ext_hdr
+{
+    pj_uint16_t	profile_data;
+    pj_uint16_t	length;
+};
+
+typedef struct pj_rtp_ext_hdr pj_rtp_ext_hdr;
+
+/**
+ * A generic sequence number management, used by both RTP and RTCP.
+ */
+struct pj_rtp_seq_session
+{
+    pj_uint16_t	    max_seq;	    /**< highest sequence number heard */
+    pj_uint32_t	    cycles;	    /**< shifted count of seq. number cycles */
+    pj_uint32_t	    base_seq;	    /**< base seq number */
+    pj_uint32_t	    bad_seq;        /**< last 'bad' seq number + 1 */
+    pj_uint32_t	    probation;      /**< sequ. packets till source is valid */
+};
+
+typedef struct pj_rtp_seq_session pj_rtp_seq_session;
+
+/**
+ * RTP session descriptor.
+ */
+struct pj_rtp_session
+{
+    pj_rtp_hdr		out_hdr;    /**< Saved header for outgoing packets. */
+    pj_rtp_seq_session	seq_ctrl;   /**< Sequence number management. */
+    pj_uint16_t	        out_pt;	    /**< Default outgoing payload type. */
+    pj_uint32_t	        out_extseq; /**< Outgoing extended sequence number. */
+    pj_uint32_t	        peer_ssrc;  /**< Peer SSRC. */
+    pj_uint32_t	        received;   /**< Number of received packets. */
+};
+
+typedef struct pj_rtp_session pj_rtp_session;
+
+/**
+ * \brief Initialize RTP session.
+ * This function will initialize the RTP session according to given parameters.
+ *
+ * @param ses		The session.
+ * @param default_pt	Default payload type.
+ * @param sender_ssrc	SSRC used for outgoing packets.
+ *
+ * @return zero if successfull.
+ */
+PJ_DECL(pj_status_t) pj_rtp_session_init( pj_rtp_session *ses,
+					  int default_pt, pj_uint32_t sender_ssrc );
+
+/**
+ * \brief Encode outgoing RTP packet header.
+ * Create the RTP header based on arguments and current state of the RTP
+ * session.
+ *
+ * @param ses		The session.
+ * @param pt		Payload type.
+ * @param m		Marker flag.
+ * @param payload_len	Payload length in bytes.
+ * @param ts_len	Timestamp length.
+ * @param rtphdr	Upon return will point to RTP packet header.
+ * @param hdrlen	Upon return will indicate the size of RTP packet header
+ *
+ * @return zero if successfull.
+ */
+PJ_DECL(pj_status_t) pj_rtp_encode_rtp( pj_rtp_session *ses, int pt, int m,
+				        int payload_len, int ts_len,
+					const void **rtphdr, int *hdrlen );
+
+/**
+ * \brief Decode an incoming RTP packet.
+ * This function will decode incoming packet into RTP header and payload.
+ * The decode function is guaranteed to point the payload to the correct 
+ * position regardless of any options present in the RTP packet.
+ *
+ * @param ses		The session.
+ * @param pkt		The received RTP packet.
+ * @param pkt_len	The length of the packet.
+ * @param hdr		Upon return will point to the location of the RTP header
+ *			inside the packet.
+ * @param payload	Upon return will point to the location of the
+ *			payload inside the packet.
+ * @param payloadlen	Upon return will indicate the size of the payload.
+ *
+ * @return zero if successfull.
+ */
+PJ_DECL(pj_status_t) pj_rtp_decode_rtp( pj_rtp_session *ses, 
+				        const void *pkt, int pkt_len,
+					const pj_rtp_hdr **hdr,
+					const void **payload,
+					unsigned *payloadlen);
+
+/**
+ * \brief Update RTP session with an incoming RTP packet. 
+ * Call this function everytime
+ * an RTP packet is received to check whether the packet can be received and to
+ * let the RTP session performs its internal calculations.
+ *
+ * @param ses	    The session.
+ * @param hdr	    The RTP header of the incoming packet.
+ *
+ * @return zero if the packet is valid and can be processed, otherwise will
+ *         return one of the error in #pj_rtp_error_t.
+ */
+PJ_DECL(pj_status_t) pj_rtp_session_update( pj_rtp_session *ses, 
+					    const pj_rtp_hdr *hdr);
+
+/** 
+* \brief Internal.
+ * Internal function for sequence control, shared by RTCP implementation. 
+ */
+void pj_rtp_seq_init(pj_rtp_seq_session *seq_ctrl, pj_uint16_t seq);
+
+/** 
+* \brief Internal.
+ * Internal function for sequence control, shared by RTCP implementation. 
+ */
+void pj_rtp_seq_restart(pj_rtp_seq_session *seq_ctrl, pj_uint16_t seq);
+
+/** 
+* \brief Internal.
+ * Internal function for sequence control, shared by RTCP implementation. 
+ */
+int  pj_rtp_seq_update(pj_rtp_seq_session *seq_ctrl, pj_uint16_t seq);
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+
+#endif	/* __PJMEDIA_RTP_H__ */
Index: pjproject/trunk/pjmedia/include/pjmedia/sdp.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/sdp.h	(revision 121)
+++ pjproject/trunk/pjmedia/include/pjmedia/sdp.h	(revision 121)
@@ -0,0 +1,332 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJSDP_SDP_H__
+#define __PJSDP_SDP_H__
+
+/**
+ * @defgroup PJSDP SDP Library
+ */
+/**
+ * @file sdp.h
+ * @brief SDP header file.
+ */
+/**
+ * @defgroup PJ_SDP_H SDP stack.
+ * @ingroup PJSDP
+ * @{
+ *
+ * This SDP module consists of SDP parser, SDP structure, and function to
+ * print back the structure as SDP message.
+ */
+
+#include <pj/types.h>
+
+PJ_BEGIN_DECL
+
+#define PJSDP_MAX_FMT	32
+#define PJSDP_MAX_ATTR	32
+#define PJSDP_MAX_MEDIA	16
+
+/**
+ * This enumeration describes the attribute type.
+ */
+typedef enum pjsdp_attr_type_e
+{
+    PJSDP_ATTR_RTPMAP,
+    PJSDP_ATTR_CAT,
+    PJSDP_ATTR_KEYWORDS,
+    PJSDP_ATTR_TOOL,
+    PJSDP_ATTR_PTIME,
+    PJSDP_ATTR_RECV_ONLY,
+    PJSDP_ATTR_SEND_ONLY,
+    PJSDP_ATTR_SEND_RECV,
+    PJSDP_ATTR_ORIENT,
+    PJSDP_ATTR_TYPE,
+    PJSDP_ATTR_CHARSET,
+    PJSDP_ATTR_SDP_LANG,
+    PJSDP_ATTR_LANG,
+    PJSDP_ATTR_FRAME_RATE,
+    PJSDP_ATTR_QUALITY,
+    PJSDP_ATTR_FMTP,
+    PJSDP_ATTR_INACTIVE,
+    PJSDP_ATTR_GENERIC,
+    PJSDP_END_OF_ATTR,
+} pjsdp_attr_type_e;
+
+
+/**
+ * This structure keeps the common attributes that all 'descendants' 
+ * will have.
+ */
+typedef struct pjsdp_attr
+{
+    pjsdp_attr_type_e	type;	/**< Attribute type. */
+} pjsdp_attr;
+
+
+/**
+ * This is the structure to represent generic attribute which has a 
+ * string value.
+ */
+typedef struct pjsdp_attr_string
+{
+    pjsdp_attr_type_e	type;
+    pj_str_t		value;
+} pjsdp_attr_string;
+
+
+/**
+ * This is the structure to represent generic SDP attribute which has
+ * a numeric value.
+ */
+typedef struct pjsdp_attr_num
+{
+    pjsdp_attr_type_e	type;
+    pj_uint32_t		value;
+} pjsdp_attr_num;
+
+
+/**
+ * SDP \a rtpmap attribute.
+ */
+typedef struct pjsdp_rtpmap_attr
+{
+    pjsdp_attr_type_e	type;
+    unsigned		payload_type;
+    pj_str_t		encoding_name;
+    unsigned		clock_rate;
+    pj_str_t		parameter;
+} pjsdp_rtpmap_attr;
+
+
+/**
+ * SDP \a fmtp attribute.
+ */
+typedef struct pjsdp_fmtp_attr
+{
+    pjsdp_attr_type_e	type;
+    pj_str_t		format;
+    pj_str_t		param;
+} pjsdp_fmtp_attr;
+
+
+/** 
+ * SDP generic attribute.
+ */
+typedef struct pjsdp_generic_attr
+{
+    pjsdp_attr_type_e	type;
+    pj_str_t		name;
+    pj_str_t		value;
+} pjsdp_generic_attr;
+
+
+/** SDP \a cat attribute. */
+typedef struct pjsdp_attr_string pjsdp_cat_attr;
+
+/** SDP \a keywds attribute. */
+typedef struct pjsdp_attr_string pjsdp_keywds_attr;
+
+/** SDP \a tool attribute. */
+typedef struct pjsdp_attr_string pjsdp_tool_attr;
+
+/** SDP \a ptime attribute. */
+typedef struct pjsdp_attr_num pjsdp_ptime_attr;
+
+/** SDP \a recvonly attribute. */
+typedef struct pjsdp_attr pjsdp_recv_only_attr;
+
+/** SDP \a sendonly attribute. */
+typedef struct pjsdp_attr pjsdp_send_only_attr;
+
+/** SDP \a sendrecv attribute. */
+typedef struct pjsdp_attr pjsdp_send_recv_attr;
+
+/** SDP \a orient attribute. */
+typedef struct pjsdp_attr_string pjsdp_orient_attr;
+
+/** SDP \a type attribute. */
+typedef struct pjsdp_attr_string pjsdp_type_attr;
+
+/** SDP \a charset attribute. */
+typedef struct pjsdp_attr_string pjsdp_charset_attr;
+
+/** SDP \a sdplang attribute. */
+typedef struct pjsdp_attr_string pjsdp_sdp_lang_attr;
+
+/** SDP \a lang attribute. */
+typedef struct pjsdp_attr_string pjsdp_lang_attr;
+
+/** SDP \a framerate attribute. */
+typedef struct pjsdp_attr_string pjsdp_frame_rate_attr;
+
+/** SDP \a quality attribute. */
+typedef struct pjsdp_attr_num pjsdp_quality_attr;
+
+/** SDP \a inactive attribute. */
+typedef struct pjsdp_attr pjsdp_inactive_attr;
+
+/** Clone attribute */
+PJ_DECL(pjsdp_attr*) pjsdp_attr_clone (pj_pool_t *pool, const pjsdp_attr *rhs);
+
+/** Find attribute */
+PJ_DECL(const pjsdp_attr*) pjsdp_attr_find (int count, const pjsdp_attr *attr_array[], int type);
+
+/**
+ * SDP connection info.
+ */
+typedef struct pjsdp_conn_info
+{
+    pj_str_t	net_type;
+    pj_str_t	addr_type;
+    pj_str_t	addr;
+} pjsdp_conn_info;
+
+/** 
+ *Clone connection info. 
+ * 
+ * @param pool	    Pool to allocate memory for the new connection info.
+ * @param rhs	    The connection into to clone.
+ *
+ * @return the new connection info.
+ */
+PJ_DECL(pjsdp_conn_info*) pjsdp_conn_info_clone (pj_pool_t *pool, 
+						 const pjsdp_conn_info *rhs);
+
+/**
+ * SDP media description.
+ */
+typedef struct pjsdp_media_desc
+{
+    struct
+    {
+	pj_str_t    media;
+	pj_uint16_t port;
+	unsigned    port_count;
+	pj_str_t    transport;
+	unsigned    fmt_count;
+	pj_str_t    fmt[PJSDP_MAX_FMT];
+    } desc;
+
+    pjsdp_conn_info *conn;
+    unsigned	    attr_count;
+    pjsdp_attr	   *attr[PJSDP_MAX_ATTR];
+
+} pjsdp_media_desc;
+
+/** 
+ * Clone SDP media description. 
+ *
+ * @param pool	    Pool to allocate memory for the new media description.
+ * @param rhs	    The media descriptin to clone.
+ *
+ * @return a new media description.
+ */
+PJ_DECL(pjsdp_media_desc*) pjsdp_media_desc_clone (pj_pool_t *pool, 
+						   const pjsdp_media_desc *rhs);
+
+/** 
+ * Check if the media description has the specified attribute.
+ *
+ * @param m		The SDP media description.
+ * @param attr_type	The attribute type.
+ *
+ * @return nonzero if true.
+ */
+PJ_DECL(pj_bool_t) pjsdp_media_desc_has_attr (const pjsdp_media_desc *m, 
+					      pjsdp_attr_type_e attr_type);
+
+/** 
+ * Find rtpmap attribute for the specified payload type. 
+ *
+ * @param m	    The SDP media description.
+ * @param pt	    RTP payload type.
+ *
+ * @return the SDP rtpmap attribute for the payload type, or NULL if not found.
+ */
+PJ_DECL(const pjsdp_rtpmap_attr*) 
+pjsdp_media_desc_find_rtpmap (const pjsdp_media_desc *m, unsigned pt);
+
+
+/**
+ * This structure describes SDP session description.
+ */
+typedef struct pjsdp_session_desc
+{
+    struct
+    {
+	pj_str_t    user;
+	pj_uint32_t id;
+	pj_uint32_t version;
+	pj_str_t    net_type;
+	pj_str_t    addr_type;
+	pj_str_t    addr;
+    } origin;
+
+    pj_str_t	     name;
+    pjsdp_conn_info *conn;
+    
+    struct
+    {
+	pj_uint32_t start;
+	pj_uint32_t stop;
+    } time;
+
+    unsigned	    attr_count;
+    pjsdp_attr	   *attr[PJSDP_MAX_ATTR];
+
+    unsigned	      media_count;
+    pjsdp_media_desc *media[PJSDP_MAX_MEDIA];
+
+} pjsdp_session_desc;
+
+
+/**
+ * Parse SDP message.
+ *
+ * @param buf	    The message buffer.
+ * @param len	    The length of the message.
+ * @param pool	    The pool to allocate SDP session description.
+ *
+ * @return SDP session description.
+ */
+PJ_DECL(pjsdp_session_desc*) pjsdp_parse( char *buf, pj_size_t len, 
+					  pj_pool_t *pool);
+
+/**
+ * Print SDP description to a buffer.
+ *
+ * @param buf	    The buffer.
+ * @param size	    The buffer length.
+ * @param desc	    The SDP session description.
+ *
+ * @return the length printed, or -1.
+ */
+PJ_DECL(int) pjsdp_print( const pjsdp_session_desc *desc, 
+			  char *buf, pj_size_t size);
+
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+#endif	/* __PJSDP_SDP_H__ */
+
Index: pjproject/trunk/pjmedia/include/pjmedia/session.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/session.h	(revision 121)
+++ pjproject/trunk/pjmedia/include/pjmedia/session.h	(revision 121)
@@ -0,0 +1,152 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJMEDIA_SESSION_H__
+#define __PJMEDIA_SESSION_H__
+
+
+/**
+ * @file session.h
+ * @brief Media Session.
+ */
+
+#include <pj/types.h>
+#include <pjmedia/mediamgr.h>
+#include <pjmedia/stream.h>
+#include <pjmedia/sdp.h>
+
+PJ_BEGIN_DECL 
+
+/**
+ * @defgroup PJMED_SES Media session
+ * @ingroup PJMEDIA
+ * @{
+ */
+
+/** Opaque declaration of media session. */
+typedef struct pj_media_session_t pj_media_session_t;
+
+/** Media socket info. */
+typedef struct pj_media_sock_info
+{
+    pj_sock_t	    rtp_sock, rtcp_sock;
+    pj_sockaddr_in  rtp_addr_name;
+} pj_media_sock_info;
+
+/** Stream info. */
+typedef struct pj_media_stream_info
+{
+    pj_str_t		type;
+    pj_media_dir_t	dir;
+    pj_str_t		transport;
+    pj_media_sock_info	sock_info;
+    pj_str_t		rem_addr;
+    unsigned short	rem_port;
+    unsigned		fmt_cnt;
+    pj_codec_id		fmt[PJSDP_MAX_FMT];
+
+} pj_media_stream_info;
+
+/** Flag for modifying stream. */
+enum
+{
+    PJ_MEDIA_STREAM_MODIFY_DIR = 1,
+};
+
+/**
+ * Create new session offering.
+ */
+PJ_DECL(pj_media_session_t*) 
+pj_media_session_create ( pj_med_mgr_t *mgr, const pj_media_sock_info *skinfo );
+
+/**
+ * Create new session based on peer's offering.
+ */
+PJ_DECL(pj_media_session_t*) 
+pj_media_session_create_from_sdp ( pj_med_mgr_t *mgr, const pjsdp_session_desc *sdp,
+				   const pj_media_sock_info *skinfo);
+
+/**
+ * Duplicate session. The new session is inactive.
+ */
+PJ_DECL(pj_media_session_t*)
+pj_media_session_clone (const pj_media_session_t *session);
+
+/**
+ * Create SDP description from the session.
+ */
+PJ_DECL(pjsdp_session_desc*)
+pj_media_session_create_sdp ( const pj_media_session_t *session, pj_pool_t *pool,
+			      pj_bool_t only_first_fmt);
+
+/**
+ * Update session with SDP answer from peer. The session must NOT active.
+ */
+PJ_DECL(pj_status_t)
+pj_media_session_update ( pj_media_session_t *session, 
+			  const pjsdp_session_desc *sdp);
+
+/**
+ * Enumerate media streams in the session.
+ * @return the actual number of streams.
+ */
+PJ_DECL(unsigned)
+pj_media_session_enum_streams (const pj_media_session_t *session, 
+			       unsigned count, const pj_media_stream_info *info[]);
+
+/**
+ * Get stream statistics.
+ */
+PJ_DECL(pj_status_t)
+pj_media_session_get_stat (const pj_media_session_t *session, unsigned index,
+			   pj_media_stream_stat *tx_stat,
+			   pj_media_stream_stat *rx_stat);
+
+/**
+ * Modify stream, only when stream is inactive.
+ */
+PJ_DECL(pj_status_t)
+pj_media_session_modify_stream (pj_media_session_t *session, unsigned index,
+				unsigned modify_flag, const pj_media_stream_info *info);
+
+/**
+ * Activate all streams in media session.
+ */
+PJ_DECL(pj_status_t)
+pj_media_session_activate (pj_media_session_t *session);
+
+/**
+ * Activate individual stream in media session.
+ */
+PJ_DECL(pj_status_t)
+pj_media_session_activate_stream (pj_media_session_t *session, unsigned index);
+
+/**
+ * Destroy media session.
+ */
+PJ_DECL(pj_status_t)
+pj_media_session_destroy (pj_media_session_t *session);
+
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+#endif	/* __PJMEDIA_SESSION_H__ */
Index: pjproject/trunk/pjmedia/include/pjmedia/sound.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/sound.h	(revision 121)
+++ pjproject/trunk/pjmedia/include/pjmedia/sound.h	(revision 121)
@@ -0,0 +1,201 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJMEDIA_SOUND_H__
+#define __PJMEDIA_SOUND_H__
+
+
+/**
+ * @file sound.h
+ * @brief Sound player and recorder device framework.
+ */
+
+#include <pj/pool.h>
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup PJMED_SND Sound device abstraction.
+ * @ingroup PJMEDIA
+ * @{
+ */
+
+/** Opaque data type for audio stream. */
+typedef struct pj_snd_stream pj_snd_stream;
+
+/**
+ * Device information structure returned by #pj_snd_get_dev_info.
+ */
+typedef struct pj_snd_dev_info
+{
+    char	name[64];	        /**< Device name.		    */
+    unsigned	input_count;	        /**< Max number of input channels.  */
+    unsigned	output_count;	        /**< Max number of output channels. */
+    unsigned	default_samples_per_sec;/**< Default sampling rate.	    */
+} pj_snd_dev_info;
+
+/**
+ * Sound device parameter, to be specified when calling #pj_snd_open_recorder
+ * or #pj_snd_open_player.
+ */
+typedef struct pj_snd_stream_info
+{
+    unsigned samples_per_sec;		/* Sampling rate.	    */
+    unsigned bits_per_sample;		/* No of bits per sample.   */
+    unsigned samples_per_frame;		/* No of samples per frame. */
+    unsigned bytes_per_frame;		/* No of bytes per frame.   */
+    unsigned frames_per_packet;		/* No of frames per packet. */
+} pj_snd_stream_info;
+
+/** 
+ * This callback is called by player stream when it needs additional data
+ * to be played by the device. Application must fill in the whole of output 
+ * buffer with sound samples.
+ *
+ * @param user_data	User data associated with the stream.
+ * @param timestamp	Timestamp, in samples.
+ * @param output	Buffer to be filled out by application.
+ * @param size		The size requested in bytes, which will be equal to
+ *			the size of one whole packet.
+ *
+ * @return		Non-zero to stop the stream.
+ */
+typedef pj_status_t (*pj_snd_play_cb)(/* in */   void *user_data,
+				      /* in */   pj_uint32_t timestamp,
+				      /* out */  void *output,
+				      /* out */  unsigned size);
+
+/**
+ * This callback is called by recorder stream when it has captured the whole
+ * packet worth of audio samples.
+ *
+ * @param user_data	User data associated with the stream.
+ * @param timestamp	Timestamp, in samples.
+ * @param output	Buffer containing the captured audio samples.
+ * @param size		The size of the data in the buffer, in bytes.
+ *
+ * @return		Non-zero to stop the stream.
+ */
+typedef pj_status_t (*pj_snd_rec_cb)(/* in */   void *user_data,
+				     /* in */   pj_uint32_t timestamp,
+				     /* in */   const void *input,
+				     /* in*/    unsigned size);
+
+/**
+ * Init the sound library.
+ *
+ * @param factory	The sound factory.
+ *
+ * @return		Zero on success.
+ */
+PJ_DECL(pj_status_t) pj_snd_init(pj_pool_factory *factory);
+
+
+/**
+ * Get the number of devices detected by the library.
+ *
+ * @return		Number of devices.
+ */
+PJ_DECL(int) pj_snd_get_dev_count(void);
+
+
+/**
+ * Get device info.
+ *
+ * @param index		The index of the device, which should be in the range
+ *			from zero to #pj_snd_get_dev_count - 1.
+ */
+PJ_DECL(const pj_snd_dev_info*) pj_snd_get_dev_info(unsigned index);
+
+
+/**
+ * Create a new audio stream for audio capture purpose.
+ *
+ * @param index		Device index, or -1 to let the library choose the first
+ *			available device, or -2 to use NULL device.
+ * @param param		Stream parameters.
+ * @param rec_cb	Callback to handle captured audio samples.
+ * @param user_data	User data to be associated with the stream.
+ *
+ * @return		Audio stream, or NULL if failed.
+ */
+PJ_DECL(pj_snd_stream*) pj_snd_open_recorder(int index,
+					     const pj_snd_stream_info *param,
+					     pj_snd_rec_cb rec_cb,
+					     void *user_data);
+
+/**
+ * Create a new audio stream for playing audio samples.
+ *
+ * @param index		Device index, or -1 to let the library choose the first
+ *			available device, or -2 to use NULL device.
+ * @param param		Stream parameters.
+ * @param play_cb	Callback to supply audio samples.
+ * @param user_data	User data to be associated with the stream.
+ *
+ * @return		Audio stream, or NULL if failed.
+ */
+PJ_DECL(pj_snd_stream*) pj_snd_open_player(int index,
+					   const pj_snd_stream_info *param,
+					   pj_snd_play_cb play_cb,
+					   void *user_data);
+
+/**
+ * Start the stream.
+ *
+ * @param stream	The recorder or player stream.
+ *
+ * @return		Zero on success.
+ */
+PJ_DECL(pj_status_t) pj_snd_stream_start(pj_snd_stream *stream);
+
+/**
+ * Stop the stream.
+ *
+ * @param stream	The recorder or player stream.
+ *
+ * @return		Zero on success.
+ */
+PJ_DECL(pj_status_t) pj_snd_stream_stop(pj_snd_stream *stream);
+
+/**
+ * Destroy the stream.
+ *
+ * @param stream	The recorder of player stream.
+ *
+ * @return		Zero on success.
+ */
+PJ_DECL(pj_status_t) pj_snd_stream_close(pj_snd_stream *stream);
+
+/**
+ * Deinitialize sound library.
+ *
+ * @return		Zero on success.
+ */
+PJ_DECL(pj_status_t) pj_snd_deinit(void);
+
+
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+
+#endif	/* __PJMEDIA_SOUND_H__ */
Index: pjproject/trunk/pjmedia/include/pjmedia/stream.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/stream.h	(revision 121)
+++ pjproject/trunk/pjmedia/include/pjmedia/stream.h	(revision 121)
@@ -0,0 +1,99 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJMEDIA_STREAM_H__
+#define __PJMEDIA_STREAM_H__
+
+
+/**
+ * @file stream.h
+ * @brief Stream of media.
+ */
+
+#include <pjmedia/sound.h>
+#include <pjmedia/codec.h>
+#include <pjmedia/mediamgr.h>
+#include <pj/sock.h>
+
+PJ_BEGIN_DECL
+
+
+/**
+ * @defgroup PJMED_SES Media session
+ * @ingroup PJMEDIA
+ * @{
+ */
+
+typedef struct pj_media_stream_t pj_media_stream_t;
+
+/** Parameter for creating channel. */
+typedef struct pj_media_stream_create_param
+{
+    /** Codec ID, must NOT be NULL. */
+    pj_codec_id		 *codec_id;
+
+    /** Media manager, must NOT be NULL. */
+    pj_med_mgr_t	 *mediamgr;
+
+    /** Direction: IN_OUT, or IN only, or OUT only. */
+    pj_media_dir_t	  dir;
+
+    /** RTP socket. */
+    pj_sock_t		 rtp_sock;
+
+    /** RTCP socket. */
+    pj_sock_t		 rtcp_sock;
+
+    /** Address of remote */
+    pj_sockaddr_in	 *remote_addr;
+
+    /** RTP SSRC */
+    pj_uint32_t		  ssrc;
+
+    /** Jitter buffer parameters. */
+    int			  jb_min, jb_max, jb_maxcnt;
+
+} pj_media_stream_create_param;
+
+typedef struct pj_media_stream_stat
+{
+    pj_uint32_t pkt_tx, pkt_rx;	/* packets transmitted/received */
+    pj_uint32_t oct_tx, oct_rx;	/* octets transmitted/received */
+    pj_uint32_t jitter;		/* receive jitter in ms */
+    pj_uint32_t pkt_lost;	/* total packet lost count */
+} pj_media_stream_stat;
+
+PJ_DECL(pj_status_t) pj_media_stream_create (pj_pool_t *pool,
+					     pj_media_stream_t **enc_stream,
+					     pj_media_stream_t **dec_stream,
+					     pj_media_stream_create_param *param);
+PJ_DECL(pj_status_t) pj_media_stream_start (pj_media_stream_t *stream);
+PJ_DECL(pj_status_t) pj_media_stream_get_stat (const pj_media_stream_t *stream,
+					       pj_media_stream_stat *stat);
+PJ_DECL(pj_status_t) pj_media_stream_pause (pj_media_stream_t *stream);
+PJ_DECL(pj_status_t) pj_media_stream_resume (pj_media_stream_t *stream);
+PJ_DECL(pj_status_t) pj_media_stream_destroy (pj_media_stream_t *stream);
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+
+#endif	/* __PJMEDIA_STREAM_H__ */
Index: pjproject/trunk/pjmedia/src/pjmedia.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia.h	(revision 120)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/* $Id$
- *
- */
-/* 
- * PJMEDIA - Multimedia over IP Stack 
- * (C)2003-2005 Benny Prijono <bennylp@bulukucing.org>
- *
- * Author:
- *  Benny Prijono <bennylp@bulukucing.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#ifndef __PJMEDIA_H__
-#define __PJMEDIA_H__
-
-#include <pjmedia/codec.h>
-#include <pjmedia/jbuf.h>
-#include <pjmedia/mediamgr.h>
-#include <pjmedia/rtcp.h>
-#include <pjmedia/rtp.h>
-#include <pjmedia/session.h>
-#include <pjmedia/sound.h>
-#include <pjmedia/sdp.h>
-
-#endif	/* __PJMEDIA_H__ */
-
Index: pjproject/trunk/pjmedia/src/pjmedia/codec.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/codec.c	(revision 120)
+++ pjproject/trunk/pjmedia/src/pjmedia/codec.c	(revision 121)
@@ -20,4 +20,5 @@
 #include <pj/pool.h>
 #include <pj/string.h>
+#include <pj/assert.h>
 #include <pj/log.h>
 
@@ -66,5 +67,5 @@
 PJ_DEF(void) pj_codec_mgr_unregister_factory (pj_codec_mgr *mgr, pj_codec_factory *factory)
 {
-    PJ_UNUSED_ARG(mgr)
+    PJ_UNUSED_ARG(mgr);
     pj_list_erase(factory);
     enum_all_codecs (mgr);
@@ -101,5 +102,5 @@
 PJ_DEF(void) pj_codec_mgr_dealloc_codec (pj_codec_mgr *mgr, pj_codec *codec)
 {
-    PJ_UNUSED_ARG(mgr)
+    PJ_UNUSED_ARG(mgr);
     (*codec->factory->op->dealloc_codec)(codec->factory, codec);
 }
Index: pjproject/trunk/pjmedia/src/pjmedia/codec.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/codec.h	(revision 120)
+++ 	(revision )
@@ -1,353 +1,0 @@
-/* $Id$ */
-/* 
- * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
- */
-#ifndef __PJMEDIA_CODEC_H__
-#define __PJMEDIA_CODEC_H__
-
-
-/**
- * @file codec.h
- * @brief Codec framework.
- */
-
-#include <pj/list.h>
-
-PJ_BEGIN_DECL
-
-
-/**
- * @defgroup PJMED_CODEC Codec framework.
- * @ingroup PJMEDIA
- * @{
- */
-
-/** Top most media type. */
-typedef enum pj_media_type
-{
-    /** No type. */
-    PJ_MEDIA_TYPE_NONE = 0,
-
-    /** The media is audio */
-    PJ_MEDIA_TYPE_AUDIO = 1,
-
-    /** The media is video. */
-    PJ_MEDIA_TYPE_VIDEO = 2,
-
-    /** Unknown media type, in this case the name will be specified in 
-     *  encoding_name.
-     */
-    PJ_MEDIA_TYPE_UNKNOWN = 3,
-
-} pj_media_type;
-
-
-/** Media direction. */
-typedef enum pj_media_dir_t
-{
-    /** None */
-    PJ_MEDIA_DIR_NONE = 0,
-
-    /** Encoding (outgoing to network) stream */
-    PJ_MEDIA_DIR_ENCODING = 1,
-
-    /** Decoding (incoming from network) stream. */
-    PJ_MEDIA_DIR_DECODING = 2,
-
-    /** Incoming and outgoing stream. */
-    PJ_MEDIA_DIR_ENCODING_DECODING = 3,
-
-} pj_media_dir_t;
-
-
-/** Standard RTP paylist types. */
-typedef enum pj_rtp_pt
-{
-    PJ_RTP_PT_PCMU = 0,		/* audio PCMU */
-    PJ_RTP_PT_GSM  = 3,		/* audio GSM */
-    PJ_RTP_PT_G723 = 4,		/* audio G723 */
-    PJ_RTP_PT_DVI4_8K = 5,	/* audio DVI4 8KHz */
-    PJ_RTP_PT_DVI4_16K = 6,	/* audio DVI4 16Khz */
-    PJ_RTP_PT_LPC = 7,		/* audio LPC */
-    PJ_RTP_PT_PCMA = 8,		/* audio PCMA */
-    PJ_RTP_PT_G722 = 9,		/* audio G722 */
-    PJ_RTP_PT_L16_2 = 10,	/* audio 16bit linear 44.1KHz stereo */
-    PJ_RTP_PT_L16_1 = 11,	/* audio 16bit linear 44.1KHz mono */
-    PJ_RTP_PT_QCELP = 12,	/* audio QCELP */
-    PJ_RTP_PT_CN = 13,		/* audio Comfort Noise */
-    PJ_RTP_PT_MPA = 14,		/* audio MPEG1 or MPEG2 as elementary streams */
-    PJ_RTP_PT_G728 = 15,	/* audio G728 */
-    PJ_RTP_PT_DVI4_11K = 16,	/* audio DVI4 11.025KHz mono */
-    PJ_RTP_PT_DVI4_22K = 17,	/* audio DVI4 22.050KHz mono */
-    PJ_RTP_PT_G729 = 18,	/* audio G729 */
-    PJ_RTP_PT_CELB = 25,	/* video/comb Cell-B by Sun Microsystems (RFC 2029) */
-    PJ_RTP_PT_JPEG = 26,	/* video JPEG */
-    PJ_RTP_PT_NV = 28,		/* video NV implemented by nv program by Xerox */
-    PJ_RTP_PT_H261 = 31,	/* video H261 */
-    PJ_RTP_PT_MPV = 32,		/* video MPEG1 or MPEG2 elementary streams */
-    PJ_RTP_PT_MP2T = 33,	/* video MPEG2 transport */
-    PJ_RTP_PT_H263 = 34,	/* video H263 */
-
-    PJ_RTP_PT_DYNAMIC = 96,	/* start of dynamic RTP payload */
-} pj_rtp_pt;
-
-
-/** Identification used to search for codec factory that supports specific 
- *  codec specification. 
- */
-typedef struct pj_codec_id
-{
-    /** Media type. */
-    pj_media_type   type;
-
-    /** Payload type (can be dynamic). */
-    unsigned	    pt;
-
-    /** Encoding name, must be present if the payload type is dynamic. */
-    pj_str_t	    encoding_name;
-
-    /** Sampling rate. */
-    unsigned	    sample_rate;
-} pj_codec_id;
-
-
-/** Detailed codec attributes used both to configure a codec and to query
- *  the capability of codec factories.
- */
-typedef struct pj_codec_attr
-{
-    pj_uint32_t	sample_rate;	    /* Sampling rate in Hz */
-    pj_uint32_t	avg_bps;	    /* Average bandwidth in bits per second */
-
-    pj_uint8_t	pcm_bits_per_sample;/* Bits per sample in the PCM side */
-    pj_uint16_t	ptime;		    /* Packet time in miliseconds */
-
-    unsigned	pt:8;		    /* Payload type. */
-    unsigned    vad_enabled:1;	    /* Voice Activity Detector. */
-    unsigned    cng_enabled:1;	    /* Comfort Noise Generator. */
-    unsigned    lpf_enabled:1;	    /* Low pass filter */
-    unsigned    hpf_enabled:1;	    /* High pass filter */
-    unsigned    penh_enabled:1;	    /* Perceptual Enhancement */
-    unsigned    concl_enabled:1;    /* Packet loss concealment */
-    unsigned    reserved_bit:1;
-
-} pj_codec_attr;
-
-/** Types of audio frame. */
-typedef enum pj_audio_frame_type
-{
-    /** The frame is a silence audio frame. */
-    PJ_AUDIO_FRAME_SILENCE,
-
-    /** The frame is a non-silence audio frame. */
-    PJ_AUDIO_FRAME_AUDIO,
-
-} pj_audio_frame_type;
-
-typedef struct pj_codec pj_codec;
-typedef struct pj_codec_factory pj_codec_factory;
-
-
-/** This structure describes an audio frame. */
-struct pj_audio_frame
-{
-    /** Type: silence or non-silence. */
-    pj_audio_frame_type type;
-
-    /** Pointer to buffer. */
-    void	*buf;
-
-    /** Frame size in bytes. */
-    unsigned	 size;
-};
-
-/**
- * Operations that must be supported by the codec.
- */
-typedef struct pj_codec_op
-{
-    /** Get default attributes. */
-    pj_status_t (*default_attr) (pj_codec *codec, pj_codec_attr *attr);
-
-    /** Open and initialize codec using the specified attribute.
-     *  @return zero on success.
-     */
-    pj_status_t	(*init)( pj_codec *codec, pj_pool_t *pool );
-
-    /** Close and shutdown codec.
-     */
-    pj_status_t	(*open)( pj_codec *codec, pj_codec_attr *attr );
-
-    /** Close and shutdown codec.
-     */
-    pj_status_t (*close)( pj_codec *codec );
-
-    /** Encode frame.
-     */
-    pj_status_t (*encode)( pj_codec *codec, const struct pj_audio_frame *input,
-			   unsigned output_buf_len, struct pj_audio_frame *output);
-
-    /** Decode frame.
-     */
-    pj_status_t (*decode)( pj_codec *codec, const struct pj_audio_frame *input,
-			   unsigned output_buf_len, struct pj_audio_frame *output);
-
-} pj_codec_op;
-
-/**
- * A codec describes an instance to encode or decode media frames. 
- */
-struct pj_codec
-{
-    /** Entries to put this codec instance in codec factory's list. */
-    PJ_DECL_LIST_MEMBER(struct pj_codec)
-
-    /** Codec's private data. */
-    void	*codec_data;
-
-    /** Codec factory where this codec was allocated. */
-    pj_codec_factory *factory;
-
-    /** Operations to codec. */
-    pj_codec_op	*op;
-};
-
-/**
- * This structure describes operations that must be supported by codec factories.
- */
-typedef struct pj_codec_factory_op
-{
-    /** Check whether the factory can create codec with the specified ID.
-     *  @param factory The codec factory.
-     *  @param id  The codec ID.
-     *  @return zero it matches.
-     */
-    pj_status_t	(*match_id)( pj_codec_factory *factory, const pj_codec_id *id );
-
-    /** Create default attributes for the specified codec ID. This function can
-     *  be called by application to get the capability of the codec.
-     *  @param factory The codec factory.
-     *  @param id  The codec ID.
-     *  @param attr The attribute to be initialized.
-     *  @return zero if success.
-     */
-    pj_status_t (*default_attr)( pj_codec_factory *factory, const pj_codec_id *id,
-				 pj_codec_attr *attr );
-
-    /** Enumerate supported codecs.
-     *  @param factory The codec factory.
-     *  @param count Number of entries in the array.
-     *  @param codecs The codec array.
-     *  @return the total number of supported codecs, which can be less or 
-     *          greater than requested.
-     */
-    unsigned (*enum_codecs) (pj_codec_factory *factory, unsigned count, pj_codec_id codecs[]);
-
-    /** This function is called by codec manager to instantiate one codec
-     *  instance.
-     *  @param factory The codec factory.
-     *  @param id  The codec ID.
-     *  @return the instance of the codec, or NULL if codec can not be created.
-     */
-    pj_codec* (*alloc_codec)( pj_codec_factory *factory, const pj_codec_id *id);
-
-    /** This function is called by codec manager to return a particular instance
-     *  of codec back to the codec factory.
-     *  @param factory The codec factory.
-     *  @param codec The codec instance to be returned.
-     */
-    void (*dealloc_codec)( pj_codec_factory *factory, pj_codec *codec );
-
-} pj_codec_factory_op;
-
-/**
- * Codec factory describes a module that is able to create codec with specific
- * capabilities. These capabilities can be queried by codec manager to create
- * instances of codec.
- */
-struct pj_codec_factory
-{
-    /** Entries to put this structure in the codec manager list. */
-    PJ_DECL_LIST_MEMBER(struct pj_codec_factory)
-
-    /** The factory's private data. */
-    void		*factory_data;
-
-    /** Operations to the factory. */
-    pj_codec_factory_op *op;
-
-};
-
-/**
- * Declare maximum codecs
- */
-#define PJ_CODEC_MGR_MAX_CODECS	    32
-
-/**
- * Codec manager maintains codec factory etc.
- */
-typedef struct pj_codec_mgr
-{
-    pj_codec_factory factory_list;
-    unsigned	     codec_cnt;
-    pj_codec_id	     codecs[PJ_CODEC_MGR_MAX_CODECS];
-} pj_codec_mgr;
-
-/**
- * Init codec manager.
- */
-PJ_DECL(pj_status_t) 
-pj_codec_mgr_init (pj_codec_mgr *mgr);
-
-/** 
- * Register codec to codec manager. 
- */
-PJ_DECL(pj_status_t) 
-pj_codec_mgr_register_factory (pj_codec_mgr *mgr, pj_codec_factory *factory);
-
-/**
- * Unregister codec.
- */
-PJ_DECL(void) 
-pj_codec_mgr_unregister_factory (pj_codec_mgr *mgr, pj_codec_factory *factory);
-
-/**
- * Enumerate codecs.
- */
-PJ_DECL(unsigned)
-pj_codec_mgr_enum_codecs (pj_codec_mgr *mgr, unsigned count, const pj_codec_id *codecs[]);
-
-/**
- * Open codec.
- */
-PJ_DECL(pj_codec*) 
-pj_codec_mgr_alloc_codec (pj_codec_mgr *mgr, const struct pj_codec_id *id);
-
-/**
- * Close codec.
- */
-PJ_DECL(void) 
-pj_codec_mgr_dealloc_codec (pj_codec_mgr *mgr, pj_codec *codec);
-
-/**
- * @}
- */
-
-PJ_END_DECL
-
-
-#endif	/* __PJMEDIA_CODEC_H__ */
Index: pjproject/trunk/pjmedia/src/pjmedia/config.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/config.h	(revision 120)
+++ 	(revision )
@@ -1,27 +1,0 @@
-/* $Id$ */
-/* 
- * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
- */
-#ifndef __PJMED_CONFIG_H__
-#define __PJMED_CONFIG_H__
-
-/**
- * @defgroup PJMEDIA Media Stack
- */
-
-
-#endif	/* __PJMED_CONFIG_H__ */
Index: pjproject/trunk/pjmedia/src/pjmedia/g711.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/g711.c	(revision 120)
+++ pjproject/trunk/pjmedia/src/pjmedia/g711.c	(revision 121)
@@ -23,5 +23,6 @@
 #include <pj/pool.h>
 #include <pj/string.h>
-#include <string.h>	/* memset */
+#include <pj/assert.h>
+
 
 #define G711_BPS	64000
@@ -129,5 +130,5 @@
 static pj_status_t g711_match_id( pj_codec_factory *factory, const pj_codec_id *id )
 {
-    PJ_UNUSED_ARG(factory)
+    PJ_UNUSED_ARG(factory);
 
     /* It's sufficient to check payload type only. */
@@ -139,5 +140,5 @@
 				      pj_codec_attr *attr )
 {
-    PJ_UNUSED_ARG(factory)
+    PJ_UNUSED_ARG(factory);
 
     memset(attr, 0, sizeof(pj_codec_attr));
@@ -156,5 +157,5 @@
 				  unsigned count, pj_codec_id codecs[])
 {
-    PJ_UNUSED_ARG(factory)
+    PJ_UNUSED_ARG(factory);
 
     if (count > 0) {
@@ -230,6 +231,6 @@
 {
     /* There's nothing to do here really */
-    PJ_UNUSED_ARG(codec)
-    PJ_UNUSED_ARG(pool)
+    PJ_UNUSED_ARG(codec);
+    PJ_UNUSED_ARG(pool);
 
     return PJ_SUCCESS;
Index: pjproject/trunk/pjmedia/src/pjmedia/jbuf.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/jbuf.c	(revision 120)
+++ pjproject/trunk/pjmedia/src/pjmedia/jbuf.c	(revision 121)
@@ -20,5 +20,7 @@
 #include <pj/log.h>
 #include <pj/pool.h>
-#include <string.h>	/* memset() */
+#include <pj/assert.h>
+#include <pj/string.h>
+
 
 /*
@@ -68,5 +70,5 @@
     PJ_LOG(5, (THIS_FILE, "..pj_frame_list_init [lst=%p], maxcount=%d", lst, maxcount));
 
-    memset(lst, 0, sizeof(*lst));
+    pj_memset(lst, 0, sizeof(*lst));
     lst->maxcount = maxcount;
     lst->frames = pj_pool_calloc( pool, maxcount, sizeof(*lst->frames) );
Index: pjproject/trunk/pjmedia/src/pjmedia/jbuf.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/jbuf.h	(revision 120)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/* $Id$ */
-/* 
- * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
- */
-#ifndef __PJMEDIA_JBUF_H__
-#define __PJMEDIA_JBUF_H__
-
-
-/**
- * @file jbuf.h
- * @brief Adaptive jitter buffer implementation.
- */
-/**
- * @defgroup PJMED_JBUF Adaptive jitter buffer
- * @ingroup PJMEDIA
- * @{
- */
-
-#include <pj/types.h>
-
-
-PJ_BEGIN_DECL
-
-
-/**
- * Opaque declaration of internal frame type used by jitter buffer. 
- */
-struct pj_jbframe;
-
-
-/**
- * Miscelaneous operation result/status. 
- */ 
-typedef enum jb_op_status
-{
-    PJ_JB_STATUS_TOO_OLD = -2,		/** The packet is too old. */
-    PJ_JB_STATUS_TOO_SOON = -3,		/** The packet is too soon. */
-    PJ_JB_STATUS_FRAME_NULL = -4,	/** No packet can be retrieved */
-    PJ_JB_STATUS_FRAME_MISSING = -5,	/** The specified packet is missing/lost */
-} jb_op_status;
-
-
-/*
- * Frame list, container abstraction for ordered list with fixed maximum
- * size. It is used internally by the jitter buffer.
- */  
-typedef struct pj_jbframelist
-{
-    unsigned		head, count, maxcount;
-    struct pj_jbframe  *frames;
-} pj_jbframelist;
-
-
-/**
- * Jitter buffer implementation.
- */ 
-typedef struct pj_jitter_buffer
-{
-    pj_jbframelist  lst;	    /** The frame list. */
-    int		    level;	    /** Current, real-time jitter level. */
-    int		    max_level;	    /** Maximum level for the period.	 */
-    unsigned	    prefetch;	    /** Prefetch count currently used. */
-    unsigned	    get_cnt;	    /** Number of get operation during prefetch state. */
-    unsigned	    min;	    /** Minimum jitter size, in packets. */
-    unsigned	    max;	    /** Maximum jitter size, in packets. */
-    pj_uint32_t	    lastseq;	    /** Last sequence number put to jitter buffer. */
-    unsigned	    upd_count;	    /** Internal counter to manage update interval. */
-    int		    state;	    /** Jitter buffer state (1==operational) */
-    int		    last_op;	    /** Last jitter buffer operation. */
-} pj_jitter_buffer;
-
-
-/**
- * Initialize jitter buffer with the specified parameters.
- * This function will allocate internal frame buffer from the specified pool.
- * @param jb The jitter buffer to be initialized.
- * @param pool Pool where memory will be allocated for the frame buffer.
- * @param min The minimum value of jitter buffer, in packets.
- * @param max The maximum value of jitter buffer, in packets.
- * @param maxcount The maximum number of delay, in packets, which must be
- *		   greater than max.
- * @return PJ_SUCCESS on success.
- */
-PJ_DECL(pj_status_t) pj_jb_init(pj_jitter_buffer *jb, pj_pool_t *pool, 
-				unsigned min, unsigned max, unsigned maxcount);
-
-/**
- * Reset jitter buffer according to the parameters specified when the jitter
- * buffer was initialized. Any packets currently in the buffer will be 
- * discarded.
- */
-PJ_DECL(void) pj_jb_reset(pj_jitter_buffer *jb);
-
-/**
- * Put a pointer to the buffer with the specified sequence number. The pointer
- * normally points to a buffer held by application, and this pointer will be
- * returned later on when pj_jb_get() is called. The jitter buffer will not try
- * to interpret the content of this pointer.
- * @return:
- *   - PJ_SUCCESS on success.
- *   - PJ_JB_STATUS_TOO_OLD when the packet is too old.
- *   - PJ_JB_STATUS_TOO_SOON when the packet is too soon.
- */
-PJ_DECL(pj_status_t) pj_jb_put( pj_jitter_buffer *jb, pj_uint32_t extseq, void *buf );
-
-/**
- * Get the earliest data from the jitter buffer. ONLY when the operation succeeds,
- * the function returns both sequence number and a pointer in the parameters.
- * This returned data corresponds to sequence number and pointer that were
- * given to jitter buffer in the previous pj_jb_put operation.
- * @return 
- *  - PJ_SUCCESS on success
- *  - PJ_JB_STATUS_FRAME_NULL when there is no frames to be returned.
- *  - PJ_JB_STATUS_FRAME_MISSING if the jitter buffer detects that the packet 
- *     is lost. Application may run packet concealment algorithm when it 
- *     receives this status.
- */
-PJ_DECL(pj_status_t) pj_jb_get( pj_jitter_buffer *jb, pj_uint32_t *extseq, void **buf );
-
-
-
-PJ_END_DECL
-
-/**
- * @}
- */
-
-#endif	/* __PJMEDIA_JBUF_H__ */
Index: pjproject/trunk/pjmedia/src/pjmedia/mediamgr.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/mediamgr.h	(revision 120)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/* $Id$ */
-/* 
- * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
- */
-#ifndef __PJMEDIA_MEDIAMGR_H__
-#define __PJMEDIA_MEDIAMGR_H__
-
-
-/**
- * @file mediamgr.h
- * @brief Media Manager.
- */
-/**
- * @defgroup PJMED_MGR Media Manager
- * @ingroup PJMEDIA
- * @{
- *
- * The media manager acts as placeholder for endpoint capabilities. Each 
- * media manager will have a codec manager to manage list of codecs installed
- * in the endpoint and a sound device factory.
- *
- * A reference to media manager instance is required when application wants
- * to create a media session (#pj_media_session_create or 
- * #pj_media_session_create_from_sdp).
- */
-
-#include <pjmedia/sound.h>
-#include <pjmedia/codec.h>
-
-
-PJ_BEGIN_DECL
-
-
-/** Opague declaration of media manager. */
-typedef struct pj_med_mgr_t pj_med_mgr_t;
-
-/**
- * Create an instance of media manager.
- *
- * @param pf		Pool factory.
- * @param conn_addr	Connection address to be used by this media manager.
- *
- * @return A new instance of media manager, or NULL if failed.
- */
-PJ_DECL(pj_med_mgr_t*) pj_med_mgr_create (pj_pool_factory *pf);
-
-/**
- * Destroy media manager instance.
- *
- * @param mgr		Media manager instance.
- *
- * @return zero on success.
- */
-PJ_DECL(pj_status_t) pj_med_mgr_destroy (pj_med_mgr_t *mgr);
-
-/**
- * Get pool factory of the media manager as specified when the media
- * manager was created.
- *
- * @param mgr		The media manager instance.
- *
- * @return Pool factory instance of the media manager.
- */
-PJ_DECL(pj_pool_factory*) pj_med_mgr_get_pool_factory (pj_med_mgr_t *mgr);
-
-/**
- * Get the codec manager instance.
- *
- * @param mgr		The media manager instance.
- *
- * @return The instance of codec manager.
- */
-PJ_DECL(pj_codec_mgr*) pj_med_mgr_get_codec_mgr (pj_med_mgr_t *mgr);
-
-
-
-PJ_END_DECL
-
-
-/**
- * @}
- */
-
-
-
-#endif	/* __PJMEDIA_MEDIAMGR_H__ */
Index: pjproject/trunk/pjmedia/src/pjmedia/nullsound.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/nullsound.c	(revision 120)
+++ pjproject/trunk/pjmedia/src/pjmedia/nullsound.c	(revision 121)
@@ -18,110 +18,76 @@
  */
 #include <pjmedia/sound.h>
+#include <pj/assert.h>
 
-/*
- * Null Factory Operations
- */
-static pj_status_t null_sound_init(void);
-static const char *null_sound_get_name(void);
-static pj_status_t null_sound_destroy(void);
-static pj_status_t null_sound_enum_devices(int *count, char *dev_names[]);
-static pj_status_t null_sound_create_dev(const char *dev_name, pj_snd_dev *dev);
-static pj_status_t null_sound_destroy_dev(pj_snd_dev *dev);
+static pj_snd_dev_info null_info = 
+{
+    "Null Device",
+    1,
+    1,
+    8000
+};
 
 
-/*
- * Null Device Operations
- */
-static pj_status_t null_sound_dev_open( pj_snd_dev *dev, pj_snd_role_t role );
-static pj_status_t null_sound_dev_close( pj_snd_dev *dev );
-static pj_status_t null_sound_dev_play( pj_snd_dev *dev );
-static pj_status_t null_sound_dev_record( pj_snd_dev *dev );
-
-
-static pj_snd_dev_factory null_sound_factory = 
+PJ_DEF(pj_status_t) pj_snd_init(pj_pool_factory *factory)
 {
-    &null_sound_init,
-    &null_sound_get_name,
-    &null_sound_destroy,
-    &null_sound_enum_devices,
-    &null_sound_create_dev,
-    &null_sound_destroy_dev
-};
-
-static struct pj_snd_dev_op null_sound_dev_op = 
-{
-    &null_sound_dev_open,
-    &null_sound_dev_close,
-    &null_sound_dev_play,
-    &null_sound_dev_record
-};
-
-PJ_DEF(pj_snd_dev_factory*) pj_nullsound_get_factory()
-{
-    return &null_sound_factory;
+    PJ_UNUSED_ARG(factory);
+    return PJ_SUCCESS;
 }
 
-static pj_status_t null_sound_init(void)
+PJ_DEF(int) pj_snd_get_dev_count(void)
 {
-    return 0;
+    return 1;
 }
 
-static const char *null_sound_get_name(void)
+PJ_DEF(const pj_snd_dev_info*) pj_snd_get_dev_info(unsigned index)
 {
-    return "nullsound";
+    PJ_ASSERT_RETURN(index==0, NULL);
+    return &null_info;
 }
 
-static pj_status_t null_sound_destroy(void)
+PJ_DEF(pj_snd_stream*) pj_snd_open_recorder( int index,
+					     const pj_snd_stream_info *param,
+					     pj_snd_rec_cb rec_cb,
+					     void *user_data)
 {
-    return 0;
+    PJ_UNUSED_ARG(index);
+    PJ_UNUSED_ARG(param);
+    PJ_UNUSED_ARG(rec_cb);
+    PJ_UNUSED_ARG(user_data);
+    return (void*)1;
 }
 
-static pj_status_t null_sound_enum_devices(int *count, char *dev_names[])
+PJ_DEF(pj_snd_stream*) pj_snd_open_player( int index,
+					   const pj_snd_stream_info *param,
+					   pj_snd_play_cb play_cb,
+					   void *user_data)
 {
-    *count = 1;
-    dev_names[0] = "nullsound";
-    return 0;
+    PJ_UNUSED_ARG(index);
+    PJ_UNUSED_ARG(param);
+    PJ_UNUSED_ARG(play_cb);
+    PJ_UNUSED_ARG(user_data);
+    return (void*)1;
 }
 
-static pj_status_t null_sound_create_dev(const char *dev_name, pj_snd_dev *dev)
+PJ_DEF(pj_status_t) pj_snd_stream_start(pj_snd_stream *stream)
 {
-    PJ_UNUSED_ARG(dev_name);
-    dev->op = &null_sound_dev_op;
-    return 0;
+    PJ_UNUSED_ARG(stream);
+    return PJ_SUCCESS;
 }
 
-static pj_status_t null_sound_destroy_dev(pj_snd_dev *dev)
+PJ_DEF(pj_status_t) pj_snd_stream_stop(pj_snd_stream *stream)
 {
-    PJ_UNUSED_ARG(dev);
-    return 0;
+    PJ_UNUSED_ARG(stream);
+    return PJ_SUCCESS;
 }
 
-
-/*
- * Null Device Operations
- */
-static pj_status_t null_sound_dev_open( pj_snd_dev *dev, pj_snd_role_t role )
+PJ_DEF(pj_status_t) pj_snd_stream_close(pj_snd_stream *stream)
 {
-    PJ_UNUSED_ARG(dev);
-    PJ_UNUSED_ARG(role);
-    return 0;
+    PJ_UNUSED_ARG(stream);
+    return PJ_SUCCESS;
 }
 
-static pj_status_t null_sound_dev_close( pj_snd_dev *dev )
+PJ_DEF(pj_status_t) pj_snd_deinit(void)
 {
-    PJ_UNUSED_ARG(dev);
-    return 0;
+    return PJ_SUCCESS;
 }
-
-static pj_status_t null_sound_dev_play( pj_snd_dev *dev )
-{
-    PJ_UNUSED_ARG(dev);
-    return 0;
-}
-
-static pj_status_t null_sound_dev_record( pj_snd_dev *dev )
-{
-    PJ_UNUSED_ARG(dev);
-    return 0;
-}
-
Index: pjproject/trunk/pjmedia/src/pjmedia/pasound.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/pasound.c	(revision 120)
+++ pjproject/trunk/pjmedia/src/pjmedia/pasound.c	(revision 121)
@@ -61,6 +61,6 @@
     pj_status_t status;
 
-    PJ_UNUSED_ARG(output)
-    PJ_UNUSED_ARG(timeInfo)
+    PJ_UNUSED_ARG(output);
+    PJ_UNUSED_ARG(timeInfo);
 
     if (stream->quit_flag)
@@ -68,5 +68,5 @@
 
     if (stream->thread_initialized == 0) {
-	stream->thread = pj_thread_register("pa_rec", stream->thread_desc);
+	status = pj_thread_register("pa_rec", stream->thread_desc, &stream->thread);
 	stream->thread_initialized = 1;
     }
@@ -101,6 +101,6 @@
     unsigned size = frameCount * stream->bytes_per_sample;
 
-    PJ_UNUSED_ARG(input)
-    PJ_UNUSED_ARG(timeInfo)
+    PJ_UNUSED_ARG(input);
+    PJ_UNUSED_ARG(timeInfo);
 
     if (stream->quit_flag)
@@ -108,5 +108,5 @@
 
     if (stream->thread_initialized == 0) {
-	stream->thread = pj_thread_register("pa_rec", stream->thread_desc);
+	status = pj_thread_register("pa_rec", stream->thread_desc, &stream->thread);
 	stream->thread_initialized = 1;
     }
Index: pjproject/trunk/pjmedia/src/pjmedia/rtcp.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/rtcp.c	(revision 120)
+++ pjproject/trunk/pjmedia/src/pjmedia/rtcp.c	(revision 121)
@@ -20,5 +20,6 @@
 #include <pj/os.h>	/* pj_gettimeofday */
 #include <pj/sock.h>	/* pj_htonx, pj_ntohx */
-#include <string.h>	/* memset */
+#include <pj/string.h>	/* pj_memset */
+
 
 #define RTCP_SR   200
@@ -47,5 +48,5 @@
     pj_rtcp_pkt *rtcp_pkt = &s->rtcp_pkt;
     
-    memset(rtcp_pkt, 0, sizeof(pj_rtcp_pkt));
+    pj_memset(rtcp_pkt, 0, sizeof(pj_rtcp_pkt));
     
     /* Init time */
@@ -68,5 +69,5 @@
 {
     /* Nothing to do. */
-    PJ_UNUSED_ARG(session)
+    PJ_UNUSED_ARG(session);
 }
 
Index: pjproject/trunk/pjmedia/src/pjmedia/rtcp.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/rtcp.h	(revision 120)
+++ 	(revision )
@@ -1,192 +1,0 @@
-/* $Id$ */
-/* 
- * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
- */
-#ifndef __PJMEDIA_RTCP_H__
-#define __PJMEDIA_RTCP_H__
-
-/**
- * @file rtcp.h
- * @brief RTCP implementation.
- */
-
-#include <pj/types.h>
-#include <pjmedia/rtp.h>
-
-PJ_BEGIN_DECL
-
-
-/**
- * @defgroup PJMED_RTCP RTCP
- * @ingroup PJMEDIA
- * @{
- */
-
-/**
- * RTCP sender report.
- */
-struct pj_rtcp_sr
-{
-    pj_uint32_t	    ssrc;
-    pj_uint32_t	    ntp_sec;
-    pj_uint32_t	    ntp_frac;
-    pj_uint32_t	    rtp_ts;
-    pj_uint32_t	    sender_pcount;
-    pj_uint32_t	    sender_bcount;
-};
-
-typedef struct pj_rtcp_sr pj_rtcp_sr;
-
-/**
- * RTCP receiver report.
- */
-struct pj_rtcp_rr
-{
-    pj_uint32_t	    ssrc;
-#if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN!=0
-    pj_uint32_t	    fract_lost:8;
-    pj_uint32_t	    total_lost_2:8;
-    pj_uint32_t	    total_lost_1:8;
-    pj_uint32_t	    total_lost_0:8;
-#else
-    pj_uint32_t	    fract_lost:8;
-    pj_uint32_t	    total_lost_0:8;
-    pj_uint32_t	    total_lost_1:8;
-    pj_uint32_t	    total_lost_2:8;
-#endif	
-    pj_uint32_t	    last_seq;
-    pj_uint32_t	    jitter;
-    pj_uint32_t	    lsr;
-    pj_uint32_t	    dlsr;
-};
-
-typedef struct pj_rtcp_rr pj_rtcp_rr;
-
-/**
- * RTCP common header.
- */
-struct pj_rtcp_common
-{
-#if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN!=0
-    unsigned	    version:2;	/* packet type            */
-    unsigned	    p:1;	/* padding flag           */
-    unsigned	    count:5;	/* varies by payload type */
-    unsigned	    pt:8;	/* payload type           */
-#else
-    unsigned	    count:5;	/* varies by payload type */
-    unsigned	    p:1;	/* padding flag           */
-    unsigned	    version:2;	/* packet type            */
-    unsigned	    pt:8;	/* payload type           */
-#endif
-    pj_uint16_t	    length;	/* packet length          */
-};
-
-typedef struct pj_rtcp_common pj_rtcp_common;
-
-/**
- * RTCP packet.
- */
-struct pj_rtcp_pkt
-{
-    pj_rtcp_common  common;	
-    pj_rtcp_sr	    sr;
-    pj_rtcp_rr	    rr;		/* variable-length list */
-};
-
-typedef struct pj_rtcp_pkt pj_rtcp_pkt;
-
-/**
- * NTP time representation.
- */
-struct pj_rtcp_ntp_rec
-{
-    pj_uint32_t	    hi;
-    pj_uint32_t	    lo;
-};
-
-typedef struct pj_rtcp_ntp_rec pj_rtcp_ntp_rec;
-
-/**
- * RTCP session.
- */
-struct pj_rtcp_session
-{
-    pj_rtcp_pkt		rtcp_pkt;
-    
-    pj_rtp_seq_session	seq_ctrl;
-
-    pj_uint32_t		received;       /* packets received */
-    pj_uint32_t		expected_prior; /* packet expected at last interval */
-    pj_uint32_t		received_prior; /* packet received at last interval */
-    pj_int32_t		transit;        /* relative trans time for prev pkt */
-    pj_uint32_t		jitter;		/* estimated jitter */
-    
-    pj_rtcp_ntp_rec	rtcp_lsr;	/* NTP timestamp in last sender report received */
-    unsigned 		rtcp_lsr_time;  /* Time when last RTCP SR is received. */
-    unsigned 		peer_ssrc;	/* Peer SSRC */
-    
-};
-
-typedef struct pj_rtcp_session pj_rtcp_session;
-
-/**
- * Init RTCP session.
- * @param session The session
- * @param ssrc The SSRC used in to identify the session.
- */
-PJ_DECL(void) pj_rtcp_init( pj_rtcp_session *session, pj_uint32_t ssrc );
-
-/**
- * Deinit RTCP session.
- * @param session The session.
- */
-PJ_DECL(void) pj_rtcp_fini( pj_rtcp_session *session);
-
-/**
- * Call this function everytime an RTP packet is received to let the RTCP
- * session do its internal calculations.
- * @param session The session.
- * @param seq The RTP packet sequence number, in host byte order.
- * @param ts The RTP packet timestamp, in host byte order.
- */
-PJ_DECL(void) pj_rtcp_rx_rtp( pj_rtcp_session *session, pj_uint16_t seq, pj_uint32_t ts );
-
-/**
- * Call this function everytime an RTP packet is sent to let the RTCP session
- * do its internal calculations.
- * @param session The session.
- * @param bytes_payload_size The payload size of the RTP packet (ie packet minus
- *             RTP header).
- */
-PJ_DECL(void) pj_rtcp_tx_rtp( pj_rtcp_session *session, pj_uint16_t bytes_payload_size );
-
-/**
- * Build a RTCP SR/RR packet to be transmitted to remote RTP peer.
- * @param session The session.
- * @param rtcp_pkt [output] Upon return, it will contain pointer to the RTCP packet.
- * @param len [output] Upon return, it will indicate the size of the RTCP packet.
- */
-PJ_DECL(void) pj_rtcp_build_rtcp( pj_rtcp_session *session, pj_rtcp_pkt **rtcp_pkt, int *len );
-
-/**
- * @}
- */
-
-PJ_END_DECL
-
-
-#endif	/* __PJMEDIA_RTCP_H__ */
Index: pjproject/trunk/pjmedia/src/pjmedia/rtp.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/rtp.c	(revision 120)
+++ pjproject/trunk/pjmedia/src/pjmedia/rtp.c	(revision 121)
@@ -21,5 +21,7 @@
 #include <pj/os.h>	/* pj_gettimeofday() */
 #include <pj/sock.h>	/* pj_htonx, pj_htonx */
-#include <string.h>	/* memset() */
+#include <pj/assert.h>
+#include <pj/string.h>
+
 
 #define THIS_FILE   "rtp.c"
@@ -62,5 +64,5 @@
 
     /* Build default header for outgoing RTP packet. */
-    memset(ses, 0, sizeof(*ses));
+    pj_memset(ses, 0, sizeof(*ses));
     ses->out_hdr.v = RTP_VERSION;
     ses->out_hdr.p = 0;
Index: pjproject/trunk/pjmedia/src/pjmedia/rtp.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/rtp.h	(revision 120)
+++ 	(revision )
@@ -1,256 +1,0 @@
-/* $Id$ */
-/* 
- * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
- */
-#ifndef __PJMEDIA_RTP_H__
-#define __PJMEDIA_RTP_H__
-
-#include <pj/types.h>
-
-/**
- * @file rtp.h
- * @brief RTP implementation.
- */
-
-PJ_BEGIN_DECL
-
-
-/**
- * @defgroup PJMED_RTP RTP
- * @ingroup PJMEDIA
- * @{
- *
- * The RTP module is designed to be dependent only to PJLIB, it does not depend
- * on any other parts of PJMEDIA library. The RTP module does not even depend
- * on any transports (sockets), to promote even more use.
- *
- * An RTCP implementation is also separated from this module.
- *
- * The functions that are provided by this module:
- *  - creating RTP header for each outgoing packet.
- *  - decoding RTP packet into RTP header and payload.
- *  - provide simple RTP session management (sequence number, etc.)
- *
- * The RTP module does not use any dynamic memory at all.
- *
- * \section P1 How to Use the RTP Module
- * 
- * First application must call #pj_rtp_session_init to initialize the RTP 
- * session.
- *
- * When application wants to send RTP packet, it needs to call 
- * #pj_rtp_encode_rtp to build the RTP header. Note that this WILL NOT build
- * the complete RTP packet, but instead only the header. Application can
- * then either concatenate the header with the payload, or send the two
- * fragments (the header and the payload) using scatter-gather transport API
- * (e.g. \a sendv()).
- *
- * When application receives an RTP packet, first it should call
- * #pj_rtp_decode_rtp to decode RTP header and payload, then it should call
- * #pj_rtp_session_update to check whether we can process the RTP payload,
- * and to let the RTP session updates its internal status. The decode function
- * is guaranteed to point the payload to the correct position regardless of
- * any options present in the RTP packet.
- *
- */
-
-
-#ifdef _MSC_VER
-#  pragma warning ( disable : 4214 )
-#endif
-
-
-/**
- * Error codes.
- */
-enum pj_rtp_error_t
-{
-    PJ_RTP_ERR_RTP_PACKING,	    /**< Invalid RTP packet. */
-    PJ_RTP_ERR_INVALID_VERSION,	    /**< Invalid RTP version. */
-    PJ_RTP_ERR_INVALID_SSRC,	    /**< Invalid SSRC. */
-    PJ_RTP_ERR_INVALID_PT,	    /**< Invalid payload type. */
-    PJ_RTP_ERR_INVALID_PACKET,	    /**< Invalid packet. */
-    PJ_RTP_ERR_SESSION_RESTARTED,   /**< Session has just been restarted. */
-    PJ_RTP_ERR_SESSION_PROBATION,   /**< Session in probation. */
-    PJ_RTP_ERR_BAD_SEQUENCE,	    /**< Bad RTP sequence number. */
-};
-
-#pragma pack(1)
-/**
- * RTP packet header.
- */
-struct pj_rtp_hdr
-{
-#if defined(PJ_IS_BIG_ENDIAN) && (PJ_IS_BIG_ENDIAN!=0)
-    pj_uint16_t v:2;	/**< packet type/version	    */
-    pj_uint16_t p:1;	/**< padding flag		    */
-    pj_uint16_t x:1;	/**< extension flag	    */
-    pj_uint16_t cc:4;	/**< CSRC count		    */
-    pj_uint16_t m:1;	/**< marker bit		    */
-    pj_uint16_t pt:7;	/**< payload type		    */
-#else
-    pj_uint16_t cc:4;	/**< CSRC count		    */
-    pj_uint16_t x:1;	/**< header extension flag    */ 
-    pj_uint16_t p:1;	/**< padding flag		    */
-    pj_uint16_t v:2;	/**< packet type/version	    */
-    pj_uint16_t pt:7;	/**< payload type		    */
-    pj_uint16_t m:1;	/**< marker bit		    */
-#endif
-    pj_uint16_t seq;	/**< sequence number	    */
-    pj_uint32_t ts;	/**< timestamp		    */
-    pj_uint32_t ssrc;	/**< synchronization source   */
-};
-#pragma pack()
-
-typedef struct pj_rtp_hdr pj_rtp_hdr;
-
-/**
- * RTP extendsion header.
- */
-struct pj_rtp_ext_hdr
-{
-    pj_uint16_t	profile_data;
-    pj_uint16_t	length;
-};
-
-typedef struct pj_rtp_ext_hdr pj_rtp_ext_hdr;
-
-/**
- * A generic sequence number management, used by both RTP and RTCP.
- */
-struct pj_rtp_seq_session
-{
-    pj_uint16_t	    max_seq;	    /**< highest sequence number heard */
-    pj_uint32_t	    cycles;	    /**< shifted count of seq. number cycles */
-    pj_uint32_t	    base_seq;	    /**< base seq number */
-    pj_uint32_t	    bad_seq;        /**< last 'bad' seq number + 1 */
-    pj_uint32_t	    probation;      /**< sequ. packets till source is valid */
-};
-
-typedef struct pj_rtp_seq_session pj_rtp_seq_session;
-
-/**
- * RTP session descriptor.
- */
-struct pj_rtp_session
-{
-    pj_rtp_hdr		out_hdr;    /**< Saved header for outgoing packets. */
-    pj_rtp_seq_session	seq_ctrl;   /**< Sequence number management. */
-    pj_uint16_t	        out_pt;	    /**< Default outgoing payload type. */
-    pj_uint32_t	        out_extseq; /**< Outgoing extended sequence number. */
-    pj_uint32_t	        peer_ssrc;  /**< Peer SSRC. */
-    pj_uint32_t	        received;   /**< Number of received packets. */
-};
-
-typedef struct pj_rtp_session pj_rtp_session;
-
-/**
- * \brief Initialize RTP session.
- * This function will initialize the RTP session according to given parameters.
- *
- * @param ses		The session.
- * @param default_pt	Default payload type.
- * @param sender_ssrc	SSRC used for outgoing packets.
- *
- * @return zero if successfull.
- */
-PJ_DECL(pj_status_t) pj_rtp_session_init( pj_rtp_session *ses,
-					  int default_pt, pj_uint32_t sender_ssrc );
-
-/**
- * \brief Encode outgoing RTP packet header.
- * Create the RTP header based on arguments and current state of the RTP
- * session.
- *
- * @param ses		The session.
- * @param pt		Payload type.
- * @param m		Marker flag.
- * @param payload_len	Payload length in bytes.
- * @param ts_len	Timestamp length.
- * @param rtphdr	Upon return will point to RTP packet header.
- * @param hdrlen	Upon return will indicate the size of RTP packet header
- *
- * @return zero if successfull.
- */
-PJ_DECL(pj_status_t) pj_rtp_encode_rtp( pj_rtp_session *ses, int pt, int m,
-				        int payload_len, int ts_len,
-					const void **rtphdr, int *hdrlen );
-
-/**
- * \brief Decode an incoming RTP packet.
- * This function will decode incoming packet into RTP header and payload.
- * The decode function is guaranteed to point the payload to the correct 
- * position regardless of any options present in the RTP packet.
- *
- * @param ses		The session.
- * @param pkt		The received RTP packet.
- * @param pkt_len	The length of the packet.
- * @param hdr		Upon return will point to the location of the RTP header
- *			inside the packet.
- * @param payload	Upon return will point to the location of the
- *			payload inside the packet.
- * @param payloadlen	Upon return will indicate the size of the payload.
- *
- * @return zero if successfull.
- */
-PJ_DECL(pj_status_t) pj_rtp_decode_rtp( pj_rtp_session *ses, 
-				        const void *pkt, int pkt_len,
-					const pj_rtp_hdr **hdr,
-					const void **payload,
-					unsigned *payloadlen);
-
-/**
- * \brief Update RTP session with an incoming RTP packet. 
- * Call this function everytime
- * an RTP packet is received to check whether the packet can be received and to
- * let the RTP session performs its internal calculations.
- *
- * @param ses	    The session.
- * @param hdr	    The RTP header of the incoming packet.
- *
- * @return zero if the packet is valid and can be processed, otherwise will
- *         return one of the error in #pj_rtp_error_t.
- */
-PJ_DECL(pj_status_t) pj_rtp_session_update( pj_rtp_session *ses, 
-					    const pj_rtp_hdr *hdr);
-
-/** 
-* \brief Internal.
- * Internal function for sequence control, shared by RTCP implementation. 
- */
-void pj_rtp_seq_init(pj_rtp_seq_session *seq_ctrl, pj_uint16_t seq);
-
-/** 
-* \brief Internal.
- * Internal function for sequence control, shared by RTCP implementation. 
- */
-void pj_rtp_seq_restart(pj_rtp_seq_session *seq_ctrl, pj_uint16_t seq);
-
-/** 
-* \brief Internal.
- * Internal function for sequence control, shared by RTCP implementation. 
- */
-int  pj_rtp_seq_update(pj_rtp_seq_session *seq_ctrl, pj_uint16_t seq);
-
-/**
- * @}
- */
-
-PJ_END_DECL
-
-
-#endif	/* __PJMEDIA_RTP_H__ */
Index: pjproject/trunk/pjmedia/src/pjmedia/sdp.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/sdp.c	(revision 120)
+++ pjproject/trunk/pjmedia/src/pjmedia/sdp.c	(revision 121)
@@ -18,5 +18,5 @@
  */
 #include <pjmedia/sdp.h>
-#include <pj/scanner.h>
+#include <pjlib-util/scanner.h>
 #include <pj/except.h>
 #include <pj/log.h>
@@ -24,4 +24,5 @@
 #include <pj/string.h>
 #include <pj/pool.h>
+#include <pj/assert.h>
 
 enum {
@@ -124,5 +125,6 @@
  */
 static int is_initialized;
-static pj_char_spec cs_token;
+static pj_cis_buf_t cis_buf;
+static pj_cis_t cs_token;
 
 static void init_sdp_parser(void)
@@ -134,7 +136,10 @@
 	}
     }
-    pj_cs_add_alpha(cs_token);
-    pj_cs_add_num(cs_token);
-    pj_cs_add_str( cs_token, TOKEN);
+
+    pj_cis_buf_init(&cis_buf);
+    pj_cis_init(&cis_buf, &cs_token);
+    pj_cis_add_alpha(&cs_token);
+    pj_cis_add_num(&cs_token);
+    pj_cis_add_str(&cs_token, TOKEN);
 }
 
@@ -203,7 +208,7 @@
 static int print_name_only_attr(const pjsdp_attr *attr, char *buf, int len)
 {
-    PJ_UNUSED_ARG(attr)
-    PJ_UNUSED_ARG(buf)
-    PJ_UNUSED_ARG(len)
+    PJ_UNUSED_ARG(attr);
+    PJ_UNUSED_ARG(buf);
+    PJ_UNUSED_ARG(len);
     return 0;
 }
@@ -707,10 +712,10 @@
 
     /* port */
-    pj_scan_get(scanner, cs_token, &str);
+    pj_scan_get(scanner, &cs_token, &str);
     med->desc.port = (unsigned short)pj_strtoul(&str);
-    if (*scanner->current == '/') {
+    if (*scanner->curptr == '/') {
 	/* port count */
 	pj_scan_get_char(scanner);
-	pj_scan_get(scanner, cs_token, &str);
+	pj_scan_get(scanner, &cs_token, &str);
 	med->desc.port_count = pj_strtoul(&str);
 
@@ -728,7 +733,7 @@
     /* format list */
     med->desc.fmt_count = 0;
-    while (*scanner->current == ' ') {
+    while (*scanner->curptr == ' ') {
 	pj_scan_get_char(scanner);
-	pj_scan_get(scanner, cs_token, &med->desc.fmt[med->desc.fmt_count++]);
+	pj_scan_get(scanner, &cs_token, &med->desc.fmt[med->desc.fmt_count++]);
     }
 
@@ -752,8 +757,8 @@
     pj_scan_get_until_ch(scanner, '/', &rtpmap->encoding_name);
     pj_scan_get_char(scanner);
-    pj_scan_get(scanner, cs_token, &str);
+    pj_scan_get(scanner, &cs_token, &str);
     rtpmap->clock_rate = pj_strtoul(&str);
 
-    if (*scanner->current == '/') {
+    if (*scanner->curptr == '/') {
 	pj_scan_get_char(scanner);
 	pj_scan_get_until_ch(scanner, '\r', &rtpmap->parameter);
@@ -794,5 +799,5 @@
     pjsdp_attr *attr;
 
-    PJ_UNUSED_ARG(scanner)
+    PJ_UNUSED_ARG(scanner);
     attr = pj_pool_calloc(pool, 1, sizeof(*attr));
     return attr;
@@ -825,5 +830,5 @@
     
     /* get attr name. */
-    pj_scan_get(scanner, cs_token, &attrname);
+    pj_scan_get(scanner, &cs_token, &attrname);
 
     /* find entry to handle attrname */
@@ -852,5 +857,5 @@
 static void on_scanner_error(pj_scanner *scanner)
 {
-    PJ_UNUSED_ARG(scanner)
+    PJ_UNUSED_ARG(scanner);
 
     PJ_THROW(SYNTAX_ERROR);
@@ -879,5 +884,5 @@
     PJ_TRY {
 	while (!pj_scan_is_eof(&scanner)) {
-		cur_name = *scanner.current;
+		cur_name = *scanner.curptr;
 		switch (cur_name) {
 		case 'a':
@@ -925,7 +930,7 @@
     PJ_CATCH(SYNTAX_ERROR) {
 	PJ_LOG(2, (LOG_THIS, "Syntax error in SDP parser '%c' line %d col %d",
-		cur_name, scanner.line, scanner.col));
+		cur_name, scanner.line, pj_scan_get_col(&scanner)));
 	if (!pj_scan_is_eof(&scanner)) {
-	    if (*scanner.current != '\r') {
+	    if (*scanner.curptr != '\r') {
 		pj_scan_get_until_ch(&scanner, '\r', &dummy);
 	    }
Index: pjproject/trunk/pjmedia/src/pjmedia/sdp.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/sdp.h	(revision 120)
+++ 	(revision )
@@ -1,332 +1,0 @@
-/* $Id$ */
-/* 
- * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
- */
-#ifndef __PJSDP_SDP_H__
-#define __PJSDP_SDP_H__
-
-/**
- * @defgroup PJSDP SDP Library
- */
-/**
- * @file sdp.h
- * @brief SDP header file.
- */
-/**
- * @defgroup PJ_SDP_H SDP stack.
- * @ingroup PJSDP
- * @{
- *
- * This SDP module consists of SDP parser, SDP structure, and function to
- * print back the structure as SDP message.
- */
-
-#include <pj/types.h>
-
-PJ_BEGIN_DECL
-
-#define PJSDP_MAX_FMT	32
-#define PJSDP_MAX_ATTR	32
-#define PJSDP_MAX_MEDIA	16
-
-/**
- * This enumeration describes the attribute type.
- */
-typedef enum pjsdp_attr_type_e
-{
-    PJSDP_ATTR_RTPMAP,
-    PJSDP_ATTR_CAT,
-    PJSDP_ATTR_KEYWORDS,
-    PJSDP_ATTR_TOOL,
-    PJSDP_ATTR_PTIME,
-    PJSDP_ATTR_RECV_ONLY,
-    PJSDP_ATTR_SEND_ONLY,
-    PJSDP_ATTR_SEND_RECV,
-    PJSDP_ATTR_ORIENT,
-    PJSDP_ATTR_TYPE,
-    PJSDP_ATTR_CHARSET,
-    PJSDP_ATTR_SDP_LANG,
-    PJSDP_ATTR_LANG,
-    PJSDP_ATTR_FRAME_RATE,
-    PJSDP_ATTR_QUALITY,
-    PJSDP_ATTR_FMTP,
-    PJSDP_ATTR_INACTIVE,
-    PJSDP_ATTR_GENERIC,
-    PJSDP_END_OF_ATTR,
-} pjsdp_attr_type_e;
-
-
-/**
- * This structure keeps the common attributes that all 'descendants' 
- * will have.
- */
-typedef struct pjsdp_attr
-{
-    pjsdp_attr_type_e	type;	/**< Attribute type. */
-} pjsdp_attr;
-
-
-/**
- * This is the structure to represent generic attribute which has a 
- * string value.
- */
-typedef struct pjsdp_attr_string
-{
-    pjsdp_attr_type_e	type;
-    pj_str_t		value;
-} pjsdp_attr_string;
-
-
-/**
- * This is the structure to represent generic SDP attribute which has
- * a numeric value.
- */
-typedef struct pjsdp_attr_num
-{
-    pjsdp_attr_type_e	type;
-    pj_uint32_t		value;
-} pjsdp_attr_num;
-
-
-/**
- * SDP \a rtpmap attribute.
- */
-typedef struct pjsdp_rtpmap_attr
-{
-    pjsdp_attr_type_e	type;
-    unsigned		payload_type;
-    pj_str_t		encoding_name;
-    unsigned		clock_rate;
-    pj_str_t		parameter;
-} pjsdp_rtpmap_attr;
-
-
-/**
- * SDP \a fmtp attribute.
- */
-typedef struct pjsdp_fmtp_attr
-{
-    pjsdp_attr_type_e	type;
-    pj_str_t		format;
-    pj_str_t		param;
-} pjsdp_fmtp_attr;
-
-
-/** 
- * SDP generic attribute.
- */
-typedef struct pjsdp_generic_attr
-{
-    pjsdp_attr_type_e	type;
-    pj_str_t		name;
-    pj_str_t		value;
-} pjsdp_generic_attr;
-
-
-/** SDP \a cat attribute. */
-typedef struct pjsdp_attr_string pjsdp_cat_attr;
-
-/** SDP \a keywds attribute. */
-typedef struct pjsdp_attr_string pjsdp_keywds_attr;
-
-/** SDP \a tool attribute. */
-typedef struct pjsdp_attr_string pjsdp_tool_attr;
-
-/** SDP \a ptime attribute. */
-typedef struct pjsdp_attr_num pjsdp_ptime_attr;
-
-/** SDP \a recvonly attribute. */
-typedef struct pjsdp_attr pjsdp_recv_only_attr;
-
-/** SDP \a sendonly attribute. */
-typedef struct pjsdp_attr pjsdp_send_only_attr;
-
-/** SDP \a sendrecv attribute. */
-typedef struct pjsdp_attr pjsdp_send_recv_attr;
-
-/** SDP \a orient attribute. */
-typedef struct pjsdp_attr_string pjsdp_orient_attr;
-
-/** SDP \a type attribute. */
-typedef struct pjsdp_attr_string pjsdp_type_attr;
-
-/** SDP \a charset attribute. */
-typedef struct pjsdp_attr_string pjsdp_charset_attr;
-
-/** SDP \a sdplang attribute. */
-typedef struct pjsdp_attr_string pjsdp_sdp_lang_attr;
-
-/** SDP \a lang attribute. */
-typedef struct pjsdp_attr_string pjsdp_lang_attr;
-
-/** SDP \a framerate attribute. */
-typedef struct pjsdp_attr_string pjsdp_frame_rate_attr;
-
-/** SDP \a quality attribute. */
-typedef struct pjsdp_attr_num pjsdp_quality_attr;
-
-/** SDP \a inactive attribute. */
-typedef struct pjsdp_attr pjsdp_inactive_attr;
-
-/** Clone attribute */
-PJ_DECL(pjsdp_attr*) pjsdp_attr_clone (pj_pool_t *pool, const pjsdp_attr *rhs);
-
-/** Find attribute */
-PJ_DECL(const pjsdp_attr*) pjsdp_attr_find (int count, const pjsdp_attr *attr_array[], int type);
-
-/**
- * SDP connection info.
- */
-typedef struct pjsdp_conn_info
-{
-    pj_str_t	net_type;
-    pj_str_t	addr_type;
-    pj_str_t	addr;
-} pjsdp_conn_info;
-
-/** 
- *Clone connection info. 
- * 
- * @param pool	    Pool to allocate memory for the new connection info.
- * @param rhs	    The connection into to clone.
- *
- * @return the new connection info.
- */
-PJ_DECL(pjsdp_conn_info*) pjsdp_conn_info_clone (pj_pool_t *pool, 
-						 const pjsdp_conn_info *rhs);
-
-/**
- * SDP media description.
- */
-typedef struct pjsdp_media_desc
-{
-    struct
-    {
-	pj_str_t    media;
-	pj_uint16_t port;
-	unsigned    port_count;
-	pj_str_t    transport;
-	unsigned    fmt_count;
-	pj_str_t    fmt[PJSDP_MAX_FMT];
-    } desc;
-
-    pjsdp_conn_info *conn;
-    unsigned	    attr_count;
-    pjsdp_attr	   *attr[PJSDP_MAX_ATTR];
-
-} pjsdp_media_desc;
-
-/** 
- * Clone SDP media description. 
- *
- * @param pool	    Pool to allocate memory for the new media description.
- * @param rhs	    The media descriptin to clone.
- *
- * @return a new media description.
- */
-PJ_DECL(pjsdp_media_desc*) pjsdp_media_desc_clone (pj_pool_t *pool, 
-						   const pjsdp_media_desc *rhs);
-
-/** 
- * Check if the media description has the specified attribute.
- *
- * @param m		The SDP media description.
- * @param attr_type	The attribute type.
- *
- * @return nonzero if true.
- */
-PJ_DECL(pj_bool_t) pjsdp_media_desc_has_attr (const pjsdp_media_desc *m, 
-					      pjsdp_attr_type_e attr_type);
-
-/** 
- * Find rtpmap attribute for the specified payload type. 
- *
- * @param m	    The SDP media description.
- * @param pt	    RTP payload type.
- *
- * @return the SDP rtpmap attribute for the payload type, or NULL if not found.
- */
-PJ_DECL(const pjsdp_rtpmap_attr*) 
-pjsdp_media_desc_find_rtpmap (const pjsdp_media_desc *m, unsigned pt);
-
-
-/**
- * This structure describes SDP session description.
- */
-typedef struct pjsdp_session_desc
-{
-    struct
-    {
-	pj_str_t    user;
-	pj_uint32_t id;
-	pj_uint32_t version;
-	pj_str_t    net_type;
-	pj_str_t    addr_type;
-	pj_str_t    addr;
-    } origin;
-
-    pj_str_t	     name;
-    pjsdp_conn_info *conn;
-    
-    struct
-    {
-	pj_uint32_t start;
-	pj_uint32_t stop;
-    } time;
-
-    unsigned	    attr_count;
-    pjsdp_attr	   *attr[PJSDP_MAX_ATTR];
-
-    unsigned	      media_count;
-    pjsdp_media_desc *media[PJSDP_MAX_MEDIA];
-
-} pjsdp_session_desc;
-
-
-/**
- * Parse SDP message.
- *
- * @param buf	    The message buffer.
- * @param len	    The length of the message.
- * @param pool	    The pool to allocate SDP session description.
- *
- * @return SDP session description.
- */
-PJ_DECL(pjsdp_session_desc*) pjsdp_parse( char *buf, pj_size_t len, 
-					  pj_pool_t *pool);
-
-/**
- * Print SDP description to a buffer.
- *
- * @param buf	    The buffer.
- * @param size	    The buffer length.
- * @param desc	    The SDP session description.
- *
- * @return the length printed, or -1.
- */
-PJ_DECL(int) pjsdp_print( const pjsdp_session_desc *desc, 
-			  char *buf, pj_size_t size);
-
-
-/**
- * @}
- */
-
-PJ_END_DECL
-
-#endif	/* __PJSDP_SDP_H__ */
-
Index: pjproject/trunk/pjmedia/src/pjmedia/session.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/session.c	(revision 120)
+++ pjproject/trunk/pjmedia/src/pjmedia/session.c	(revision 121)
@@ -22,4 +22,6 @@
 #include <pj/pool.h>
 #include <pj/string.h>
+#include <pj/assert.h>
+
 
 typedef struct pj_media_stream_desc
@@ -772,5 +774,5 @@
     scp.rtcp_sock = sd->info.sock_info.rtcp_sock;
     scp.remote_addr = pj_pool_calloc (session->pool, 1, sizeof(pj_sockaddr_in));
-    pj_sockaddr_init (scp.remote_addr, &sd->info.rem_addr, sd->info.rem_port);
+    pj_sockaddr_in_init(scp.remote_addr, &sd->info.rem_addr, sd->info.rem_port);
     scp.ssrc = tv.sec;
     scp.jb_min = 1;
Index: pjproject/trunk/pjmedia/src/pjmedia/session.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/session.h	(revision 120)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/* $Id$ */
-/* 
- * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
- */
-#ifndef __PJMEDIA_SESSION_H__
-#define __PJMEDIA_SESSION_H__
-
-
-/**
- * @file session.h
- * @brief Media Session.
- */
-
-#include <pj/types.h>
-#include <pjmedia/mediamgr.h>
-#include <pjmedia/stream.h>
-#include <pjmedia/sdp.h>
-
-PJ_BEGIN_DECL 
-
-/**
- * @defgroup PJMED_SES Media session
- * @ingroup PJMEDIA
- * @{
- */
-
-/** Opaque declaration of media session. */
-typedef struct pj_media_session_t pj_media_session_t;
-
-/** Media socket info. */
-typedef struct pj_media_sock_info
-{
-    pj_sock_t	    rtp_sock, rtcp_sock;
-    pj_sockaddr_in  rtp_addr_name;
-} pj_media_sock_info;
-
-/** Stream info. */
-typedef struct pj_media_stream_info
-{
-    pj_str_t		type;
-    pj_media_dir_t	dir;
-    pj_str_t		transport;
-    pj_media_sock_info	sock_info;
-    pj_str_t		rem_addr;
-    unsigned short	rem_port;
-    unsigned		fmt_cnt;
-    pj_codec_id		fmt[PJSDP_MAX_FMT];
-
-} pj_media_stream_info;
-
-/** Flag for modifying stream. */
-enum
-{
-    PJ_MEDIA_STREAM_MODIFY_DIR = 1,
-};
-
-/**
- * Create new session offering.
- */
-PJ_DECL(pj_media_session_t*) 
-pj_media_session_create ( pj_med_mgr_t *mgr, const pj_media_sock_info *skinfo );
-
-/**
- * Create new session based on peer's offering.
- */
-PJ_DECL(pj_media_session_t*) 
-pj_media_session_create_from_sdp ( pj_med_mgr_t *mgr, const pjsdp_session_desc *sdp,
-				   const pj_media_sock_info *skinfo);
-
-/**
- * Duplicate session. The new session is inactive.
- */
-PJ_DECL(pj_media_session_t*)
-pj_media_session_clone (const pj_media_session_t *session);
-
-/**
- * Create SDP description from the session.
- */
-PJ_DECL(pjsdp_session_desc*)
-pj_media_session_create_sdp ( const pj_media_session_t *session, pj_pool_t *pool,
-			      pj_bool_t only_first_fmt);
-
-/**
- * Update session with SDP answer from peer. The session must NOT active.
- */
-PJ_DECL(pj_status_t)
-pj_media_session_update ( pj_media_session_t *session, 
-			  const pjsdp_session_desc *sdp);
-
-/**
- * Enumerate media streams in the session.
- * @return the actual number of streams.
- */
-PJ_DECL(unsigned)
-pj_media_session_enum_streams (const pj_media_session_t *session, 
-			       unsigned count, const pj_media_stream_info *info[]);
-
-/**
- * Get stream statistics.
- */
-PJ_DECL(pj_status_t)
-pj_media_session_get_stat (const pj_media_session_t *session, unsigned index,
-			   pj_media_stream_stat *tx_stat,
-			   pj_media_stream_stat *rx_stat);
-
-/**
- * Modify stream, only when stream is inactive.
- */
-PJ_DECL(pj_status_t)
-pj_media_session_modify_stream (pj_media_session_t *session, unsigned index,
-				unsigned modify_flag, const pj_media_stream_info *info);
-
-/**
- * Activate all streams in media session.
- */
-PJ_DECL(pj_status_t)
-pj_media_session_activate (pj_media_session_t *session);
-
-/**
- * Activate individual stream in media session.
- */
-PJ_DECL(pj_status_t)
-pj_media_session_activate_stream (pj_media_session_t *session, unsigned index);
-
-/**
- * Destroy media session.
- */
-PJ_DECL(pj_status_t)
-pj_media_session_destroy (pj_media_session_t *session);
-
-
-/**
- * @}
- */
-
-PJ_END_DECL
-
-#endif	/* __PJMEDIA_SESSION_H__ */
Index: pjproject/trunk/pjmedia/src/pjmedia/sound.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/sound.h	(revision 120)
+++ 	(revision )
@@ -1,201 +1,0 @@
-/* $Id$ */
-/* 
- * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
- */
-#ifndef __PJMEDIA_SOUND_H__
-#define __PJMEDIA_SOUND_H__
-
-
-/**
- * @file sound.h
- * @brief Sound player and recorder device framework.
- */
-
-#include <pj/pool.h>
-
-PJ_BEGIN_DECL
-
-/**
- * @defgroup PJMED_SND Sound device abstraction.
- * @ingroup PJMEDIA
- * @{
- */
-
-/** Opaque data type for audio stream. */
-typedef struct pj_snd_stream pj_snd_stream;
-
-/**
- * Device information structure returned by #pj_snd_get_dev_info.
- */
-typedef struct pj_snd_dev_info
-{
-    char	name[64];	        /**< Device name.		    */
-    unsigned	input_count;	        /**< Max number of input channels.  */
-    unsigned	output_count;	        /**< Max number of output channels. */
-    unsigned	default_samples_per_sec;/**< Default sampling rate.	    */
-} pj_snd_dev_info;
-
-/**
- * Sound device parameter, to be specified when calling #pj_snd_open_recorder
- * or #pj_snd_open_player.
- */
-typedef struct pj_snd_stream_info
-{
-    unsigned samples_per_sec;		/* Sampling rate.	    */
-    unsigned bits_per_sample;		/* No of bits per sample.   */
-    unsigned samples_per_frame;		/* No of samples per frame. */
-    unsigned bytes_per_frame;		/* No of bytes per frame.   */
-    unsigned frames_per_packet;		/* No of frames per packet. */
-} pj_snd_stream_info;
-
-/** 
- * This callback is called by player stream when it needs additional data
- * to be played by the device. Application must fill in the whole of output 
- * buffer with sound samples.
- *
- * @param user_data	User data associated with the stream.
- * @param timestamp	Timestamp, in samples.
- * @param output	Buffer to be filled out by application.
- * @param size		The size requested in bytes, which will be equal to
- *			the size of one whole packet.
- *
- * @return		Non-zero to stop the stream.
- */
-typedef pj_status_t (*pj_snd_play_cb)(/* in */   void *user_data,
-				      /* in */   pj_uint32_t timestamp,
-				      /* out */  void *output,
-				      /* out */  unsigned size);
-
-/**
- * This callback is called by recorder stream when it has captured the whole
- * packet worth of audio samples.
- *
- * @param user_data	User data associated with the stream.
- * @param timestamp	Timestamp, in samples.
- * @param output	Buffer containing the captured audio samples.
- * @param size		The size of the data in the buffer, in bytes.
- *
- * @return		Non-zero to stop the stream.
- */
-typedef pj_status_t (*pj_snd_rec_cb)(/* in */   void *user_data,
-				     /* in */   pj_uint32_t timestamp,
-				     /* in */   const void *input,
-				     /* in*/    unsigned size);
-
-/**
- * Init the sound library.
- *
- * @param factory	The sound factory.
- *
- * @return		Zero on success.
- */
-PJ_DECL(pj_status_t) pj_snd_init(pj_pool_factory *factory);
-
-
-/**
- * Get the number of devices detected by the library.
- *
- * @return		Number of devices.
- */
-PJ_DECL(int) pj_snd_get_dev_count(void);
-
-
-/**
- * Get device info.
- *
- * @param index		The index of the device, which should be in the range
- *			from zero to #pj_snd_get_dev_count - 1.
- */
-PJ_DECL(const pj_snd_dev_info*) pj_snd_get_dev_info(unsigned index);
-
-
-/**
- * Create a new audio stream for audio capture purpose.
- *
- * @param index		Device index, or -1 to let the library choose the first
- *			available device, or -2 to use NULL device.
- * @param param		Stream parameters.
- * @param rec_cb	Callback to handle captured audio samples.
- * @param user_data	User data to be associated with the stream.
- *
- * @return		Audio stream, or NULL if failed.
- */
-PJ_DECL(pj_snd_stream*) pj_snd_open_recorder(int index,
-					     const pj_snd_stream_info *param,
-					     pj_snd_rec_cb rec_cb,
-					     void *user_data);
-
-/**
- * Create a new audio stream for playing audio samples.
- *
- * @param index		Device index, or -1 to let the library choose the first
- *			available device, or -2 to use NULL device.
- * @param param		Stream parameters.
- * @param play_cb	Callback to supply audio samples.
- * @param user_data	User data to be associated with the stream.
- *
- * @return		Audio stream, or NULL if failed.
- */
-PJ_DECL(pj_snd_stream*) pj_snd_open_player(int index,
-					   const pj_snd_stream_info *param,
-					   pj_snd_play_cb play_cb,
-					   void *user_data);
-
-/**
- * Start the stream.
- *
- * @param stream	The recorder or player stream.
- *
- * @return		Zero on success.
- */
-PJ_DECL(pj_status_t) pj_snd_stream_start(pj_snd_stream *stream);
-
-/**
- * Stop the stream.
- *
- * @param stream	The recorder or player stream.
- *
- * @return		Zero on success.
- */
-PJ_DECL(pj_status_t) pj_snd_stream_stop(pj_snd_stream *stream);
-
-/**
- * Destroy the stream.
- *
- * @param stream	The recorder of player stream.
- *
- * @return		Zero on success.
- */
-PJ_DECL(pj_status_t) pj_snd_stream_close(pj_snd_stream *stream);
-
-/**
- * Deinitialize sound library.
- *
- * @return		Zero on success.
- */
-PJ_DECL(pj_status_t) pj_snd_deinit(void);
-
-
-
-/**
- * @}
- */
-
-PJ_END_DECL
-
-
-#endif	/* __PJMEDIA_SOUND_H__ */
Index: pjproject/trunk/pjmedia/src/pjmedia/stream.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/stream.c	(revision 120)
+++ pjproject/trunk/pjmedia/src/pjmedia/stream.c	(revision 121)
@@ -25,5 +25,10 @@
 #include <pj/string.h>	    /* memcpy() */
 #include <pj/pool.h>
+#include <pj/assert.h>
+#include <pj/compat/socket.h>
+#include <pj/sock_select.h>
+#include <pj/errno.h>
 #include <stdlib.h>
+
 
 #define THISFILE    "stream.c"
@@ -92,5 +97,5 @@
     struct pj_audio_frame frame_in, frame_out;
 
-    PJ_UNUSED_ARG(timestamp)
+    PJ_UNUSED_ARG(timestamp);
 
     /* Lock mutex */
@@ -153,10 +158,10 @@
     void *rtphdr;
     int rtphdrlen;
-    int sent;
+    pj_ssize_t sent;
 #if 0
     static FILE *fhnd = NULL;
 #endif
 
-    PJ_UNUSED_ARG(timestamp)
+    PJ_UNUSED_ARG(timestamp);
 
     /* Start locking channel mutex */
@@ -203,12 +208,9 @@
 
     /* Send. */
-    sent = pj_sock_sendto (channel->rtp_sock, channel->out_pkt, frame_out.size+sizeof(pj_rtp_hdr), 0, 
+    sent = frame_out.size+sizeof(pj_rtp_hdr);
+    status = pj_sock_sendto (channel->rtp_sock, channel->out_pkt, &sent, 0, 
 			   &channel->dst_addr, sizeof(channel->dst_addr));
-    if (sent != (int)frame_out.size + (int)sizeof(pj_rtp_hdr))  {
-	pj_perror(THISFILE, "Error sending RTP packet to %s:%d", 
-		  pj_sockaddr_get_str_addr(&channel->dst_addr),
-		  pj_sockaddr_get_port(&channel->dst_addr));
+    if (status != PJ_SUCCESS)
 	goto on_return;
-    }
 
     /* Update stat */
@@ -232,10 +234,10 @@
 
 
-static void* PJ_THREAD_FUNC stream_decoder_transport_thread (void*arg)
+static int PJ_THREAD_FUNC stream_decoder_transport_thread (void*arg)
 {
     pj_media_stream_t *channel = arg;
 
     while (!channel->thread_quit_flag) {
-	int len, size;
+	pj_ssize_t len, size;
 	const pj_rtp_hdr *hdr;
 	const void *payload;
@@ -245,5 +247,5 @@
 
 	/* Wait for packet. */
-	fd_set fds;
+	pj_fd_set_t fds;
 	pj_time_val timeout;
 
@@ -259,7 +261,8 @@
 
 	/* Get packet from socket. */
-	len = pj_sock_recv (channel->rtp_sock, channel->in_pkt, channel->in_pkt_size, 0);
-	if (len < 1) {
-	    if (pj_getlasterror() == PJ_ECONNRESET) {
+	len = channel->in_pkt_size;
+	status = pj_sock_recv (channel->rtp_sock, channel->in_pkt, &len, 0);
+	if (len < 1 || status != PJ_SUCCESS) {
+	    if (pj_get_netos_error() == PJ_STATUS_FROM_OS(OSERR_ECONNRESET)) {
 		/* On Win2K SP2 (or above) and WinXP, recv() will get WSAECONNRESET
 		   when the sending side receives ICMP port unreachable.
@@ -267,5 +270,5 @@
 		continue;
 	    }
-	    pj_perror(THISFILE, "Error receiving packet from socket (len=%d)", len);
+	    //pj_perror(THISFILE, "Error receiving packet from socket (len=%d)", len);
 	    pj_thread_sleep(1);
 	    continue;
@@ -326,5 +329,5 @@
     }
 
-    return NULL;
+    return 0;
 }
 
@@ -349,5 +352,5 @@
     void *ptr;
     unsigned size;
-    int status;
+    pj_status_t status;
     
     /* Allocate memory for channel descriptor */
@@ -370,6 +373,6 @@
 
     /* Create mutex for the channel. */
-    channel->mutex = pj_mutex_create(pool, NULL, PJ_MUTEX_SIMPLE);
-    if (channel->mutex == NULL)
+    status = pj_mutex_create_simple(pool, NULL, &channel->mutex);
+    if (status != PJ_SUCCESS)
 	goto err_cleanup;
 
@@ -485,9 +488,9 @@
 	}
 
-	channel->transport_thread = pj_thread_create(pool, "decode", 
-						     &stream_decoder_transport_thread, channel,
-						     0, NULL, 0);
-	if (!channel->transport_thread) {
-	    pj_perror(THISFILE, "Unable to create transport thread");
+	status = pj_thread_create(pool, "decode", 
+				  &stream_decoder_transport_thread, channel,
+				  0, 0, &channel->transport_thread);
+	if (status != PJ_SUCCESS) {
+	    //pj_perror(THISFILE, "Unable to create transport thread");
 	    goto err_cleanup;
 	}
@@ -574,5 +577,5 @@
 PJ_DEF(pj_status_t) pj_media_stream_pause (pj_media_stream_t *channel)
 {
-    PJ_UNUSED_ARG(channel)
+    PJ_UNUSED_ARG(channel);
     return -1;
 }
@@ -580,5 +583,5 @@
 PJ_DEF(pj_status_t) pj_media_stream_resume (pj_media_stream_t *channel)
 {
-    PJ_UNUSED_ARG(channel)
+    PJ_UNUSED_ARG(channel);
     return -1;
 }
Index: pjproject/trunk/pjmedia/src/pjmedia/stream.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/stream.h	(revision 120)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/* $Id$ */
-/* 
- * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
- */
-#ifndef __PJMEDIA_STREAM_H__
-#define __PJMEDIA_STREAM_H__
-
-
-/**
- * @file stream.h
- * @brief Stream of media.
- */
-
-#include <pjmedia/sound.h>
-#include <pjmedia/codec.h>
-#include <pjmedia/mediamgr.h>
-#include <pj/sock.h>
-
-PJ_BEGIN_DECL
-
-
-/**
- * @defgroup PJMED_SES Media session
- * @ingroup PJMEDIA
- * @{
- */
-
-typedef struct pj_media_stream_t pj_media_stream_t;
-
-/** Parameter for creating channel. */
-typedef struct pj_media_stream_create_param
-{
-    /** Codec ID, must NOT be NULL. */
-    pj_codec_id		 *codec_id;
-
-    /** Media manager, must NOT be NULL. */
-    pj_med_mgr_t	 *mediamgr;
-
-    /** Direction: IN_OUT, or IN only, or OUT only. */
-    pj_media_dir_t	  dir;
-
-    /** RTP socket. */
-    pj_sock_t		 rtp_sock;
-
-    /** RTCP socket. */
-    pj_sock_t		 rtcp_sock;
-
-    /** Address of remote */
-    pj_sockaddr_in	 *remote_addr;
-
-    /** RTP SSRC */
-    pj_uint32_t		  ssrc;
-
-    /** Jitter buffer parameters. */
-    int			  jb_min, jb_max, jb_maxcnt;
-
-} pj_media_stream_create_param;
-
-typedef struct pj_media_stream_stat
-{
-    pj_uint32_t pkt_tx, pkt_rx;	/* packets transmitted/received */
-    pj_uint32_t oct_tx, oct_rx;	/* octets transmitted/received */
-    pj_uint32_t jitter;		/* receive jitter in ms */
-    pj_uint32_t pkt_lost;	/* total packet lost count */
-} pj_media_stream_stat;
-
-PJ_DECL(pj_status_t) pj_media_stream_create (pj_pool_t *pool,
-					     pj_media_stream_t **enc_stream,
-					     pj_media_stream_t **dec_stream,
-					     pj_media_stream_create_param *param);
-PJ_DECL(pj_status_t) pj_media_stream_start (pj_media_stream_t *stream);
-PJ_DECL(pj_status_t) pj_media_stream_get_stat (const pj_media_stream_t *stream,
-					       pj_media_stream_stat *stat);
-PJ_DECL(pj_status_t) pj_media_stream_pause (pj_media_stream_t *stream);
-PJ_DECL(pj_status_t) pj_media_stream_resume (pj_media_stream_t *stream);
-PJ_DECL(pj_status_t) pj_media_stream_destroy (pj_media_stream_t *stream);
-
-/**
- * @}
- */
-
-PJ_END_DECL
-
-
-#endif	/* __PJMEDIA_STREAM_H__ */
