summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-05-02 11:29:37 +0000
committerBenny Prijono <bennylp@teluu.com>2007-05-02 11:29:37 +0000
commit8bb2ecb06d7e994b4b5c94af831fb02c465ecb49 (patch)
treedaf006ab1fcc27244ae19cf4816d61756cab84ad
parent67ecaf91d4e3383af948d75df8164436c7116bbc (diff)
PJSUA-LIB was ported to Symbian and added simple Symbian app. Testing follows
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1242 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--build.symbian/bld.inf13
-rw-r--r--build.symbian/pjlib.mmp32
-rw-r--r--build.symbian/pjlib_test.mmp1
-rw-r--r--build.symbian/pjlib_util.mmp25
-rw-r--r--build.symbian/pjmedia.mmp79
-rw-r--r--build.symbian/pjnath.mmp22
-rw-r--r--build.symbian/pjproject.cww416
-rw-r--r--build.symbian/pjsdp.mmp1
-rw-r--r--build.symbian/pjsip.mmp1
-rw-r--r--build.symbian/pjsip_simple.mmp1
-rw-r--r--build.symbian/pjsip_ua.mmp1
-rw-r--r--build.symbian/pjstun_client.mmp1
-rw-r--r--build.symbian/pjsua_lib.mmp32
-rw-r--r--build.symbian/symbian_ua.mmp30
-rw-r--r--pjlib-util/include/pjlib-util.h21
-rw-r--r--pjlib-util/include/pjlib-util/types.h20
-rw-r--r--pjlib-util/src/pjlib-util/errno.c1
-rw-r--r--pjlib/include/pj/compat/os_symbian.h2
-rw-r--r--pjlib/include/pj/config_site_sample.h12
-rw-r--r--pjlib/include/pj/except.h7
-rw-r--r--pjlib/include/pj/pool_buf.h3
-rw-r--r--pjlib/src/pj/exception_symbian.cpp38
-rw-r--r--pjlib/src/pj/os_core_symbian.cpp19
-rw-r--r--pjlib/src/pjlib-test/errno.c4
-rw-r--r--pjmedia/src/pjmedia/codec.c2
-rw-r--r--pjmedia/src/pjmedia/g711.c2
-rw-r--r--pjmedia/src/pjmedia/plc_steveu.c338
-rw-r--r--pjmedia/src/pjmedia/resample_resample.c52
-rw-r--r--pjmedia/src/pjmedia/symbian_sound.cpp873
-rw-r--r--pjnath/include/pjnath/ice_session.h6
-rw-r--r--pjnath/include/pjnath/ice_strans.h6
-rw-r--r--pjsip-apps/src/symbian_ua/main_symbian.cpp157
-rw-r--r--pjsip-apps/src/symbian_ua/ua.cpp323
-rw-r--r--pjsip-apps/src/symbian_ua/ua.h5
-rw-r--r--pjsip/src/pjsip-ua/sip_inv.c6
-rw-r--r--pjsip/src/pjsip-ua/sip_xfer.c2
-rw-r--r--pjsip/src/pjsip/sip_transport_udp.c2
-rw-r--r--pjsip/src/pjsua-lib/pjsua_acc.c10
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c16
-rw-r--r--pjsip/src/pjsua-lib/pjsua_im.c5
-rw-r--r--pjsip/src/pjsua-lib/pjsua_media.c2
41 files changed, 2140 insertions, 449 deletions
diff --git a/build.symbian/bld.inf b/build.symbian/bld.inf
index 91a4ead8..02b4b100 100644
--- a/build.symbian/bld.inf
+++ b/build.symbian/bld.inf
@@ -1,9 +1,12 @@
prj_mmpfiles
pjlib.mmp
-//pjlib_util.mmp
-//pjsip.mmp
-//pjsip_simple.mmp
-//pjsdp.mmp
-//pjsip_ua.mmp
+pjlib_util.mmp
+pjnath.mmp
+pjsdp.mmp
+pjmedia.mmp
+pjsip.mmp
+pjsip_simple.mmp
+pjsip_ua.mmp
//pjlib_test.mmp
//sipstateless.mmp
+symbian_ua.mmp
diff --git a/build.symbian/pjlib.mmp b/build.symbian/pjlib.mmp
index c3e689ab..94b3951f 100644
--- a/build.symbian/pjlib.mmp
+++ b/build.symbian/pjlib.mmp
@@ -9,7 +9,6 @@ OPTION CW -lang c++
MACRO PJ_M_I386=1
MACRO PJ_SYMBIAN=1
-MACRO PJ_EXPORTING
//
// Platform independent source
@@ -57,6 +56,37 @@ SOURCE sock_select_symbian.cpp
SOURCE ioqueue_symbian.cpp
SOURCE unicode_symbian.cpp
+DOCUMENT os_symbian.h
+
+DOCUMENT pj\\addr_resolv.h
+DOCUMENT pj\\array.h
+DOCUMENT pj\\assert.h
+DOCUMENT pj\\config.h
+DOCUMENT pj\\config_site.h
+DOCUMENT pj\\config_site_sample.h
+DOCUMENT pj\\ctype.h
+DOCUMENT pj\\errno.h
+DOCUMENT pj\\except.h
+DOCUMENT pj\\file_access.h
+DOCUMENT pj\\file_io.h
+DOCUMENT pj\\guid.h
+DOCUMENT pj\\hash.h
+DOCUMENT pj\\ioqueue.h
+DOCUMENT pj\\ip_helper.h
+DOCUMENT pj\\list.h
+DOCUMENT pj\\lock.h
+DOCUMENT pj\\log.h
+DOCUMENT pj\\os.h
+DOCUMENT pj\\pool.h
+DOCUMENT pj\\pool_buf.h
+DOCUMENT pj\\rand.h
+DOCUMENT pj\\rbtree.h
+DOCUMENT pj\\sock.h
+DOCUMENT pj\\sock_select.h
+DOCUMENT pj\\string.h
+DOCUMENT pj\\timer.h
+DOCUMENT pj\\types.h
+DOCUMENT pj\\unicode.h
SYSTEMINCLUDE ..\pjlib\include
diff --git a/build.symbian/pjlib_test.mmp b/build.symbian/pjlib_test.mmp
index e13d53ff..9836a14e 100644
--- a/build.symbian/pjlib_test.mmp
+++ b/build.symbian/pjlib_test.mmp
@@ -7,7 +7,6 @@ SOURCEPATH ..\pjlib\src\pjlib-test
MACRO PJ_M_I386=1
MACRO PJ_SYMBIAN=1
-MACRO PJ_IMPORTING
OPTION CW -lang c++
diff --git a/build.symbian/pjlib_util.mmp b/build.symbian/pjlib_util.mmp
index 6751bdbe..870dfbc6 100644
--- a/build.symbian/pjlib_util.mmp
+++ b/build.symbian/pjlib_util.mmp
@@ -7,12 +7,12 @@ SOURCEPATH ..\pjlib-util\src\pjlib-util
MACRO PJ_M_I386=1
MACRO PJ_SYMBIAN=1
-MACRO PJ_IMPORTING
OPTION CW -lang c++
+//
// PJLIB-UTIL files
-
+//
SOURCE crc32.c
SOURCE dns.c
SOURCE dns_dump.c
@@ -30,6 +30,27 @@ SOURCE stun_simple.c
SOURCE stun_simple_client.c
SOURCE xml.c
+//
+// Header files
+//
+DOCUMENT pjlib-util\\config.h
+DOCUMENT pjlib-util\\crc32.h
+DOCUMENT pjlib-util\\dns.h
+DOCUMENT pjlib-util\\errno.h
+DOCUMENT pjlib-util\\getopt.h
+DOCUMENT pjlib-util\\hmac_md5.h
+DOCUMENT pjlib-util\hmac_sha1.h
+DOCUMENT pjlib-util\md5.h
+DOCUMENT pjlib-util\resolver.h
+DOCUMENT pjlib-util\scanner.h
+DOCUMENT pjlib-util\sha1.h
+DOCUMENT pjlib-util\srv_resolver.h
+DOCUMENT pjlib-util\string.h
+DOCUMENT pjlib-util\stun_simple.h
+DOCUMENT pjlib-util\types.h
+DOCUMENT pjlib-util\xml.h
+
+
SYSTEMINCLUDE ..\pjlib\include
SYSTEMINCLUDE ..\pjlib-util\include
diff --git a/build.symbian/pjmedia.mmp b/build.symbian/pjmedia.mmp
new file mode 100644
index 00000000..f9bd56a4
--- /dev/null
+++ b/build.symbian/pjmedia.mmp
@@ -0,0 +1,79 @@
+TARGET pjmedia.lib
+TARGETTYPE lib
+UID 0x100039CE 0x10004299
+VENDORID 0x70000001
+
+SOURCEPATH ..\pjmedia\src\pjmedia
+
+//OPTION CW -lang c++
+
+MACRO PJ_M_I386=1
+MACRO PJ_SYMBIAN=1
+
+//
+// Platform independent source
+//
+
+SOURCE alaw_ulaw.c
+SOURCE alaw_ulaw_table.c
+SOURCE bidirectional.c
+SOURCE clock_thread.c
+SOURCE codec.c
+SOURCE conference.c
+SOURCE echo_common.c
+SOURCE echo_port.c
+SOURCE echo_suppress.c
+SOURCE endpoint.c
+SOURCE errno.c
+SOURCE g711.c
+SOURCE jbuf.c
+SOURCE master_port.c
+SOURCE mem_capture.c
+SOURCE mem_player.c
+SOURCE null_port.c
+SOURCE plc_common.c
+SOURCE port.c
+SOURCE resample_port.c
+SOURCE resample_resample.c
+SOURCE rtcp.c
+SOURCE rtp.c
+//SDP files are in pjsdp.mmp
+//SOURCE sdp.c
+//SOURCE sdp_cmp.c
+//SOURCE sdp_neg.c
+SOURCE session.c
+SOURCE silencedet.c
+SOURCE sound_port.c
+SOURCE splitcomb.c
+SOURCE stream.c
+SOURCE transport_ice.c
+SOURCE transport_udp.c
+SOURCE wav_player.c
+SOURCE wav_playlist.c
+SOURCE wav_writer.c
+SOURCE wave.c
+
+//
+// Symbian specific
+// These are on separate project
+//
+//SOURCE symbian_sound.cpp
+//SOURCE null_sound.c
+
+
+//
+// Header files
+//
+
+
+SYSTEMINCLUDE ..\pjmedia\include
+SYSTEMINCLUDE ..\pjlib\include
+SYSTEMINCLUDE ..\pjlib-util\include
+SYSTEMINCLUDE ..\pjnath\include
+
+SYSTEMINCLUDE \epoc32\include
+SYSTEMINCLUDE \epoc32\include\libc
+SYSTEMINCLUDE \epoc32\include\mmf\plugin
+
+CAPABILITY None
+
diff --git a/build.symbian/pjnath.mmp b/build.symbian/pjnath.mmp
index c6855a58..44ef14b6 100644
--- a/build.symbian/pjnath.mmp
+++ b/build.symbian/pjnath.mmp
@@ -7,12 +7,12 @@ SOURCEPATH ..\pjnath\src\pjnath
MACRO PJ_M_I386=1
MACRO PJ_SYMBIAN=1
-MACRO PJ_IMPORTING
-OPTION CW -lang c++
+//OPTION CW -lang c++
+//
// PJNATH files
-
+//
SOURCE errno.c
SOURCE ice_session.c
SOURCE ice_strans.c
@@ -22,6 +22,22 @@ SOURCE stun_msg_dump.c
SOURCE stun_session.c
SOURCE stun_transaction.c
+//
+// Include files
+//
+DOCUMENT pjnath\config.h
+DOCUMENT pjnath\\errno.h
+DOCUMENT pjnath\\ice_session.h
+DOCUMENT pjnath\\ice_strans.h
+DOCUMENT pjnath\\stun_auth.h
+DOCUMENT pjnath\\stun_config.h
+DOCUMENT pjnath\\stun_msg.h
+DOCUMENT pjnath\\stun_session.h
+DOCUMENT pjnath\\stun_transaction.h
+DOCUMENT pjnath\\types.h
+
+
+
SYSTEMINCLUDE ..\pjlib\include
SYSTEMINCLUDE ..\pjlib-util\include
SYSTEMINCLUDE ..\pjnath\include
diff --git a/build.symbian/pjproject.cww b/build.symbian/pjproject.cww
new file mode 100644
index 00000000..112e0d76
--- /dev/null
+++ b/build.symbian/pjproject.cww
@@ -0,0 +1,416 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<?codewarrior exportversion="1.0" ideversion="5.5" success="y" ?>
+
+<!DOCTYPE MWIDEWORKSPACE [
+<!ELEMENT MWIDEWORKSPACE (WINDOW*, COMWINDOW*)>
+<!ELEMENT WINDOW (SESSION, EDOCTYPE, PATH, FRAMELOC, FRAMESIZE, DOCKINFO)>
+<!ELEMENT COMWINDOW (SESSION, CLSID, OWNERPROJECT, DATA, FRAMELOC, FRAMESIZE, DOCKINFO)>
+<!ELEMENT SESSION (#PCDATA)>
+<!ELEMENT EDOCTYPE (#PCDATA)>
+<!ELEMENT DEFAULT (#PCDATA)>
+<!ELEMENT MAXIMIZED (#PCDATA)>
+<!ELEMENT PATH (#PCDATA)>
+<!ATTLIST PATH USERELATIVEPATHS (true | false) "true">
+<!ELEMENT FRAMELOC (X, Y)>
+<!ELEMENT X (#PCDATA)>
+<!ELEMENT Y (#PCDATA)>
+<!ELEMENT FRAMESIZE (W, H)>
+<!ELEMENT W (#PCDATA)>
+<!ELEMENT H (#PCDATA)>
+<!ELEMENT DOCKINFO (STATUS, ROW, COLUMN, DOCKBARID, PCTWIDTH, HGT, GROUPID)>
+<!ELEMENT STATUS (#PCDATA)>
+<!ELEMENT ROW (#PCDATA)>
+<!ELEMENT COLUMN (#PCDATA)>
+<!ELEMENT DOCKBARID (#PCDATA)>
+<!ELEMENT PCTWIDTH (#PCDATA)>
+<!ELEMENT HGT (#PCDATA)>
+<!ELEMENT GROUPID (GIDHIGHPART, GIDLOWPART)>
+<!ELEMENT GIDHIGHPART (#PCDATA)>
+<!ELEMENT GIDLOWPART (#PCDATA)>
+<!ELEMENT CLSID (#PCDATA)>
+<!ELEMENT OWNERPROJECT (#PCDATA)>
+<!ATTLIST OWNERPROJECT USERELATIVEPATHS (true | false) "true">
+<!ELEMENT DATA (#PCDATA)>
+<!ATTLIST DATA BINARYFORMAT (true | false) "true">
+]>
+
+<MWIDEWORKSPACE>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>0</EDOCTYPE>
+ <DEFAULT>true</DEFAULT>
+ <PATH USERELATIVEPATHS = "true">pjlib.mcp</PATH>
+ <FRAMELOC>
+ <X>0</X>
+ <Y>0</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>347</W>
+ <H>128</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>1</STATUS>
+ <ROW>0</ROW>
+ <COLUMN>0</COLUMN>
+ <DOCKBARID>59420</DOCKBARID>
+ <PCTWIDTH>1.000000</PCTWIDTH>
+ <HGT>506</HGT>
+ <GROUPID>
+ <GIDHIGHPART>4294967294</GIDHIGHPART>
+ <GIDLOWPART>4294967294</GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>0</EDOCTYPE>
+ <PATH USERELATIVEPATHS = "true">pjlib_test.mcp</PATH>
+ <FRAMELOC>
+ <X>0</X>
+ <Y>0</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>347</W>
+ <H>128</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>1</STATUS>
+ <ROW>0</ROW>
+ <COLUMN>0</COLUMN>
+ <DOCKBARID>59420</DOCKBARID>
+ <PCTWIDTH>1.000000</PCTWIDTH>
+ <HGT>506</HGT>
+ <GROUPID>
+ <GIDHIGHPART>4294967294</GIDHIGHPART>
+ <GIDLOWPART>4294967294</GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>0</EDOCTYPE>
+ <PATH USERELATIVEPATHS = "true">pjlib_util.mcp</PATH>
+ <FRAMELOC>
+ <X>0</X>
+ <Y>0</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>347</W>
+ <H>128</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>1</STATUS>
+ <ROW>0</ROW>
+ <COLUMN>0</COLUMN>
+ <DOCKBARID>59420</DOCKBARID>
+ <PCTWIDTH>1.000000</PCTWIDTH>
+ <HGT>506</HGT>
+ <GROUPID>
+ <GIDHIGHPART>4294967294</GIDHIGHPART>
+ <GIDLOWPART>4294967294</GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>0</EDOCTYPE>
+ <PATH USERELATIVEPATHS = "true">pjnath.mcp</PATH>
+ <FRAMELOC>
+ <X>0</X>
+ <Y>0</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>347</W>
+ <H>128</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>1</STATUS>
+ <ROW>0</ROW>
+ <COLUMN>0</COLUMN>
+ <DOCKBARID>59420</DOCKBARID>
+ <PCTWIDTH>1.000000</PCTWIDTH>
+ <HGT>506</HGT>
+ <GROUPID>
+ <GIDHIGHPART>4294967294</GIDHIGHPART>
+ <GIDLOWPART>4294967294</GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>0</EDOCTYPE>
+ <PATH USERELATIVEPATHS = "true">pjmedia.mcp</PATH>
+ <FRAMELOC>
+ <X>0</X>
+ <Y>0</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>347</W>
+ <H>128</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>1</STATUS>
+ <ROW>0</ROW>
+ <COLUMN>0</COLUMN>
+ <DOCKBARID>59420</DOCKBARID>
+ <PCTWIDTH>1.000000</PCTWIDTH>
+ <HGT>506</HGT>
+ <GROUPID>
+ <GIDHIGHPART>4294967294</GIDHIGHPART>
+ <GIDLOWPART>4294967294</GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>0</EDOCTYPE>
+ <PATH USERELATIVEPATHS = "true">pjsdp.mcp</PATH>
+ <FRAMELOC>
+ <X>0</X>
+ <Y>0</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>347</W>
+ <H>128</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>1</STATUS>
+ <ROW>0</ROW>
+ <COLUMN>0</COLUMN>
+ <DOCKBARID>59420</DOCKBARID>
+ <PCTWIDTH>1.000000</PCTWIDTH>
+ <HGT>506</HGT>
+ <GROUPID>
+ <GIDHIGHPART>4294967294</GIDHIGHPART>
+ <GIDLOWPART>4294967294</GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>0</EDOCTYPE>
+ <PATH USERELATIVEPATHS = "true">pjsip.mcp</PATH>
+ <FRAMELOC>
+ <X>0</X>
+ <Y>0</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>347</W>
+ <H>128</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>1</STATUS>
+ <ROW>0</ROW>
+ <COLUMN>0</COLUMN>
+ <DOCKBARID>59420</DOCKBARID>
+ <PCTWIDTH>1.000000</PCTWIDTH>
+ <HGT>506</HGT>
+ <GROUPID>
+ <GIDHIGHPART>4294967294</GIDHIGHPART>
+ <GIDLOWPART>4294967294</GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>0</EDOCTYPE>
+ <PATH USERELATIVEPATHS = "true">pjsip_ua.mcp</PATH>
+ <FRAMELOC>
+ <X>548</X>
+ <Y>123</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>400</W>
+ <H>372</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>1</STATUS>
+ <ROW>0</ROW>
+ <COLUMN>0</COLUMN>
+ <DOCKBARID>59420</DOCKBARID>
+ <PCTWIDTH>1.000000</PCTWIDTH>
+ <HGT>506</HGT>
+ <GROUPID>
+ <GIDHIGHPART>4294967294</GIDHIGHPART>
+ <GIDLOWPART>4294967294</GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>0</EDOCTYPE>
+ <PATH USERELATIVEPATHS = "true">pjsip_simple.mcp</PATH>
+ <FRAMELOC>
+ <X>0</X>
+ <Y>0</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>347</W>
+ <H>128</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>1</STATUS>
+ <ROW>0</ROW>
+ <COLUMN>0</COLUMN>
+ <DOCKBARID>59420</DOCKBARID>
+ <PCTWIDTH>1.000000</PCTWIDTH>
+ <HGT>506</HGT>
+ <GROUPID>
+ <GIDHIGHPART>4294967294</GIDHIGHPART>
+ <GIDLOWPART>4294967294</GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>0</EDOCTYPE>
+ <PATH USERELATIVEPATHS = "true">pjsua_lib.mcp</PATH>
+ <FRAMELOC>
+ <X>631</X>
+ <Y>228</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>400</W>
+ <H>372</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>1</STATUS>
+ <ROW>0</ROW>
+ <COLUMN>0</COLUMN>
+ <DOCKBARID>59420</DOCKBARID>
+ <PCTWIDTH>1.000000</PCTWIDTH>
+ <HGT>506</HGT>
+ <GROUPID>
+ <GIDHIGHPART>4294967294</GIDHIGHPART>
+ <GIDLOWPART>4294967294</GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>0</EDOCTYPE>
+ <PATH USERELATIVEPATHS = "true">symbian_ua.mcp</PATH>
+ <FRAMELOC>
+ <X>568</X>
+ <Y>146</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>400</W>
+ <H>372</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>1</STATUS>
+ <ROW>0</ROW>
+ <COLUMN>0</COLUMN>
+ <DOCKBARID>59420</DOCKBARID>
+ <PCTWIDTH>1.000000</PCTWIDTH>
+ <HGT>506</HGT>
+ <GROUPID>
+ <GIDHIGHPART>4294967294</GIDHIGHPART>
+ <GIDLOWPART>4294967294</GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-1</SESSION>
+ <EDOCTYPE>1</EDOCTYPE>
+ <PATH USERELATIVEPATHS = "true">..\pjsip-apps\src\symbian_ua\ua.cpp</PATH>
+ <MAXIMIZED>true</MAXIMIZED>
+ <FRAMELOC>
+ <X>4</X>
+ <Y>4</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>731</W>
+ <H>822</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>0</STATUS>
+ <ROW></ROW>
+ <COLUMN></COLUMN>
+ <DOCKBARID></DOCKBARID>
+ <PCTWIDTH></PCTWIDTH>
+ <HGT></HGT>
+ <GROUPID>
+ <GIDHIGHPART></GIDHIGHPART>
+ <GIDLOWPART></GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-2147483648</SESSION>
+ <EDOCTYPE>36</EDOCTYPE>
+ <DEFAULT>true</DEFAULT>
+ <FRAMELOC>
+ <X>4</X>
+ <Y>23</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>414</W>
+ <H>516</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>0</STATUS>
+ <ROW></ROW>
+ <COLUMN></COLUMN>
+ <DOCKBARID></DOCKBARID>
+ <PCTWIDTH></PCTWIDTH>
+ <HGT></HGT>
+ <GROUPID>
+ <GIDHIGHPART></GIDHIGHPART>
+ <GIDLOWPART></GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-2147483648</SESSION>
+ <EDOCTYPE>20</EDOCTYPE>
+ <DEFAULT>true</DEFAULT>
+ <FRAMELOC>
+ <X>4</X>
+ <Y>23</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>792</W>
+ <H>1413</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>0</STATUS>
+ <ROW></ROW>
+ <COLUMN></COLUMN>
+ <DOCKBARID></DOCKBARID>
+ <PCTWIDTH></PCTWIDTH>
+ <HGT></HGT>
+ <GROUPID>
+ <GIDHIGHPART></GIDHIGHPART>
+ <GIDLOWPART></GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+ <WINDOW>
+ <SESSION>-2147483648</SESSION>
+ <EDOCTYPE>23</EDOCTYPE>
+ <DEFAULT>true</DEFAULT>
+ <MAXIMIZED>true</MAXIMIZED>
+ <FRAMELOC>
+ <X>6</X>
+ <Y>81</Y>
+ </FRAMELOC>
+ <FRAMESIZE>
+ <W>566</W>
+ <H>477</H>
+ </FRAMESIZE>
+ <DOCKINFO>
+ <STATUS>0</STATUS>
+ <ROW></ROW>
+ <COLUMN></COLUMN>
+ <DOCKBARID></DOCKBARID>
+ <PCTWIDTH></PCTWIDTH>
+ <HGT></HGT>
+ <GROUPID>
+ <GIDHIGHPART></GIDHIGHPART>
+ <GIDLOWPART></GIDLOWPART>
+ </GROUPID>
+ </DOCKINFO>
+ </WINDOW>
+</MWIDEWORKSPACE>
diff --git a/build.symbian/pjsdp.mmp b/build.symbian/pjsdp.mmp
index 351f9a55..97f461bf 100644
--- a/build.symbian/pjsdp.mmp
+++ b/build.symbian/pjsdp.mmp
@@ -9,7 +9,6 @@ OPTION CW -lang c++
MACRO PJ_M_I386=1
MACRO PJ_SYMBIAN=1
-MACRO PJ_EXPORTING
//
// Platform independent source
diff --git a/build.symbian/pjsip.mmp b/build.symbian/pjsip.mmp
index cb280b67..d1dd741e 100644
--- a/build.symbian/pjsip.mmp
+++ b/build.symbian/pjsip.mmp
@@ -7,7 +7,6 @@ SOURCEPATH ..\pjsip\src\pjsip
MACRO PJ_M_I386=1
MACRO PJ_SYMBIAN=1
-MACRO PJ_IMPORTING
OPTION CW -lang c++
diff --git a/build.symbian/pjsip_simple.mmp b/build.symbian/pjsip_simple.mmp
index 16b7f8a5..0ff7f162 100644
--- a/build.symbian/pjsip_simple.mmp
+++ b/build.symbian/pjsip_simple.mmp
@@ -7,7 +7,6 @@ SOURCEPATH ..\pjsip\src\pjsip-simple
MACRO PJ_M_I386=1
MACRO PJ_SYMBIAN=1
-MACRO PJ_IMPORTING
OPTION CW -lang c++
diff --git a/build.symbian/pjsip_ua.mmp b/build.symbian/pjsip_ua.mmp
index 53017865..cef53738 100644
--- a/build.symbian/pjsip_ua.mmp
+++ b/build.symbian/pjsip_ua.mmp
@@ -7,7 +7,6 @@ SOURCEPATH ..\pjsip\src\pjsip-ua
MACRO PJ_M_I386=1
MACRO PJ_SYMBIAN=1
-MACRO PJ_IMPORTING
//OPTION CW -lang c++
diff --git a/build.symbian/pjstun_client.mmp b/build.symbian/pjstun_client.mmp
index 38a43eb2..98194e86 100644
--- a/build.symbian/pjstun_client.mmp
+++ b/build.symbian/pjstun_client.mmp
@@ -7,7 +7,6 @@ SOURCEPATH ..\pjnath\src\pjstun-client
MACRO PJ_M_I386=1
MACRO PJ_SYMBIAN=1
-MACRO PJ_IMPORTING
OPTION CW -lang c++
diff --git a/build.symbian/pjsua_lib.mmp b/build.symbian/pjsua_lib.mmp
new file mode 100644
index 00000000..6dc316cc
--- /dev/null
+++ b/build.symbian/pjsua_lib.mmp
@@ -0,0 +1,32 @@
+TARGET pjsua_lib.lib
+TARGETTYPE lib
+UID 0x100039CE 0x10004299
+VENDORID 0x70000001
+
+SOURCEPATH ..\pjsip\src\pjsua-lib
+
+MACRO PJ_M_I386=1
+MACRO PJ_SYMBIAN=1
+
+// OPTION CW -lang c++
+
+// PJLIB-UTIL files
+
+SOURCE pjsua_acc.c
+SOURCE pjsua_call.c
+SOURCE pjsua_core.c
+SOURCE pjsua_im.c
+SOURCE pjsua_media.c
+SOURCE pjsua_pres.c
+
+SYSTEMINCLUDE ..\pjlib\include
+SYSTEMINCLUDE ..\pjlib-util\include
+SYSTEMINCLUDE ..\pjnath\include
+SYSTEMINCLUDE ..\pjmedia\include
+SYSTEMINCLUDE ..\pjsip\include
+
+SYSTEMINCLUDE \epoc32\include
+SYSTEMINCLUDE \epoc32\include\libc
+
+CAPABILITY None
+
diff --git a/build.symbian/symbian_ua.mmp b/build.symbian/symbian_ua.mmp
new file mode 100644
index 00000000..8531cb00
--- /dev/null
+++ b/build.symbian/symbian_ua.mmp
@@ -0,0 +1,30 @@
+TARGET symbian_ua.exe
+TARGETTYPE exe
+UID 0x100039CE 0x10004299
+VENDORID 0x70000001
+
+SOURCEPATH ..\pjsip-apps\src\symbian_ua
+
+MACRO PJ_M_I386=1
+MACRO PJ_SYMBIAN=1
+
+// Test files
+
+SOURCE ua.cpp
+SOURCE main_symbian.cpp
+
+DOCUMENT ua.h
+
+SYSTEMINCLUDE ..\pjlib\include
+SYSTEMINCLUDE ..\pjlib-util\include
+SYSTEMINCLUDE ..\pjnath\include
+SYSTEMINCLUDE ..\pjmedia\include
+SYSTEMINCLUDE ..\pjsip\include
+
+SYSTEMINCLUDE \epoc32\include
+SYSTEMINCLUDE \epoc32\include\libc
+
+LIBRARY pjsua_lib.lib pjsip_ua.lib pjsip_simple.lib pjsip.lib pjsdp.lib pjmedia.lib pjnath.lib pjlib_util.lib pjlib.lib esock.lib insock.lib charconv.lib euser.lib estlib.lib eexe.lib
+STATICLIBRARY ecrt0.lib
+CAPABILITY None
+
diff --git a/pjlib-util/include/pjlib-util.h b/pjlib-util/include/pjlib-util.h
index 30a49569..c12e0b28 100644
--- a/pjlib-util/include/pjlib-util.h
+++ b/pjlib-util/include/pjlib-util.h
@@ -52,26 +52,5 @@
/* Old STUN */
#include <pjlib-util/stun_simple.h>
-/**
- * @addtogroup PJLIB_UTIL
- * @{
- */
-
-PJ_BEGIN_DECL
-
-/**
- * Initialize PJLIB UTIL (defined in errno.c)
- *
- * @return PJ_SUCCESS on success.
- */
-PJ_DECL(pj_status_t) pjlib_util_init(void);
-
-
-/**
- * @}
- */
-
-PJ_END_DECL
-
#endif /* __PJLIB_UTIL_H__ */
diff --git a/pjlib-util/include/pjlib-util/types.h b/pjlib-util/include/pjlib-util/types.h
index 5596a4bf..a512f435 100644
--- a/pjlib-util/include/pjlib-util/types.h
+++ b/pjlib-util/include/pjlib-util/types.h
@@ -29,8 +29,28 @@
/**
* @defgroup PJLIB_UTIL PJLIB-UTIL Library
+ * @{
*/
+PJ_BEGIN_DECL
+
+/**
+ * Initialize PJLIB UTIL (defined in errno.c)
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjlib_util_init(void);
+
+
+
+PJ_END_DECL
+
+
+/**
+ * @}
+ */
+
+
/**
* @mainpage PJLIB-UTIL
*
diff --git a/pjlib-util/src/pjlib-util/errno.c b/pjlib-util/src/pjlib-util/errno.c
index a60b3184..f09cd775 100644
--- a/pjlib-util/src/pjlib-util/errno.c
+++ b/pjlib-util/src/pjlib-util/errno.c
@@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <pjlib-util/errno.h>
+#include <pjlib-util/types.h>
#include <pj/string.h>
diff --git a/pjlib/include/pj/compat/os_symbian.h b/pjlib/include/pj/compat/os_symbian.h
index 51d78eb6..2871fe0a 100644
--- a/pjlib/include/pj/compat/os_symbian.h
+++ b/pjlib/include/pj/compat/os_symbian.h
@@ -145,6 +145,7 @@ typedef unsigned int socklen_t;
#include <e32def.h>
+/*
#if defined(PJ_EXPORTING)
# define PJ_EXPORT_IMPORT EXPORT_C
#elif defined(PJ_IMPORTING)
@@ -152,6 +153,7 @@ typedef unsigned int socklen_t;
#else
# error "Must define either PJ_EXPORTING or PJ_IMPORTING"
#endif
+*/
#endif /* __PJ_COMPAT_OS_SYMBIAN_H__ */
diff --git a/pjlib/include/pj/config_site_sample.h b/pjlib/include/pj/config_site_sample.h
index da67ca85..c4821de4 100644
--- a/pjlib/include/pj/config_site_sample.h
+++ b/pjlib/include/pj/config_site_sample.h
@@ -30,7 +30,19 @@
* Typical configuration for Symbian OS target
*/
#if defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0
+
+# undef PJ_HAS_FLOATING_POINT
+# define PJ_HAS_FLOATING_POINT 0
+
# define PJMEDIA_SOUND_IMPLEMENTATION PJMEDIA_SOUND_NULL_SOUND
+# define PJMEDIA_HAS_LIBRESAMPLE 0
+# define PJMEDIA_HAS_SPEEX_AEC 0
+
+# define PJMEDIA_HAS_L16_CODEC 0
+# define PJMEDIA_HAS_GSM_CODEC 0
+# define PJMEDIA_HAS_ILBC_CODEC 0
+# define PJMEDIA_HAS_SPEEX_CODEC 0
+
#endif
diff --git a/pjlib/include/pj/except.h b/pjlib/include/pj/except.h
index 2f1f9ddd..610f4626 100644
--- a/pjlib/include/pj/except.h
+++ b/pjlib/include/pj/except.h
@@ -245,6 +245,11 @@ pj_throw_exception_(pj_exception_id_t id) PJ_ATTR_NORETURN
**
****************************************************************************/
+/* To include this file, the source file must be compiled as
+ * C++ code!
+ */
+#ifdef __cplusplus
+
class TPjException
{
public:
@@ -260,6 +265,8 @@ public:
while (0)
#define PJ_GET_EXCEPTION() pj_excp_.code_
+#endif /* __cplusplus */
+
#else
/*****************************************************************************
**
diff --git a/pjlib/include/pj/pool_buf.h b/pjlib/include/pj/pool_buf.h
index 92af2d2b..e50ee080 100644
--- a/pjlib/include/pj/pool_buf.h
+++ b/pjlib/include/pj/pool_buf.h
@@ -70,6 +70,7 @@
* @{
*/
+PJ_BEGIN_DECL
/**
* Create the pool using the specified buffer as the pool's memory.
@@ -93,6 +94,8 @@ PJ_DECL(pj_pool_t*) pj_pool_create_on_buf(const char *name,
void *buf,
pj_size_t size);
+PJ_END_DECL
+
/**
* @}
*/
diff --git a/pjlib/src/pj/exception_symbian.cpp b/pjlib/src/pj/exception_symbian.cpp
index f04045bf..1d475335 100644
--- a/pjlib/src/pj/exception_symbian.cpp
+++ b/pjlib/src/pj/exception_symbian.cpp
@@ -35,44 +35,6 @@ static long thread_local_id = -1;
#endif /* PJ_HAS_EXCEPTION_NAMES */
-//#if !defined(PJ_EXCEPTION_USE_WIN32_SEH) || PJ_EXCEPTION_USE_WIN32_SEH==0
-#if 0
-PJ_DEF(void) pj_throw_exception_(int exception_id)
-{
- struct pj_exception_state_t *handler;
-
- handler = (pj_exception_state_t*)pj_thread_local_get(thread_local_id);
- if (handler == NULL) {
- PJ_LOG(1,("except.c", "!!!FATAL: unhandled exception %d!\n", exception_id));
- pj_assert(handler != NULL);
- /* This will crash the system! */
- }
- pj_longjmp(handler->state, exception_id);
-}
-
-PJ_DEF(void) pj_push_exception_handler_(struct pj_exception_state_t *rec)
-{
- struct pj_exception_state_t *parent_handler = NULL;
-
- if (thread_local_id == -1) {
- pj_thread_local_alloc(&thread_local_id);
- pj_assert(thread_local_id != -1);
- }
- parent_handler = (pj_exception_state_t*)pj_thread_local_get(thread_local_id);
- rec->prev = parent_handler;
- pj_thread_local_set(thread_local_id, rec);
-}
-
-PJ_DEF(void) pj_pop_exception_handler_(void)
-{
- struct pj_exception_state_t *handler;
-
- handler = (pj_exception_state_t*)pj_thread_local_get(thread_local_id);
- pj_assert(handler != NULL);
- pj_thread_local_set(thread_local_id, handler->prev);
-}
-#endif
-
#if defined(PJ_HAS_EXCEPTION_NAMES) && PJ_HAS_EXCEPTION_NAMES != 0
PJ_DEF(pj_status_t) pj_exception_id_alloc( const char *name,
pj_exception_id_t *id)
diff --git a/pjlib/src/pj/os_core_symbian.cpp b/pjlib/src/pj/os_core_symbian.cpp
index 7386fd63..fbc30233 100644
--- a/pjlib/src/pj/os_core_symbian.cpp
+++ b/pjlib/src/pj/os_core_symbian.cpp
@@ -270,6 +270,8 @@ PJ_DECL(void) pj_shutdown(void);
*/
PJ_DEF(pj_status_t) pj_init(void)
{
+ pj_status_t status;
+
pj_ansi_strcpy(main_thread.obj_name, "pjthread");
// Init main thread
@@ -280,10 +282,17 @@ PJ_DEF(pj_status_t) pj_init(void)
PJ_LOG(4,(THIS_FILE, "Initializing PJLIB for Symbian OS.."));
- TInt err;
+ TInt err;
err = os->Initialize();
if (err != KErrNone)
goto on_error;
+
+ /* Initialize exception ID for the pool.
+ * Must do so after critical section is configured.
+ */
+ status = pj_exception_id_alloc("PJLIB/No memory", &PJ_NO_MEMORY_EXCEPTION);
+ if (status != PJ_SUCCESS)
+ return status;
PJ_LOG(5,(THIS_FILE, "PJLIB initialized."));
return PJ_SUCCESS;
@@ -307,13 +316,11 @@ PJ_DEF(pj_status_t) pj_atexit(void (*func)(void))
PJ_DEF(void) pj_shutdown(void)
{
- unsigned i;
-
/* Call atexit() functions */
- for (i=atexit_count-1; i>=0; --i) {
- (*atexit_func[i])();
+ while (atexit_count > 0) {
+ (*atexit_func[atexit_count-1])();
+ --atexit_count;
}
- atexit_count = 0;
/* Free exception ID */
if (PJ_NO_MEMORY_EXCEPTION != -1) {
diff --git a/pjlib/src/pjlib-test/errno.c b/pjlib/src/pjlib-test/errno.c
index fd06af35..33378fea 100644
--- a/pjlib/src/pjlib-test/errno.c
+++ b/pjlib/src/pjlib-test/errno.c
@@ -70,11 +70,13 @@ const char *my_stristr(const char *whole, const char *part)
int errno_test(void)
{
enum { CUT = 6 };
- pj_status_t rc;
+ pj_status_t rc = 0;
char errbuf[256];
PJ_LOG(3,(THIS_FILE, "...errno test: check the msg carefully"));
+ PJ_UNUSED_ARG(rc);
+
/*
* Windows platform error.
*/
diff --git a/pjmedia/src/pjmedia/codec.c b/pjmedia/src/pjmedia/codec.c
index 593ca6f9..12ff4c02 100644
--- a/pjmedia/src/pjmedia/codec.c
+++ b/pjmedia/src/pjmedia/codec.c
@@ -322,7 +322,7 @@ pjmedia_codec_mgr_set_codec_priority(pjmedia_codec_mgr *mgr,
pj_strnicmp2(codec_id, mgr->codec_desc[i].id,
codec_id->slen) == 0)
{
- mgr->codec_desc[i].prio = prio;
+ mgr->codec_desc[i].prio = (pjmedia_codec_priority) prio;
++found;
}
}
diff --git a/pjmedia/src/pjmedia/g711.c b/pjmedia/src/pjmedia/g711.c
index da9b7586..0a8def01 100644
--- a/pjmedia/src/pjmedia/g711.c
+++ b/pjmedia/src/pjmedia/g711.c
@@ -372,7 +372,7 @@ static pj_status_t g711_dealloc_codec(pjmedia_codec_factory *factory,
pjmedia_codec *codec )
{
struct g711_private *priv = codec->codec_data;
- int i;
+ int i = 0;
PJ_ASSERT_RETURN(factory==&g711_factory.base, PJ_EINVAL);
diff --git a/pjmedia/src/pjmedia/plc_steveu.c b/pjmedia/src/pjmedia/plc_steveu.c
deleted file mode 100644
index 3326b748..00000000
--- a/pjmedia/src/pjmedia/plc_steveu.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * plc.c
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2004 Steve Underwood
- *
- * All rights reserved.
- *
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * This version may be optionally licenced under the GNU LGPL licence.
- * This version is disclaimed to DIGIUM for inclusion in the Asterisk project.
- */
-
-/*! \file */
-
-#include <pjmedia/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <limits.h>
-
-#include "plc_steveu.h"
-
-#if !defined(FALSE)
-#define FALSE 0
-#endif
-#if !defined(TRUE)
-#define TRUE (!FALSE)
-#endif
-
-#ifndef INT16_MAX
-#define INT16_MAX (32767)
-#endif
-
-#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
-#endif
-
-//#define PJ_HAS_RINT 1
-
-
-/* We do a straight line fade to zero volume in 50ms when we are filling in for missing data. */
-#define ATTENUATION_INCREMENT 0.0025 /* Attenuation per sample */
-
-#define ms_to_samples(t) (((t)*SAMPLE_RATE)/1000)
-
-
-#if defined(PJ_HAS_RINT) && PJ_HAS_RINT!=0
-#define RINT(d) rint(d)
-#else
-double RINT(double d)
-{
- double f = floor(d);
- double c = ceil(d);
-
- if (c-d > d-f)
- return f;
- else if (c-d < d-f)
- return c;
- else if (d >= 0) {
- if (f/2==f)
- return f;
- else
- return c;
- } else {
- if (c/2==c)
- return c;
- else
- return f;
- }
-}
-#endif
-
-
-PJ_INLINE(pj_int16_t) fsaturate(double damp)
-{
- if (damp > 32767.0)
- return INT16_MAX;
- else if (damp < -32768.0)
- return INT16_MIN;
- else {
- return (pj_int16_t) RINT(damp);
- }
-}
-
-static void save_history(plc_state_t *s, pj_int16_t *buf, int len)
-{
- if (len >= PLC_HISTORY_LEN)
- {
- /* Just keep the last part of the new data, starting at the beginning of the buffer */
- memcpy(s->history, buf + len - PLC_HISTORY_LEN, sizeof(pj_int16_t)*PLC_HISTORY_LEN);
- s->buf_ptr = 0;
- return;
- }
- if (s->buf_ptr + len > PLC_HISTORY_LEN)
- {
- /* Wraps around - must break into two sections */
- memcpy(s->history + s->buf_ptr, buf, sizeof(pj_int16_t)*(PLC_HISTORY_LEN - s->buf_ptr));
- len -= (PLC_HISTORY_LEN - s->buf_ptr);
- memcpy(s->history, buf + (PLC_HISTORY_LEN - s->buf_ptr), sizeof(pj_int16_t)*len);
- s->buf_ptr = len;
- return;
- }
- /* Can use just one section */
- memcpy(s->history + s->buf_ptr, buf, sizeof(pj_int16_t)*len);
- s->buf_ptr += len;
-}
-/*- End of function --------------------------------------------------------*/
-
-static void normalise_history(plc_state_t *s)
-{
- pj_int16_t tmp[PLC_HISTORY_LEN];
-
- if (s->buf_ptr == 0)
- return;
- memcpy(tmp, s->history, sizeof(pj_int16_t)*s->buf_ptr);
- memcpy(s->history, s->history + s->buf_ptr, sizeof(pj_int16_t)*(PLC_HISTORY_LEN - s->buf_ptr));
- memcpy(s->history + PLC_HISTORY_LEN - s->buf_ptr, tmp, sizeof(pj_int16_t)*s->buf_ptr);
- s->buf_ptr = 0;
-}
-/*- End of function --------------------------------------------------------*/
-
-PJ_INLINE(int) amdf_pitch(int min_pitch, int max_pitch, pj_int16_t amp[], int len)
-{
- int i;
- int j;
- int acc;
- int min_acc;
- int pitch;
-
- pitch = min_pitch;
- min_acc = INT_MAX;
- for (i = max_pitch; i <= min_pitch; i++)
- {
- acc = 0;
- for (j = 0; j < len; j++)
- acc += abs(amp[i + j] - amp[j]);
- if (acc < min_acc)
- {
- min_acc = acc;
- pitch = i;
- }
- }
- return pitch;
-}
-/*- End of function --------------------------------------------------------*/
-
-int plc_rx(plc_state_t *s, pj_int16_t amp[], int len)
-{
- int i;
- /*int overlap_len;*/
- int pitch_overlap;
- float old_step;
- float new_step;
- float old_weight;
- float new_weight;
- float gain;
-
- if (s->missing_samples)
- {
- /* Although we have a real signal, we need to smooth it to fit well
- with the synthetic signal we used for the previous block */
-
- /* The start of the real data is overlapped with the next 1/4 cycle
- of the synthetic data. */
- pitch_overlap = s->pitch >> 2;
- if (pitch_overlap > len)
- pitch_overlap = len;
- gain = 1.0 - s->missing_samples*ATTENUATION_INCREMENT;
- if (gain < 0.0)
- gain = 0.0;
- new_step = 1.0/pitch_overlap;
- old_step = new_step*gain;
- new_weight = new_step;
- old_weight = (1.0 - new_step)*gain;
- for (i = 0; i < pitch_overlap; i++)
- {
- amp[i] = fsaturate(old_weight*s->pitchbuf[s->pitch_offset] + new_weight*amp[i]);
- if (++s->pitch_offset >= s->pitch)
- s->pitch_offset = 0;
- new_weight += new_step;
- old_weight -= old_step;
- if (old_weight < 0.0)
- old_weight = 0.0;
- }
- s->missing_samples = 0;
- }
- save_history(s, amp, len);
- return len;
-}
-/*- End of function --------------------------------------------------------*/
-
-int plc_fillin(plc_state_t *s, pj_int16_t amp[], int len)
-{
- /*pj_int16_t tmp[PLC_PITCH_OVERLAP_MAX];*/
- int i;
- int pitch_overlap;
- float old_step;
- float new_step;
- float old_weight;
- float new_weight;
- float gain;
- pj_int16_t *orig_amp;
- int orig_len;
-
- orig_amp = amp;
- orig_len = len;
- if (s->missing_samples == 0)
- {
- /* As the gap in real speech starts we need to assess the last known pitch,
- and prepare the synthetic data we will use for fill-in */
- normalise_history(s);
- s->pitch = amdf_pitch(PLC_PITCH_MIN, PLC_PITCH_MAX, s->history + PLC_HISTORY_LEN - CORRELATION_SPAN - PLC_PITCH_MIN, CORRELATION_SPAN);
- /* We overlap a 1/4 wavelength */
- pitch_overlap = s->pitch >> 2;
- /* Cook up a single cycle of pitch, using a single of the real signal with 1/4
- cycle OLA'ed to make the ends join up nicely */
- /* The first 3/4 of the cycle is a simple copy */
- for (i = 0; i < s->pitch - pitch_overlap; i++)
- s->pitchbuf[i] = s->history[PLC_HISTORY_LEN - s->pitch + i];
- /* The last 1/4 of the cycle is overlapped with the end of the previous cycle */
- new_step = 1.0/pitch_overlap;
- new_weight = new_step;
- for ( ; i < s->pitch; i++)
- {
- s->pitchbuf[i] = s->history[PLC_HISTORY_LEN - s->pitch + i]*(1.0 - new_weight) + s->history[PLC_HISTORY_LEN - 2*s->pitch + i]*new_weight;
- new_weight += new_step;
- }
- /* We should now be ready to fill in the gap with repeated, decaying cycles
- of what is in pitchbuf */
-
- /* We need to OLA the first 1/4 wavelength of the synthetic data, to smooth
- it into the previous real data. To avoid the need to introduce a delay
- in the stream, reverse the last 1/4 wavelength, and OLA with that. */
- gain = 1.0;
- new_step = 1.0/pitch_overlap;
- old_step = new_step;
- new_weight = new_step;
- old_weight = 1.0 - new_step;
- for (i = 0; i < pitch_overlap; i++)
- {
- amp[i] = fsaturate(old_weight*s->history[PLC_HISTORY_LEN - 1 - i] + new_weight*s->pitchbuf[i]);
- new_weight += new_step;
- old_weight -= old_step;
- if (old_weight < 0.0)
- old_weight = 0.0;
- }
- s->pitch_offset = i;
- }
- else
- {
- gain = 1.0 - s->missing_samples*ATTENUATION_INCREMENT;
- i = 0;
- }
- for ( ; gain > 0.0 && i < len; i++)
- {
- amp[i] = (pj_int16_t)(s->pitchbuf[s->pitch_offset]*gain);
- gain = gain - ATTENUATION_INCREMENT;
- if (++s->pitch_offset >= s->pitch)
- s->pitch_offset = 0;
- }
- for ( ; i < len; i++)
- amp[i] = 0;
- s->missing_samples += orig_len;
- save_history(s, amp, len);
- return len;
-}
-/*- End of function --------------------------------------------------------*/
-
-plc_state_t *plc_init(plc_state_t *s)
-{
- memset(s, 0, sizeof(*s));
- return s;
-}
-/*- End of function --------------------------------------------------------*/
-
-
-/*
- * PJMEDIA specifics
- */
-#include <pj/assert.h>
-#include <pj/pool.h>
-#include <pj/log.h>
-
-#define THIS_FILE "plc_steveu.c"
-
-struct steveu_plc
-{
- plc_state_t state;
- unsigned samples_per_frame;
-};
-
-void* pjmedia_plc_steveu_create(pj_pool_t *pool, unsigned c, unsigned f)
-{
- struct steveu_plc *splc;
-
- PJ_ASSERT_RETURN(c==8000, NULL);
- PJ_UNUSED_ARG(c);
-
- splc = pj_pool_alloc(pool, sizeof(struct steveu_plc));
- plc_init(&splc->state);
- splc->samples_per_frame = f;
-
- return splc;
-}
-
-void pjmedia_plc_steveu_save(void *obj, pj_int16_t *samples)
-{
- struct steveu_plc *splc = obj;
- plc_rx(&splc->state, samples, splc->samples_per_frame);
-}
-
-void pjmedia_plc_steveu_generate(void *obj, pj_int16_t *samples)
-{
- struct steveu_plc *splc = obj;
- //PJ_LOG(5,(THIS_FILE, "PLC: generating lost frame"));
- plc_fillin(&splc->state, samples, splc->samples_per_frame);
-}
-
-/*- End of file ------------------------------------------------------------*/
-
diff --git a/pjmedia/src/pjmedia/resample_resample.c b/pjmedia/src/pjmedia/resample_resample.c
index 0dc755d9..9caaa31b 100644
--- a/pjmedia/src/pjmedia/resample_resample.c
+++ b/pjmedia/src/pjmedia/resample_resample.c
@@ -217,7 +217,57 @@ PJ_DEF(void) pjmedia_resample_destroy(pjmedia_resample *resample)
#else /* PJMEDIA_HAS_LIBRESAMPLE */
-int pjmedia_resample_resample_excluded;
+/*
+ * This is the configuration when sample rate conversion is disabled.
+ */
+struct pjmedia_resample
+{
+ unsigned samples_per_frame;
+};
+
+PJ_DEF(pj_status_t) pjmedia_resample_create( pj_pool_t *pool,
+ pj_bool_t high_quality,
+ pj_bool_t large_filter,
+ unsigned channel_count,
+ unsigned rate_in,
+ unsigned rate_out,
+ unsigned samples_per_frame,
+ pjmedia_resample **p_resample)
+{
+ pjmedia_resample *resample;
+
+ PJ_ASSERT_RETURN(rate_in == rate_out, PJ_EINVALIDOP);
+
+ PJ_UNUSED_ARG(high_quality);
+ PJ_UNUSED_ARG(large_filter);
+ PJ_UNUSED_ARG(channel_count);
+ PJ_UNUSED_ARG(rate_in);
+ PJ_UNUSED_ARG(rate_out);
+
+ resample = PJ_POOL_ZALLOC_T(pool, pjmedia_resample);
+ resample->samples_per_frame = samples_per_frame;
+
+ *p_resample = resample;
+
+ return PJ_SUCCESS;
+}
+
+PJ_DEF(void) pjmedia_resample_run( pjmedia_resample *resample,
+ const pj_int16_t *input,
+ pj_int16_t *output )
+{
+ pjmedia_copy_samples(output, input, resample->samples_per_frame);
+}
+
+PJ_DEF(unsigned) pjmedia_resample_get_input_size(pjmedia_resample *resample)
+{
+ return resample->samples_per_frame;
+}
+
+PJ_DEF(void) pjmedia_resample_destroy(pjmedia_resample *resample)
+{
+ PJ_UNUSED_ARG(resample);
+}
#endif /* PJMEDIA_HAS_LIBRESAMPLE */
diff --git a/pjmedia/src/pjmedia/symbian_sound.cpp b/pjmedia/src/pjmedia/symbian_sound.cpp
new file mode 100644
index 00000000..c2db57b5
--- /dev/null
+++ b/pjmedia/src/pjmedia/symbian_sound.cpp
@@ -0,0 +1,873 @@
+/* $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
+ */
+#include <pjmedia/sound.h>
+#include <pjmedia/errno.h>
+#include <pj/assert.h>
+#include <pj/log.h>
+#include <pj/os.h>
+
+
+/*
+ * This file provides sound implementation for Symbian Audio Streaming
+ * device. Application using this sound abstraction must link with:
+ * - mediaclientaudiostream.lib, and
+ * - mediaclientaudioinputstream.lib
+ */
+#include <mda/common/audio.h>
+#include <MdaAudioOutputStream.h>
+#include <MdaAudioInputStream.h>
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+
+#define THIS_FILE "symbian_sound.cpp"
+#define BYTES_PER_SAMPLE 2
+#define POOL_NAME "SymbianSound"
+#define POOL_SIZE 512
+#define POOL_INC 512
+
+static pjmedia_snd_dev_info symbian_snd_dev_info =
+{
+ "Symbian Sound Device",
+ 1,
+ 1,
+ 8000
+};
+
+class CPjAudioInputEngine;
+class CPjAudioOutputEngine;
+
+/*
+ * PJMEDIA Sound Stream instance
+ */
+struct pjmedia_snd_stream
+{
+ // Pool
+ pj_pool_t *pool;
+
+ // Common settings.
+ unsigned clock_rate;
+ unsigned channel_count;
+ unsigned samples_per_frame;
+
+ // Input stream
+ CPjAudioInputEngine *inEngine;
+
+ // Output stream
+ CPjAudioOutputEngine *outEngine;
+};
+
+static pj_pool_factory *snd_pool_factory;
+
+
+/*
+ * Convert clock rate to Symbian's TMdaAudioDataSettings capability.
+ */
+static TInt get_clock_rate_cap(unsigned clock_rate)
+{
+ switch (clock_rate) {
+ case 8000: return TMdaAudioDataSettings::ESampleRate8000Hz;
+ case 11025: return TMdaAudioDataSettings::ESampleRate11025Hz;
+ case 12000: return TMdaAudioDataSettings::ESampleRate12000Hz;
+ case 16000: return TMdaAudioDataSettings::ESampleRate16000Hz;
+ case 22050: return TMdaAudioDataSettings::ESampleRate22050Hz;
+ case 24000: return TMdaAudioDataSettings::ESampleRate24000Hz;
+ case 32000: return TMdaAudioDataSettings::ESampleRate32000Hz;
+ case 44100: return TMdaAudioDataSettings::ESampleRate44100Hz;
+ case 48000: return TMdaAudioDataSettings::ESampleRate48000Hz;
+ case 64000: return TMdaAudioDataSettings::ESampleRate64000Hz;
+ case 96000: return TMdaAudioDataSettings::ESampleRate96000Hz;
+ default:
+ return 0;
+ }
+}
+
+
+/*
+ * Convert number of channels into Symbian's TMdaAudioDataSettings capability.
+ */
+static TInt get_channel_cap(unsigned channel_count)
+{
+ switch (channel_count) {
+ case 1: return TMdaAudioDataSettings::EChannelsMono;
+ case 2: return TMdaAudioDataSettings::EChannelsStereo;
+ default:
+ return 0;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+
+/*
+ * Implementation: Symbian Input Stream.
+ */
+class CPjAudioInputEngine : public MMdaAudioInputStreamCallback
+{
+public:
+ enum State
+ {
+ STATE_INACTIVE,
+ STATE_ACTIVE,
+ };
+
+ ~CPjAudioInputEngine();
+
+ static CPjAudioInputEngine *NewL(pjmedia_snd_stream *parent_strm,
+ pjmedia_snd_rec_cb rec_cb,
+ void *user_data);
+
+ static CPjAudioInputEngine *NewLC(pjmedia_snd_stream *parent_strm,
+ pjmedia_snd_rec_cb rec_cb,
+ void *user_data);
+
+ pj_status_t StartRecord();
+ void Stop();
+
+public:
+ State state_;
+ pjmedia_snd_stream *parentStrm_;
+ pjmedia_snd_rec_cb recCb_;
+ void *userData_;
+ CMdaAudioInputStream *iInputStream_;
+ HBufC8 *iStreamBuffer_;
+ TPtr8 iFramePtr_;
+ TInt lastError_;
+ pj_uint32_t timeStamp_;
+
+ CPjAudioInputEngine(pjmedia_snd_stream *parent_strm,
+ pjmedia_snd_rec_cb rec_cb,
+ void *user_data);
+ void ConstructL();
+
+public:
+ virtual void MaiscOpenComplete(TInt aError);
+ virtual void MaiscBufferCopied(TInt aError, const TDesC8 &aBuffer);
+ virtual void MaiscRecordComplete(TInt aError);
+
+};
+
+
+CPjAudioInputEngine::CPjAudioInputEngine(pjmedia_snd_stream *parent_strm,
+ pjmedia_snd_rec_cb rec_cb,
+ void *user_data)
+ : state_(STATE_INACTIVE), parentStrm_(parent_strm), recCb_(rec_cb),
+ iInputStream_(NULL), iStreamBuffer_(NULL), iFramePtr_(NULL, 0),
+ userData_(user_data), lastError_(KErrNone), timeStamp_(0)
+{
+}
+
+CPjAudioInputEngine::~CPjAudioInputEngine()
+{
+ Stop();
+ delete iStreamBuffer_;
+}
+
+void CPjAudioInputEngine::ConstructL()
+{
+ iStreamBuffer_ = HBufC8::NewMaxL(parentStrm_->samples_per_frame *
+ parentStrm_->channel_count *
+ BYTES_PER_SAMPLE);
+}
+
+CPjAudioInputEngine *CPjAudioInputEngine::NewLC(pjmedia_snd_stream *parent,
+ pjmedia_snd_rec_cb rec_cb,
+ void *user_data)
+{
+ CPjAudioInputEngine* self = new (ELeave) CPjAudioInputEngine(parent,
+ rec_cb,
+ user_data);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+CPjAudioInputEngine *CPjAudioInputEngine::NewL(pjmedia_snd_stream *parent,
+ pjmedia_snd_rec_cb rec_cb,
+ void *user_data)
+{
+ CPjAudioInputEngine *self = NewLC(parent, rec_cb, user_data);
+ CleanupStack::Pop(self);
+ return self;
+}
+
+
+pj_status_t CPjAudioInputEngine::StartRecord()
+{
+
+ // Ignore command if recording is in progress.
+ if (state_ == STATE_ACTIVE)
+ return PJ_SUCCESS;
+
+ // According to Nokia's AudioStream example, some 2nd Edition, FP2 devices
+ // (such as Nokia 6630) require the stream to be reconstructed each time
+ // before calling Open() - otherwise the callback never gets called.
+ // For uniform behavior, lets just delete/re-create the stream for all
+ // devices.
+
+ // Destroy existing stream.
+ if (iInputStream_) delete iInputStream_;
+ iInputStream_ = NULL;
+
+ // Create the stream.
+ TRAPD(err, iInputStream_ = CMdaAudioInputStream::NewL(*this));
+ if (err != KErrNone)
+ return PJ_RETURN_OS_ERROR(err);
+
+ // Initialize settings.
+ TMdaAudioDataSettings iStreamSettings;
+ iStreamSettings.iChannels = get_channel_cap(parentStrm_->channel_count);
+ iStreamSettings.iSampleRate = get_clock_rate_cap(parentStrm_->clock_rate);
+
+ pj_assert(iStreamSettings.iChannels != 0 &&
+ iStreamSettings.iSampleRate != 0);
+
+ // Create timeout timer to wait for Open to complete
+ RTimer timer;
+ TRequestStatus reqStatus;
+ TInt rc;
+
+ rc = timer.CreateLocal();
+ if (rc != KErrNone) {
+ delete iInputStream_;
+ iInputStream_ = NULL;
+ return PJ_RETURN_OS_ERROR(rc);
+ }
+
+ PJ_LOG(4,(THIS_FILE, "Opening sound device for capture, "
+ "clock rate=%d, channel count=%d..",
+ parentStrm_->clock_rate,
+ parentStrm_->channel_count));
+
+ // Open stream.
+ lastError_ = KRequestPending;
+ iInputStream_->Open(&iStreamSettings);
+
+ // Wait until callback is called.
+ if (lastError_ == KRequestPending) {
+ timer.After(reqStatus, 5 * 1000 * 1000);
+
+ do {
+ User::WaitForAnyRequest();
+ } while (lastError_==KRequestPending && reqStatus==KRequestPending);
+
+ if (reqStatus==KRequestPending)
+ timer.Cancel();
+ }
+
+ // Close timer
+ timer.Close();
+
+ // Handle timeout
+ if (lastError_ == KRequestPending) {
+ iInputStream_->Stop();
+ delete iInputStream_;
+ iInputStream_ = NULL;
+ return PJ_ETIMEDOUT;
+ }
+ else if (lastError_ != KErrNone) {
+ // Handle failure.
+ delete iInputStream_;
+ iInputStream_ = NULL;
+ return PJ_RETURN_OS_ERROR(lastError_);
+ }
+
+ // Feed the first frame.
+ iFramePtr_ = iStreamBuffer_->Des();
+ iInputStream_->ReadL(iFramePtr_);
+
+ // Success
+ PJ_LOG(4,(THIS_FILE, "Sound capture started."));
+ return PJ_SUCCESS;
+}
+
+
+void CPjAudioInputEngine::Stop()
+{
+ // If capture is in progress, stop it.
+ if (iInputStream_ && state_ == STATE_ACTIVE) {
+ lastError_ = KRequestPending;
+ iInputStream_->Stop();
+
+ // Wait until it's actually stopped
+ while (lastError_ == KRequestPending)
+ pj_thread_sleep(100);
+ }
+
+ if (iInputStream_) {
+ delete iInputStream_;
+ iInputStream_ = NULL;
+ }
+
+ state_ = STATE_INACTIVE;
+}
+
+
+void CPjAudioInputEngine::MaiscOpenComplete(TInt aError)
+{
+ lastError_ = aError;
+}
+
+void CPjAudioInputEngine::MaiscBufferCopied(TInt aError,
+ const TDesC8 &aBuffer)
+{
+ lastError_ = aError;
+ if (aError != KErrNone)
+ return;
+
+ // Call the callback.
+ recCb_(userData_, timeStamp_, (void*)aBuffer.Ptr(), aBuffer.Size());
+
+ // Increment timestamp.
+ timeStamp_ += (aBuffer.Size() * BYTES_PER_SAMPLE);
+
+ // Record next frame
+ iFramePtr_ = iStreamBuffer_->Des();
+ iInputStream_->ReadL(iFramePtr_);
+}
+
+
+void CPjAudioInputEngine::MaiscRecordComplete(TInt aError)
+{
+ lastError_ = aError;
+ state_ = STATE_INACTIVE;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+
+/*
+ * Implementation: Symbian Output Stream.
+ */
+
+class CPjAudioOutputEngine : public MMdaAudioOutputStreamCallback
+{
+public:
+ enum State
+ {
+ STATE_INACTIVE,
+ STATE_ACTIVE,
+ };
+
+ ~CPjAudioOutputEngine();
+
+ static CPjAudioOutputEngine *NewL(pjmedia_snd_stream *parent_strm,
+ pjmedia_snd_play_cb play_cb,
+ void *user_data);
+
+ static CPjAudioOutputEngine *NewLC(pjmedia_snd_stream *parent_strm,
+ pjmedia_snd_play_cb rec_cb,
+ void *user_data);
+
+ pj_status_t StartPlay();
+ void Stop();
+
+public:
+ State state_;
+ pjmedia_snd_stream *parentStrm_;
+ pjmedia_snd_play_cb playCb_;
+ void *userData_;
+ CMdaAudioOutputStream *iOutputStream_;
+ TUint8 *frameBuf_;
+ unsigned frameBufSize_;
+ TInt lastError_;
+ unsigned timestamp_;
+
+ CPjAudioOutputEngine(pjmedia_snd_stream *parent_strm,
+ pjmedia_snd_play_cb play_cb,
+ void *user_data);
+ void ConstructL();
+
+ virtual void MaoscOpenComplete(TInt aError);
+ virtual void MaoscBufferCopied(TInt aError, const TDesC8& aBuffer);
+ virtual void MaoscPlayComplete(TInt aError);
+};
+
+
+CPjAudioOutputEngine::CPjAudioOutputEngine(pjmedia_snd_stream *parent_strm,
+ pjmedia_snd_play_cb play_cb,
+ void *user_data)
+: state_(STATE_INACTIVE), parentStrm_(parent_strm), playCb_(play_cb),
+ userData_(user_data), iOutputStream_(NULL), frameBuf_(NULL),
+ lastError_(KErrNone), timestamp_(0)
+{
+}
+
+
+void CPjAudioOutputEngine::ConstructL()
+{
+ frameBufSize_ = parentStrm_->samples_per_frame *
+ parentStrm_->channel_count *
+ BYTES_PER_SAMPLE;
+ frameBuf_ = new TUint8[frameBufSize_];
+}
+
+CPjAudioOutputEngine::~CPjAudioOutputEngine()
+{
+ Stop();
+ delete [] frameBuf_;
+}
+
+CPjAudioOutputEngine *
+CPjAudioOutputEngine::NewLC(pjmedia_snd_stream *parent_strm,
+ pjmedia_snd_play_cb rec_cb,
+ void *user_data)
+{
+ CPjAudioOutputEngine* self = new (ELeave) CPjAudioOutputEngine(parent_strm,
+ rec_cb,
+ user_data);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+CPjAudioOutputEngine *
+CPjAudioOutputEngine::NewL(pjmedia_snd_stream *parent_strm,
+ pjmedia_snd_play_cb play_cb,
+ void *user_data)
+{
+ CPjAudioOutputEngine *self = NewLC(parent_strm, play_cb, user_data);
+ CleanupStack::Pop(self);
+ return self;
+}
+
+pj_status_t CPjAudioOutputEngine::StartPlay()
+{
+ // Ignore command if playing is in progress.
+ if (state_ == STATE_ACTIVE)
+ return PJ_SUCCESS;
+
+ // Destroy existing stream.
+ if (iOutputStream_) delete iOutputStream_;
+ iOutputStream_ = NULL;
+
+ // Create the stream
+ TRAPD(err, iOutputStream_ = CMdaAudioOutputStream::NewL(*this));
+ if (err != KErrNone)
+ return PJ_RETURN_OS_ERROR(err);
+
+ // Initialize settings.
+ TMdaAudioDataSettings iStreamSettings;
+ iStreamSettings.iChannels = get_channel_cap(parentStrm_->channel_count);
+ iStreamSettings.iSampleRate = get_clock_rate_cap(parentStrm_->clock_rate);
+
+ pj_assert(iStreamSettings.iChannels != 0 &&
+ iStreamSettings.iSampleRate != 0);
+
+ PJ_LOG(4,(THIS_FILE, "Opening sound device for playback, "
+ "clock rate=%d, channel count=%d..",
+ parentStrm_->clock_rate,
+ parentStrm_->channel_count));
+
+ // Open stream.
+ lastError_ = KRequestPending;
+ iOutputStream_->Open(&iStreamSettings);
+
+ // Wait until callback is called.
+ while (lastError_ == KRequestPending)
+ pj_thread_sleep(100);
+
+ // Handle failure.
+ if (lastError_ != KErrNone) {
+ delete iOutputStream_;
+ iOutputStream_ = NULL;
+ return PJ_RETURN_OS_ERROR(lastError_);
+ }
+
+ // Success
+ PJ_LOG(4,(THIS_FILE, "Sound playback started"));
+ return PJ_SUCCESS;
+
+}
+
+void CPjAudioOutputEngine::Stop()
+{
+ // Stop stream if it's playing
+ if (iOutputStream_ && state_ != STATE_INACTIVE) {
+ lastError_ = KRequestPending;
+ iOutputStream_->Stop();
+
+ // Wait until it's actually stopped
+ while (lastError_ == KRequestPending)
+ pj_thread_sleep(100);
+ }
+
+ if (iOutputStream_) {
+ delete iOutputStream_;
+ iOutputStream_ = NULL;
+ }
+
+ state_ = STATE_INACTIVE;
+}
+
+void CPjAudioOutputEngine::MaoscOpenComplete(TInt aError)
+{
+ lastError_ = aError;
+
+ if (aError==KErrNone) {
+ // output stream opened succesfully, set status to Active
+ state_ = STATE_ACTIVE;
+
+ // set stream properties, 16bit 8KHz mono
+ TMdaAudioDataSettings iSettings;
+ iSettings.iChannels = get_channel_cap(parentStrm_->channel_count);
+ iSettings.iSampleRate = get_clock_rate_cap(parentStrm_->clock_rate);
+
+ iOutputStream_->SetAudioPropertiesL(iSettings.iSampleRate,
+ iSettings.iChannels);
+
+ // set volume to 1/4th of stream max volume
+ iOutputStream_->SetVolume(iOutputStream_->MaxVolume()/4);
+
+ // set stream priority to normal and time sensitive
+ iOutputStream_->SetPriority(EPriorityNormal,
+ EMdaPriorityPreferenceTime);
+
+ // Call callback to retrieve frame from upstream.
+ pj_status_t status;
+ status = playCb_(this->userData_, timestamp_, frameBuf_,
+ frameBufSize_);
+ if (status != PJ_SUCCESS) {
+ this->Stop();
+ return;
+ }
+
+ // Increment timestamp.
+ timestamp_ += (frameBufSize_ / BYTES_PER_SAMPLE);
+
+ // issue WriteL() to write the first audio data block,
+ // subsequent calls to WriteL() will be issued in
+ // MMdaAudioOutputStreamCallback::MaoscBufferCopied()
+ // until whole data buffer is written.
+ TPtrC8 frame(frameBuf_, frameBufSize_);
+ iOutputStream_->WriteL(frame);
+ }
+}
+
+void CPjAudioOutputEngine::MaoscBufferCopied(TInt aError,
+ const TDesC8& aBuffer)
+{
+ PJ_UNUSED_ARG(aBuffer);
+
+ if (aError==KErrNone) {
+ // Buffer successfully written, feed another one.
+
+ // Call callback to retrieve frame from upstream.
+ pj_status_t status;
+ status = playCb_(this->userData_, timestamp_, frameBuf_,
+ frameBufSize_);
+ if (status != PJ_SUCCESS) {
+ this->Stop();
+ return;
+ }
+
+ // Increment timestamp.
+ timestamp_ += (frameBufSize_ / BYTES_PER_SAMPLE);
+
+ // Write to playback stream.
+ TPtrC8 frame(frameBuf_, frameBufSize_);
+ iOutputStream_->WriteL(frame);
+
+ } else if (aError==KErrAbort) {
+ // playing was aborted, due to call to CMdaAudioOutputStream::Stop()
+ state_ = STATE_INACTIVE;
+ } else {
+ // error writing data to output
+ lastError_ = aError;
+ state_ = STATE_INACTIVE;
+ }
+}
+
+void CPjAudioOutputEngine::MaoscPlayComplete(TInt aError)
+{
+ lastError_ = aError;
+ state_ = STATE_INACTIVE;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+
+
+/*
+ * Initialize sound subsystem.
+ */
+PJ_DEF(pj_status_t) pjmedia_snd_init(pj_pool_factory *factory)
+{
+ snd_pool_factory = factory;
+ return PJ_SUCCESS;
+}
+
+/*
+ * Get device count.
+ */
+PJ_DEF(int) pjmedia_snd_get_dev_count(void)
+{
+ /* Always return 1 */
+ return 1;
+}
+
+/*
+ * Get device info.
+ */
+PJ_DEF(const pjmedia_snd_dev_info*) pjmedia_snd_get_dev_info(unsigned index)
+{
+ /* Always return the default sound device */
+ PJ_ASSERT_RETURN(index==0, NULL);
+ return &symbian_snd_dev_info;
+}
+
+
+
+/*
+ * Open sound recorder stream.
+ */
+PJ_DEF(pj_status_t) pjmedia_snd_open_rec( int index,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned bits_per_sample,
+ pjmedia_snd_rec_cb rec_cb,
+ void *user_data,
+ pjmedia_snd_stream **p_snd_strm)
+{
+ pj_pool_t *pool;
+ pjmedia_snd_stream *strm;
+
+ PJ_ASSERT_RETURN(index == 0, PJ_EINVAL);
+ PJ_ASSERT_RETURN(clock_rate && channel_count && samples_per_frame &&
+ bits_per_sample && rec_cb && p_snd_strm, PJ_EINVAL);
+
+ pool = pj_pool_create(snd_pool_factory, POOL_NAME, POOL_SIZE, POOL_INC,
+ NULL);
+ if (!pool)
+ return PJ_ENOMEM;
+
+ strm = (pjmedia_snd_stream*) pj_pool_zalloc(pool,
+ sizeof(pjmedia_snd_stream));
+ strm->pool = pool;
+ strm->clock_rate = clock_rate;
+ strm->channel_count = channel_count;
+ strm->samples_per_frame = samples_per_frame;
+
+ TMdaAudioDataSettings settings;
+ TInt clockRateCap, channelCountCap;
+
+ clockRateCap = get_clock_rate_cap(clock_rate);
+ channelCountCap = get_channel_cap(channel_count);
+
+ PJ_ASSERT_RETURN(bits_per_sample == 16, PJ_EINVAL);
+ PJ_ASSERT_RETURN(clockRateCap != 0, PJ_EINVAL);
+ PJ_ASSERT_RETURN(channelCountCap != 0, PJ_EINVAL);
+
+ // Create the input stream.
+ TRAPD(err, strm->inEngine = CPjAudioInputEngine::NewL(strm, rec_cb,
+ user_data));
+ if (err != KErrNone) {
+ pj_pool_release(pool);
+ return PJ_RETURN_OS_ERROR(err);
+ }
+
+
+ // Done.
+ *p_snd_strm = strm;
+ return PJ_SUCCESS;
+}
+
+PJ_DEF(pj_status_t) pjmedia_snd_open_player( int index,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned bits_per_sample,
+ pjmedia_snd_play_cb play_cb,
+ void *user_data,
+ pjmedia_snd_stream **p_snd_strm )
+{
+ pj_pool_t *pool;
+ pjmedia_snd_stream *strm;
+
+ PJ_ASSERT_RETURN(index == 0, PJ_EINVAL);
+ PJ_ASSERT_RETURN(clock_rate && channel_count && samples_per_frame &&
+ bits_per_sample && play_cb && p_snd_strm, PJ_EINVAL);
+
+ pool = pj_pool_create(snd_pool_factory, POOL_NAME, POOL_SIZE, POOL_INC,
+ NULL);
+ if (!pool)
+ return PJ_ENOMEM;
+
+ strm = (pjmedia_snd_stream*) pj_pool_zalloc(pool,
+ sizeof(pjmedia_snd_stream));
+ strm->pool = pool;
+ strm->clock_rate = clock_rate;
+ strm->channel_count = channel_count;
+ strm->samples_per_frame = samples_per_frame;
+
+ TMdaAudioDataSettings settings;
+ TInt clockRateCap, channelCountCap;
+
+ clockRateCap = get_clock_rate_cap(clock_rate);
+ channelCountCap = get_channel_cap(channel_count);
+
+ PJ_ASSERT_RETURN(bits_per_sample == 16, PJ_EINVAL);
+ PJ_ASSERT_RETURN(clockRateCap != 0, PJ_EINVAL);
+ PJ_ASSERT_RETURN(channelCountCap != 0, PJ_EINVAL);
+
+ // Create the output stream.
+ TRAPD(err, strm->outEngine = CPjAudioOutputEngine::NewL(strm, play_cb,
+ user_data));
+ if (err != KErrNone) {
+ pj_pool_release(pool);
+ return PJ_RETURN_OS_ERROR(err);
+ }
+
+ // Done.
+ *p_snd_strm = strm;
+ return PJ_SUCCESS;
+}
+
+PJ_DEF(pj_status_t) pjmedia_snd_open( int rec_id,
+ int play_id,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned bits_per_sample,
+ pjmedia_snd_rec_cb rec_cb,
+ pjmedia_snd_play_cb play_cb,
+ void *user_data,
+ pjmedia_snd_stream **p_snd_strm)
+{
+ pj_pool_t *pool;
+ pjmedia_snd_stream *strm;
+
+ PJ_ASSERT_RETURN(rec_id == 0 && play_id == 0, PJ_EINVAL);
+ PJ_ASSERT_RETURN(clock_rate && channel_count && samples_per_frame &&
+ bits_per_sample && rec_cb && play_cb && p_snd_strm,
+ PJ_EINVAL);
+
+ pool = pj_pool_create(snd_pool_factory, POOL_NAME, POOL_SIZE, POOL_INC,
+ NULL);
+ if (!pool)
+ return PJ_ENOMEM;
+
+ strm = (pjmedia_snd_stream*) pj_pool_zalloc(pool,
+ sizeof(pjmedia_snd_stream));
+ strm->pool = pool;
+ strm->clock_rate = clock_rate;
+ strm->channel_count = channel_count;
+ strm->samples_per_frame = samples_per_frame;
+
+ TMdaAudioDataSettings settings;
+ TInt clockRateCap, channelCountCap;
+
+ clockRateCap = get_clock_rate_cap(clock_rate);
+ channelCountCap = get_channel_cap(channel_count);
+
+ PJ_ASSERT_RETURN(bits_per_sample == 16, PJ_EINVAL);
+ PJ_ASSERT_RETURN(clockRateCap != 0, PJ_EINVAL);
+ PJ_ASSERT_RETURN(channelCountCap != 0, PJ_EINVAL);
+
+ // Create the output stream.
+ TRAPD(err, strm->outEngine = CPjAudioOutputEngine::NewL(strm, play_cb,
+ user_data));
+ if (err != KErrNone) {
+ pj_pool_release(pool);
+ return PJ_RETURN_OS_ERROR(err);
+ }
+
+ // Done.
+ *p_snd_strm = strm;
+ return PJ_SUCCESS;
+}
+
+
+PJ_DEF(pj_status_t) pjmedia_snd_stream_start(pjmedia_snd_stream *stream)
+{
+ pj_status_t status;
+
+ PJ_ASSERT_RETURN(stream != NULL, PJ_EINVAL);
+
+ if (stream->inEngine) {
+ status = stream->inEngine->StartRecord();
+ if (status != PJ_SUCCESS)
+ return status;
+ }
+
+ if (stream->outEngine) {
+ status = stream->outEngine->StartPlay();
+ if (status != PJ_SUCCESS)
+ return status;
+ }
+
+ return PJ_SUCCESS;
+}
+
+
+PJ_DEF(pj_status_t) pjmedia_snd_stream_stop(pjmedia_snd_stream *stream)
+{
+ PJ_ASSERT_RETURN(stream != NULL, PJ_EINVAL);
+
+ if (stream->inEngine) {
+ stream->inEngine->Stop();
+ }
+
+ if (stream->outEngine) {
+ stream->outEngine->Stop();
+ }
+
+ return PJ_SUCCESS;
+}
+
+
+PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream)
+{
+ pj_pool_t *pool;
+
+ PJ_ASSERT_RETURN(stream != NULL, PJ_EINVAL);
+
+ if (stream->inEngine) {
+ delete stream->inEngine;
+ stream->inEngine = NULL;
+ }
+
+ if (stream->outEngine) {
+ delete stream->outEngine;
+ stream->outEngine = NULL;
+ }
+
+ pool = stream->pool;
+ if (pool) {
+ stream->pool = NULL;
+ pj_pool_release(pool);
+ }
+
+ return PJ_SUCCESS;
+}
+
+
+PJ_DEF(pj_status_t) pjmedia_snd_deinit(void)
+{
+ /* Nothing to do */
+ return PJ_SUCCESS;
+}
+
diff --git a/pjnath/include/pjnath/ice_session.h b/pjnath/include/pjnath/ice_session.h
index aaa07ae6..5084c318 100644
--- a/pjnath/include/pjnath/ice_session.h
+++ b/pjnath/include/pjnath/ice_session.h
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef __PJNATH_ICE_SOCK_H__
-#define __PJNATH_ICE_SOCK_H__
+#ifndef __PJNATH_ICE_SESSION_H__
+#define __PJNATH_ICE_SESSION_H__
/**
* @file ice_session.h
@@ -750,5 +750,5 @@ PJ_DECL(pj_status_t) pj_ice_sess_on_rx_pkt(pj_ice_sess *ice,
PJ_END_DECL
-#endif /* __PJNATH_ICE_SOCK_H__ */
+#endif /* __PJNATH_ICE_SESSION_H__ */
diff --git a/pjnath/include/pjnath/ice_strans.h b/pjnath/include/pjnath/ice_strans.h
index c145b277..ba9d669a 100644
--- a/pjnath/include/pjnath/ice_strans.h
+++ b/pjnath/include/pjnath/ice_strans.h
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef __PJNATH_ICE_STREAM_TRANSPORT_H__
-#define __PJNATH_ICE_STREAM_TRANSPORT_H__
+#ifndef __PJNATH_ICE_STRANS_H__
+#define __PJNATH_ICE_STRANS_H__
/**
@@ -587,5 +587,5 @@ PJ_END_DECL
-#endif /* __PJNATH_ICE_STREAM_TRANSPORT_H__ */
+#endif /* __PJNATH_ICE_STRANS_H__ */
diff --git a/pjsip-apps/src/symbian_ua/main_symbian.cpp b/pjsip-apps/src/symbian_ua/main_symbian.cpp
new file mode 100644
index 00000000..a90ea167
--- /dev/null
+++ b/pjsip-apps/src/symbian_ua/main_symbian.cpp
@@ -0,0 +1,157 @@
+//Auto-generated file. Please do not modify.
+//#include <e32cmn.h>
+
+//#pragma data_seg(".SYMBIAN")
+//__EMULATOR_IMAGE_HEADER2 (0x1000007a,0x00000000,0x00000000,EPriorityForeground,0x00000000u,0x00000000u,0x00000000,0x00000000,0x00000000,0)
+//#pragma data_seg()
+
+#include "ua.h"
+#include <stdlib.h>
+#include <pj/errno.h>
+#include <pj/os.h>
+#include <pj/log.h>
+#include <pj/unicode.h>
+#include <stdio.h>
+
+#include <e32std.h>
+
+#include <pj/os.h>
+
+#include <e32base.h>
+#include <e32std.h>
+
+
+
+// Global Variables
+CConsoleBase* console;
+static CActiveSchedulerWait *asw;
+
+
+// Local Functions
+
+LOCAL_C void MainL()
+{
+ //
+ // add your program code here, example code below
+ //
+ int rc = ua_main();
+
+ asw->AsyncStop();
+}
+
+class MyScheduler : public CActiveScheduler
+{
+public:
+ MyScheduler()
+ {}
+
+ void Error(TInt aError) const;
+};
+
+void MyScheduler::Error(TInt aError) const
+{
+ PJ_UNUSED_ARG(aError);
+}
+
+class MyTask : public CActive
+{
+public:
+ static MyTask *NewL();
+ void Start();
+
+protected:
+ MyTask();
+ void ConstructL();
+ virtual void RunL();
+ virtual void DoCancel();
+ TInt RunError(TInt aError);
+
+private:
+ RTimer timer_;
+};
+
+MyTask::MyTask()
+: CActive(EPriorityNormal)
+{
+}
+
+void MyTask::ConstructL()
+{
+ timer_.CreateLocal();
+ CActiveScheduler::Add(this);
+}
+
+MyTask *MyTask::NewL()
+{
+ MyTask *self = new (ELeave) MyTask;
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ CleanupStack::Pop(self);
+ return self;
+}
+
+void MyTask::Start()
+{
+ timer_.After(iStatus, 0);
+ SetActive();
+}
+
+void MyTask::RunL()
+{
+ MainL();
+}
+
+void MyTask::DoCancel()
+{
+}
+
+TInt MyTask::RunError(TInt aError)
+{
+ PJ_UNUSED_ARG(aError);
+ return KErrNone;
+}
+
+
+LOCAL_C void DoStartL()
+{
+ // Create active scheduler (to run active objects)
+ MyScheduler* scheduler = new (ELeave) MyScheduler;
+ CleanupStack::PushL(scheduler);
+ CActiveScheduler::Install(scheduler);
+
+ MyTask *task = MyTask::NewL();
+ task->Start();
+
+ asw = new CActiveSchedulerWait;
+ asw->Start();
+
+ delete asw;
+ CleanupStack::Pop(scheduler);
+}
+
+
+// Global Functions
+GLDEF_C TInt E32Main()
+{
+ // Create cleanup stack
+ //__UHEAP_MARK;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+
+ // Create output console
+ TRAPD(createError, console = Console::NewL(_L("Console"), TSize(KConsFullScreen,KConsFullScreen)));
+ if (createError)
+ return createError;
+
+ TRAPD(startError, DoStartL());
+
+ console->Printf(_L("[press any key to close]\n"));
+ console->Getch();
+
+ delete console;
+ delete cleanup;
+ //__UHEAP_MARKEND;
+ return KErrNone;
+}
+
diff --git a/pjsip-apps/src/symbian_ua/ua.cpp b/pjsip-apps/src/symbian_ua/ua.cpp
new file mode 100644
index 00000000..87735499
--- /dev/null
+++ b/pjsip-apps/src/symbian_ua/ua.cpp
@@ -0,0 +1,323 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2003-2007 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
+ */
+
+/**
+ * simple_pjsua.c
+ *
+ * This is a very simple but fully featured SIP user agent, with the
+ * following capabilities:
+ * - SIP registration
+ * - Making and receiving call
+ * - Audio/media to sound device.
+ *
+ * Usage:
+ * - To make outgoing call, start simple_pjsua with the URL of remote
+ * destination to contact.
+ * E.g.:
+ * simpleua sip:user@remote
+ *
+ * - Incoming calls will automatically be answered with 200.
+ *
+ * This program will quit once it has completed a single call.
+ */
+
+#include <pjsua-lib/pjsua.h>
+#include "ua.h"
+
+#define THIS_FILE "symbian_ua.cpp"
+
+#define SIP_DOMAIN "colinux"
+#define SIP_USER "bulukucing"
+#define SIP_PASSWD "netura"
+
+
+/* Callback called by the library upon receiving incoming call */
+static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
+ pjsip_rx_data *rdata)
+{
+ pjsua_call_info ci;
+
+ PJ_UNUSED_ARG(acc_id);
+ PJ_UNUSED_ARG(rdata);
+
+ pjsua_call_get_info(call_id, &ci);
+
+ PJ_LOG(3,(THIS_FILE, "Incoming call from %.*s!!",
+ (int)ci.remote_info.slen,
+ ci.remote_info.ptr));
+
+ /* Automatically answer incoming calls with 200/OK */
+ pjsua_call_answer(call_id, 200, NULL, NULL);
+}
+
+/* Callback called by the library when call's state has changed */
+static void on_call_state(pjsua_call_id call_id, pjsip_event *e)
+{
+ pjsua_call_info ci;
+
+ PJ_UNUSED_ARG(e);
+
+ pjsua_call_get_info(call_id, &ci);
+ PJ_LOG(3,(THIS_FILE, "Call %d state=%.*s", call_id,
+ (int)ci.state_text.slen,
+ ci.state_text.ptr));
+}
+
+/* Callback called by the library when call's media state has changed */
+static void on_call_media_state(pjsua_call_id call_id)
+{
+ pjsua_call_info ci;
+
+ pjsua_call_get_info(call_id, &ci);
+
+ if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE) {
+ // When media is active, connect call to sound device.
+ pjsua_conf_connect(ci.conf_slot, 0);
+ pjsua_conf_connect(0, ci.conf_slot);
+ }
+}
+
+
+/* Logging callback */
+static void log_writer(int level, const char *buf, unsigned len)
+{
+ wchar_t buf16[PJ_LOG_MAX_SIZE];
+
+ PJ_UNUSED_ARG(level);
+
+ pj_ansi_to_unicode(buf, len, buf16, PJ_ARRAY_SIZE(buf16));
+
+ TPtrC16 aBuf((const TUint16*)buf16, (TInt)len);
+ console->Write(aBuf);
+}
+
+/*
+ * app_startup()
+ *
+ * url may contain URL to call.
+ */
+static pj_status_t app_startup(char *url)
+{
+ pjsua_acc_id acc_id;
+ pj_status_t status;
+
+ /* Redirect log before pjsua_init() */
+ pj_log_set_log_func((void (*)(int,const char*,int)) &log_writer);
+
+ /* Create pjsua first! */
+ status = pjsua_create();
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "pjsua_create() error", status);
+ return status;
+ }
+
+ /* If argument is specified, it's got to be a valid SIP URL */
+ if (url) {
+ status = pjsua_verify_sip_url(url);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Invalid URL", status);
+ return status;
+ }
+ }
+
+ /* Init pjsua */
+ {
+ pjsua_config cfg;
+ pjsua_logging_config log_cfg;
+ pjsua_media_config med_cfg;
+
+ pjsua_config_default(&cfg);
+ cfg.thread_cnt = 0; // Disable threading on Symbian
+ cfg.cb.on_incoming_call = &on_incoming_call;
+ cfg.cb.on_call_media_state = &on_call_media_state;
+ cfg.cb.on_call_state = &on_call_state;
+
+ pjsua_logging_config_default(&log_cfg);
+ log_cfg.console_level = 4;
+ log_cfg.cb = &log_writer;
+
+ pjsua_media_config_default(&med_cfg);
+ med_cfg.thread_cnt = 0; // Disable threading on Symbian
+ med_cfg.has_ioqueue = PJ_FALSE;
+ med_cfg.ec_tail_len = 0;
+
+ status = pjsua_init(&cfg, &log_cfg, &med_cfg);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "pjsua_init() error", status);
+ pjsua_destroy();
+ return status;
+ }
+ }
+
+ /* Add UDP transport. */
+ {
+ pjsua_transport_config cfg;
+
+ pjsua_transport_config_default(&cfg);
+ cfg.port = 5060;
+ status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &cfg, NULL);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Error creating transport", status);
+ pjsua_destroy();
+ return status;
+ }
+ }
+
+ /* Initialization is done, now start pjsua */
+ status = pjsua_start();
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Error starting pjsua", status);
+ pjsua_destroy();
+ return status;
+ }
+
+ /* Register to SIP server by creating SIP account. */
+ {
+ pjsua_acc_config cfg;
+
+ pjsua_acc_config_default(&cfg);
+ cfg.id = pj_str("sip:" SIP_USER "@" SIP_DOMAIN);
+ cfg.reg_uri = pj_str("sip:" SIP_DOMAIN);
+ cfg.cred_count = 1;
+ cfg.cred_info[0].realm = pj_str(SIP_DOMAIN);
+ cfg.cred_info[0].scheme = pj_str("digest");
+ cfg.cred_info[0].username = pj_str(SIP_USER);
+ cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
+ cfg.cred_info[0].data = pj_str(SIP_PASSWD);
+
+ status = pjsua_acc_add(&cfg, PJ_TRUE, &acc_id);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Error adding account", status);
+ pjsua_destroy();
+ return status;
+ }
+ }
+
+ /* If URL is specified, make call to the URL. */
+ if (url != NULL) {
+ pj_str_t uri = pj_str(url);
+ status = pjsua_call_make_call(acc_id, &uri, 0, NULL, NULL, NULL);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Error making call", status);
+ pjsua_destroy();
+ return status;
+ }
+
+ }
+
+ return PJ_SUCCESS;
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+#include <e32base.h>
+
+class ConsoleUI : public CActive
+{
+public:
+ ConsoleUI(CActiveSchedulerWait *asw, CConsoleBase *con);
+
+ // Run console UI
+ void Run();
+
+ // Stop
+ void Stop();
+
+protected:
+ // Cancel asynchronous read.
+ void DoCancel();
+
+ // Implementation: called when read has completed.
+ void RunL();
+
+private:
+ CActiveSchedulerWait *asw_;
+ CConsoleBase *con_;
+};
+
+
+ConsoleUI::ConsoleUI(CActiveSchedulerWait *asw, CConsoleBase *con)
+: CActive(EPriorityStandard), asw_(asw), con_(con)
+{
+ CActiveScheduler::Add(this);
+}
+
+// Run console UI
+void ConsoleUI::Run()
+{
+ con_->Read(iStatus);
+ SetActive();
+}
+
+// Stop console UI
+void ConsoleUI::Stop()
+{
+ DoCancel();
+}
+
+// Cancel asynchronous read.
+void ConsoleUI::DoCancel()
+{
+ con_->ReadCancel();
+}
+
+// Implementation: called when read has completed.
+void ConsoleUI::RunL()
+{
+ TKeyCode kc = con_->KeyCode();
+
+ switch (kc) {
+ case 'q':
+ asw_->AsyncStop();
+ break;
+ default:
+ PJ_LOG(3,(THIS_FILE, "Keycode '%c' (%d) is pressed",
+ kc, kc));
+ Run();
+ break;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+int ua_main()
+{
+ pj_status_t status;
+
+ // Initialize pjsua
+ status = app_startup(NULL);
+ if (status != PJ_SUCCESS)
+ return status;
+
+
+ // Run the UI
+ CActiveSchedulerWait *asw = new CActiveSchedulerWait;
+ ConsoleUI *con = new ConsoleUI(asw, console);
+
+ con->Run();
+ asw->Start();
+
+ delete con;
+ delete asw;
+
+ // Shutdown pjsua
+ pjsua_destroy();
+
+ return 0;
+}
+
diff --git a/pjsip-apps/src/symbian_ua/ua.h b/pjsip-apps/src/symbian_ua/ua.h
new file mode 100644
index 00000000..cd9a1eea
--- /dev/null
+++ b/pjsip-apps/src/symbian_ua/ua.h
@@ -0,0 +1,5 @@
+#include <e32cons.h> // Console
+
+extern CConsoleBase* console; // write all messages to this
+
+int ua_main();
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
index f6a6a249..e08e10d2 100644
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -169,7 +169,7 @@ void inv_set_cause(pjsip_inv_session *inv, int cause_code,
const pj_str_t *cause_text)
{
if (cause_code > inv->cause) {
- inv->cause = cause_code;
+ inv->cause = (pjsip_status_code) cause_code;
if (cause_text)
pj_strdup(inv->pool, &inv->cause_text, cause_text);
else if (cause_code/100 == 2)
@@ -461,7 +461,7 @@ PJ_DEF(pj_status_t) pjsip_inv_create_uac( pjsip_dialog *dlg,
inv->dlg = dlg;
inv->options = options;
inv->notify = PJ_TRUE;
- inv->cause = 0;
+ inv->cause = (pjsip_status_code) 0;
/* Object name will use the same dialog pointer. */
pj_ansi_snprintf(inv->obj_name, PJ_MAX_OBJ_NAME, "inv%p", dlg);
@@ -883,7 +883,7 @@ PJ_DEF(pj_status_t) pjsip_inv_create_uas( pjsip_dialog *dlg,
inv->dlg = dlg;
inv->options = options;
inv->notify = PJ_TRUE;
- inv->cause = 0;
+ inv->cause = (pjsip_status_code) 0;
/* Object name will use the same dialog pointer. */
pj_ansi_snprintf(inv->obj_name, PJ_MAX_OBJ_NAME, "inv%p", dlg);
diff --git a/pjsip/src/pjsip-ua/sip_xfer.c b/pjsip/src/pjsip-ua/sip_xfer.c
index 798b04d0..f772f78d 100644
--- a/pjsip/src/pjsip-ua/sip_xfer.c
+++ b/pjsip/src/pjsip-ua/sip_xfer.c
@@ -58,7 +58,7 @@ enum
};
const pjsip_method pjsip_refer_method = {
- PJSIP_REFER_METHOD,
+ (pjsip_method_e) PJSIP_REFER_METHOD,
{ "REFER", 5}
};
diff --git a/pjsip/src/pjsip/sip_transport_udp.c b/pjsip/src/pjsip/sip_transport_udp.c
index 661d49fc..42e001da 100644
--- a/pjsip/src/pjsip/sip_transport_udp.c
+++ b/pjsip/src/pjsip/sip_transport_udp.c
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <pjsip/sip_transport.h>
+#include <pjsip/sip_transport_udp.h>
#include <pjsip/sip_endpoint.h>
#include <pjsip/sip_errno.h>
#include <pj/addr_resolv.h>
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c
index b2b63740..01be07f7 100644
--- a/pjsip/src/pjsua-lib/pjsua_acc.c
+++ b/pjsip/src/pjsua-lib/pjsua_acc.c
@@ -682,22 +682,22 @@ PJ_DEF(pj_status_t) pjsua_acc_get_info( pjsua_acc_id acc_id,
info->online_status = acc->online_status;
if (acc->reg_last_err) {
- info->status = acc->reg_last_err;
+ info->status = (pjsip_status_code) acc->reg_last_err;
pj_strerror(acc->reg_last_err, info->buf_, sizeof(info->buf_));
info->status_text = pj_str(info->buf_);
} else if (acc->reg_last_code) {
if (info->has_registration) {
- info->status = acc->reg_last_code;
+ info->status = (pjsip_status_code) acc->reg_last_code;
info->status_text = *pjsip_get_status_text(acc->reg_last_code);
} else {
- info->status = 0;
+ info->status = (pjsip_status_code) 0;
info->status_text = pj_str("not registered");
}
} else if (acc->cfg.reg_uri.slen) {
- info->status = 100;
+ info->status = PJSIP_SC_TRYING;
info->status_text = pj_str("In Progress");
} else {
- info->status = 0;
+ info->status = (pjsip_status_code) 0;
info->status_text = pj_str("does not register");
}
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index c86a7560..47dbaa72 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -84,7 +84,7 @@ static void reset_call(pjsua_call_id id)
call->user_data = NULL;
call->session = NULL;
call->xfer_sub = NULL;
- call->last_code = 0;
+ call->last_code = (pjsip_status_code) 0;
call->conf_slot = PJSUA_INVALID_ID;
call->last_text.ptr = call->last_text_buf_;
call->last_text.slen = 0;
@@ -1946,7 +1946,8 @@ static void pjsua_call_on_state_changed(pjsip_inv_session *inv,
case PJSIP_INV_STATE_CONNECTING:
if (call->res_time.sec == 0)
pj_gettimeofday(&call->res_time);
- call->last_code = e->body.tsx_state.tsx->status_code;
+ call->last_code = (pjsip_status_code)
+ e->body.tsx_state.tsx->status_code;
pj_strncpy(&call->last_text,
&e->body.tsx_state.tsx->status_text,
sizeof(call->last_text_buf_));
@@ -1959,14 +1960,16 @@ static void pjsua_call_on_state_changed(pjsip_inv_session *inv,
if (call->res_time.sec == 0)
pj_gettimeofday(&call->res_time);
if (e->body.tsx_state.tsx->status_code > call->last_code) {
- call->last_code = e->body.tsx_state.tsx->status_code;
+ call->last_code = (pjsip_status_code)
+ e->body.tsx_state.tsx->status_code;
pj_strncpy(&call->last_text,
&e->body.tsx_state.tsx->status_text,
sizeof(call->last_text_buf_));
}
break;
default:
- call->last_code = e->body.tsx_state.tsx->status_code;
+ call->last_code = (pjsip_status_code)
+ e->body.tsx_state.tsx->status_code;
pj_strncpy(&call->last_text,
&e->body.tsx_state.tsx->status_text,
sizeof(call->last_text_buf_));
@@ -2534,7 +2537,7 @@ static void on_call_transfered( pjsip_inv_session *inv,
&code);
if (code < 200)
- code = 200;
+ code = PJSIP_SC_OK;
if (code >= 300) {
/* Application rejects call transfer request */
pjsip_dlg_respond( inv->dlg, rdata, code, NULL, NULL, NULL);
@@ -2775,7 +2778,8 @@ static void pjsua_call_on_tsx_state_changed(pjsip_inv_session *inv,
&im_data->to,
&im_data->body,
im_data->user_data,
- tsx->status_code,
+ (pjsip_status_code)
+ tsx->status_code,
&tsx->status_text);
}
}
diff --git a/pjsip/src/pjsua-lib/pjsua_im.c b/pjsip/src/pjsua-lib/pjsua_im.c
index aa56e348..f9f945e6 100644
--- a/pjsip/src/pjsua-lib/pjsua_im.c
+++ b/pjsip/src/pjsua-lib/pjsua_im.c
@@ -35,7 +35,7 @@ enum
const pjsip_method pjsip_message_method =
{
- PJSIP_MESSAGE_METHOD,
+ (pjsip_method_e) PJSIP_MESSAGE_METHOD,
{ "MESSAGE", 7 }
};
@@ -340,7 +340,8 @@ static void im_callback(void *token, pjsip_event *e)
&im_data->to,
&im_data->body,
im_data->user_data,
- tsx->status_code,
+ (pjsip_status_code)
+ tsx->status_code,
&tsx->status_text);
}
}
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
index 80e4383e..bd306ae3 100644
--- a/pjsip/src/pjsua-lib/pjsua_media.c
+++ b/pjsip/src/pjsua-lib/pjsua_media.c
@@ -38,7 +38,7 @@ static void close_snd_dev(void);
*/
pj_status_t pjsua_media_subsys_init(const pjsua_media_config *cfg)
{
- pj_str_t codec_id;
+ pj_str_t codec_id = {NULL, 0};
unsigned opt;
pj_status_t status;