├── .boring ├── LICENSE ├── MANIFEST.in ├── README ├── build_inplace ├── debian ├── changelog ├── compat ├── control ├── copyright ├── docs ├── python-sipsimple.lintian-overrides ├── rules └── source │ └── format ├── deps ├── patches │ ├── 001_pjsip_210.patch │ ├── 002_zsrtp.patch │ ├── 003_pjsip_tls_log_fix.patch │ ├── 003_vpx.patch │ ├── 004_mac_audio_device_fix.patch │ ├── 005_fix_ffmpeg.patch │ ├── 006_fix_uint_zrtp.patch │ ├── 007_video_support_dshow_mingw.patch │ ├── 008_support_mingw_w64.patch │ ├── 009_aconfigure.patch │ ├── 2.11 │ │ ├── 001_pjsip_211.patch │ │ ├── 002_zsrtp.patch │ │ ├── 003_pjsip_tls_log_fix.patch │ │ ├── 003_vpx.patch │ │ ├── 004_mac_audio_device_fix.patch │ │ ├── 005_fix_ffmpeg.patch │ │ ├── 006_fix_uint_zrtp.patch │ │ ├── 007_video_support_dshow_mingw.patch │ │ └── 008_support_mingw_w64.patch │ ├── 2.12 │ │ ├── 001_pjsip_210.patch │ │ ├── 002_zsrtp.patch │ │ ├── 003_pjsip_tls_log_fix.patch │ │ ├── 003_vpx.patch │ │ ├── 004_mac_audio_device_fix.patch │ │ ├── 005_fix_ffmpeg.patch │ │ ├── 006_fix_uint_zrtp.patch │ │ ├── 007_video_support_dshow_mingw.patch │ │ └── 008_support_mingw_w64.patch │ ├── apple-silicon.txt │ └── windows │ │ └── 001_disable_gevent.patch ├── vo-amrwbenc-0.1.3 │ ├── COPYING │ ├── ChangeLog │ ├── Makefile.am │ ├── Makefile.in │ ├── NOTICE │ ├── README │ ├── aclocal.m4 │ ├── amrwb-enc.c │ ├── amrwbenc │ │ ├── Android.mk │ │ ├── MODULE_LICENSE_APACHE2 │ │ ├── NOTICE │ │ ├── SampleCode │ │ │ ├── AMRWB_E_SAMPLE.c │ │ │ ├── Android.mk │ │ │ ├── MODULE_LICENSE_APACHE2 │ │ │ └── NOTICE │ │ ├── SoftAMRWBEncoder.cpp │ │ ├── SoftAMRWBEncoder.h │ │ ├── doc │ │ │ └── voAMRWBEncoderSDK.pdf │ │ ├── inc │ │ │ ├── acelp.h │ │ │ ├── basic_op.h │ │ │ ├── bits.h │ │ │ ├── cnst.h │ │ │ ├── cod_main.h │ │ │ ├── dtx.h │ │ │ ├── grid100.tab │ │ │ ├── ham_wind.tab │ │ │ ├── homing.tab │ │ │ ├── isp_isf.tab │ │ │ ├── lag_wind.tab │ │ │ ├── log2.h │ │ │ ├── log2_tab.h │ │ │ ├── main.h │ │ │ ├── math_op.h │ │ │ ├── mem_align.h │ │ │ ├── mime_io.tab │ │ │ ├── oper_32b.h │ │ │ ├── p_med_o.h │ │ │ ├── p_med_ol.tab │ │ │ ├── q_gain2.tab │ │ │ ├── q_pulse.h │ │ │ ├── qisf_ns.tab │ │ │ ├── qpisf_2s.tab │ │ │ ├── stream.h │ │ │ ├── typedef.h │ │ │ ├── typedefs.h │ │ │ ├── wb_vad.h │ │ │ └── wb_vad_c.h │ │ ├── patent_disclaimer.txt │ │ └── src │ │ │ ├── asm │ │ │ ├── ARMV5E │ │ │ │ ├── Deemph_32_opt.s │ │ │ │ ├── Dot_p_opt.s │ │ │ │ ├── Filt_6k_7k_opt.s │ │ │ │ ├── Norm_Corr_opt.s │ │ │ │ ├── Syn_filt_32_opt.s │ │ │ │ ├── convolve_opt.s │ │ │ │ ├── cor_h_vec_opt.s │ │ │ │ ├── pred_lt4_1_opt.s │ │ │ │ ├── residu_asm_opt.s │ │ │ │ ├── scale_sig_opt.s │ │ │ │ └── syn_filt_opt.s │ │ │ └── ARMV7 │ │ │ │ ├── Deemph_32_neon.s │ │ │ │ ├── Dot_p_neon.s │ │ │ │ ├── Filt_6k_7k_neon.s │ │ │ │ ├── Norm_Corr_neon.s │ │ │ │ ├── Syn_filt_32_neon.s │ │ │ │ ├── convolve_neon.s │ │ │ │ ├── cor_h_vec_neon.s │ │ │ │ ├── pred_lt4_1_neon.s │ │ │ │ ├── residu_asm_neon.s │ │ │ │ ├── scale_sig_neon.s │ │ │ │ └── syn_filt_neon.s │ │ │ ├── autocorr.c │ │ │ ├── az_isp.c │ │ │ ├── bits.c │ │ │ ├── c2t64fx.c │ │ │ ├── c4t64fx.c │ │ │ ├── convolve.c │ │ │ ├── cor_h_x.c │ │ │ ├── decim54.c │ │ │ ├── deemph.c │ │ │ ├── dtx.c │ │ │ ├── g_pitch.c │ │ │ ├── gpclip.c │ │ │ ├── homing.c │ │ │ ├── hp400.c │ │ │ ├── hp50.c │ │ │ ├── hp6k.c │ │ │ ├── hp_wsp.c │ │ │ ├── int_lpc.c │ │ │ ├── isp_az.c │ │ │ ├── isp_isf.c │ │ │ ├── lag_wind.c │ │ │ ├── levinson.c │ │ │ ├── log2.c │ │ │ ├── lp_dec2.c │ │ │ ├── math_op.c │ │ │ ├── mem_align.c │ │ │ ├── oper_32b.c │ │ │ ├── p_med_ol.c │ │ │ ├── pit_shrp.c │ │ │ ├── pitch_f4.c │ │ │ ├── pred_lt4.c │ │ │ ├── preemph.c │ │ │ ├── q_gain2.c │ │ │ ├── q_pulse.c │ │ │ ├── qisf_ns.c │ │ │ ├── qpisf_2s.c │ │ │ ├── random.c │ │ │ ├── residu.c │ │ │ ├── scale.c │ │ │ ├── stream.c │ │ │ ├── syn_filt.c │ │ │ ├── updt_tar.c │ │ │ ├── util.c │ │ │ ├── voAMRWBEnc.c │ │ │ ├── voicefac.c │ │ │ ├── wb_vad.c │ │ │ └── weight_a.c │ ├── common │ │ ├── Android.mk │ │ ├── Config.mk │ │ ├── MODULE_LICENSE_APACHE2 │ │ ├── NOTICE │ │ ├── cmnMemory.c │ │ └── include │ │ │ ├── cmnMemory.h │ │ │ ├── voAAC.h │ │ │ ├── voAMRWB.h │ │ │ ├── voAudio.h │ │ │ ├── voIndex.h │ │ │ ├── voMem.h │ │ │ └── voType.h │ ├── config.guess │ ├── config.sub │ ├── configure │ ├── configure.ac │ ├── depcomp │ ├── enc_if.h │ ├── install-sh │ ├── ltmain.sh │ ├── m4 │ │ ├── libtool.m4 │ │ ├── ltoptions.m4 │ │ ├── ltsugar.m4 │ │ ├── ltversion.m4 │ │ └── lt~obsolete.m4 │ ├── missing │ ├── vo-amrwbenc.pc.in │ ├── vo-amrwbenc.sym │ ├── wavreader.c │ ├── wavreader.h │ └── wrapper.c └── zsrtp │ ├── build │ └── Makefile │ ├── include │ ├── ZsrtpCWrapper.h │ └── openssl_compat.h │ └── srtp │ └── ZsrtpCWrapper.cpp ├── docs ├── Dependencies.txt ├── DeveloperGuide.txt ├── Install.debian ├── Install.linux ├── Install.osx ├── Install.raspbian ├── Install.ubuntu ├── Install.windows ├── Licenses.txt ├── TLS.txt └── TODO ├── get_dependencies.sh ├── mac ├── 01-install-build-env.sh ├── 02-install-c-deps.sh ├── 03-install-python-deps.sh ├── 04-install_sipsimple.sh ├── 05-install_sipclients.sh ├── activate_venv.sh ├── python-requirements.txt └── sipsimple-requirements.txt ├── makedeb.sh ├── setup.py ├── setup_pjsip.py └── sipsimple ├── __info__.py ├── __init__.py ├── account ├── __init__.py ├── bonjour │ ├── __init__.py │ └── _bonjour.py ├── publication.py ├── registration.py ├── subscription.py └── xcap │ ├── __init__.py │ └── storage │ ├── __init__.py │ ├── file.py │ └── memory.py ├── addressbook.py ├── application.py ├── audio.py ├── configuration ├── __init__.py ├── backend │ ├── __init__.py │ ├── file.py │ └── memory.py ├── datatypes.py └── settings.py ├── core ├── __init__.py ├── _core.error.pxi ├── _core.event.pxi ├── _core.headers.pxi ├── _core.helper.pxi ├── _core.invitation.pxi ├── _core.lib.pxi ├── _core.mediatransport.pxi ├── _core.pxd ├── _core.pyx ├── _core.referral.pxi ├── _core.request.pxi ├── _core.sdp.pxi ├── _core.sound.pxi ├── _core.subscription.pxi ├── _core.ua.pxi ├── _core.util.pxi ├── _core.video.pxi ├── _engine.py ├── _helpers.py └── _primitives.py ├── logging.py ├── lookup-gevent.py ├── lookup.py ├── payloads ├── README.txt ├── __init__.py ├── addressbook.py ├── caps.py ├── cipid.py ├── commonpolicy.py ├── conference.py ├── datatypes.py ├── dialoginfo.py ├── dialogrules.py ├── directory.py ├── imdn.py ├── iscomposing.py ├── messagesummary.py ├── omapolicy.py ├── pidf.py ├── prescontent.py ├── presrules.py ├── rcsfthttp.py ├── resourcelists.py ├── rlmi.py ├── rlsnotify.py ├── rlsservices.py ├── rpid.py ├── watcherinfo.py ├── xcapcaps.py ├── xcapdiff.py └── xml-schemas │ ├── addressbook.xsd │ ├── caps.xsd │ ├── cipid.xsd │ ├── common-policy.xsd │ ├── common-schema.xsd │ ├── conference.xsd │ ├── data-model.xsd │ ├── dialog-info.xsd │ ├── dialog-rules.xsd │ ├── im-iscomposing.xsd │ ├── imdn.xsd │ ├── oma-common-policy.xsd │ ├── oma-pres-content.xsd │ ├── patchops.xsd │ ├── pidf.xsd │ ├── pres-rules.xsd │ ├── rcs-fthttp-ext.xsd │ ├── rcs-fthttp.xsd │ ├── resourcelists.xsd │ ├── rlmi.xsd │ ├── rlsservices.xsd │ ├── rpid.xsd │ ├── watcherinfo.xsd │ ├── xcap-caps.xsd │ ├── xcap-directory.xsd │ ├── xcapdiff.xsd │ └── xml.xsd ├── session.py ├── storage.py ├── streams ├── __init__.py ├── msrp │ ├── __init__.py │ ├── chat.py │ ├── filetransfer.py │ └── screensharing.py └── rtp │ ├── __init__.py │ ├── audio.py │ └── video.py ├── threading ├── __init__.py └── green.py ├── util ├── __init__.py ├── _sha1.h └── _sha1.pyx └── video.py /.boring: -------------------------------------------------------------------------------- 1 | # 2 | # Boring file regular expresions 3 | # 4 | 5 | ~$ 6 | \# 7 | (^|/)\.DS_Store$ 8 | (^|/)Thumbs\.db$ 9 | (^|/)core(\.[0-9]+)?$ 10 | \.(pyc|pyo|o|so|orig|rej|prof|bak|BAK|tmp|wpr|wpu|swp|swo|komodoproject)$ 11 | 12 | (^|/)\.idea($|/) 13 | (^|/)\.komodotools($|/) 14 | (^|/)_darcs($|/) 15 | (^|/)autom4te.cache($|/) 16 | (^|/)tags($|/) 17 | 18 | ^MANIFEST$ 19 | ^build($|/) 20 | ^dist($|/) 21 | ^test($|/) 22 | ^sipsimple/core/_core.c$ 23 | ^sipsimple/util/_sha1.c$ 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright: 2008-2021 AG Projects 2 | 3 | License: GPL-3+ 4 | 5 | This package is free software; you can redistribute it and/or modify it 6 | under the terms of the GNU General Public License as published by the 7 | Free Software Foundation; either version 3 of the License, or (at your 8 | option) any later version. 9 | 10 | This package is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | For a copy of the license see https://www.gnu.org/licenses/gpl.html 16 | 17 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS 2 | include LICENSE 3 | include README 4 | include MANIFEST.in 5 | 6 | include build_inplace 7 | include setup_pjsip.py 8 | 9 | include sipsimple/payloads/xml-schemas/*.xsd 10 | include sipsimple/util/_sha1.h 11 | 12 | include debian/changelog 13 | include debian/compat 14 | include debian/control 15 | include debian/copyright 16 | include debian/dirs 17 | include debian/docs 18 | include debian/pycompat 19 | include debian/pyversions 20 | include debian/python-sipsimple.lintian-overrides 21 | include debian/python-sipsimple-dbg.lintian-overrides 22 | include debian/rules 23 | include debian/source/format 24 | 25 | recursive-include docs * 26 | recursive-include deps * 27 | -------------------------------------------------------------------------------- /build_inplace: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #./get_dependencies.sh 4 | 5 | chmod +x deps/pjsip/configure 6 | chmod +x deps/pjsip/aconfigure 7 | python3 setup.py build_ext --inplace "$@" 8 | test -d build && python3 setup.py clean 9 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 11 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: python3-sipsimple 2 | Section: python 3 | Priority: optional 4 | Maintainer: Adrian Georgescu 5 | Uploaders: Tijmen de Mes 6 | Build-Depends: debhelper (>= 11), python3, 7 | dh-python, 8 | python3-all-dev, 9 | cython3, 10 | libasound2-dev, 11 | python3-dateutil, 12 | python3-dnspython, 13 | libssl-dev, 14 | libv4l-dev, 15 | libavcodec-dev, 16 | libavformat-dev, 17 | libopencore-amrnb-dev, 18 | libopencore-amrwb-dev, 19 | libavutil-dev, 20 | libswscale-dev, 21 | libx264-dev, 22 | libvpx-dev, 23 | libopus-dev, 24 | libsqlite3-dev, 25 | pkg-config, 26 | uuid-dev 27 | Standards-Version: 4.5.0 28 | Homepage: https://sipsimpleclient.org 29 | 30 | Package: python3-sipsimple 31 | Architecture: any 32 | Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}, 33 | python3-application, 34 | python3-dateutil, 35 | python3-dnspython, 36 | python3-eventlib, 37 | python3-gevent, 38 | python3-gnutls, 39 | python3-lxml, 40 | python3-msrplib, 41 | python3-twisted, 42 | python3-xcaplib 43 | Suggests: libavahi-compat-libdnssd1, python3-otr 44 | Provides: ${python3:Provides} 45 | Description: SIP SIMPLE SDK is a Python library for desktop operating 46 | systems designed for the development of real time communications 47 | applications based on SIP protocol and related media like audio, video, 48 | messaging, file transfers, desktop sharing and presence. 49 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Copyright: 2008-2020 AG Projects 2 | 3 | License: GPL-3+ 4 | 5 | This package is free software; you can redistribute it and/or modify it 6 | under the terms of the GNU General Public License as published by the 7 | Free Software Foundation; either version 3 of the License, or (at your 8 | option) any later version. 9 | 10 | This package is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | For a copy of the license see /usr/share/common-licenses/GPL-3 16 | 17 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | docs/DeveloperGuide.txt 2 | -------------------------------------------------------------------------------- /debian/python-sipsimple.lintian-overrides: -------------------------------------------------------------------------------- 1 | binary: possible-gpl-code-linked-with-openssl 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | export DEB_BUILD_HARDENING = 1 4 | export PYBUILD_NAME = sipsimple 5 | 6 | %: 7 | dh $@ --with python3 --buildsystem=pybuild 8 | 9 | override_dh_clean: 10 | dh_clean 11 | rm -rf build dist MANIFEST 12 | 13 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /deps/patches/003_pjsip_tls_log_fix.patch: -------------------------------------------------------------------------------- 1 | --- pjsip/pjlib/src/pj/ssl_sock_ossl.c 2 | +++ pjsip/pjlib/src/pj/ssl_sock_ossl.c 3 | @@ -1705,6 +1705,10 @@ static void ssl_update_certs_info(pj_ssl_sock_t *ssock) 4 | pj_parsed_time v; 5 | pj_time_val end; 6 | pj_bool_t gmt; 7 | + char *local_cert_subject; 8 | + char *local_cert_issuer; 9 | + char *remote_cert_subject; 10 | + char *remote_cert_issuer; 11 | 12 | pj_assert(ssock->ssl_state == SSL_STATE_ESTABLISHED); 13 | 14 | @@ -1716,7 +1720,12 @@ static void ssl_update_certs_info(pj_ssl_sock_t *ssock) 15 | 16 | pj_time_decode(&end, &v); 17 | 18 | - PJ_LOG(1, (THIS_FILE, "[local TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d", ssock->local_cert_info.subject.info.ptr, ssock->local_cert_info.issuer.info.ptr, v.year, v.mon, v.day)); 19 | + local_cert_subject = ssock->local_cert_info.subject.info.ptr; 20 | + local_cert_subject[ssock->local_cert_info.subject.info.slen] = '\x00'; 21 | + local_cert_issuer = ssock->local_cert_info.issuer.info.ptr; 22 | + local_cert_issuer[ssock->local_cert_info.issuer.info.slen] = '\x00'; 23 | + 24 | + PJ_LOG(1, (THIS_FILE, "[local TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d", local_cert_subject, local_cert_issuer, v.year, v.mon, v.day)); 25 | 26 | /* Don't free local's X509! */ 27 | } else { 28 | @@ -1731,7 +1740,12 @@ static void ssl_update_certs_info(pj_ssl_sock_t *ssock) 29 | 30 | pj_time_decode(&end, &v); 31 | 32 | - PJ_LOG(1, (THIS_FILE, "[remote TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d | host:%s:%d", ssock->remote_cert_info.subject.info.ptr, ssock->remote_cert_info.issuer.info.ptr, v.year, v.mon, v.day, pj_inet_ntoa(ssock->rem_addr.ipv4.sin_addr), ssock->rem_addr.ipv4.sin_port)); 33 | + remote_cert_subject = ssock->remote_cert_info.subject.info.ptr; 34 | + remote_cert_subject[ssock->remote_cert_info.subject.info.slen] = '\x00'; 35 | + remote_cert_issuer = ssock->remote_cert_info.issuer.info.ptr; 36 | + remote_cert_issuer[ssock->remote_cert_info.issuer.info.slen] = '\x00'; 37 | + 38 | + PJ_LOG(1, (THIS_FILE, "[remote TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d | host:%s:%d", remote_cert_subject, remote_cert_issuer, v.year, v.mon, v.day, pj_inet_ntoa(ssock->rem_addr.ipv4.sin_addr), ssock->rem_addr.ipv4.sin_port)); 39 | 40 | /* Free peer's X509 */ 41 | X509_free(x); 42 | -------------------------------------------------------------------------------- /deps/patches/003_vpx.patch: -------------------------------------------------------------------------------- 1 | --- pjsip/pjmedia/src/pjmedia-codec/vpx.c 2021-06-23 09:50:03.983367807 +0200 2 | +++ pjsip/pjmedia/src/pjmedia-codec/vpx.c 2021-06-23 09:49:17.753967323 +0200 3 | @@ -507,8 +507,10 @@ 4 | PJ_ASSERT_RETURN(codec, PJ_EINVAL); 5 | 6 | vpx_data = (vpx_codec_data*) codec->codec_data; 7 | - vpx_codec_destroy(&vpx_data->enc); 8 | - vpx_codec_destroy(&vpx_data->dec); 9 | + if (&vpx_data->enc) 10 | + vpx_codec_destroy(&vpx_data->enc); 11 | + if (&vpx_data->dec) 12 | + vpx_codec_destroy(&vpx_data->dec); 13 | 14 | return PJ_SUCCESS; 15 | } 16 | -------------------------------------------------------------------------------- /deps/patches/004_mac_audio_device_fix.patch: -------------------------------------------------------------------------------- 1 | --- pjsip/pjmedia/src/pjmedia-audiodev/coreaudio_dev.m.old 2021-07-08 11:44:05.000000000 -0300 2 | +++ pjsip/pjmedia/src/pjmedia-audiodev/coreaudio_dev.m 2021-07-08 11:45:16.000000000 -0300 3 | @@ -280,9 +280,12 @@ 4 | if (cf->io_comp == NULL) 5 | return PJMEDIA_EAUD_INIT; // cannot find IO unit; 6 | 7 | + /* 8 | + This perhaps belongs to iOS? -adi 9 | desc.componentSubType = kAudioUnitSubType_VoiceProcessingIO; 10 | if (AudioComponentFindNext(NULL, &desc) != NULL) 11 | cf->has_vpio = PJ_TRUE; 12 | + */ 13 | 14 | status = ca_factory_refresh(f); 15 | if (status != PJ_SUCCESS) 16 | -------------------------------------------------------------------------------- /deps/patches/006_fix_uint_zrtp.patch: -------------------------------------------------------------------------------- 1 | --- deps/ZRTPCPP/zrtp/ZRtp.cpp 2024-08-27 21:00:15.615166000 +0200 2 | +++ pjsip/third_party/zsrtp/zrtp/zrtp/ZRtp.cpp 2024-08-27 21:09:06.630791500 +0200 3 | @@ -19,6 +19,10 @@ 4 | */ 5 | #include 6 | 7 | +#ifndef uint 8 | +#define uint unsigned int 9 | +#endif 10 | + 11 | -------------------------------------------------------------------------------- /deps/patches/008_support_mingw_w64.patch: -------------------------------------------------------------------------------- 1 | diff -ruN pjsip/Makefile pjsip-patch/Makefile 2 | --- pjsip/Makefile 2020-02-14 10:48:27.000000000 +0100 3 | +++ pjsip-patch/Makefile 2024-09-03 10:32:23.926160100 +0200 4 | @@ -129,10 +129,9 @@ 5 | sed -e "s!@INCLUDEDIR@!$(includedir)!" | \ 6 | sed -e "s!@LIBDIR@!$(libdir)!" | \ 7 | sed -e "s/@PJ_VERSION@/$(PJ_VERSION)/" | \ 8 | - sed -e "s!@PJ_LDLIBS@!!" | \ 9 | - sed -e "s!@PJ_LDXXLIBS@!$(PJ_LDXXLIBS)!" | \ 10 | - sed -e "s!@PJ_INSTALL_CFLAGS@!!" | \ 11 | - sed -e "s!@PJ_INSTALL_CXXFLAGS@!$(PJ_INSTALL_CXXFLAGS)!" > $(DESTDIR)/$(libdir)/pkgconfig/libpjproject.pc 12 | + sed -e "s!@PJ_INSTALL_LDFLAGS@!$(PJ_INSTALL_LDFLAGS)!" | \ 13 | + sed -e "s!@PJ_INSTALL_LDFLAGS_PRIVATE@!$(PJ_INSTALL_LDFLAGS_PRIVATE)!" | \ 14 | + sed -e "s!@PJ_INSTALL_CFLAGS@!$(PJ_INSTALL_CFLAGS)!" > $(DESTDIR)$(libdir)/pkgconfig/libpjproject.pc 15 | 16 | uninstall: 17 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/libpjproject.pc 18 | diff -ruN pjsip/aconfigure pjsip-patch/aconfigure 19 | --- pjsip/aconfigure 2024-09-03 10:10:13.926165600 +0200 20 | +++ pjsip-patch/aconfigure 2024-09-03 10:32:23.941785600 +0200 21 | @@ -5156,6 +5156,12 @@ 22 | 23 | $as_echo "#define WIN32_LEAN_AND_MEAN 1" >>confdefs.h 24 | 25 | + case $target in 26 | + *_64-w64-mingw* ) 27 | + $as_echo "#define PJ_WIN64 1" >>confdefs.h 28 | + 29 | + ;; 30 | + esac 31 | ;; 32 | *darwin*) 33 | $as_echo "#define PJ_DARWINOS 1" >>confdefs.h 34 | diff -ruN pjsip/aconfigure.ac pjsip-patch/aconfigure.ac 35 | --- pjsip/aconfigure.ac 2020-02-14 10:48:27.000000000 +0100 36 | +++ pjsip-patch/aconfigure.ac 2024-09-03 10:32:23.973036300 +0200 37 | @@ -161,6 +161,11 @@ 38 | AC_DEFINE(PJ_WIN32,1) 39 | AC_DEFINE(PJ_WIN32_WINNT,0x0400) 40 | AC_DEFINE(WIN32_LEAN_AND_MEAN) 41 | + case $target in 42 | + *_64-w64-mingw* ) 43 | + AC_DEFINE(PJ_WIN64,1) 44 | + ;; 45 | + esac 46 | ;; 47 | *darwin*) 48 | AC_DEFINE(PJ_DARWINOS,1) 49 | diff -ruN pjsip/pjlib/include/pj/compat/os_auto.h.in pjsip-patch/pjlib/include/pj/compat/os_auto.h.in 50 | --- pjsip/pjlib/include/pj/compat/os_auto.h.in 2020-02-14 10:48:27.000000000 +0100 51 | +++ pjsip-patch/pjlib/include/pj/compat/os_auto.h.in 2024-09-03 10:32:23.988659900 +0200 52 | @@ -30,6 +30,7 @@ 53 | #undef PJ_OS_NAME 54 | 55 | /* Legacy macros */ 56 | +#undef PJ_WIN64 57 | #undef PJ_WIN32 58 | #undef PJ_WIN32_WINNT 59 | #undef WIN32_LEAN_AND_MEAN 60 | diff -ruN pjsip/pjnath/src/pjnath-test/stun_sock_test.c pjsip-patch/pjnath/src/pjnath-test/stun_sock_test.c 61 | --- pjsip/pjnath/src/pjnath-test/stun_sock_test.c 2020-02-14 10:48:27.000000000 +0100 62 | +++ pjsip-patch/pjnath/src/pjnath-test/stun_sock_test.c 2024-09-03 10:32:23.988659900 +0200 63 | @@ -25,7 +25,6 @@ 64 | RESPOND_STUN = 1, 65 | WITH_MAPPED = 2, 66 | WITH_XOR_MAPPED = 4, 67 | - 68 | ECHO = 8 69 | }; 70 | 71 | -------------------------------------------------------------------------------- /deps/patches/009_aconfigure.patch: -------------------------------------------------------------------------------- 1 | --- aconfigure 2025-03-25 12:10:27 2 | +++ pjsip/aconfigure 2025-03-25 12:13:44 3 | @@ -9042,6 +9042,10 @@ 4 | armv7l*gnueabihf) 5 | ac_webrtc_instset=neon 6 | ac_webrtc_cflags="-DWEBRTC_ARCH_ARMV7 -mfloat-abi=hard -mfpu=neon" 7 | + ;; 8 | + arm-apple-darwin*) 9 | + ac_webrtc_instset=neon 10 | + ac_webrtc_cflags="-DWEBRTC_ARCH_ARM64" 11 | ;; 12 | *) 13 | ac_webrtc_instset=sse2 14 | -------------------------------------------------------------------------------- /deps/patches/2.11/003_pjsip_tls_log_fix.patch: -------------------------------------------------------------------------------- 1 | --- pjsip/pjlib/src/pj/ssl_sock_ossl.c 2 | +++ pjsip/pjlib/src/pj/ssl_sock_ossl.c 3 | @@ -1705,6 +1705,10 @@ static void ssl_update_certs_info(pj_ssl_sock_t *ssock) 4 | pj_parsed_time v; 5 | pj_time_val end; 6 | pj_bool_t gmt; 7 | + char *local_cert_subject; 8 | + char *local_cert_issuer; 9 | + char *remote_cert_subject; 10 | + char *remote_cert_issuer; 11 | 12 | pj_assert(ssock->ssl_state == SSL_STATE_ESTABLISHED); 13 | 14 | @@ -1716,7 +1720,12 @@ static void ssl_update_certs_info(pj_ssl_sock_t *ssock) 15 | 16 | pj_time_decode(&end, &v); 17 | 18 | - PJ_LOG(1, (THIS_FILE, "[local TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d", ssock->local_cert_info.subject.info.ptr, ssock->local_cert_info.issuer.info.ptr, v.year, v.mon, v.day)); 19 | + local_cert_subject = ssock->local_cert_info.subject.info.ptr; 20 | + local_cert_subject[ssock->local_cert_info.subject.info.slen] = '\x00'; 21 | + local_cert_issuer = ssock->local_cert_info.issuer.info.ptr; 22 | + local_cert_issuer[ssock->local_cert_info.issuer.info.slen] = '\x00'; 23 | + 24 | + PJ_LOG(1, (THIS_FILE, "[local TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d", local_cert_subject, local_cert_issuer, v.year, v.mon, v.day)); 25 | 26 | /* Don't free local's X509! */ 27 | } else { 28 | @@ -1731,7 +1740,12 @@ static void ssl_update_certs_info(pj_ssl_sock_t *ssock) 29 | 30 | pj_time_decode(&end, &v); 31 | 32 | - PJ_LOG(1, (THIS_FILE, "[remote TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d | host:%s:%d", ssock->remote_cert_info.subject.info.ptr, ssock->remote_cert_info.issuer.info.ptr, v.year, v.mon, v.day, pj_inet_ntoa(ssock->rem_addr.ipv4.sin_addr), ssock->rem_addr.ipv4.sin_port)); 33 | + remote_cert_subject = ssock->remote_cert_info.subject.info.ptr; 34 | + remote_cert_subject[ssock->remote_cert_info.subject.info.slen] = '\x00'; 35 | + remote_cert_issuer = ssock->remote_cert_info.issuer.info.ptr; 36 | + remote_cert_issuer[ssock->remote_cert_info.issuer.info.slen] = '\x00'; 37 | + 38 | + PJ_LOG(1, (THIS_FILE, "[remote TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d | host:%s:%d", remote_cert_subject, remote_cert_issuer, v.year, v.mon, v.day, pj_inet_ntoa(ssock->rem_addr.ipv4.sin_addr), ssock->rem_addr.ipv4.sin_port)); 39 | 40 | /* Free peer's X509 */ 41 | X509_free(x); 42 | -------------------------------------------------------------------------------- /deps/patches/2.11/003_vpx.patch: -------------------------------------------------------------------------------- 1 | --- pjsip/pjmedia/src/pjmedia-codec/vpx.c 2021-06-23 09:50:03.983367807 +0200 2 | +++ pjsip/pjmedia/src/pjmedia-codec/vpx.c 2021-06-23 09:49:17.753967323 +0200 3 | @@ -507,8 +507,10 @@ 4 | PJ_ASSERT_RETURN(codec, PJ_EINVAL); 5 | 6 | vpx_data = (vpx_codec_data*) codec->codec_data; 7 | - vpx_codec_destroy(&vpx_data->enc); 8 | - vpx_codec_destroy(&vpx_data->dec); 9 | + if (&vpx_data->enc) 10 | + vpx_codec_destroy(&vpx_data->enc); 11 | + if (&vpx_data->dec) 12 | + vpx_codec_destroy(&vpx_data->dec); 13 | 14 | return PJ_SUCCESS; 15 | } 16 | -------------------------------------------------------------------------------- /deps/patches/2.11/004_mac_audio_device_fix.patch: -------------------------------------------------------------------------------- 1 | --- pjsip/pjmedia/src/pjmedia-audiodev/coreaudio_dev.m.old 2021-07-08 11:44:05.000000000 -0300 2 | +++ pjsip/pjmedia/src/pjmedia-audiodev/coreaudio_dev.m 2021-07-08 11:45:16.000000000 -0300 3 | @@ -280,9 +280,12 @@ 4 | if (cf->io_comp == NULL) 5 | return PJMEDIA_EAUD_INIT; // cannot find IO unit; 6 | 7 | + /* 8 | + This perhaps belongs to iOS? -adi 9 | desc.componentSubType = kAudioUnitSubType_VoiceProcessingIO; 10 | if (AudioComponentFindNext(NULL, &desc) != NULL) 11 | cf->has_vpio = PJ_TRUE; 12 | + */ 13 | 14 | status = ca_factory_refresh(f); 15 | if (status != PJ_SUCCESS) 16 | -------------------------------------------------------------------------------- /deps/patches/2.11/006_fix_uint_zrtp.patch: -------------------------------------------------------------------------------- 1 | --- deps/ZRTPCPP/zrtp/ZRtp.cpp 2024-08-27 21:00:15.615166000 +0200 2 | +++ pjsip/third_party/zsrtp/zrtp/zrtp/ZRtp.cpp 2024-08-27 21:09:06.630791500 +0200 3 | @@ -19,6 +19,10 @@ 4 | */ 5 | #include 6 | 7 | +#ifndef uint 8 | +#define uint unsigned int 9 | +#endif 10 | + 11 | -------------------------------------------------------------------------------- /deps/patches/2.11/008_support_mingw_w64.patch: -------------------------------------------------------------------------------- 1 | diff -ruN pjsip/Makefile pjsip-patch/Makefile 2 | --- pjsip/Makefile 2020-02-14 10:48:27.000000000 +0100 3 | +++ pjsip-patch/Makefile 2024-09-03 10:32:23.926160100 +0200 4 | @@ -129,10 +129,9 @@ 5 | sed -e "s!@INCLUDEDIR@!$(includedir)!" | \ 6 | sed -e "s!@LIBDIR@!$(libdir)!" | \ 7 | sed -e "s/@PJ_VERSION@/$(PJ_VERSION)/" | \ 8 | - sed -e "s!@PJ_LDLIBS@!!" | \ 9 | - sed -e "s!@PJ_LDXXLIBS@!$(PJ_LDXXLIBS)!" | \ 10 | - sed -e "s!@PJ_INSTALL_CFLAGS@!!" | \ 11 | - sed -e "s!@PJ_INSTALL_CXXFLAGS@!$(PJ_INSTALL_CXXFLAGS)!" > $(DESTDIR)/$(libdir)/pkgconfig/libpjproject.pc 12 | + sed -e "s!@PJ_INSTALL_LDFLAGS@!$(PJ_INSTALL_LDFLAGS)!" | \ 13 | + sed -e "s!@PJ_INSTALL_LDFLAGS_PRIVATE@!$(PJ_INSTALL_LDFLAGS_PRIVATE)!" | \ 14 | + sed -e "s!@PJ_INSTALL_CFLAGS@!$(PJ_INSTALL_CFLAGS)!" > $(DESTDIR)$(libdir)/pkgconfig/libpjproject.pc 15 | 16 | uninstall: 17 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/libpjproject.pc 18 | diff -ruN pjsip/aconfigure pjsip-patch/aconfigure 19 | --- pjsip/aconfigure 2024-09-03 10:10:13.926165600 +0200 20 | +++ pjsip-patch/aconfigure 2024-09-03 10:32:23.941785600 +0200 21 | @@ -5156,6 +5156,12 @@ 22 | 23 | $as_echo "#define WIN32_LEAN_AND_MEAN 1" >>confdefs.h 24 | 25 | + case $target in 26 | + *_64-w64-mingw* ) 27 | + $as_echo "#define PJ_WIN64 1" >>confdefs.h 28 | + 29 | + ;; 30 | + esac 31 | ;; 32 | *darwin*) 33 | $as_echo "#define PJ_DARWINOS 1" >>confdefs.h 34 | diff -ruN pjsip/aconfigure.ac pjsip-patch/aconfigure.ac 35 | --- pjsip/aconfigure.ac 2020-02-14 10:48:27.000000000 +0100 36 | +++ pjsip-patch/aconfigure.ac 2024-09-03 10:32:23.973036300 +0200 37 | @@ -161,6 +161,11 @@ 38 | AC_DEFINE(PJ_WIN32,1) 39 | AC_DEFINE(PJ_WIN32_WINNT,0x0400) 40 | AC_DEFINE(WIN32_LEAN_AND_MEAN) 41 | + case $target in 42 | + *_64-w64-mingw* ) 43 | + AC_DEFINE(PJ_WIN64,1) 44 | + ;; 45 | + esac 46 | ;; 47 | *darwin*) 48 | AC_DEFINE(PJ_DARWINOS,1) 49 | diff -ruN pjsip/pjlib/include/pj/compat/os_auto.h.in pjsip-patch/pjlib/include/pj/compat/os_auto.h.in 50 | --- pjsip/pjlib/include/pj/compat/os_auto.h.in 2020-02-14 10:48:27.000000000 +0100 51 | +++ pjsip-patch/pjlib/include/pj/compat/os_auto.h.in 2024-09-03 10:32:23.988659900 +0200 52 | @@ -30,6 +30,7 @@ 53 | #undef PJ_OS_NAME 54 | 55 | /* Legacy macros */ 56 | +#undef PJ_WIN64 57 | #undef PJ_WIN32 58 | #undef PJ_WIN32_WINNT 59 | #undef WIN32_LEAN_AND_MEAN 60 | diff -ruN pjsip/pjnath/src/pjnath-test/stun_sock_test.c pjsip-patch/pjnath/src/pjnath-test/stun_sock_test.c 61 | --- pjsip/pjnath/src/pjnath-test/stun_sock_test.c 2020-02-14 10:48:27.000000000 +0100 62 | +++ pjsip-patch/pjnath/src/pjnath-test/stun_sock_test.c 2024-09-03 10:32:23.988659900 +0200 63 | @@ -25,7 +25,6 @@ 64 | RESPOND_STUN = 1, 65 | WITH_MAPPED = 2, 66 | WITH_XOR_MAPPED = 4, 67 | - 68 | ECHO = 8 69 | }; 70 | 71 | -------------------------------------------------------------------------------- /deps/patches/2.12/003_pjsip_tls_log_fix.patch: -------------------------------------------------------------------------------- 1 | --- pjsip/pjlib/src/pj/ssl_sock_ossl.c 2 | +++ pjsip/pjlib/src/pj/ssl_sock_ossl.c 3 | @@ -1705,6 +1705,10 @@ static void ssl_update_certs_info(pj_ssl_sock_t *ssock) 4 | pj_parsed_time v; 5 | pj_time_val end; 6 | pj_bool_t gmt; 7 | + char *local_cert_subject; 8 | + char *local_cert_issuer; 9 | + char *remote_cert_subject; 10 | + char *remote_cert_issuer; 11 | 12 | pj_assert(ssock->ssl_state == SSL_STATE_ESTABLISHED); 13 | 14 | @@ -1716,7 +1720,12 @@ static void ssl_update_certs_info(pj_ssl_sock_t *ssock) 15 | 16 | pj_time_decode(&end, &v); 17 | 18 | - PJ_LOG(1, (THIS_FILE, "[local TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d", ssock->local_cert_info.subject.info.ptr, ssock->local_cert_info.issuer.info.ptr, v.year, v.mon, v.day)); 19 | + local_cert_subject = ssock->local_cert_info.subject.info.ptr; 20 | + local_cert_subject[ssock->local_cert_info.subject.info.slen] = '\x00'; 21 | + local_cert_issuer = ssock->local_cert_info.issuer.info.ptr; 22 | + local_cert_issuer[ssock->local_cert_info.issuer.info.slen] = '\x00'; 23 | + 24 | + PJ_LOG(1, (THIS_FILE, "[local TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d", local_cert_subject, local_cert_issuer, v.year, v.mon, v.day)); 25 | 26 | /* Don't free local's X509! */ 27 | } else { 28 | @@ -1731,7 +1740,12 @@ static void ssl_update_certs_info(pj_ssl_sock_t *ssock) 29 | 30 | pj_time_decode(&end, &v); 31 | 32 | - PJ_LOG(1, (THIS_FILE, "[remote TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d | host:%s:%d", ssock->remote_cert_info.subject.info.ptr, ssock->remote_cert_info.issuer.info.ptr, v.year, v.mon, v.day, pj_inet_ntoa(ssock->rem_addr.ipv4.sin_addr), ssock->rem_addr.ipv4.sin_port)); 33 | + remote_cert_subject = ssock->remote_cert_info.subject.info.ptr; 34 | + remote_cert_subject[ssock->remote_cert_info.subject.info.slen] = '\x00'; 35 | + remote_cert_issuer = ssock->remote_cert_info.issuer.info.ptr; 36 | + remote_cert_issuer[ssock->remote_cert_info.issuer.info.slen] = '\x00'; 37 | + 38 | + PJ_LOG(1, (THIS_FILE, "[remote TLS certificate] subject:%s | issuer:%s | valid until:%d-%d-%d | host:%s:%d", remote_cert_subject, remote_cert_issuer, v.year, v.mon, v.day, pj_inet_ntoa(ssock->rem_addr.ipv4.sin_addr), ssock->rem_addr.ipv4.sin_port)); 39 | 40 | /* Free peer's X509 */ 41 | X509_free(x); 42 | -------------------------------------------------------------------------------- /deps/patches/2.12/003_vpx.patch: -------------------------------------------------------------------------------- 1 | --- pjsip/pjmedia/src/pjmedia-codec/vpx.c 2021-06-23 09:50:03.983367807 +0200 2 | +++ pjsip/pjmedia/src/pjmedia-codec/vpx.c 2021-06-23 09:49:17.753967323 +0200 3 | @@ -507,8 +507,10 @@ 4 | PJ_ASSERT_RETURN(codec, PJ_EINVAL); 5 | 6 | vpx_data = (vpx_codec_data*) codec->codec_data; 7 | - vpx_codec_destroy(&vpx_data->enc); 8 | - vpx_codec_destroy(&vpx_data->dec); 9 | + if (&vpx_data->enc) 10 | + vpx_codec_destroy(&vpx_data->enc); 11 | + if (&vpx_data->dec) 12 | + vpx_codec_destroy(&vpx_data->dec); 13 | 14 | return PJ_SUCCESS; 15 | } 16 | -------------------------------------------------------------------------------- /deps/patches/2.12/004_mac_audio_device_fix.patch: -------------------------------------------------------------------------------- 1 | --- pjsip/pjmedia/src/pjmedia-audiodev/coreaudio_dev.m.old 2021-07-08 11:44:05.000000000 -0300 2 | +++ pjsip/pjmedia/src/pjmedia-audiodev/coreaudio_dev.m 2021-07-08 11:45:16.000000000 -0300 3 | @@ -280,9 +280,12 @@ 4 | if (cf->io_comp == NULL) 5 | return PJMEDIA_EAUD_INIT; // cannot find IO unit; 6 | 7 | + /* 8 | + This perhaps belongs to iOS? -adi 9 | desc.componentSubType = kAudioUnitSubType_VoiceProcessingIO; 10 | if (AudioComponentFindNext(NULL, &desc) != NULL) 11 | cf->has_vpio = PJ_TRUE; 12 | + */ 13 | 14 | status = ca_factory_refresh(f); 15 | if (status != PJ_SUCCESS) 16 | -------------------------------------------------------------------------------- /deps/patches/2.12/006_fix_uint_zrtp.patch: -------------------------------------------------------------------------------- 1 | --- deps/ZRTPCPP/zrtp/ZRtp.cpp 2024-08-27 21:00:15.615166000 +0200 2 | +++ pjsip/third_party/zsrtp/zrtp/zrtp/ZRtp.cpp 2024-08-27 21:09:06.630791500 +0200 3 | @@ -19,6 +19,10 @@ 4 | */ 5 | #include 6 | 7 | +#ifndef uint 8 | +#define uint unsigned int 9 | +#endif 10 | + 11 | -------------------------------------------------------------------------------- /deps/patches/2.12/008_support_mingw_w64.patch: -------------------------------------------------------------------------------- 1 | diff -ruN pjsip/Makefile pjsip-patch/Makefile 2 | --- pjsip/Makefile 2020-02-14 10:48:27.000000000 +0100 3 | +++ pjsip-patch/Makefile 2024-09-03 10:32:23.926160100 +0200 4 | @@ -129,10 +129,9 @@ 5 | sed -e "s!@INCLUDEDIR@!$(includedir)!" | \ 6 | sed -e "s!@LIBDIR@!$(libdir)!" | \ 7 | sed -e "s/@PJ_VERSION@/$(PJ_VERSION)/" | \ 8 | - sed -e "s!@PJ_LDLIBS@!!" | \ 9 | - sed -e "s!@PJ_LDXXLIBS@!$(PJ_LDXXLIBS)!" | \ 10 | - sed -e "s!@PJ_INSTALL_CFLAGS@!!" | \ 11 | - sed -e "s!@PJ_INSTALL_CXXFLAGS@!$(PJ_INSTALL_CXXFLAGS)!" > $(DESTDIR)/$(libdir)/pkgconfig/libpjproject.pc 12 | + sed -e "s!@PJ_INSTALL_LDFLAGS@!$(PJ_INSTALL_LDFLAGS)!" | \ 13 | + sed -e "s!@PJ_INSTALL_LDFLAGS_PRIVATE@!$(PJ_INSTALL_LDFLAGS_PRIVATE)!" | \ 14 | + sed -e "s!@PJ_INSTALL_CFLAGS@!$(PJ_INSTALL_CFLAGS)!" > $(DESTDIR)$(libdir)/pkgconfig/libpjproject.pc 15 | 16 | uninstall: 17 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/libpjproject.pc 18 | diff -ruN pjsip/aconfigure pjsip-patch/aconfigure 19 | --- pjsip/aconfigure 2024-09-03 10:10:13.926165600 +0200 20 | +++ pjsip-patch/aconfigure 2024-09-03 10:32:23.941785600 +0200 21 | @@ -5156,6 +5156,12 @@ 22 | 23 | $as_echo "#define WIN32_LEAN_AND_MEAN 1" >>confdefs.h 24 | 25 | + case $target in 26 | + *_64-w64-mingw* ) 27 | + $as_echo "#define PJ_WIN64 1" >>confdefs.h 28 | + 29 | + ;; 30 | + esac 31 | ;; 32 | *darwin*) 33 | $as_echo "#define PJ_DARWINOS 1" >>confdefs.h 34 | diff -ruN pjsip/aconfigure.ac pjsip-patch/aconfigure.ac 35 | --- pjsip/aconfigure.ac 2020-02-14 10:48:27.000000000 +0100 36 | +++ pjsip-patch/aconfigure.ac 2024-09-03 10:32:23.973036300 +0200 37 | @@ -161,6 +161,11 @@ 38 | AC_DEFINE(PJ_WIN32,1) 39 | AC_DEFINE(PJ_WIN32_WINNT,0x0400) 40 | AC_DEFINE(WIN32_LEAN_AND_MEAN) 41 | + case $target in 42 | + *_64-w64-mingw* ) 43 | + AC_DEFINE(PJ_WIN64,1) 44 | + ;; 45 | + esac 46 | ;; 47 | *darwin*) 48 | AC_DEFINE(PJ_DARWINOS,1) 49 | diff -ruN pjsip/pjlib/include/pj/compat/os_auto.h.in pjsip-patch/pjlib/include/pj/compat/os_auto.h.in 50 | --- pjsip/pjlib/include/pj/compat/os_auto.h.in 2020-02-14 10:48:27.000000000 +0100 51 | +++ pjsip-patch/pjlib/include/pj/compat/os_auto.h.in 2024-09-03 10:32:23.988659900 +0200 52 | @@ -30,6 +30,7 @@ 53 | #undef PJ_OS_NAME 54 | 55 | /* Legacy macros */ 56 | +#undef PJ_WIN64 57 | #undef PJ_WIN32 58 | #undef PJ_WIN32_WINNT 59 | #undef WIN32_LEAN_AND_MEAN 60 | diff -ruN pjsip/pjnath/src/pjnath-test/stun_sock_test.c pjsip-patch/pjnath/src/pjnath-test/stun_sock_test.c 61 | --- pjsip/pjnath/src/pjnath-test/stun_sock_test.c 2020-02-14 10:48:27.000000000 +0100 62 | +++ pjsip-patch/pjnath/src/pjnath-test/stun_sock_test.c 2024-09-03 10:32:23.988659900 +0200 63 | @@ -25,7 +25,6 @@ 64 | RESPOND_STUN = 1, 65 | WITH_MAPPED = 2, 66 | WITH_XOR_MAPPED = 4, 67 | - 68 | ECHO = 8 69 | }; 70 | 71 | -------------------------------------------------------------------------------- /deps/patches/windows/001_disable_gevent.patch: -------------------------------------------------------------------------------- 1 | --- ./sipsimple/account/xcap/__init__.py.orig 2024-08-28 16:06:08 2 | +++ ./sipsimple/account/xcap/__init__.py 2024-09-12 08:58:09 3 | @@ -10,7 +10,6 @@ 4 | import random 5 | import socket 6 | import weakref 7 | -import gevent 8 | 9 | from io import StringIO 10 | from collections import OrderedDict 11 | @@ -24,7 +23,7 @@ 12 | from eventlib import api, coros, proc 13 | from eventlib.green.httplib import BadStatusLine 14 | from twisted.internet.error import ConnectionLost 15 | -from xcaplib.client import XCAPClient 16 | +from xcaplib.green import XCAPClient 17 | from xcaplib.error import HTTPError 18 | from zope.interface import implementer 19 | 20 | @@ -38,7 +37,7 @@ 21 | from sipsimple.payloads import addressbook, commonpolicy, dialogrules, omapolicy, pidf, prescontent, presrules, resourcelists, rlsservices, xcapcaps, xcapdiff 22 | from sipsimple.payloads import rpid; del rpid # needs to be imported to register its namespace 23 | from sipsimple.threading import run_in_twisted_thread 24 | -from sipsimple.threading.green import Command, run_in_green_thread 25 | +from sipsimple.threading.green import Command, Worker, run_in_green_thread 26 | 27 | import traceback 28 | 29 | @@ -119,8 +118,6 @@ 30 | notification_center = NotificationCenter() 31 | 32 | try: 33 | - notification_data = NotificationData(method='GET', url=self.url, application=self.application, etag=self.etag, result='fetch') 34 | - notification_center.post_notification('XCAPTrace', sender=self, data=notification_data) 35 | document = self.manager.client.get(self.application, etagnot=self.etag, globaltree=self.global_tree, headers={'Accept': self.payload_type.content_type}, filename=self.filename) 36 | self.content = self.payload_type.parse(document) 37 | self.etag = document.etag 38 | @@ -1844,8 +1841,14 @@ 39 | NotificationCenter().post_notification('XCAPManagerDidReloadData', sender=self, data=data) 40 | 41 | def _fetch_documents(self, documents): 42 | - jobs = [gevent.spawn(document.fetch) for document in (doc for doc in self.documents if doc.name in documents and doc.supported)] 43 | - gevent.joinall(jobs, timeout=15) 44 | + workers = [Worker.spawn(document.fetch) for document in (doc for doc in self.documents if doc.name in documents and doc.supported)] 45 | + try: 46 | + while workers: 47 | + worker = workers.pop() 48 | + worker.wait() 49 | + finally: 50 | + for worker in workers: 51 | + worker.wait_ex() 52 | 53 | def _save_journal(self): 54 | try: 55 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/ChangeLog: -------------------------------------------------------------------------------- 1 | 0.1.3 2 | - Unify the code with upstream, after local changes have been merged upstream 3 | - Update source files to the latest version upstream (no functional changes) 4 | - Avoid text relocations in arm assembly 5 | - Clean up the autotools project files 6 | - Minor warning fixes when building with certain warning flags 7 | - Fix a bug in the wav reader, making it compatible with more wav files 8 | 9 | 0.1.2 10 | - Update source files to the latest version upstream (no functional changes) 11 | - Hide internal symbols in shared libraries 12 | - Whitespace cleanup in the codec code 13 | - Minor tweaks 14 | 15 | 0.1.1 16 | - Fix building for windows 17 | 18 | 0.1.0 19 | - Initial release of vo-amrwbenc 20 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/README: -------------------------------------------------------------------------------- 1 | VisualOn AMR-WB encoder library 2 | 3 | This library contains an encoder implementation of the Adaptive Multi 4 | Rate Wideband (AMR-WB) audio codec. The library is based on a codec 5 | implementation by VisualOn as part of the Stagefright framework from 6 | the Google Android project. 7 | 8 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AGProjects/python3-sipsimple/46699e256c16f252eeeb7f628180602c465b0930/deps/vo-amrwbenc-0.1.3/amrwbenc/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/SampleCode/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES := \ 5 | AMRWB_E_SAMPLE.c \ 6 | ../../common/cmnMemory.c 7 | 8 | LOCAL_MODULE_TAGS := debug 9 | LOCAL_MODULE := AMRWBEncTest 10 | 11 | LOCAL_ARM_MODE := arm 12 | 13 | LOCAL_CFLAGS := -DLINUX 14 | 15 | LOCAL_SHARED_LIBRARIES := \ 16 | libstagefright \ 17 | libdl 18 | 19 | LOCAL_C_INCLUDES := \ 20 | $(LOCAL_PATH)/ \ 21 | $(LOCAL_PATH)/../../common \ 22 | $(LOCAL_PATH)/../../common/include 23 | 24 | include $(BUILD_EXECUTABLE) 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/SampleCode/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AGProjects/python3-sipsimple/46699e256c16f252eeeb7f628180602c465b0930/deps/vo-amrwbenc-0.1.3/amrwbenc/SampleCode/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/SoftAMRWBEncoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SOFT_AMRWB_ENCODER_H_ 18 | 19 | #define SOFT_AMRWB_ENCODER_H_ 20 | 21 | #include "SimpleSoftOMXComponent.h" 22 | 23 | #include "voAMRWB.h" 24 | 25 | struct VO_AUDIO_CODECAPI; 26 | struct VO_MEM_OPERATOR; 27 | 28 | namespace android { 29 | 30 | struct SoftAMRWBEncoder : public SimpleSoftOMXComponent { 31 | SoftAMRWBEncoder( 32 | const char *name, 33 | const OMX_CALLBACKTYPE *callbacks, 34 | OMX_PTR appData, 35 | OMX_COMPONENTTYPE **component); 36 | 37 | protected: 38 | virtual ~SoftAMRWBEncoder(); 39 | 40 | virtual OMX_ERRORTYPE internalGetParameter( 41 | OMX_INDEXTYPE index, OMX_PTR params); 42 | 43 | virtual OMX_ERRORTYPE internalSetParameter( 44 | OMX_INDEXTYPE index, const OMX_PTR params); 45 | 46 | virtual void onQueueFilled(OMX_U32 portIndex); 47 | 48 | private: 49 | enum { 50 | kNumBuffers = 4, 51 | kNumSamplesPerFrame = 320, 52 | }; 53 | 54 | void *mEncoderHandle; 55 | VO_AUDIO_CODECAPI *mApiHandle; 56 | VO_MEM_OPERATOR *mMemOperator; 57 | 58 | OMX_U32 mBitRate; 59 | VOAMRWBMODE mMode; 60 | 61 | size_t mInputSize; 62 | int16_t mInputFrame[kNumSamplesPerFrame]; 63 | int64_t mInputTimeUs; 64 | 65 | bool mSawInputEOS; 66 | bool mSignalledError; 67 | 68 | void initPorts(); 69 | status_t initEncoder(); 70 | 71 | DISALLOW_EVIL_CONSTRUCTORS(SoftAMRWBEncoder); 72 | }; 73 | 74 | } // namespace android 75 | 76 | #endif // SOFT_AMRWB_ENCODER_H_ 77 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/doc/voAMRWBEncoderSDK.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AGProjects/python3-sipsimple/46699e256c16f252eeeb7f628180602c465b0930/deps/vo-amrwbenc-0.1.3/amrwbenc/doc/voAMRWBEncoderSDK.pdf -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/bits.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | 18 | /*--------------------------------------------------------------------------* 19 | * BITS.H * 20 | *--------------------------------------------------------------------------* 21 | * Number of bits for different modes * 22 | *--------------------------------------------------------------------------*/ 23 | 24 | #ifndef __BITS_H__ 25 | #define __BITS_H__ 26 | 27 | #include 28 | #include "typedef.h" 29 | #include "cnst.h" 30 | #include "cod_main.h" 31 | 32 | #define NBBITS_7k 132 /* 6.60k */ 33 | #define NBBITS_9k 177 /* 8.85k */ 34 | #define NBBITS_12k 253 /* 12.65k */ 35 | #define NBBITS_14k 285 /* 14.25k */ 36 | #define NBBITS_16k 317 /* 15.85k */ 37 | #define NBBITS_18k 365 /* 18.25k */ 38 | #define NBBITS_20k 397 /* 19.85k */ 39 | #define NBBITS_23k 461 /* 23.05k */ 40 | #define NBBITS_24k 477 /* 23.85k */ 41 | 42 | #define NBBITS_SID 35 43 | #define NB_BITS_MAX NBBITS_24k 44 | 45 | #define BIT_0 (Word16)-127 46 | #define BIT_1 (Word16)127 47 | #define BIT_0_ITU (Word16)0x007F 48 | #define BIT_1_ITU (Word16)0x0081 49 | 50 | #define SIZE_MAX1 (3+NB_BITS_MAX) /* serial size max */ 51 | #define TX_FRAME_TYPE (Word16)0x6b21 52 | #define RX_FRAME_TYPE (Word16)0x6b20 53 | 54 | static const Word16 nb_of_bits[NUM_OF_MODES] = { 55 | NBBITS_7k, 56 | NBBITS_9k, 57 | NBBITS_12k, 58 | NBBITS_14k, 59 | NBBITS_16k, 60 | NBBITS_18k, 61 | NBBITS_20k, 62 | NBBITS_23k, 63 | NBBITS_24k, 64 | NBBITS_SID 65 | }; 66 | 67 | /*typedef struct 68 | { 69 | Word16 sid_update_counter; 70 | Word16 sid_handover_debt; 71 | Word16 prev_ft; 72 | } TX_State; 73 | */ 74 | 75 | //typedef struct 76 | //{ 77 | // Word16 prev_ft; 78 | // Word16 prev_mode; 79 | //} RX_State; 80 | 81 | int PackBits(Word16 prms[], Word16 coding_mode, Word16 mode, Coder_State *st); 82 | 83 | 84 | void Parm_serial( 85 | Word16 value, /* input : parameter value */ 86 | Word16 no_of_bits, /* input : number of bits */ 87 | Word16 ** prms 88 | ); 89 | 90 | 91 | #endif //__BITS_H__ 92 | 93 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/grid100.tab: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /*-------------------------------------------------------------* 20 | * Table for az_isp() * 21 | * * 22 | * Vector grid[] is in Q15 * 23 | * * 24 | * grid[0] = 1.0; * 25 | * grid[grid_points+1] = -1.0; * 26 | * for (i = 1; i < grid_points; i++) * 27 | * grid[i] = cos((6.283185307*i)/(2.0*grid_points)); * 28 | * * 29 | *-------------------------------------------------------------*/ 30 | 31 | /* Version 101 points */ 32 | 33 | #define GRID_POINTS 100 34 | 35 | const Word16 vogrid[GRID_POINTS+1] ={ 36 | 32767, 32751, 32703, 32622, 32509, 32364, 37 | 32187, 31978, 31738, 31466, 31164, 30830, 38 | 30466, 30072, 29649, 29196, 28714, 28204, 39 | 27666, 27101, 26509, 25891, 25248, 24579, 40 | 23886, 23170, 22431, 21669, 20887, 20083, 41 | 19260, 18418, 17557, 16680, 15786, 14876, 42 | 13951, 13013, 12062, 11099, 10125, 9141, 43 | 8149, 7148, 6140, 5126, 4106, 3083, 44 | 2057, 1029, 0, -1029, -2057, -3083, 45 | -4106, -5126, -6140, -7148, -8149, -9141, 46 | -10125, -11099, -12062, -13013, -13951, -14876, 47 | -15786, -16680, -17557, -18418, -19260, -20083, 48 | -20887, -21669, -22431, -23170, -23886, -24579, 49 | -25248, -25891, -26509, -27101, -27666, -28204, 50 | -28714, -29196, -29649, -30072, -30466, -30830, 51 | -31164, -31466, -31738, -31978, -32187, -32364, 52 | -32509, -32622, -32703, -32751, -32760}; 53 | 54 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/isp_isf.tab: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | 18 | /*-----------------------------------------------------* 19 | | Tables for function Isf_isp() and Isp_isf() | 20 | *-----------------------------------------------------*/ 21 | 22 | /* table of cos(x) in Q15 */ 23 | 24 | static const Word16 table[129] = { 25 | 32767, 26 | 32758, 32729, 32679, 32610, 32522, 32413, 32286, 32138, 27 | 31972, 31786, 31581, 31357, 31114, 30853, 30572, 30274, 28 | 29957, 29622, 29269, 28899, 28511, 28106, 27684, 27246, 29 | 26791, 26320, 25833, 25330, 24812, 24279, 23732, 23170, 30 | 22595, 22006, 21403, 20788, 20160, 19520, 18868, 18205, 31 | 17531, 16846, 16151, 15447, 14733, 14010, 13279, 12540, 32 | 11793, 11039, 10279, 9512, 8740, 7962, 7180, 6393, 33 | 5602, 4808, 4011, 3212, 2411, 1608, 804, 0, 34 | -804, -1608, -2411, -3212, -4011, -4808, -5602, -6393, 35 | -7180, -7962, -8740, -9512, -10279, -11039, -11793, -12540, 36 | -13279, -14010, -14733, -15447, -16151, -16846, -17531, -18205, 37 | -18868, -19520, -20160, -20788, -21403, -22006, -22595, -23170, 38 | -23732, -24279, -24812, -25330, -25833, -26320, -26791, -27246, 39 | -27684, -28106, -28511, -28899, -29269, -29622, -29957, -30274, 40 | -30572, -30853, -31114, -31357, -31581, -31786, -31972, -32138, 41 | -32286, -32413, -32522, -32610, -32679, -32729, -32758, -32768}; 42 | 43 | /* slope in Q11 used to compute y = acos(x) */ 44 | 45 | static const Word16 slope[128] = { 46 | -26214, -9039, -5243, -3799, -2979, -2405, -2064, -1771, 47 | -1579, -1409, -1279, -1170, -1079, -1004, -933, -880, 48 | -827, -783, -743, -708, -676, -647, -621, -599, 49 | -576, -557, -538, -521, -506, -492, -479, -466, 50 | -456, -445, -435, -426, -417, -410, -402, -395, 51 | -389, -383, -377, -372, -367, -363, -359, -355, 52 | -351, -348, -345, -342, -340, -337, -335, -333, 53 | -331, -330, -329, -328, -327, -326, -326, -326, 54 | -326, -326, -326, -327, -328, -329, -330, -331, 55 | -333, -335, -337, -340, -342, -345, -348, -351, 56 | -355, -359, -363, -367, -372, -377, -383, -389, 57 | -395, -402, -410, -417, -426, -435, -445, -456, 58 | -466, -479, -492, -506, -521, -538, -557, -576, 59 | -599, -621, -647, -676, -708, -743, -783, -827, 60 | -880, -933, -1004, -1079, -1170, -1279, -1409, -1579, 61 | -1771, -2064, -2405, -2979, -3799, -5243, -9039, -26214}; 62 | 63 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/lag_wind.tab: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | 18 | /*-----------------------------------------------------* 19 | | Table of lag_window for autocorrelation. | 20 | | noise floor = 1.0001 = (0.9999 on r[1] ..r[16]) | 21 | | Bandwidth expansion = 60 Hz | 22 | | Sampling frequency = 12800 Hz | 23 | | | 24 | | Special double precision format. See "math_op.c" | 25 | | | 26 | | lag_wind[0] = 1.00000000 (not stored) | 27 | | lag_wind[1] = 0.99946642 | 28 | | lag_wind[2] = 0.99816680 | 29 | | lag_wind[3] = 0.99600452 | 30 | | lag_wind[4] = 0.99298513 | 31 | | lag_wind[5] = 0.98911655 | 32 | | lag_wind[6] = 0.98440880 | 33 | | lag_wind[7] = 0.97887397 | 34 | | lag_wind[8] = 0.97252619 | 35 | | lag_wind[9] = 0.96538186 | 36 | | lag_wind[10]= 0.95745903 | 37 | | lag_wind[11]= 0.94877797 | 38 | | lag_wind[12]= 0.93936038 | 39 | | lag_wind[13]= 0.92922986 | 40 | | lag_wind[14]= 0.91841155 | 41 | | lag_wind[15]= 0.90693212 | 42 | | lag_wind[16]= 0.89481968 | 43 | ------------------------------------------------------*/ 44 | 45 | #define M 16 46 | 47 | static Word16 volag_h[M] = { 48 | 32750, 49 | 32707, 50 | 32637, 51 | 32538, 52 | 32411, 53 | 32257, 54 | 32075, 55 | 31867, 56 | 31633, 57 | 31374, 58 | 31089, 59 | 30780, 60 | 30449, 61 | 30094, 62 | 29718, 63 | 29321}; 64 | 65 | static Word16 volag_l[M] = { 66 | 16896, 67 | 30464, 68 | 2496, 69 | 4480, 70 | 12160, 71 | 3520, 72 | 24320, 73 | 24192, 74 | 20736, 75 | 576, 76 | 18240, 77 | 31488, 78 | 128, 79 | 16704, 80 | 11520, 81 | 14784}; 82 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/log2.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ** Copyright 2003-2010, VisualOn, Inc. 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | /******************************************************************************** 20 | * 21 | * File : log2.h 22 | * Purpose : Computes log2(L_x) 23 | * 24 | ******************************************************************************** 25 | */ 26 | #ifndef __LOG2_H__ 27 | #define __LOG2_H__ 28 | 29 | /* 30 | ******************************************************************************** 31 | * INCLUDE FILES 32 | ******************************************************************************** 33 | */ 34 | #include "typedef.h" 35 | 36 | /* 37 | ******************************************************************************** 38 | * DEFINITION OF DATA TYPES 39 | ******************************************************************************** 40 | */ 41 | 42 | /* 43 | ******************************************************************************** 44 | * DECLARATION OF PROTOTYPES 45 | ******************************************************************************** 46 | */ 47 | void Log2 ( 48 | Word32 L_x, /* (i) : input value */ 49 | Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */ 50 | Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1)*/ 51 | ); 52 | 53 | void Log2_norm ( 54 | Word32 L_x, /* (i) : input value (normalized) */ 55 | Word16 exp, /* (i) : norm_l (L_x) */ 56 | Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */ 57 | Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1) */ 58 | ); 59 | 60 | #endif //__LOG2_H__ 61 | 62 | 63 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/log2_tab.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ** Copyright 2003-2010, VisualOn, Inc. 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | 20 | /******************************************************************************* 21 | * 22 | * File : log2.tab 23 | * Purpose : Table for routine Log2(). 24 | * $Id $ 25 | * 26 | ******************************************************************************** 27 | */ 28 | static const Word16 table[33] = 29 | { 30 | 0, 1455, 2866, 4236, 5568, 6863, 8124, 9352, 10549, 11716, 31 | 12855, 13967, 15054, 16117, 17156, 18172, 19167, 20142, 21097, 22033, 32 | 22951, 23852, 24735, 25603, 26455, 27291, 28113, 28922, 29716, 30497, 33 | 31266, 32023, 32767 34 | }; 35 | 36 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/main.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ** Copyright 2003-2010, VisualOn, Inc. 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | /*--------------------------------------------------------------------------* 20 | * MAIN.H * 21 | *--------------------------------------------------------------------------* 22 | * Main functions * 23 | *--------------------------------------------------------------------------*/ 24 | 25 | #ifndef __MAIN_H__ 26 | #define __MAIN_H__ 27 | 28 | void coder( 29 | Word16 * mode, /* input : used mode */ 30 | Word16 speech16k[], /* input : 320 new speech samples (at 16 kHz) */ 31 | Word16 prms[], /* output: output parameters */ 32 | Word16 * ser_size, /* output: bit rate of the used mode */ 33 | void *spe_state, /* i/o : State structure */ 34 | Word16 allow_dtx /* input : DTX ON/OFF */ 35 | ); 36 | 37 | 38 | 39 | void Reset_encoder(void *st, Word16 reset_all); 40 | 41 | 42 | Word16 encoder_homing_frame_test(Word16 input_frame[]); 43 | 44 | #endif //__MAIN_H__ 45 | 46 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/math_op.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | 18 | /*--------------------------------------------------------------------------* 19 | * MATH_OP.H * 20 | *--------------------------------------------------------------------------* 21 | * Mathematical operations * 22 | *--------------------------------------------------------------------------*/ 23 | 24 | #ifndef __MATH_OP_H__ 25 | #define __MATH_OP_H__ 26 | 27 | Word32 Isqrt( /* (o) Q31 : output value (range: 0<=val<1) */ 28 | Word32 L_x /* (i) Q0 : input value (range: 0<=val<=7fffffff) */ 29 | ); 30 | 31 | void Isqrt_n( 32 | Word32 * frac, /* (i/o) Q31: normalized value (1.0 < frac <= 0.5) */ 33 | Word16 * exp /* (i/o) : exponent (value = frac x 2^exponent) */ 34 | ); 35 | 36 | Word32 Pow2( /* (o) Q0 : result (range: 0<=val<=0x7fffffff) */ 37 | Word16 exponant, /* (i) Q0 : Integer part. (range: 0<=val<=30) */ 38 | Word16 fraction /* (i) Q15 : Fractionnal part. (range: 0.0<=val<1.0) */ 39 | ); 40 | 41 | Word32 Dot_product12( /* (o) Q31: normalized result (1 < val <= -1) */ 42 | Word16 x[], /* (i) 12bits: x vector */ 43 | Word16 y[], /* (i) 12bits: y vector */ 44 | Word16 lg, /* (i) : vector length */ 45 | Word16 * exp /* (o) : exponent of result (0..+30) */ 46 | ); 47 | 48 | Word32 Dot_product12_asm( /* (o) Q31: normalized result (1 < val <= -1) */ 49 | Word16 x[], /* (i) 12bits: x vector */ 50 | Word16 y[], /* (i) 12bits: y vector */ 51 | Word16 lg, /* (i) : vector length */ 52 | Word16 * exp /* (o) : exponent of result (0..+30) */ 53 | ); 54 | #endif //__MATH_OP_H__ 55 | 56 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/mem_align.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | /******************************************************************************* 17 | File: mem_align.h 18 | 19 | Content: Memory alloc alignments functions 20 | 21 | *******************************************************************************/ 22 | 23 | #ifndef __VO_MEM_ALIGN_H__ 24 | #define __VO_MEM_ALIGN_H__ 25 | 26 | #include "voMem.h" 27 | #include "typedef.h" 28 | 29 | extern void *mem_malloc(VO_MEM_OPERATOR *pMemop, unsigned int size, unsigned char alignment, unsigned int CodecID); 30 | extern void mem_free(VO_MEM_OPERATOR *pMemop, void *mem_ptr, unsigned int CodecID); 31 | 32 | #endif /* __VO_MEM_ALIGN_H__ */ 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/oper_32b.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | 18 | /* Double precision operations */ 19 | /* $Id$ */ 20 | 21 | #ifndef __OPER_32B_H__ 22 | #define __OPER_32B_H__ 23 | 24 | void VO_L_Extract (Word32 L_32, Word16 *hi, Word16 *lo); 25 | Word32 L_Comp (Word16 hi, Word16 lo); 26 | Word32 Mpy_32 (Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2); 27 | Word32 Mpy_32_16 (Word16 hi, Word16 lo, Word16 n); 28 | Word32 Div_32 (Word32 L_num, Word16 denom_hi, Word16 denom_lo); 29 | 30 | #endif //__OPER_32B_H__ 31 | 32 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/p_med_o.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*--------------------------------------------------------------------------* 18 | * P_MED_O.H * 19 | *--------------------------------------------------------------------------* 20 | * Median open-loop lag search * 21 | *--------------------------------------------------------------------------*/ 22 | 23 | #ifndef __P_MED_O_H__ 24 | #define __P_MED_O_H__ 25 | 26 | Word16 Pitch_med_ol( /* output: open loop pitch lag */ 27 | Word16 wsp[], /* input : signal used to compute the open loop pitch */ 28 | /* wsp[-pit_max] to wsp[-1] should be known */ 29 | Word16 L_min, /* input : minimum pitch lag */ 30 | Word16 L_max, /* input : maximum pitch lag */ 31 | Word16 L_frame, /* input : length of frame to compute pitch */ 32 | Word16 L_0, /* input : old_ open-loop pitch */ 33 | Word16 * gain, /* output: normalize correlation of hp_wsp for the Lag */ 34 | Word16 * hp_wsp_mem, /* i:o : memory of the hypass filter for hp_wsp[] (lg=9) */ 35 | Word16 * old_hp_wsp, /* i:o : hypass wsp[] */ 36 | Word16 wght_flg /* input : is weighting function used */ 37 | ); 38 | 39 | Word16 Med_olag( /* output : median of 5 previous open-loop lags */ 40 | Word16 prev_ol_lag, /* input : previous open-loop lag */ 41 | Word16 old_ol_lag[5] 42 | ); 43 | 44 | void Hp_wsp( 45 | Word16 wsp[], /* i : wsp[] signal */ 46 | Word16 hp_wsp[], /* o : hypass wsp[] */ 47 | Word16 lg, /* i : lenght of signal */ 48 | Word16 mem[] /* i/o : filter memory [9] */ 49 | ); 50 | 51 | #endif //__P_MED_O_H__ 52 | 53 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/p_med_ol.tab: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ** Copyright 2003-2010, VisualOn, Inc. 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | /*-----------------------------------------------------* 20 | | Table for function Pitch_med_ol() | 21 | *-----------------------------------------------------*/ 22 | 23 | static Word16 corrweight[199]= { 24 | 25 | 10772, 10794, 10816, 10839, 10862, 10885, 10908, 10932, 10955, 10980, 26 | 11004, 11029, 11054, 11079, 11105, 11131, 11157, 11183, 11210, 11238, 27 | 11265, 11293, 11322, 11350, 11379, 11409, 11439, 11469, 11500, 11531, 28 | 11563, 11595, 11628, 11661, 11694, 11728, 11763, 11798, 11834, 11870, 29 | 11907, 11945, 11983, 12022, 12061, 12101, 12142, 12184, 12226, 12270, 30 | 12314, 12358, 12404, 12451, 12498, 12547, 12596, 12647, 12699, 12751, 31 | 12805, 12861, 12917, 12975, 13034, 13095, 13157, 13221, 13286, 13353, 32 | 13422, 13493, 13566, 13641, 13719, 13798, 13880, 13965, 14053, 14143, 33 | 14237, 14334, 14435, 14539, 14648, 14761, 14879, 15002, 15130, 15265, 34 | 15406, 15554, 15710, 15874, 16056, 16384, 16384, 16384, 16384, 16384, 35 | 16384, 16384, 16056, 15874, 15710, 15554, 15406, 15265, 15130, 15002, 36 | 14879, 14761, 14648, 14539, 14435, 14334, 14237, 14143, 14053, 13965, 37 | 13880, 13798, 13719, 13641, 13566, 13493, 13422, 13353, 13286, 13221, 38 | 13157, 13095, 13034, 12975, 12917, 12861, 12805, 12751, 12699, 12647, 39 | 12596, 12547, 12498, 12451, 12404, 12358, 12314, 12270, 12226, 12184, 40 | 12142, 12101, 12061, 12022, 11983, 11945, 11907, 11870, 11834, 11798, 41 | 11763, 11728, 11694, 11661, 11628, 11595, 11563, 11531, 11500, 11469, 42 | 11439, 11409, 11379, 11350, 11322, 11293, 11265, 11238, 11210, 11183, 43 | 11157, 11131, 11105, 11079, 11054, 11029, 11004, 10980, 10955, 10932, 44 | 10908, 10885, 10862, 10839, 10816, 10794, 10772, 10750, 10728}; 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/stream.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ** Copyright 2003-2010, VisualOn, Inc. 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | /*********************************************************************** 20 | File: stream.h 21 | 22 | Contains: VOME API Buffer Operator Implement Header 23 | 24 | ************************************************************************/ 25 | #ifndef __STREAM_H__ 26 | #define __STREAM_H__ 27 | 28 | #include "voMem.h" 29 | #define Frame_Maxsize 1024 * 2 //Work Buffer 10K 30 | #define Frame_MaxByte 640 //AMR_WB Encoder one frame 320 samples = 640 Bytes 31 | #define MIN(a,b) ((a) < (b)? (a) : (b)) 32 | 33 | typedef struct{ 34 | unsigned char *set_ptr; 35 | unsigned char *frame_ptr; 36 | unsigned char *frame_ptr_bk; 37 | int set_len; 38 | int framebuffer_len; 39 | int frame_storelen; 40 | int used_len; 41 | }FrameStream; 42 | 43 | void voAWB_UpdateFrameBuffer(FrameStream *stream, VO_MEM_OPERATOR *pMemOP); 44 | void voAWB_InitFrameBuffer(FrameStream *stream); 45 | void voAWB_FlushFrameBuffer(FrameStream *stream); 46 | #endif //__STREAM_H__ 47 | 48 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/inc/typedef.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * 19 | * File : typedef.c 20 | * Purpose : Basic types. 21 | * 22 | ************************************************************************/ 23 | 24 | #ifndef __TYPEDEF_H__ 25 | #define __TYPEDEF_H__ 26 | 27 | #undef ORIGINAL_TYPEDEF_H /* define to get "original" ETSI version 28 | of typedef.h */ 29 | 30 | #ifdef ORIGINAL_TYPEDEF_H 31 | /* 32 | * this is the original code from the ETSI file typedef.h 33 | */ 34 | 35 | #if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__ZTC__) 36 | typedef signed char Word8; 37 | typedef short Word16; 38 | typedef long Word32; 39 | typedef int Flag; 40 | 41 | #elif defined(__sun) 42 | typedef signed char Word8; 43 | typedef short Word16; 44 | typedef long Word32; 45 | typedef int Flag; 46 | 47 | #elif defined(__unix__) || defined(__unix) 48 | typedef signed char Word8; 49 | typedef short Word16; 50 | typedef int Word32; 51 | typedef int Flag; 52 | 53 | #endif 54 | #else /* not original typedef.h */ 55 | 56 | /* 57 | * use (improved) type definition file typdefs.h and add a "Flag" type 58 | */ 59 | #include "typedefs.h" 60 | typedef int Flag; 61 | 62 | #endif 63 | 64 | #endif //__TYPEDEF_H__ 65 | 66 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/patent_disclaimer.txt: -------------------------------------------------------------------------------- 1 | 2 | THIS IS NOT A GRANT OF PATENT RIGHTS. 3 | 4 | Google makes no representation or warranty that the codecs for which 5 | source code is made available hereunder are unencumbered by 6 | third-party patents. Those intending to use this source code in 7 | hardware or software products are advised that implementations of 8 | these codecs, including in open source software or shareware, may 9 | require patent licenses from the relevant patent holders. 10 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/asm/ARMV5E/Dot_p_opt.s: -------------------------------------------------------------------------------- 1 | @/* 2 | @ ** Copyright 2003-2010, VisualOn, Inc. 3 | @ ** 4 | @ ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | @ ** you may not use this file except in compliance with the License. 6 | @ ** You may obtain a copy of the License at 7 | @ ** 8 | @ ** http://www.apache.org/licenses/LICENSE-2.0 9 | @ ** 10 | @ ** Unless required by applicable law or agreed to in writing, software 11 | @ ** distributed under the License is distributed on an "AS IS" BASIS, 12 | @ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @ ** See the License for the specific language governing permissions and 14 | @ ** limitations under the License. 15 | @ */ 16 | @ 17 | @Word32 Dot_product12( /* (o) Q31: normalized result (1 < val <= -1) */ 18 | @ Word16 x[], /* (i) 12bits: x vector */ 19 | @ Word16 y[], /* (i) 12bits: y vector */ 20 | @ Word16 lg, /* (i) : vector length */ 21 | @ Word16 * exp /* (o) : exponent of result (0..+30) */ 22 | @) 23 | @**************************************************************** 24 | @ x[] --- r0 25 | @ y[] --- r1 26 | @ lg --- r2 27 | @ *exp --- r3 28 | 29 | .section .text 30 | .global Dot_product12_asm 31 | 32 | Dot_product12_asm: 33 | 34 | STMFD r13!, {r4 - r12, r14} 35 | MOV r4, #0 @ L_sum = 0 36 | MOV r5, #0 @ i = 0 37 | 38 | LOOP: 39 | LDR r6, [r0], #4 40 | LDR r7, [r1], #4 41 | LDR r8, [r0], #4 42 | SMLABB r4, r6, r7, r4 43 | LDR r9, [r1], #4 44 | SMLATT r4, r6, r7, r4 45 | 46 | LDR r6, [r0], #4 47 | SMLABB r4, r8, r9, r4 48 | 49 | LDR r7, [r1], #4 50 | SMLATT r4, r8, r9, r4 51 | LDR r8, [r0], #4 52 | 53 | SMLABB r4, r6, r7, r4 54 | LDR r9, [r1], #4 55 | SMLATT r4, r6, r7, r4 56 | ADD r5, r5, #8 57 | SMLABB r4, r8, r9, r4 58 | CMP r5, r2 59 | SMLATT r4, r8, r9, r4 60 | BLT LOOP 61 | 62 | MOV r12, r4, LSL #1 63 | ADD r12, r12, #1 @ L_sum = (L_sum << 1) + 1 64 | MOV r4, r12 65 | 66 | CMP r12, #0 67 | RSBLT r4, r12, #0 68 | CLZ r10, r4 69 | SUB r10, r10, #1 @ sft = norm_l(L_sum) 70 | MOV r0, r12, LSL r10 @ L_sum = L_sum << sft 71 | RSB r11, r10, #30 @ *exp = 30 - sft 72 | STRH r11, [r3] 73 | 74 | Dot_product12_end: 75 | 76 | LDMFD r13!, {r4 - r12, r15} 77 | @ENDFUNC 78 | .END 79 | 80 | 81 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/asm/ARMV5E/scale_sig_opt.s: -------------------------------------------------------------------------------- 1 | @/* 2 | @ ** Copyright 2003-2010, VisualOn, Inc. 3 | @ ** 4 | @ ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | @ ** you may not use this file except in compliance with the License. 6 | @ ** You may obtain a copy of the License at 7 | @ ** 8 | @ ** http://www.apache.org/licenses/LICENSE-2.0 9 | @ ** 10 | @ ** Unless required by applicable law or agreed to in writing, software 11 | @ ** distributed under the License is distributed on an "AS IS" BASIS, 12 | @ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @ ** See the License for the specific language governing permissions and 14 | @ ** limitations under the License. 15 | @ */ 16 | @ 17 | @void Scale_sig( 18 | @ Word16 x[], /* (i/o) : signal to scale */ 19 | @ Word16 lg, /* (i) : size of x[] */ 20 | @ Word16 exp /* (i) : exponent: x = round(x << exp) */ 21 | @ ) 22 | @ 23 | @r0 --- x[] 24 | @r1 --- lg 25 | @r2 --- exp 26 | 27 | .section .text 28 | .global Scale_sig_opt 29 | 30 | Scale_sig_opt: 31 | 32 | STMFD r13!, {r4 - r12, r14} 33 | SUB r3, r1, #1 @i = lg - 1 34 | CMP r2, #0 @Compare exp and 0 35 | RSB r7, r2, #0 @exp = -exp 36 | ADD r10, r2, #16 @16 + exp 37 | ADD r4, r0, r3, LSL #1 @x[i] address 38 | MOV r8, #0x7fffffff 39 | MOV r9, #0x8000 40 | BLE LOOP2 41 | 42 | LOOP1: 43 | 44 | LDRSH r5, [r4] @load x[i] 45 | MOV r12, r5, LSL r10 46 | TEQ r5, r12, ASR r10 47 | EORNE r12, r8, r5, ASR #31 48 | SUBS r3, r3, #1 49 | QADD r11, r12, r9 50 | MOV r12, r11, ASR #16 51 | STRH r12, [r4], #-2 52 | BGE LOOP1 53 | BL The_end 54 | 55 | LOOP2: 56 | 57 | LDRSH r5, [r4] @load x[i] 58 | MOV r6, r5, LSL #16 @L_tmp = x[i] << 16 59 | MOV r5, r6, ASR r7 @L_tmp >>= exp 60 | QADD r11, r5, r9 61 | MOV r12, r11, ASR #16 62 | SUBS r3, r3, #1 63 | STRH r12, [r4], #-2 64 | BGE LOOP2 65 | 66 | The_end: 67 | LDMFD r13!, {r4 - r12, r15} 68 | 69 | @ENDFUNC 70 | .END 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/convolve.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | File: convolve.c 19 | 20 | Description:Perform the convolution between two vectors x[] and h[] 21 | and write the result in the vector y[] 22 | 23 | ************************************************************************/ 24 | 25 | #include "typedef.h" 26 | #include "basic_op.h" 27 | 28 | void Convolve ( 29 | Word16 x[], /* (i) : input vector */ 30 | Word16 h[], /* (i) : impulse response */ 31 | Word16 y[], /* (o) : output vector */ 32 | Word16 L /* (i) : vector size */ 33 | ) 34 | { 35 | Word32 i, n; 36 | Word16 *tmpH,*tmpX; 37 | Word32 s; 38 | for (n = 0; n < 64;) 39 | { 40 | tmpH = h+n; 41 | tmpX = x; 42 | i=n+1; 43 | s = vo_mult32((*tmpX++), (*tmpH--));i--; 44 | while(i>0) 45 | { 46 | s += vo_mult32((*tmpX++), (*tmpH--)); 47 | s += vo_mult32((*tmpX++), (*tmpH--)); 48 | s += vo_mult32((*tmpX++), (*tmpH--)); 49 | s += vo_mult32((*tmpX++), (*tmpH--)); 50 | i -= 4; 51 | } 52 | y[n] = ((s<<1) + 0x8000)>>16; 53 | n++; 54 | 55 | tmpH = h+n; 56 | tmpX = x; 57 | i=n+1; 58 | s = vo_mult32((*tmpX++), (*tmpH--));i--; 59 | s += vo_mult32((*tmpX++), (*tmpH--));i--; 60 | 61 | while(i>0) 62 | { 63 | s += vo_mult32((*tmpX++), (*tmpH--)); 64 | s += vo_mult32((*tmpX++), (*tmpH--)); 65 | s += vo_mult32((*tmpX++), (*tmpH--)); 66 | s += vo_mult32((*tmpX++), (*tmpH--)); 67 | i -= 4; 68 | } 69 | y[n] = ((s<<1) + 0x8000)>>16; 70 | n++; 71 | 72 | tmpH = h+n; 73 | tmpX = x; 74 | i=n+1; 75 | s = vo_mult32((*tmpX++), (*tmpH--));i--; 76 | s += vo_mult32((*tmpX++), (*tmpH--));i--; 77 | s += vo_mult32((*tmpX++), (*tmpH--));i--; 78 | 79 | while(i>0) 80 | { 81 | s += vo_mult32((*tmpX++), (*tmpH--)); 82 | s += vo_mult32((*tmpX++), (*tmpH--)); 83 | s += vo_mult32((*tmpX++), (*tmpH--)); 84 | s += vo_mult32((*tmpX++), (*tmpH--)); 85 | i -= 4; 86 | } 87 | y[n] = ((s<<1) + 0x8000)>>16; 88 | n++; 89 | 90 | s = 0; 91 | tmpH = h+n; 92 | tmpX = x; 93 | i=n+1; 94 | while(i>0) 95 | { 96 | s += vo_mult32((*tmpX++), (*tmpH--)); 97 | s += vo_mult32((*tmpX++), (*tmpH--)); 98 | s += vo_mult32((*tmpX++), (*tmpH--)); 99 | s += vo_mult32((*tmpX++), (*tmpH--)); 100 | i -= 4; 101 | } 102 | y[n] = ((s<<1) + 0x8000)>>16; 103 | n++; 104 | } 105 | return; 106 | } 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/g_pitch.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: g_pitch.c * 19 | * * 20 | * Description:Compute the gain of pitch. Result in Q12 * 21 | * if(gain < 0) gain = 0 * 22 | * if(gain > 1.2) gain = 1.2 * 23 | ************************************************************************/ 24 | 25 | #include "typedef.h" 26 | #include "basic_op.h" 27 | #include "math_op.h" 28 | 29 | Word16 G_pitch( /* (o) Q14 : Gain of pitch lag saturated to 1.2 */ 30 | Word16 xn[], /* (i) : Pitch target. */ 31 | Word16 y1[], /* (i) : filtered adaptive codebook. */ 32 | Word16 g_coeff[], /* : Correlations need for gain quantization. */ 33 | Word16 L_subfr /* : Length of subframe. */ 34 | ) 35 | { 36 | Word32 i; 37 | Word16 xy, yy, exp_xy, exp_yy, gain; 38 | /* Compute scalar product */ 39 | #ifdef ASM_OPT /* asm optimization branch */ 40 | /* Compute scalar product */ 41 | xy = extract_h(Dot_product12_asm(xn, y1, L_subfr, &exp_xy)); 42 | yy = extract_h(Dot_product12_asm(y1, y1, L_subfr, &exp_yy)); 43 | 44 | #else 45 | /* Compute scalar product */ 46 | xy = extract_h(Dot_product12(xn, y1, L_subfr, &exp_xy)); 47 | yy = extract_h(Dot_product12(y1, y1, L_subfr, &exp_yy)); 48 | 49 | #endif 50 | 51 | g_coeff[0] = yy; 52 | g_coeff[1] = exp_yy; 53 | g_coeff[2] = xy; 54 | g_coeff[3] = exp_xy; 55 | 56 | /* If (xy < 0) gain = 0 */ 57 | if (xy < 0) 58 | return ((Word16) 0); 59 | 60 | /* compute gain = xy/yy */ 61 | 62 | xy >>= 1; /* Be sure xy < yy */ 63 | gain = div_s(xy, yy); 64 | 65 | i = exp_xy; 66 | i -= exp_yy; 67 | 68 | gain = shl(gain, i); 69 | 70 | /* if (gain > 1.2) gain = 1.2 in Q14 */ 71 | if(gain > 19661) 72 | { 73 | gain = 19661; 74 | } 75 | return (gain); 76 | } 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/homing.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: homing.c * 19 | * * 20 | * Description:Performs the homing routines * 21 | * * 22 | ************************************************************************/ 23 | 24 | #include "typedef.h" 25 | #include "cnst.h" 26 | #include "basic_op.h" 27 | #include "bits.h" 28 | #include "homing.tab" 29 | 30 | Word16 encoder_homing_frame_test(Word16 input_frame[]) 31 | { 32 | Word32 i; 33 | Word16 j = 0; 34 | 35 | /* check 320 input samples for matching EHF_MASK: defined in e_homing.h */ 36 | for (i = 0; i < L_FRAME16k; i++) 37 | { 38 | j = (Word16) (input_frame[i] ^ EHF_MASK); 39 | 40 | if (j) 41 | break; 42 | } 43 | 44 | return (Word16) (!j); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/hp6k.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: hp6k.c * 19 | * * 20 | * Description:15th order band pass 6kHz to 7kHz FIR filter * 21 | * frequency: 4kHz 5kHz 5.5kHz 6kHz 6.5kHz 7kHz 7.5kHz 8kHz * 22 | * dB loss: -60dB -45dB -13dB -3dB 0dB -3dB -13dB -45dB * 23 | * * 24 | ************************************************************************/ 25 | 26 | #include "typedef.h" 27 | #include "basic_op.h" 28 | #include "acelp.h" 29 | #include "cnst.h" 30 | 31 | #define L_FIR 31 32 | 33 | /* filter coefficients (gain=4.0) */ 34 | 35 | Word16 fir_6k_7k[L_FIR] = 36 | { 37 | -32, 47, 32, -27, -369, 38 | 1122, -1421, 0, 3798, -8880, 39 | 12349, -10984, 3548, 7766, -18001, 40 | 22118, -18001, 7766, 3548, -10984, 41 | 12349, -8880, 3798, 0, -1421, 42 | 1122, -369, -27, 32, 47, 43 | -32 44 | }; 45 | 46 | 47 | void Init_Filt_6k_7k(Word16 mem[]) /* mem[30] */ 48 | { 49 | Set_zero(mem, L_FIR - 1); 50 | return; 51 | } 52 | 53 | void Filt_6k_7k( 54 | Word16 signal[], /* input: signal */ 55 | Word16 lg, /* input: length of input */ 56 | Word16 mem[] /* in/out: memory (size=30) */ 57 | ) 58 | { 59 | Word16 x[L_SUBFR16k + (L_FIR - 1)]; 60 | Word32 i, L_tmp; 61 | 62 | Copy(mem, x, L_FIR - 1); 63 | for (i = lg - 1; i >= 0; i--) 64 | { 65 | x[i + L_FIR - 1] = signal[i] >> 2; /* gain of filter = 4 */ 66 | } 67 | for (i = 0; i < lg; i++) 68 | { 69 | L_tmp = (x[i] + x[i+ 30]) * fir_6k_7k[0]; 70 | L_tmp += (x[i+1] + x[i + 29]) * fir_6k_7k[1]; 71 | L_tmp += (x[i+2] + x[i + 28]) * fir_6k_7k[2]; 72 | L_tmp += (x[i+3] + x[i + 27]) * fir_6k_7k[3]; 73 | L_tmp += (x[i+4] + x[i + 26]) * fir_6k_7k[4]; 74 | L_tmp += (x[i+5] + x[i + 25]) * fir_6k_7k[5]; 75 | L_tmp += (x[i+6] + x[i + 24]) * fir_6k_7k[6]; 76 | L_tmp += (x[i+7] + x[i + 23]) * fir_6k_7k[7]; 77 | L_tmp += (x[i+8] + x[i + 22]) * fir_6k_7k[8]; 78 | L_tmp += (x[i+9] + x[i + 21]) * fir_6k_7k[9]; 79 | L_tmp += (x[i+10] + x[i + 20]) * fir_6k_7k[10]; 80 | L_tmp += (x[i+11] + x[i + 19]) * fir_6k_7k[11]; 81 | L_tmp += (x[i+12] + x[i + 18]) * fir_6k_7k[12]; 82 | L_tmp += (x[i+13] + x[i + 17]) * fir_6k_7k[13]; 83 | L_tmp += (x[i+14] + x[i + 16]) * fir_6k_7k[14]; 84 | L_tmp += (x[i+15]) * fir_6k_7k[15]; 85 | signal[i] = (L_tmp + 0x4000) >> 15; 86 | } 87 | 88 | Copy(x + lg, mem, L_FIR - 1); 89 | 90 | } 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/int_lpc.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: int_lpc.c * 19 | * * 20 | * Description:Interpolation of the LP parameters in 4 subframes. * 21 | * * 22 | ************************************************************************/ 23 | 24 | #include "typedef.h" 25 | #include "basic_op.h" 26 | #include "cnst.h" 27 | #include "acelp.h" 28 | 29 | #define MP1 (M+1) 30 | 31 | 32 | void Int_isp( 33 | Word16 isp_old[], /* input : isps from past frame */ 34 | Word16 isp_new[], /* input : isps from present frame */ 35 | Word16 frac[], /* input : fraction for 3 first subfr (Q15) */ 36 | Word16 Az[] /* output: LP coefficients in 4 subframes */ 37 | ) 38 | { 39 | Word32 i, k; 40 | Word16 fac_old, fac_new; 41 | Word16 isp[M]; 42 | Word32 L_tmp; 43 | 44 | for (k = 0; k < 3; k++) 45 | { 46 | fac_new = frac[k]; 47 | fac_old = (32767 - fac_new) + 1; /* 1.0 - fac_new */ 48 | 49 | for (i = 0; i < M; i++) 50 | { 51 | L_tmp = (isp_old[i] * fac_old)<<1; 52 | L_tmp += (isp_new[i] * fac_new)<<1; 53 | isp[i] = (L_tmp + 0x8000)>>16; 54 | } 55 | Isp_Az(isp, Az, M, 0); 56 | Az += MP1; 57 | } 58 | 59 | /* 4th subframe: isp_new (frac=1.0) */ 60 | Isp_Az(isp_new, Az, M, 0); 61 | 62 | return; 63 | } 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/lag_wind.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: lag_wind.c * 19 | * * 20 | * Description: Lag_windows on autocorrelations * 21 | * r[i] *= lag_wind[i] * 22 | * * 23 | ************************************************************************/ 24 | 25 | #include "typedef.h" 26 | #include "basic_op.h" 27 | #include "oper_32b.h" 28 | #include "lag_wind.tab" 29 | 30 | 31 | void Lag_window( 32 | Word16 r_h[], /* (i/o) : Autocorrelations (msb) */ 33 | Word16 r_l[] /* (i/o) : Autocorrelations (lsb) */ 34 | ) 35 | { 36 | Word32 i; 37 | Word32 x; 38 | 39 | for (i = 1; i <= M; i++) 40 | { 41 | x = Mpy_32(r_h[i], r_l[i], volag_h[i - 1], volag_l[i - 1]); 42 | r_h[i] = x >> 16; 43 | r_l[i] = (x & 0xffff)>>1; 44 | } 45 | return; 46 | } 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/lp_dec2.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: lp_dec2.c * 19 | * * 20 | * Description:Decimate a vector by 2 with 2nd order fir filter * 21 | * * 22 | ************************************************************************/ 23 | 24 | #include "typedef.h" 25 | #include "basic_op.h" 26 | #include "cnst.h" 27 | 28 | #define L_FIR 5 29 | #define L_MEM (L_FIR-2) 30 | 31 | /* static float h_fir[L_FIR] = {0.13, 0.23, 0.28, 0.23, 0.13}; */ 32 | /* fixed-point: sum of coef = 32767 to avoid overflow on DC */ 33 | static Word16 h_fir[L_FIR] = {4260, 7536, 9175, 7536, 4260}; 34 | 35 | void LP_Decim2( 36 | Word16 x[], /* in/out: signal to process */ 37 | Word16 l, /* input : size of filtering */ 38 | Word16 mem[] /* in/out: memory (size=3) */ 39 | ) 40 | { 41 | Word16 *p_x, x_buf[L_FRAME + L_MEM]; 42 | Word32 i, j; 43 | Word32 L_tmp; 44 | /* copy initial filter states into buffer */ 45 | p_x = x_buf; 46 | for (i = 0; i < L_MEM; i++) 47 | { 48 | *p_x++ = mem[i]; 49 | mem[i] = x[l - L_MEM + i]; 50 | } 51 | for (i = 0; i < l; i++) 52 | { 53 | *p_x++ = x[i]; 54 | } 55 | for (i = 0, j = 0; i < l; i += 2, j++) 56 | { 57 | p_x = &x_buf[i]; 58 | L_tmp = ((*p_x++) * h_fir[0]); 59 | L_tmp += ((*p_x++) * h_fir[1]); 60 | L_tmp += ((*p_x++) * h_fir[2]); 61 | L_tmp += ((*p_x++) * h_fir[3]); 62 | L_tmp += ((*p_x++) * h_fir[4]); 63 | x[j] = (L_tmp + 0x4000)>>15; 64 | } 65 | return; 66 | } 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/mem_align.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /******************************************************************************* 18 | File: mem_align.c 19 | 20 | Content: Memory alloc alignments functions 21 | 22 | *******************************************************************************/ 23 | 24 | 25 | #include "mem_align.h" 26 | #ifdef _MSC_VER 27 | #include 28 | #else 29 | #include 30 | #endif 31 | 32 | /***************************************************************************** 33 | * 34 | * function name: mem_malloc 35 | * description: malloc the alignments memory 36 | * returns: the point of the memory 37 | * 38 | **********************************************************************************/ 39 | void * 40 | mem_malloc(VO_MEM_OPERATOR *pMemop, unsigned int size, unsigned char alignment, unsigned int CodecID) 41 | { 42 | int ret; 43 | unsigned char *mem_ptr; 44 | VO_MEM_INFO MemInfo; 45 | 46 | if (!alignment) { 47 | 48 | MemInfo.Flag = 0; 49 | MemInfo.Size = size + 1; 50 | ret = pMemop->Alloc(CodecID, &MemInfo); 51 | if(ret != 0) 52 | return 0; 53 | mem_ptr = (unsigned char *)MemInfo.VBuffer; 54 | 55 | pMemop->Set(CodecID, mem_ptr, 0, size + 1); 56 | 57 | *mem_ptr = (unsigned char)1; 58 | 59 | return ((void *)(mem_ptr+1)); 60 | } else { 61 | unsigned char *tmp; 62 | 63 | MemInfo.Flag = 0; 64 | MemInfo.Size = size + alignment; 65 | ret = pMemop->Alloc(CodecID, &MemInfo); 66 | if(ret != 0) 67 | return 0; 68 | 69 | tmp = (unsigned char *)MemInfo.VBuffer; 70 | 71 | pMemop->Set(CodecID, tmp, 0, size + alignment); 72 | 73 | mem_ptr = 74 | (unsigned char *) ((intptr_t) (tmp + alignment - 1) & 75 | (~((intptr_t) (alignment - 1)))); 76 | 77 | if (mem_ptr == tmp) 78 | mem_ptr += alignment; 79 | 80 | *(mem_ptr - 1) = (unsigned char) (mem_ptr - tmp); 81 | 82 | return ((void *)mem_ptr); 83 | } 84 | 85 | return(0); 86 | } 87 | 88 | 89 | /***************************************************************************** 90 | * 91 | * function name: mem_free 92 | * description: free the memory 93 | * 94 | *******************************************************************************/ 95 | void 96 | mem_free(VO_MEM_OPERATOR *pMemop, void *mem_ptr, unsigned int CodecID) 97 | { 98 | 99 | unsigned char *ptr; 100 | 101 | if (mem_ptr == 0) 102 | return; 103 | 104 | ptr = mem_ptr; 105 | 106 | ptr -= *(ptr - 1); 107 | 108 | pMemop->Free(CodecID, ptr); 109 | } 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/pit_shrp.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: pit_shrp.c * 19 | * * 20 | * Description: Performs Pitch sharpening routine * 21 | * * 22 | ************************************************************************/ 23 | 24 | #include "typedef.h" 25 | #include "basic_op.h" 26 | 27 | void Pit_shrp( 28 | Word16 * x, /* in/out: impulse response (or algebraic code) */ 29 | Word16 pit_lag, /* input : pitch lag */ 30 | Word16 sharp, /* input : pitch sharpening factor (Q15) */ 31 | Word16 L_subfr /* input : subframe size */ 32 | ) 33 | { 34 | Word32 i; 35 | Word32 L_tmp; 36 | Word16 *x_ptr = x + pit_lag; 37 | 38 | for (i = pit_lag; i < L_subfr; i++) 39 | { 40 | L_tmp = (*x_ptr << 15); 41 | L_tmp += *x++ * sharp; 42 | *x_ptr++ = ((L_tmp + 0x4000)>>15); 43 | } 44 | 45 | return; 46 | } 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/preemph.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: preemph.c * 19 | * * 20 | * Description: Preemphasis: filtering through 1 - g z^-1 * 21 | * Preemph2 --> signal is multiplied by 2 * 22 | * * 23 | ************************************************************************/ 24 | 25 | #include "typedef.h" 26 | #include "basic_op.h" 27 | 28 | void Preemph( 29 | Word16 x[], /* (i/o) : input signal overwritten by the output */ 30 | Word16 mu, /* (i) Q15 : preemphasis coefficient */ 31 | Word16 lg, /* (i) : lenght of filtering */ 32 | Word16 * mem /* (i/o) : memory (x[-1]) */ 33 | ) 34 | { 35 | Word16 temp; 36 | Word32 i, L_tmp; 37 | 38 | temp = x[lg - 1]; 39 | 40 | for (i = lg - 1; i > 0; i--) 41 | { 42 | L_tmp = L_deposit_h(x[i]); 43 | L_tmp -= (x[i - 1] * mu)<<1; 44 | x[i] = (L_tmp + 0x8000)>>16; 45 | } 46 | 47 | L_tmp = L_deposit_h(x[0]); 48 | L_tmp -= ((*mem) * mu)<<1; 49 | x[0] = (L_tmp + 0x8000)>>16; 50 | 51 | *mem = temp; 52 | 53 | return; 54 | } 55 | 56 | 57 | void Preemph2( 58 | Word16 x[], /* (i/o) : input signal overwritten by the output */ 59 | Word16 mu, /* (i) Q15 : preemphasis coefficient */ 60 | Word16 lg, /* (i) : lenght of filtering */ 61 | Word16 * mem /* (i/o) : memory (x[-1]) */ 62 | ) 63 | { 64 | Word16 temp; 65 | Word32 i, L_tmp; 66 | 67 | temp = x[lg - 1]; 68 | 69 | for (i = (Word16) (lg - 1); i > 0; i--) 70 | { 71 | L_tmp = L_deposit_h(x[i]); 72 | L_tmp -= (x[i - 1] * mu)<<1; 73 | L_tmp = (L_tmp << 1); 74 | x[i] = (L_tmp + 0x8000)>>16; 75 | } 76 | 77 | L_tmp = L_deposit_h(x[0]); 78 | L_tmp -= ((*mem) * mu)<<1; 79 | L_tmp = (L_tmp << 1); 80 | x[0] = (L_tmp + 0x8000)>>16; 81 | 82 | *mem = temp; 83 | 84 | return; 85 | } 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/random.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: random.c * 19 | * * 20 | * Description: Signed 16 bits random generator * 21 | * * 22 | ************************************************************************/ 23 | 24 | #include "typedef.h" 25 | #include "basic_op.h" 26 | 27 | Word16 Random(Word16 * seed) 28 | { 29 | /* static Word16 seed = 21845; */ 30 | *seed = (Word16)(L_add((L_mult(*seed, 31821) >> 1), 13849L)); 31 | return (*seed); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/residu.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: residu.c * 19 | * * 20 | * Description: Compute the LPC residual by filtering * 21 | * the input speech through A(z) * 22 | * * 23 | ************************************************************************/ 24 | 25 | #include "typedef.h" 26 | #include "basic_op.h" 27 | 28 | void Residu( 29 | Word16 a[], /* (i) Q12 : prediction coefficients */ 30 | Word16 x[], /* (i) : speech (values x[-m..-1] are needed */ 31 | Word16 y[], /* (o) x2 : residual signal */ 32 | Word16 lg /* (i) : size of filtering */ 33 | ) 34 | { 35 | Word16 i,*p1, *p2; 36 | Word32 s; 37 | for (i = 0; i < lg; i++) 38 | { 39 | p1 = a; 40 | p2 = &x[i]; 41 | s = vo_mult32((*p1++), (*p2--)); 42 | s += vo_mult32((*p1++), (*p2--)); 43 | s += vo_mult32((*p1++), (*p2--)); 44 | s += vo_mult32((*p1++), (*p2--)); 45 | s += vo_mult32((*p1++), (*p2--)); 46 | s += vo_mult32((*p1++), (*p2--)); 47 | s += vo_mult32((*p1++), (*p2--)); 48 | s += vo_mult32((*p1++), (*p2--)); 49 | s += vo_mult32((*p1++), (*p2--)); 50 | s += vo_mult32((*p1++), (*p2--)); 51 | s += vo_mult32((*p1++), (*p2--)); 52 | s += vo_mult32((*p1++), (*p2--)); 53 | s += vo_mult32((*p1++), (*p2--)); 54 | s += vo_mult32((*p1++), (*p2--)); 55 | s += vo_mult32((*p1++), (*p2--)); 56 | s += vo_mult32((*p1++), (*p2--)); 57 | s += vo_mult32((*p1), (*p2)); 58 | 59 | s = L_shl2(s, 5); 60 | y[i] = extract_h(L_add(s, 0x8000)); 61 | } 62 | 63 | return; 64 | } 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/scale.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: scale.c * 19 | * * 20 | * Description: Scale signal to get maximum of dynamic * 21 | * * 22 | ************************************************************************/ 23 | 24 | #include "typedef.h" 25 | #include "basic_op.h" 26 | 27 | void Scale_sig( 28 | Word16 x[], /* (i/o) : signal to scale */ 29 | Word16 lg, /* (i) : size of x[] */ 30 | Word16 exp /* (i) : exponent: x = round(x << exp) */ 31 | ) 32 | { 33 | Word32 i; 34 | Word32 L_tmp; 35 | if(exp > 0) 36 | { 37 | for (i = lg - 1 ; i >= 0; i--) 38 | { 39 | L_tmp = L_shl2(x[i], 16 + exp); 40 | x[i] = extract_h(L_add(L_tmp, 0x8000)); 41 | } 42 | } 43 | else 44 | { 45 | exp = -exp; 46 | for (i = lg - 1; i >= 0; i--) 47 | { 48 | L_tmp = x[i] << 16; 49 | L_tmp >>= exp; 50 | x[i] = (L_tmp + 0x8000)>>16; 51 | } 52 | } 53 | return; 54 | } 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/stream.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: stream.c * 19 | * * 20 | * Description: VOME API Buffer Operator Implement Code * 21 | * * 22 | ************************************************************************/ 23 | 24 | #include "stream.h" 25 | 26 | void voAWB_InitFrameBuffer(FrameStream *stream) 27 | { 28 | stream->set_ptr = NULL; 29 | stream->frame_ptr_bk = stream->frame_ptr; 30 | stream->set_len = 0; 31 | stream->framebuffer_len = 0; 32 | stream->frame_storelen = 0; 33 | } 34 | 35 | void voAWB_UpdateFrameBuffer( 36 | FrameStream *stream, 37 | VO_MEM_OPERATOR *pMemOP 38 | ) 39 | { 40 | int len; 41 | len = MIN(Frame_Maxsize - stream->frame_storelen, stream->set_len); 42 | pMemOP->Copy(VO_INDEX_ENC_AMRWB, stream->frame_ptr_bk + stream->frame_storelen , stream->set_ptr, len); 43 | stream->set_len -= len; 44 | stream->set_ptr += len; 45 | stream->framebuffer_len = stream->frame_storelen + len; 46 | stream->frame_ptr = stream->frame_ptr_bk; 47 | stream->used_len += len; 48 | } 49 | 50 | void voAWB_FlushFrameBuffer(FrameStream *stream) 51 | { 52 | stream->set_ptr = NULL; 53 | stream->frame_ptr_bk = stream->frame_ptr; 54 | stream->set_len = 0; 55 | stream->framebuffer_len = 0; 56 | stream->frame_storelen = 0; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/updt_tar.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: updt_tar.c * 19 | * * 20 | * Description: Update the target vector for codebook search * 21 | * * 22 | ************************************************************************/ 23 | 24 | #include "typedef.h" 25 | #include "basic_op.h" 26 | 27 | void Updt_tar( 28 | Word16 * x, /* (i) Q0 : old target (for pitch search) */ 29 | Word16 * x2, /* (o) Q0 : new target (for codebook search) */ 30 | Word16 * y, /* (i) Q0 : filtered adaptive codebook vector */ 31 | Word16 gain, /* (i) Q14 : adaptive codebook gain */ 32 | Word16 L /* (i) : subframe size */ 33 | ) 34 | { 35 | Word32 i; 36 | Word32 L_tmp; 37 | 38 | for (i = 0; i < L; i++) 39 | { 40 | L_tmp = x[i] << 15; 41 | L_tmp -= (y[i] * gain)<<1; 42 | x2[i] = extract_h(L_shl2(L_tmp, 1)); 43 | } 44 | 45 | return; 46 | } 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/util.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: util.c * 19 | * * 20 | * Description: Reset and Copy buffer * 21 | * * 22 | ************************************************************************/ 23 | 24 | #include "typedef.h" 25 | #include "basic_op.h" 26 | 27 | /*********************************************************************** 28 | * Function: Set_zero() * 29 | * Description: Set vector x[] to zero * 30 | ************************************************************************/ 31 | 32 | void Set_zero( 33 | Word16 x[], /* (o) : vector to clear */ 34 | Word16 L /* (i) : length of vector */ 35 | ) 36 | { 37 | Word32 num = (Word32)L; 38 | do{ 39 | *x++ = 0; 40 | }while(--num !=0); 41 | } 42 | 43 | 44 | /********************************************************************* 45 | * Function: Copy() * 46 | * * 47 | * Description: Copy vector x[] to y[] * 48 | *********************************************************************/ 49 | 50 | void Copy( 51 | Word16 x[], /* (i) : input vector */ 52 | Word16 y[], /* (o) : output vector */ 53 | Word16 L /* (i) : vector length */ 54 | ) 55 | { 56 | Word32 temp1,temp2,num; 57 | if(L&1) 58 | { 59 | temp1 = *x++; 60 | *y++ = temp1; 61 | } 62 | num = (Word32)(L>>1); 63 | temp1 = *x++; 64 | temp2 = *x++; 65 | do{ 66 | *y++ = temp1; 67 | *y++ = temp2; 68 | temp1 = *x++; 69 | temp2 = *x++; 70 | }while(--num!=0); 71 | } 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/voicefac.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: voicefac.c * 19 | * * 20 | * Description: Find the voicing factors (1 = voice to -1 = unvoiced) * 21 | * * 22 | ************************************************************************/ 23 | 24 | #include "typedef.h" 25 | #include "basic_op.h" 26 | #include "math_op.h" 27 | 28 | Word16 voice_factor( /* (o) Q15 : factor (-1=unvoiced to 1=voiced) */ 29 | Word16 exc[], /* (i) Q_exc : pitch excitation */ 30 | Word16 Q_exc, /* (i) : exc format */ 31 | Word16 gain_pit, /* (i) Q14 : gain of pitch */ 32 | Word16 code[], /* (i) Q9 : Fixed codebook excitation */ 33 | Word16 gain_code, /* (i) Q0 : gain of code */ 34 | Word16 L_subfr /* (i) : subframe length */ 35 | ) 36 | { 37 | Word16 tmp, exp, ener1, exp1, ener2, exp2; 38 | Word32 i, L_tmp; 39 | 40 | #ifdef ASM_OPT /* asm optimization branch */ 41 | ener1 = extract_h(Dot_product12_asm(exc, exc, L_subfr, &exp1)); 42 | #else 43 | ener1 = extract_h(Dot_product12(exc, exc, L_subfr, &exp1)); 44 | #endif 45 | exp1 = exp1 - (Q_exc + Q_exc); 46 | L_tmp = vo_L_mult(gain_pit, gain_pit); 47 | exp = norm_l(L_tmp); 48 | tmp = extract_h(L_tmp << exp); 49 | ener1 = vo_mult(ener1, tmp); 50 | exp1 = exp1 - exp - 10; /* 10 -> gain_pit Q14 to Q9 */ 51 | 52 | #ifdef ASM_OPT /* asm optimization branch */ 53 | ener2 = extract_h(Dot_product12_asm(code, code, L_subfr, &exp2)); 54 | #else 55 | ener2 = extract_h(Dot_product12(code, code, L_subfr, &exp2)); 56 | #endif 57 | 58 | exp = norm_s(gain_code); 59 | tmp = gain_code << exp; 60 | tmp = vo_mult(tmp, tmp); 61 | ener2 = vo_mult(ener2, tmp); 62 | exp2 = exp2 - (exp + exp); 63 | 64 | i = exp1 - exp2; 65 | 66 | if (i >= 0) 67 | { 68 | ener1 = ener1 >> 1; 69 | ener2 = ener2 >> (i + 1); 70 | } else 71 | { 72 | ener1 = ener1 >> (1 - i); 73 | ener2 = ener2 >> 1; 74 | } 75 | 76 | tmp = vo_sub(ener1, ener2); 77 | ener1 = add1(add1(ener1, ener2), 1); 78 | 79 | if (tmp >= 0) 80 | { 81 | tmp = div_s(tmp, ener1); 82 | } else 83 | { 84 | tmp = vo_negate(div_s(vo_negate(tmp), ener1)); 85 | } 86 | 87 | return (tmp); 88 | } 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/amrwbenc/src/weight_a.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | /*********************************************************************** 18 | * File: weight_a.c * 19 | * * 20 | * Description:Weighting of LPC coefficients * 21 | * ap[i] = a[i] * (gamma ** i) * 22 | * * 23 | ************************************************************************/ 24 | 25 | #include "typedef.h" 26 | #include "basic_op.h" 27 | 28 | void Weight_a( 29 | Word16 a[], /* (i) Q12 : a[m+1] LPC coefficients */ 30 | Word16 ap[], /* (o) Q12 : Spectral expanded LPC coefficients */ 31 | Word16 gamma, /* (i) Q15 : Spectral expansion factor. */ 32 | Word16 m /* (i) : LPC order. */ 33 | ) 34 | { 35 | Word32 num = m - 1, fac; 36 | *ap++ = *a++; 37 | fac = gamma; 38 | do{ 39 | *ap++ =(Word16)(((vo_L_mult((*a++), fac)) + 0x8000) >> 16); 40 | fac = (vo_L_mult(fac, gamma) + 0x8000) >> 16; 41 | }while(--num != 0); 42 | 43 | *ap++ = (Word16)(((vo_L_mult((*a++), fac)) + 0x8000) >> 16); 44 | return; 45 | } 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/common/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | 5 | 6 | LOCAL_SRC_FILES := cmnMemory.c 7 | 8 | LOCAL_MODULE := libstagefright_enc_common 9 | 10 | LOCAL_ARM_MODE := arm 11 | 12 | LOCAL_STATIC_LIBRARIES := 13 | 14 | LOCAL_C_INCLUDES := \ 15 | $(LOCAL_PATH)/include 16 | 17 | include $(BUILD_SHARED_LIBRARY) 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/common/Config.mk: -------------------------------------------------------------------------------- 1 | # 2 | # This configure file is just for Linux projects against Android 3 | # 4 | 5 | VOPRJ := 6 | VONJ := 7 | 8 | # WARNING: 9 | # Using v7 breaks generic build 10 | ifeq ($(TARGET_ARCH),arm) 11 | VOTT := v5 12 | else 13 | VOTT := pc 14 | endif 15 | 16 | # Do we also need to check on ARCH_ARM_HAVE_ARMV7A? - probably not 17 | ifeq ($(ARCH_ARM_HAVE_NEON),true) 18 | VOTT := v7 19 | endif 20 | 21 | VOTEST := 0 22 | 23 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/common/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AGProjects/python3-sipsimple/46699e256c16f252eeeb7f628180602c465b0930/deps/vo-amrwbenc-0.1.3/common/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/common/cmnMemory.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | /******************************************************************************* 17 | File: cmnMemory.c 18 | 19 | Content: sample code for memory operator implementation 20 | 21 | *******************************************************************************/ 22 | #include "cmnMemory.h" 23 | 24 | #include 25 | #include 26 | 27 | //VO_MEM_OPERATOR g_memOP; 28 | 29 | VO_U32 cmnMemAlloc (VO_S32 uID, VO_MEM_INFO * pMemInfo) 30 | { 31 | if (!pMemInfo) 32 | return VO_ERR_INVALID_ARG; 33 | 34 | pMemInfo->VBuffer = malloc (pMemInfo->Size); 35 | return 0; 36 | } 37 | 38 | VO_U32 cmnMemFree (VO_S32 uID, VO_PTR pMem) 39 | { 40 | free (pMem); 41 | return 0; 42 | } 43 | 44 | VO_U32 cmnMemSet (VO_S32 uID, VO_PTR pBuff, VO_U8 uValue, VO_U32 uSize) 45 | { 46 | memset (pBuff, uValue, uSize); 47 | return 0; 48 | } 49 | 50 | VO_U32 cmnMemCopy (VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize) 51 | { 52 | memcpy (pDest, pSource, uSize); 53 | return 0; 54 | } 55 | 56 | VO_U32 cmnMemCheck (VO_S32 uID, VO_PTR pBuffer, VO_U32 uSize) 57 | { 58 | return 0; 59 | } 60 | 61 | VO_S32 cmnMemCompare (VO_S32 uID, VO_PTR pBuffer1, VO_PTR pBuffer2, VO_U32 uSize) 62 | { 63 | return memcmp(pBuffer1, pBuffer2, uSize); 64 | } 65 | 66 | VO_U32 cmnMemMove (VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize) 67 | { 68 | memmove (pDest, pSource, uSize); 69 | return 0; 70 | } 71 | 72 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/common/include/voAAC.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003-2010, VisualOn, Inc. 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | /******************************************************************************* 17 | File: voAAC.h 18 | 19 | Content: AAC codec APIs & data types 20 | 21 | *******************************************************************************/ 22 | 23 | #ifndef __voAAC_H__ 24 | #define __voAAC_H__ 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif /* __cplusplus */ 29 | 30 | #include "voAudio.h" 31 | 32 | /*! 33 | * the frame type that the decoder supports 34 | */ 35 | typedef enum { 36 | VOAAC_RAWDATA = 0, /*!Alloc(ID, &voMemInfo); \ 57 | pBuff=(VO_PBYTE)voMemInfo.VBuffer; \ 58 | } 59 | 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif /* __cplusplus */ 64 | 65 | #endif // __voMem_H__ 66 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/configure.ac: -------------------------------------------------------------------------------- 1 | dnl -*- Autoconf -*- 2 | dnl Process this file with autoconf to produce a configure script. 3 | 4 | AC_INIT([vo-amrwbenc], [0.1.3], [http://sourceforge.net/projects/opencore-amr/]) 5 | AC_CONFIG_AUX_DIR(.) 6 | AC_CONFIG_MACRO_DIR([m4]) 7 | AM_INIT_AUTOMAKE([tar-ustar foreign]) 8 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 9 | AM_MAINTAINER_MODE 10 | 11 | dnl Various options for configure 12 | AC_ARG_ENABLE([armv5e], 13 | [AS_HELP_STRING([--enable-armv5e], 14 | [enable ARMV5E assembler (default is no)])], 15 | [armv5e=$enableval], [armv5e=no]) 16 | AC_ARG_ENABLE([armv7neon], 17 | [AS_HELP_STRING([--enable-armv7neon], 18 | [enable ARMV7 neon assembler (default is no)])], 19 | [armv7neon=$enableval], [armv7neon=no]) 20 | AC_ARG_ENABLE([example], 21 | [AS_HELP_STRING([--enable-example], 22 | [enable example encoding program (default is no)])], 23 | [example=$enableval], [example=no]) 24 | 25 | dnl Automake conditionals to set 26 | AM_CONDITIONAL(ARMV5E, test x$armv5e = xyes) 27 | AM_CONDITIONAL(ARMV7NEON, test x$armv7neon = xyes) 28 | AM_CONDITIONAL(EXAMPLE, test x$example = xyes) 29 | 30 | dnl Checks for programs. 31 | AM_PROG_AS 32 | AC_PROG_CC_C99 33 | 34 | dnl Setup for libtool 35 | LT_INIT 36 | 37 | dnl soname version to use 38 | dnl goes by ‘current[:revision[:age]]’ with the soname ending up as 39 | dnl current.age.revision. 40 | VO_AMRWBENC_VERSION=0:4:0 41 | AC_SUBST(VO_AMRWBENC_VERSION) 42 | 43 | AC_CONFIG_FILES([Makefile 44 | vo-amrwbenc.pc]) 45 | AC_OUTPUT 46 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/enc_if.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2010 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #ifndef VO_AMRWBENC_ENC_IF_H 20 | #define VO_AMRWBENC_ENC_IF_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | void* E_IF_init(void); 27 | int E_IF_encode(void* state, int mode, const short* speech, unsigned char* out, int dtx); 28 | void E_IF_exit(void* state); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/vo-amrwbenc.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: VisualOn AMR-WB encoder 7 | Description: Adaptive Multi-Rate Wideband speech codec library 8 | Version: @PACKAGE_VERSION@ 9 | Libs: -L${libdir} -lvo-amrwbenc 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/vo-amrwbenc.sym: -------------------------------------------------------------------------------- 1 | E_IF_init 2 | E_IF_encode 3 | E_IF_exit 4 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/wavreader.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #ifndef WAVREADER_H 20 | #define WAVREADER_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | void* wav_read_open(const char *filename); 27 | void wav_read_close(void* obj); 28 | 29 | int wav_get_header(void* obj, int* format, int* channels, int* sample_rate, int* bits_per_sample, unsigned int* data_length); 30 | int wav_read_data(void* obj, unsigned char* data, unsigned int length); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /deps/vo-amrwbenc-0.1.3/wrapper.c: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2010 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #include "enc_if.h" 20 | #include 21 | #include 22 | #include 23 | 24 | struct encoder_state { 25 | VO_AUDIO_CODECAPI audioApi; 26 | VO_HANDLE handle; 27 | VO_MEM_OPERATOR memOperator; 28 | VO_CODEC_INIT_USERDATA userData; 29 | }; 30 | 31 | void* E_IF_init(void) { 32 | struct encoder_state* state = (struct encoder_state*) malloc(sizeof(struct encoder_state)); 33 | int frameType = VOAMRWB_RFC3267; 34 | voGetAMRWBEncAPI(&state->audioApi); 35 | state->memOperator.Alloc = cmnMemAlloc; 36 | state->memOperator.Copy = cmnMemCopy; 37 | state->memOperator.Free = cmnMemFree; 38 | state->memOperator.Set = cmnMemSet; 39 | state->memOperator.Check = cmnMemCheck; 40 | state->userData.memflag = VO_IMF_USERMEMOPERATOR; 41 | state->userData.memData = (VO_PTR)&state->memOperator; 42 | state->audioApi.Init(&state->handle, VO_AUDIO_CodingAMRWB, &state->userData); 43 | state->audioApi.SetParam(state->handle, VO_PID_AMRWB_FRAMETYPE, &frameType); 44 | return state; 45 | } 46 | 47 | void E_IF_exit(void* s) { 48 | struct encoder_state* state = (struct encoder_state*) s; 49 | state->audioApi.Uninit(state->handle); 50 | free(state); 51 | } 52 | 53 | int E_IF_encode(void* s, int mode, const short* speech, unsigned char* out, int dtx) { 54 | VO_CODECBUFFER inData, outData; 55 | VO_AUDIO_OUTPUTINFO outFormat; 56 | struct encoder_state* state = (struct encoder_state*) s; 57 | 58 | state->audioApi.SetParam(state->handle, VO_PID_AMRWB_MODE, &mode); 59 | state->audioApi.SetParam(state->handle, VO_PID_AMRWB_DTX, &dtx); 60 | inData.Buffer = (unsigned char*) speech; 61 | inData.Length = 640; 62 | outData.Buffer = out; 63 | state->audioApi.SetInputData(state->handle, &inData); 64 | state->audioApi.GetOutputData(state->handle, &outData, &outFormat); 65 | return outData.Length; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /deps/zsrtp/include/openssl_compat.h: -------------------------------------------------------------------------------- 1 | #ifndef _OPENSSL_COMPAT 2 | #define _OPENSSL_COMPAT 3 | 4 | #include 5 | 6 | #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) 7 | static HMAC_CTX *HMAC_CTX_new(void) 8 | { 9 | HMAC_CTX *ctx = (HMAC_CTX*)OPENSSL_malloc(sizeof(HMAC_CTX)); 10 | if (ctx != NULL) 11 | HMAC_CTX_init(ctx); 12 | return ctx; 13 | } 14 | 15 | static void HMAC_CTX_free(HMAC_CTX *ctx) 16 | { 17 | if (ctx != NULL) { 18 | HMAC_CTX_cleanup(ctx); 19 | OPENSSL_free(ctx); 20 | } 21 | } 22 | 23 | static int HMAC_CTX_reset(HMAC_CTX *ctx) 24 | { 25 | HMAC_CTX_init(ctx); 26 | return 1; 27 | } 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /docs/Dependencies.txt: -------------------------------------------------------------------------------- 1 | 2 | SIP SIMPLE client SDK dependencies 3 | ---------------------------------- 4 | 5 | Home page: http://sipsimpleclient.org 6 | 7 | SIP SIMPLE SDK depends upon the following third party C sources: 8 | 9 | - PJSIP base revision 2.10 from 2020-02-14 10 | https://github.com/pjsip/pjproject/archive/2.10.tar.gz 11 | 12 | or PJSIP base revision 2.11 13 | https://github.com/pjsip/pjproject/archive/2.11.tar.gz 14 | 15 | - ZRTP tag 6b3cd8e6783642292bad0c21e3e5e5ce45ff3e03 16 | https://github.com/wernerd/ZRTPCPP.git 17 | 18 | Fetch and patch the dependencies using get_dependencies.sh script 19 | 20 | ./get_dependencies.sh will get 2.10 version of PJSIP 21 | ./get_dependencies.sh 2.11 will get 2.11 version of PJSIP 22 | 23 | 24 | AMR codec 25 | --------- 26 | 27 | See codecs note below. 28 | 29 | Narrow-band 30 | 31 | Install opencore-amr using apt-get on Debian/Ubuntu 32 | 33 | On Mac: 34 | 35 | brew install opencore-amr 36 | 37 | Add to shell environment: 38 | 39 | export SIPSIMPLE_AMR_NB_PATH="/usr/local/opt/opencore-amr" 40 | 41 | Wide-band 42 | 43 | Source code: https://sourceforge.net/projects/opencore-amr/files/vo-amrwbenc 44 | 45 | A copy of the tree is included in ./deps/vo-amrwbenc-0.1.3 folder. 46 | 47 | cd ./deps/vo-amrwbenc-0.1.3/ 48 | 49 | On Mac: 50 | 51 | ./configure --prefix=/usr/local/opt/vo-amrwbenc 52 | make 53 | sudo make install 54 | 55 | Add to shell environment: 56 | 57 | export SIPSIMPLE_AMR_WB_PATH="/usr/local/opt/vo-amrwbenc" 58 | 59 | On Linux: 60 | 61 | ./configure --prefix=/usr/local/ 62 | make 63 | sudo make install 64 | 65 | 66 | Python dependencies available from AG Projects repositories: 67 | 68 | * python3-application http://download.ag-projects.com/SipSimpleSDK/Python3/ 69 | * python3-eventlib http://download.ag-projects.com/SipSimpleSDK/Python3/ 70 | * python3-gnutls http://download.ag-projects.com/SipSimpleSDK/Python3/ 71 | * python3-otr http://download.ag-projects.com/SipSimpleSDK/Python3/ 72 | * python3-msrplib http://download.ag-projects.com/SipSimpleSDK/Python3/ 73 | * python3-xcaplib http://download.ag-projects.com/SipSimpleSDK/Python3/ 74 | 75 | The dependencies for each package can be found inside debian/control file 76 | 77 | On a Debian or Ubuntu based system you can install their dependencies using: 78 | 79 | sudo mk-build-deps --install debian/control 80 | 81 | 82 | Codecs note 83 | ----------- 84 | 85 | Depending on what codecs have been compiled, one needs to modify in place: 86 | 87 | AudioCodecList inside sipsimple/configuration/datatypes.py 88 | RTPSettings inside sipsimple/configuration/setting.py 89 | 90 | -------------------------------------------------------------------------------- /docs/DeveloperGuide.txt: -------------------------------------------------------------------------------- 1 | 2 | Developer guide 3 | --------------- 4 | 5 | The software allows you to create elegant real-time communications 6 | applications without having to read the +1200 RFC documents behind it. As a 7 | library with a high-level API, the toolkit can be used to add voice, IM and 8 | Presence functionality to any network devices as long as Python/C 9 | environment is supported by such platform. 10 | 11 | The developer guide is available at: 12 | 13 | http://sipsimpleclient.org/projects/sipsimpleclient/wiki/SipMiddlewareApi 14 | 15 | -------------------------------------------------------------------------------- /docs/Install.debian: -------------------------------------------------------------------------------- 1 | 2 | SIP SIMPLE SDK installation on Debian 3 | ------------------------------------- 4 | 5 | Home page: http://sipsimpleclient.org 6 | 7 | This document describes the installation procedure on Debian operating 8 | systems from the official public repository maintained by AG Projects. 9 | 10 | 11 | Configure Repository 12 | -------------------- 13 | 14 | See https://packages.ag-projects.com 15 | 16 | Update the list of available packages: 17 | 18 | sudo apt-get update 19 | 20 | Install SIP SIMPLE SDK: 21 | 22 | sudo apt-get install python3-sipsimple 23 | 24 | 25 | Install the Command Line Clients: 26 | 27 | sudo apt-get install sipclients3 28 | 29 | 30 | Creating Debian Packages 31 | ------------------------ 32 | 33 | Install the building dependencies: 34 | 35 | sudo apt-get install cython cython-dbg python3-setuptools devscripts \ 36 | debhelper python3-all-dev python3-all-dbg libasound2-dev libssl-dev \ 37 | libsqlite3-dev dh-python 38 | 39 | For adding Video support: 40 | 41 | sudo apt-get install libv4l-dev libavcodec-dev libavformat-dev libavutil-dev \ 42 | libswscale-dev libswresample-dev libx264-dev libvpx-dev libavcodec-extra 43 | 44 | Note: do NOT use the Debian-Multimedia repositories. 45 | 46 | For Ubuntu variants: 47 | 48 | sudo apt-get install libv4l-dev libavcodec-dev libavformat-dev libavutil-dev \ 49 | libswscale-dev libswresample-dev libx264-dev libvpx-dev libavcodec-extra53 50 | 51 | Obtain the source code using darcs as described in Install.linux document. 52 | 53 | Create under each repository a clean distribution file: 54 | 55 | python3 setup.py sdist 56 | 57 | Go to the ./dist directory and untar the file created at the step above. 58 | 59 | Go to the newly created directory and type: 60 | 61 | debuild -us -uc 62 | 63 | The .deb and related files are built in the upper directory. 64 | 65 | -------------------------------------------------------------------------------- /docs/Install.linux: -------------------------------------------------------------------------------- 1 | 2 | SIP SIMPLE SDK installation on Linux 3 | ------------------------------------ 4 | 5 | http://sipsimpleclient.org 6 | 7 | 8 | This document described the installation procedure on Linux operating systems. 9 | 10 | 11 | Step 1. Prerequisites 12 | --------------------- 13 | 14 | Install the C compiling environment, Python3 and the development version 15 | for the following packages: 16 | 17 | * openssl 18 | * ffmpeg 19 | 20 | 21 | Step 2. Install system dependencies 22 | ----------------------------------- 23 | 24 | Fetch the dependencies using ./get_dependencies.sh script 25 | 26 | See Dependencies.txt for detailed description of the required libraries and 27 | their minimum version number. 28 | 29 | Use the appropriate package manager for your Linux distribution to install 30 | the following packages, notice the minimum version numbers. 31 | 32 | Using pip3 inside your user environment: 33 | 34 | pip3 install --user cython==0.29.37 dnspython lxml twisted python-dateutil \ 35 | greenlet zope.interface requests gmpy2 wheel gevent 36 | 37 | 38 | Step 3. Install AG Projects dependencies 39 | ---------------------------------------- 40 | 41 | - python3-application 42 | - python3-eventlib 43 | - python3-gnutls 44 | - python3-otr 45 | - python3-msrplib 46 | - python3-xcaplib 47 | 48 | For each of them, in the exact order as listed above, retrieve the packages 49 | using one of the following methods: 50 | 51 | Using darcs: 52 | 53 | darcs clone http://devel.ag-projects.com/repositories/PROJECT 54 | 55 | replace PROJECT with each of the names above 56 | 57 | Using git: 58 | 59 | git clone https://github.com/AGProjects/PROJECT 60 | 61 | replace PROJECT with each of the names above 62 | 63 | As tar archives from: 64 | 65 | http://download.ag-projects.com/SipSimpleSDK/Python3/ 66 | 67 | Install these packages by going into each directory. 68 | 69 | Install the software inside your user environment: 70 | 71 | pip3 install --user . 72 | 73 | Install system-wide using setup.py: 74 | 75 | sudo python3 setup.py install 76 | 77 | Build a debian package, check if makedeb.sh exists and run it for each project: 78 | 79 | ./makedeb.sh 80 | 81 | The debian package can be found inside ./dist folder 82 | 83 | Install the built debian package: 84 | 85 | sudo dpkg -i *.deb 86 | 87 | 88 | Step 4. Install SIP SIMPLE SDK 89 | ------------------------------ 90 | 91 | Using pip3 inside your user environment: 92 | 93 | pip3 install --user . 94 | 95 | System-wide using setup.py: 96 | 97 | sudo python3 setup.py install 98 | 99 | As a debian package: 100 | 101 | ./makedeb.sh 102 | 103 | The debian package can be found inside ./dist folder 104 | 105 | sudo dpkg -i *.deb 106 | 107 | 108 | Step 5. Testing SIP SIMPLE SDK 109 | ------------------------------ 110 | 111 | Use the command line tools provided by sipclients3 package. 112 | 113 | The executables start with sip- prefix. 114 | 115 | -------------------------------------------------------------------------------- /docs/Install.raspbian: -------------------------------------------------------------------------------- 1 | 2 | SIP SIMPLE client SDK installation on Raspbian 3 | ---------------------------------------------- 4 | 5 | Home page: http://sipsimpleclient.org 6 | 7 | This document describes the installation procedure on Raspbian Linux 8 | operating system on a Rasberry Pi (armhf architecture). 9 | 10 | 11 | Installation from AG Projects repository 12 | ---------------------------------------- 13 | 14 | Follow the instructions from https://packages.ag-projects.com 15 | 16 | 17 | Building the debian package 18 | --------------------------- 19 | 20 | Install building dependencies: 21 | 22 | ./get_dependencies.sh 2.10 23 | 24 | For arm64 architecture edit deps/pjsip/aconfigure and replace: 25 | 26 | ac_webrtc_instset=sse2 27 | 28 | with: 29 | 30 | ac_webrtc_instset=neon 31 | ac_webrtc_cflags="-DWEBRTC_ARCH_ARM64" 32 | 33 | Obtain the source code from AG Projects using darcs command: 34 | 35 | darcs get --set-scripts-executable http://devel.ag-projects.com/repositories/project 36 | 37 | For each of the projects listed bellow: 38 | 39 | * python3-application 40 | * python3-otr 41 | * python3-eventlib 42 | * python3-xcap 43 | * python3-msrp 44 | * python3-sipsimple (see WebRTC AEC note below) 45 | * sipclients3 46 | 47 | Enter the directory where each project has been downloaded and run: 48 | 49 | ./makedeb.sh 50 | 51 | The .deb and related files are built in dist or one of the upper directories. 52 | 53 | Use dpkg -i package_name.deb command to install the software. 54 | 55 | -------------------------------------------------------------------------------- /docs/Install.ubuntu: -------------------------------------------------------------------------------- 1 | 2 | SIP SIMPLE SDK installation on Ubuntu 3 | ------------------------------------- 4 | 5 | Home page: http://sipsimpleclient.org 6 | 7 | This document describes the installation procedure on Ubuntu operating 8 | systems from the official public repository maintained by AG Projects. 9 | 10 | 11 | Configure Repository 12 | -------------------- 13 | 14 | Install the AG Projects debian software signing key: 15 | 16 | wget http://download.ag-projects.com/agp-debian-gpg.key 17 | sudo apt-key add agp-debian-gpg.key 18 | 19 | Add the repository to /etc/apt/sources.list (run commands as root): 20 | 21 | echo "deb http://ag-projects.com/ubuntu `lsb_release -c -s` main" >> /etc/apt/sources.list 22 | echo "deb-src http://ag-projects.com/ubuntu `lsb_release -c -s` main" >> /etc/apt/sources.list 23 | 24 | 25 | Update the list of available packages: 26 | 27 | sudo apt-get update 28 | 29 | 30 | Install SIP SIMPLE client SDK: 31 | 32 | sudo apt-get install python-sipsimple 33 | 34 | 35 | Install the Command Line Clients: 36 | 37 | sudo apt-get install sipclients 38 | 39 | -------------------------------------------------------------------------------- /docs/TLS.txt: -------------------------------------------------------------------------------- 1 | Placeholder for TLS info. 2 | 3 | Mac 4 | --- 5 | 6 | Linux 7 | ----- 8 | 9 | Windows 10 | ------- 11 | 12 | -------------------------------------------------------------------------------- /get_dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | unamestr=$(uname) 4 | if [[ "$unamestr" == 'Linux' ]]; then 5 | sudo apt install python3 dh-python python3-all-dev cython3 libasound2-dev \ 6 | python3-dateutil python3-dnspython libssl-dev libv4l-dev libavcodec-dev \ 7 | libavformat-dev libopencore-amrnb-dev libopencore-amrwb-dev libavutil-dev \ 8 | libswscale-dev libx264-dev libvpx-dev libopus-dev libsqlite3-dev pkg-config \ 9 | uuid-dev cython3 cython3-dbg python3-setuptools devscripts debhelper dh-python \ 10 | python3-all-dev python3-all-dbg libasound2-dev libssl-dev libsqlite3-dev 11 | fi 12 | 13 | cd deps 14 | 15 | PJSIP_VERSION="${1:-2.10}" 16 | 17 | # 18 | # Update PJSIP 19 | # 20 | echo "Preparing PJSIP $PJSIP_VERSION sources..." 21 | if [ ! -f $PJSIP_VERSION.tar.gz ]; then 22 | echo Downloading PJSIP $PJSIP_VERSION... 23 | wget https://github.com/pjsip/pjproject/archive/$PJSIP_VERSION.tar.gz 24 | if [ $? -eq 0 ]; then 25 | echo "PJSIP downloaded" 26 | else 27 | echo Fail to download PJSIP 28 | exit 1 29 | fi 30 | fi 31 | 32 | tar xzf $PJSIP_VERSION.tar.gz 33 | 34 | if [ -d pjsip ]; then 35 | rm -r pjsip 36 | fi 37 | 38 | mkdir pjsip 39 | mv pjproject*/* ./pjsip/ 40 | 41 | # 42 | # Update ZSRTP 43 | # 44 | 45 | # Clone latest version from github 46 | if [ ! -d ZRTPCPP ]; then 47 | echo Downloading ZRTP... 48 | git clone https://github.com/wernerd/ZRTPCPP.git 49 | if [ $? -eq 0 ]; then 50 | echo "ZRTP downloaded" 51 | cd ZRTPCPP 52 | git checkout 6b3cd8e6783642292bad0c21e3e5e5ce45ff3e03 53 | cd .. 54 | else 55 | echo Fail to download ZRTP 56 | exit 1 57 | fi 58 | fi 59 | 60 | # Copy wrapper from old version to third_party/zsrtp/ 61 | echo "Preparing ZRTP sources..." 62 | mkdir ./pjsip/third_party/zsrtp 63 | cp -r zsrtp/include ./pjsip/third_party/zsrtp/ 64 | cp -r zsrtp/srtp ./pjsip/third_party/zsrtp/ 65 | cp -r zsrtp/build ./pjsip/third_party/build/zsrtp 66 | 67 | # Copy new version to third_party/zsrtp/ 68 | mkdir ./pjsip/third_party/zsrtp/zrtp 69 | cp -r ZRTPCPP/bnlib ./pjsip/third_party/zsrtp/zrtp/ 70 | cp -r ZRTPCPP/common ./pjsip/third_party/zsrtp/zrtp/ 71 | cp -r ZRTPCPP/cryptcommon ./pjsip/third_party/zsrtp/zrtp/ 72 | cp -r ZRTPCPP/srtp ./pjsip/third_party/zsrtp/zrtp/ 73 | cp -r ZRTPCPP/zrtp ./pjsip/third_party/zsrtp/zrtp/ 74 | cp ZRTPCPP/COPYING ./pjsip/third_party/zsrtp/zrtp/ 75 | cp ZRTPCPP/README.md ./pjsip/third_party/zsrtp/zrtp/ 76 | 77 | patches_dir="patches" 78 | 79 | if [ -d patches/$PJSIP_VERSION ];then 80 | patches_dir=patches/$PJSIP_VERSION 81 | fi 82 | 83 | uname -v|grep ARM64 |grep Darwin > /dev/null 84 | 85 | if [ $? -eq 0 ]; then 86 | rm $patches_dir/005_fix_ffmpeg.patch 2> /dev/null 87 | rm $patches_dir/007_video_support_dshow_mingw.patch 2> /dev/null 88 | rm $patches_dir/008_support_mingw_w64.patch 2> /dev/null 89 | fi 90 | 91 | for p in $patches_dir/0*.patch; do 92 | echo "Applying patch $p" 93 | patch -p0 < $p > /dev/null 94 | done 95 | 96 | cd - > /dev/null 97 | -------------------------------------------------------------------------------- /mac/01-install-build-env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | env python3 -V|grep -E "3.11|3.10|3.9" > /dev/null 3 | 4 | RESULT=$? 5 | if [ $RESULT -ne 0 ]; then 6 | echo 7 | echo "Please install Python 3.9, 3.10 or 3.11 from https://www.python.org/" 8 | echo 9 | exit 1 10 | fi 11 | 12 | which port > /dev/null 13 | RESULT=$? 14 | 15 | if [ $RESULT -ne 0 ]; then 16 | echo 17 | echo "Please install Mac Ports from https://www.macports.org" 18 | echo 19 | exit 1 20 | fi 21 | 22 | pip3 install --user virtualenv 23 | 24 | -------------------------------------------------------------------------------- /mac/02-install-c-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install C building dependencies 4 | echo "Installing port dependencies..." 5 | 6 | sudo port install yasm x264 gnutls openssl sqlite3 ffmpeg mpfr libmpc libvpx wget gmp mpc libuuid 7 | 8 | # This will conflict with buildin MacOS 9 | sudo mv /opt/local/include/uuid/uuid.h /opt/local/include/uuid/uuid.h.old 10 | 11 | RESULT=$? 12 | if [ $RESULT -ne 0 ]; then 13 | echo 14 | echo "Failed to install all C dependencies" 15 | echo 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /mac/03-install-python-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ ! -d ~/work ]; then 3 | mkdir ~/work 4 | fi 5 | 6 | arch=`python3 -c "import platform; print(platform.processor())"` 7 | pver=`python3 -c "import sys; print('%d.%d' % (sys.version_info[0], sys.version_info[1]))"` 8 | 9 | envdir=sipsimple-python-$pver-$arch-env 10 | 11 | if [ ! -d ~/work/$envdir ]; then 12 | mkdir ~/work/$envdir 13 | virtualenv -p /usr/local/bin/python3 ~/work/$envdir 14 | else 15 | echo "Environment exists in ~/work/$envdir" 16 | fi 17 | 18 | source activate_venv.sh 19 | 20 | export CFLAGS="-I/opt/local/include" 21 | export LDFLAGS="-L/opt/local/lib" 22 | 23 | pip3 install --upgrade pip 24 | pip3 install -r python-requirements.txt 25 | pip3 install -r sipsimple-requirements.txt 26 | -------------------------------------------------------------------------------- /mac/04-install_sipsimple.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | version="5.3.3.1-mac" 4 | wget https://github.com/AGProjects/python3-sipsimple/archive/refs/tags/$version.tar.gz 5 | 6 | tar zxvf $version.tar.gz 7 | rm $version.tar.gz 8 | 9 | source activate_venv.sh 10 | 11 | cd python3-sipsimple-$version 12 | 13 | echo "Installing SIP Simple SDK..." 14 | 15 | chmod +x ./get_dependencies* 16 | ./get_dependencies.sh 2.11 17 | 18 | if [ $? -ne 0 ]; then 19 | echo 20 | echo "Failed to install all SIP SIMPLE SDK dependencies" 21 | echo 22 | exit 1 23 | fi 24 | 25 | pip3 install . 26 | if [ $? -ne 0 ]; then 27 | echo 28 | echo "Failed to build SIP SIMPLE SDK" 29 | echo 30 | cd 31 | exit 1 32 | fi 33 | -------------------------------------------------------------------------------- /mac/05-install_sipclients.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source activate_venv.sh 3 | pip3 install https://github.com/AGProjects/sipclients3/archive/refs/tags/5.2.3.tar.gz 4 | -------------------------------------------------------------------------------- /mac/activate_venv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | arch=`python3 -c "import platform; print(platform.processor())"` 3 | pver=`python3 -c "import sys; print('%d.%d' % (sys.version_info[0], sys.version_info[1]))"` 4 | 5 | venv="$HOME/work/sipsimple-python-$pver-$arch-env" 6 | 7 | echo "Activating $venv..." 8 | 9 | if [[ "$0" = "$BASH_SOURCE" ]]; then 10 | echo "Needs to be run using source: . activate_venv.sh" 11 | 12 | else 13 | VENVPATH="$venv/bin/activate" 14 | source "$VENVPATH" 15 | fi 16 | -------------------------------------------------------------------------------- /mac/python-requirements.txt: -------------------------------------------------------------------------------- 1 | cython 2 | dnspython 3 | lxml 4 | twisted 5 | python-dateutil 6 | greenlet 7 | zope.interface 8 | requests 9 | gmpy2 10 | wheel 11 | gevent 12 | pytz 13 | certifi 14 | cryptography 15 | python3-application @ https://github.com/AGProjects/python3-application/archive/refs/tags/release-3.0.7.tar.gz 16 | -------------------------------------------------------------------------------- /mac/sipsimple-requirements.txt: -------------------------------------------------------------------------------- 1 | python3-eventlib @ https://github.com/AGProjects/python3-eventlib/archive/refs/tags/0.3.0.tar.gz 2 | python3-gnutls @ https://github.com/AGProjects/python3-gnutls/archive/refs/tags/release-3.1.10.tar.gz 3 | python3-otr @ https://github.com/AGProjects/python3-otr/archive/refs/tags/2.1.0.tar.gz 4 | python3-xcaplib @ https://github.com/AGProjects/python3-xcaplib/archive/refs/tags/2.0.1.tar.gz 5 | python3-msrplib @ https://github.com/AGProjects/python3-msrplib/archive/refs/tags/0.21.0.tar.gz 6 | -------------------------------------------------------------------------------- /makedeb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -f dist ]; then 3 | rm -r dist 4 | fi 5 | 6 | ./get_dependencies.sh 7 | 8 | sudo apt install equivs 9 | sudo mk-build-deps --install debian/control 10 | 11 | chmod +x deps/pjsip/configure 12 | chmod +x deps/pjsip/aconfigure 13 | 14 | python3 setup.py sdist 15 | 16 | cd dist 17 | tar zxvf *.tar.gz 18 | 19 | cd python3-sipsimple-?.?.? 20 | 21 | debuild --no-sign 22 | 23 | cd .. 24 | 25 | ls 26 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import glob 4 | import os 5 | from distutils.core import setup 6 | from distutils.extension import Extension 7 | 8 | from setup_pjsip import PJSIP_build_ext 9 | 10 | 11 | def find_packages(root): 12 | return [directory.replace(os.path.sep, '.') for directory, sub_dirs, files in os.walk(root) if '__init__.py' in files] 13 | 14 | 15 | class PackageInfo(object): 16 | def __init__(self, info_file): 17 | with open(info_file) as f: 18 | exec(f.read(), self.__dict__) 19 | self.__dict__.pop('__builtins__', None) 20 | 21 | def __getattribute__(self, name): # this is here to silence the IDE about missing attributes 22 | return super(PackageInfo, self).__getattribute__(name) 23 | 24 | 25 | package_info = PackageInfo(os.path.join('sipsimple', '__info__.py')) 26 | 27 | 28 | setup( 29 | name=package_info.__project__, 30 | version=package_info.__version__, 31 | 32 | description=package_info.__summary__, 33 | license=package_info.__license__, 34 | url=package_info.__webpage__, 35 | 36 | author=package_info.__author__, 37 | author_email=package_info.__email__, 38 | 39 | platforms=["Platform Independent"], 40 | classifiers=[ 41 | "Development Status :: 5 - Production/Stable", 42 | "Intended Audience :: Developers", 43 | "Intended Audience :: Telecommunications Industry", 44 | "License :: OSI Approved :: GNU General Public License (GPL)", 45 | "Operating System :: OS Independent", 46 | "Programming Language :: C", 47 | "Programming Language :: Cython", 48 | "Programming Language :: Python" 49 | ], 50 | 51 | packages=find_packages('sipsimple'), 52 | package_data={ 53 | 'sipsimple.payloads': ['xml-schemas/*'] 54 | }, 55 | 56 | ext_modules=[ 57 | Extension(name="sipsimple.core._core", sources=["sipsimple/core/_core.pyx"]), 58 | Extension(name="sipsimple.util._sha1", sources=["sipsimple/util/_sha1.pyx"], depends=["sipsimple/util/_sha1.h"]) 59 | ], 60 | 61 | cmdclass={ 62 | 'build_ext': PJSIP_build_ext 63 | }, 64 | 65 | provides=['sipsimple'] 66 | ) 67 | -------------------------------------------------------------------------------- /sipsimple/__info__.py: -------------------------------------------------------------------------------- 1 | 2 | """Package information""" 3 | 4 | __project__ = "python3-sipsimple" 5 | __summary__ = "SIP SIMPLE implementation for Python" 6 | __webpage__ = "https://sipsimpleclient.org" 7 | 8 | __version__ = "5.3.3" 9 | 10 | __author__ = "AG Projects" 11 | __email__ = "support@ag-projects.com" 12 | 13 | __license__ = "GPL" 14 | __copyright__ = "Copyright 2008-2025 {}".format(__author__) 15 | -------------------------------------------------------------------------------- /sipsimple/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from sipsimple.__info__ import __project__, __summary__, __webpage__, __version__, __author__, __email__, __license__, __copyright__ 3 | from sipsimple.logging import log # This will initialize and make our logger available early, before anything else is loaded 4 | -------------------------------------------------------------------------------- /sipsimple/account/xcap/storage/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | """Base definitions for concrete implementations of XCAP storage backends""" 3 | 4 | __all__ = ['IXCAPStorage', 'XCAPStorageError'] 5 | 6 | 7 | from zope.interface import Interface 8 | 9 | 10 | class XCAPStorageError(Exception): 11 | """Base error to be used by backends implementing IXCAPStorage.""" 12 | 13 | 14 | class IXCAPStorage(Interface): 15 | """Interface describing a storage backend for XCAP data.""" 16 | 17 | def load(name): 18 | """ 19 | Load and return the data corresponding to the given name by 20 | using whatever means employed by the backend implementation. 21 | """ 22 | 23 | def save(name, data): 24 | """ 25 | Store the data associated with name by using whatever means 26 | employed by the backend implementation. 27 | """ 28 | 29 | def delete(name): 30 | """Delete the data associated with name.""" 31 | 32 | def purge(): 33 | """Delete all the data stored by the backend.""" 34 | 35 | 36 | -------------------------------------------------------------------------------- /sipsimple/account/xcap/storage/memory.py: -------------------------------------------------------------------------------- 1 | 2 | """XCAP backend for storing data in memory""" 3 | 4 | __all__ = ["MemoryStorage"] 5 | 6 | from zope.interface import implementer 7 | from sipsimple.account.xcap.storage import IXCAPStorage, XCAPStorageError 8 | 9 | 10 | @implementer(IXCAPStorage) 11 | class MemoryStorage(object): 12 | """Implementation of an XCAP backend that stores data in memory""" 13 | 14 | 15 | def __init__(self, account_id): 16 | """Initialize the backend for the specified account ID""" 17 | self.account_id = account_id 18 | self.data = {} 19 | 20 | def load(self, name): 21 | """Return the data given by name""" 22 | try: 23 | return self.data[name] 24 | except KeyError: 25 | raise XCAPStorageError("missing entry: %s/%s" % (self.account_id, name)) 26 | 27 | def save(self, name, data): 28 | """Store the data under a key given by name""" 29 | self.data[name] = data 30 | 31 | def delete(self, name): 32 | """Delete the data identified by name""" 33 | self.data.pop(name, None) 34 | 35 | def purge(self): 36 | """Delete all the data that is stored in the backend""" 37 | self.data.clear() 38 | 39 | 40 | -------------------------------------------------------------------------------- /sipsimple/configuration/backend/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | """Base definitions for concrete implementations of configuration backends""" 3 | 4 | __all__ = ['ConfigurationBackendError', 'IConfigurationBackend'] 5 | 6 | 7 | from zope.interface import Interface 8 | 9 | 10 | class ConfigurationBackendError(Exception): 11 | """Base error for use by backends implementing IConfigurationBackend.""" 12 | 13 | 14 | class IConfigurationBackend(Interface): 15 | """ 16 | Interface describing a backend used for storing and retrieving configuration 17 | data. 18 | 19 | The data kept by the backend is a dictionary whose keys are unicode strings 20 | and values are one of four types: (a) a dictionary conforming to this 21 | definition; (b) a unicode string; (c) a list of unicode strings; (d) the 22 | value None. 23 | """ 24 | def load(): 25 | """ 26 | Load the configuration data using whatever means employed by the backend 27 | implementation and return a dictionary conforming to the definition in 28 | this interface. 29 | """ 30 | 31 | def save(data): 32 | """ 33 | Given a dictionary conforming to the definition in this interface, save 34 | the data using whatever means employed by the backend implementation. 35 | """ 36 | 37 | 38 | -------------------------------------------------------------------------------- /sipsimple/configuration/backend/memory.py: -------------------------------------------------------------------------------- 1 | 2 | """Configuration backend for storing settings in memory""" 3 | 4 | __all__ = ["MemoryBackend"] 5 | 6 | from zope.interface import implementer 7 | from sipsimple.configuration.backend import IConfigurationBackend 8 | 9 | 10 | @implementer(IConfigurationBackend) 11 | class MemoryBackend(object): 12 | """Implementation of a configuration backend that stores data in memory.""" 13 | 14 | 15 | def __init__(self): 16 | self.data = {} 17 | 18 | def load(self): 19 | return self.data 20 | 21 | def save(self, data): 22 | self.data = data 23 | 24 | 25 | -------------------------------------------------------------------------------- /sipsimple/core/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from sipsimple.core._core import * 3 | from sipsimple.core._engine import * 4 | from sipsimple.core._helpers import * 5 | from sipsimple.core._primitives import * 6 | 7 | required_revision = 210 8 | if CORE_REVISION != required_revision: 9 | raise ImportError("Wrong SIP core revision %d (expected %d)" % (CORE_REVISION, required_revision)) 10 | del required_revision 11 | 12 | 13 | -------------------------------------------------------------------------------- /sipsimple/core/_core.error.pxi: -------------------------------------------------------------------------------- 1 | 2 | 3 | class SIPCoreError(Exception): 4 | pass 5 | 6 | 7 | class PJSIPError(SIPCoreError): 8 | 9 | def __init__(self, message, status): 10 | self.status = status 11 | SIPCoreError.__init__(self, "%s: %s" % (message, _pj_status_to_str(status))) 12 | 13 | @property 14 | def errno(self): 15 | # PJ_STATUS - PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE*2 16 | return 0 if self.status == 0 else self.status - 120000 17 | 18 | 19 | class PJSIPTLSError(PJSIPError): 20 | pass 21 | 22 | 23 | class SIPCoreInvalidStateError(SIPCoreError): 24 | pass 25 | 26 | -------------------------------------------------------------------------------- /sipsimple/core/_core.pyx: -------------------------------------------------------------------------------- 1 | 2 | include "_core.error.pxi" 3 | include "_core.lib.pxi" 4 | include "_core.sound.pxi" 5 | include "_core.video.pxi" 6 | include "_core.util.pxi" 7 | 8 | include "_core.ua.pxi" 9 | 10 | include "_core.event.pxi" 11 | include "_core.request.pxi" 12 | include "_core.helper.pxi" 13 | include "_core.headers.pxi" 14 | include "_core.subscription.pxi" 15 | include "_core.invitation.pxi" 16 | include "_core.referral.pxi" 17 | include "_core.sdp.pxi" 18 | include "_core.mediatransport.pxi" 19 | 20 | import cython 21 | 22 | # constants 23 | 24 | PJ_VERSION = pj_get_version() 25 | PJ_SVN_REVISION = int(PJ_SVN_REV) 26 | CORE_REVISION = 210 27 | 28 | CYTHON_VERSION = cython.__version__ 29 | 30 | # exports 31 | 32 | __all__ = ["PJ_VERSION", "PJ_SVN_REVISION", "CORE_REVISION", "CYTHON_VERSION", 33 | "SIPCoreError", "PJSIPError", "PJSIPTLSError", "SIPCoreInvalidStateError", 34 | "AudioMixer", "ToneGenerator", "RecordingWaveFile", "WaveFile", "MixerPort", 35 | "VideoCamera", "FrameBufferVideoRenderer", 36 | "sip_status_messages", 37 | "BaseCredentials", "Credentials", "FrozenCredentials", "BaseSIPURI", "SIPURI", "FrozenSIPURI", 38 | "BaseHeader", "Header", "FrozenHeader", 39 | "BaseContactHeader", "ContactHeader", "FrozenContactHeader", 40 | "BaseContentTypeHeader", "ContentType", "ContentTypeHeader", "FrozenContentTypeHeader", 41 | "BaseIdentityHeader", "IdentityHeader", "FrozenIdentityHeader", "FromHeader", "FrozenFromHeader", "ToHeader", "FrozenToHeader", 42 | "RouteHeader", "FrozenRouteHeader", "RecordRouteHeader", "FrozenRecordRouteHeader", "BaseRetryAfterHeader", "RetryAfterHeader", "FrozenRetryAfterHeader", 43 | "BaseViaHeader", "ViaHeader", "FrozenViaHeader", "BaseWarningHeader", "WarningHeader", "FrozenWarningHeader", 44 | "BaseEventHeader", "EventHeader", "FrozenEventHeader", "BaseSubscriptionStateHeader", "SubscriptionStateHeader", "FrozenSubscriptionStateHeader", 45 | "BaseReasonHeader", "ReasonHeader", "FrozenReasonHeader", 46 | "BaseReferToHeader", "ReferToHeader", "FrozenReferToHeader", 47 | "BaseSubjectHeader", "SubjectHeader", "FrozenSubjectHeader", 48 | "BaseReplacesHeader", "ReplacesHeader", "FrozenReplacesHeader", 49 | "Request", 50 | "Referral", 51 | "sipfrag_re", 52 | "Subscription", 53 | "Invitation", 54 | "DialogID", 55 | "SDPSession", "FrozenSDPSession", "SDPMediaStream", "FrozenSDPMediaStream", "SDPConnection", "FrozenSDPConnection", "SDPAttribute", "FrozenSDPAttribute", "SDPNegotiator", 56 | "RTPTransport", "AudioTransport", "VideoTransport"] 57 | 58 | 59 | -------------------------------------------------------------------------------- /sipsimple/logging.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | from application import log 5 | 6 | # Use a named logger for sipsimple logging 7 | log = log.get_logger('sipsimple') 8 | -------------------------------------------------------------------------------- /sipsimple/payloads/cipid.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | CIPID handling according to RFC4482 4 | 5 | This module provides an extension to PIDF to provide additional contact 6 | information about a presentity. 7 | """ 8 | 9 | from sipsimple.payloads import XMLAnyURIElement, XMLLocalizedStringElement 10 | from sipsimple.payloads.pidf import PIDFDocument, ServiceExtension, PersonExtension, Service, Person 11 | 12 | __all__ = ['namespace', 'Card', 'DisplayName', 'Homepage', 'Icon', 'Map', 'Sound'] 13 | 14 | namespace = "urn:ietf:params:xml:ns:pidf:cipid" 15 | PIDFDocument.register_namespace(namespace, prefix='c', schema='cipid.xsd') 16 | 17 | 18 | class Card(XMLAnyURIElement, PersonExtension, ServiceExtension): 19 | _xml_tag = 'card' 20 | _xml_namespace = namespace 21 | _xml_document = PIDFDocument 22 | 23 | Person.register_extension('card', type=Card) 24 | Service.register_extension('card', type=Card) 25 | 26 | class DisplayName(XMLLocalizedStringElement, PersonExtension, ServiceExtension): 27 | _xml_tag = 'display-name' 28 | _xml_namespace = namespace 29 | _xml_document = PIDFDocument 30 | 31 | Person.register_extension('display_name', type=DisplayName) 32 | Service.register_extension('display_name', type=DisplayName) 33 | 34 | class Homepage(XMLAnyURIElement, PersonExtension, ServiceExtension): 35 | _xml_tag = 'homepage' 36 | _xml_namespace = namespace 37 | _xml_document = PIDFDocument 38 | 39 | Person.register_extension('homepage', type=Homepage) 40 | Service.register_extension('homepage', type=Homepage) 41 | 42 | class Icon(XMLAnyURIElement, PersonExtension, ServiceExtension): 43 | _xml_tag = 'icon' 44 | _xml_namespace = namespace 45 | _xml_document = PIDFDocument 46 | 47 | Person.register_extension('icon', type=Icon) 48 | Service.register_extension('icon', type=Icon) 49 | 50 | class Map(XMLAnyURIElement, PersonExtension, ServiceExtension): 51 | _xml_tag = 'map' 52 | _xml_namespace = namespace 53 | _xml_document = PIDFDocument 54 | 55 | Person.register_extension('map', type=Map) 56 | Service.register_extension('map', type=Map) 57 | 58 | class Sound(XMLAnyURIElement, PersonExtension, ServiceExtension): 59 | _xml_tag = 'sound' 60 | _xml_namespace = namespace 61 | _xml_document = PIDFDocument 62 | 63 | Person.register_extension('sound', type=Sound) 64 | Service.register_extension('sound', type=Sound) 65 | 66 | -------------------------------------------------------------------------------- /sipsimple/payloads/dialogrules.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Parses and produces Dialog Authorization Rules documents. As there is no 4 | RFC for this we'll use common-policy format (RFC 4745). 5 | 6 | NOTE: Subscription Handling has been taken from RFC 5025. 7 | """ 8 | 9 | 10 | __all__ = ['namespace', 'DialogRulesDocument', 'SubHandling', 'DialogRules'] 11 | 12 | 13 | from sipsimple.payloads import commonpolicy, omapolicy 14 | from sipsimple.payloads import XMLStringElement 15 | 16 | 17 | namespace = 'urn:ag-projects:xml:ns:dialog-rules' 18 | 19 | 20 | class DialogRulesDocument(commonpolicy.CommonPolicyDocument): pass 21 | DialogRulesDocument.register_namespace(namespace, prefix='dr', schema='dialog-rules.xsd') 22 | DialogRulesDocument.register_namespace(omapolicy.namespace, prefix='ocp', schema='oma-common-policy.xsd') 23 | DialogRulesDocument.register_element(omapolicy.AnonymousRequest) 24 | DialogRulesDocument.register_element(omapolicy.OtherIdentity) 25 | DialogRulesDocument.register_element(omapolicy.Entry) 26 | DialogRulesDocument.register_element(omapolicy.ExternalList) 27 | 28 | 29 | class SubHandlingValue(str): 30 | __prioritymap__ = {'block': 0, 'confirm': 10, 'polite-block': 20, 'allow': 30} 31 | 32 | def __new__(cls, value): 33 | if value not in cls.__prioritymap__: 34 | raise ValueError("illegal value for SubHandling element") 35 | return str.__new__(cls, value) 36 | 37 | @property 38 | def priority(self): 39 | return self.__prioritymap__[self] 40 | 41 | 42 | class SubHandling(XMLStringElement, commonpolicy.ActionElement): 43 | _xml_tag = 'sub-handling' 44 | _xml_namespace = namespace 45 | _xml_document = DialogRulesDocument 46 | _xml_value_type = SubHandlingValue 47 | 48 | 49 | class DialogRules(commonpolicy.RuleSet): 50 | _xml_document = DialogRulesDocument 51 | 52 | -------------------------------------------------------------------------------- /sipsimple/payloads/directory.py: -------------------------------------------------------------------------------- 1 | 2 | """Parses xcap-directory messages according to OMA TS XDM Core 1.1""" 3 | 4 | 5 | __all__ = ['namespace', 'XCAPDirectoryDocument', 'Folder', 'Entry', 'ErrorCode'] 6 | 7 | 8 | from sipsimple.payloads import XMLDocument, XMLListRootElement, XMLStringElement, XMLListElement, XMLAttribute, XMLElementChild 9 | from sipsimple.payloads.datatypes import DateTime, AnyURI 10 | 11 | 12 | namespace = 'urn:oma:xml:xdm:xcap-directory' 13 | 14 | 15 | class XCAPDirectoryDocument(XMLDocument): 16 | content_type = "application/vnd.oma.xcap-directory+xml" 17 | 18 | XCAPDirectoryDocument.register_namespace(namespace, prefix=None, schema='xcap-directory.xsd') 19 | 20 | 21 | # Attribute value types 22 | class SizeValue(int): 23 | def __new__(cls, value): 24 | value = int.__new__(cls, value) 25 | if value <= 0: 26 | raise ValueError("illegal value for size") 27 | return value 28 | 29 | 30 | # Elements 31 | class Entry(XMLStringElement): 32 | _xml_tag = 'entry' 33 | _xml_namespace = namespace 34 | _xml_document = XCAPDirectoryDocument 35 | 36 | uri = XMLAttribute('uri', type=AnyURI, required=True, test_equal=True) 37 | etag = XMLAttribute('etag', type=str, required=True, test_equal=True) 38 | last_modified = XMLAttribute('last_modified', xmlname='last-modified', type=DateTime, required=False, test_equal=True) 39 | size = XMLAttribute('size', type=SizeValue, required=False, test_equal=True) 40 | 41 | class ErrorCode(XMLStringElement): 42 | _xml_tag = 'error-code' 43 | _xml_namespace = namespace 44 | _xml_document = XCAPDirectoryDocument 45 | 46 | class Folder(XMLListElement): 47 | _xml_tag = 'folder' 48 | _xml_namespace = namespace 49 | _xml_document = XCAPDirectoryDocument 50 | _xml_item_type = Entry 51 | 52 | auid = XMLAttribute('auid', type=str, required=True, test_equal=True) 53 | error_code = XMLElementChild('error_code', type=ErrorCode, required=False, test_equal=True, onset=lambda self, descriptor, value: self.clear() if value is not None else None) 54 | 55 | def __init__(self, auid, entries=[], error_code=None): 56 | if error_code is not None and entries: 57 | raise ValueError("Cannot set both an error code and add entries at the same time") 58 | XMLListElement.__init__(self) 59 | self.auid = auid 60 | self.error_code = error_code 61 | self.update(entries) 62 | 63 | def add(self, entry): 64 | if self.error_code is not None: 65 | raise ValueError("Cannot add an entry when error_code is set") 66 | super(Folder, self).add(entry) 67 | 68 | 69 | class XCAPDirectory(XMLListRootElement): 70 | _xml_tag = 'xcap-directory' 71 | _xml_namespace = namespace 72 | _xml_document = XCAPDirectoryDocument 73 | _xml_item_type = Folder 74 | 75 | def __init__(self, folders=[]): 76 | XMLListRootElement.__init__(self) 77 | self.update(folders) 78 | 79 | 80 | -------------------------------------------------------------------------------- /sipsimple/payloads/iscomposing.py: -------------------------------------------------------------------------------- 1 | 2 | """Parses and produces isComposing messages according to RFC3994.""" 3 | 4 | 5 | __all__ = ['namespace', 'IsComposingDocument', 'State', 'LastActive', 'ContentType', 'Refresh', 'IsComposingMessage'] 6 | 7 | 8 | from sipsimple.payloads import XMLDocument, XMLRootElement, XMLStringElement, XMLPositiveIntegerElement, XMLDateTimeElement, XMLElementChild 9 | 10 | 11 | namespace = 'urn:ietf:params:xml:ns:im-iscomposing' 12 | 13 | 14 | class IsComposingDocument(XMLDocument): 15 | content_type = "application/im-iscomposing+xml" 16 | 17 | IsComposingDocument.register_namespace(namespace, prefix=None, schema='im-iscomposing.xsd') 18 | 19 | 20 | # Attribute value types 21 | class StateValue(str): 22 | def __new__(cls, value): 23 | if value not in ('active', 'idle'): 24 | value = 'idle' 25 | return str.__new__(cls, value) 26 | 27 | 28 | # Elements 29 | class State(XMLStringElement): 30 | _xml_tag = 'state' 31 | _xml_namespace = namespace 32 | _xml_document = IsComposingDocument 33 | _xml_value_type = StateValue 34 | 35 | 36 | class LastActive(XMLDateTimeElement): 37 | _xml_tag = 'lastactive' 38 | _xml_namespace = namespace 39 | _xml_document = IsComposingDocument 40 | 41 | 42 | class ContentType(XMLStringElement): 43 | _xml_tag = 'contenttype' 44 | _xml_namespace = namespace 45 | _xml_document = IsComposingDocument 46 | 47 | 48 | class Refresh(XMLPositiveIntegerElement): 49 | _xml_tag = 'refresh' 50 | _xml_namespace = namespace 51 | _xml_document = IsComposingDocument 52 | 53 | 54 | class IsComposingMessage(XMLRootElement): 55 | _xml_tag = 'isComposing' 56 | _xml_namespace = namespace 57 | _xml_document = IsComposingDocument 58 | _xml_children_order = {State.qname: 0, 59 | LastActive.qname: 1, 60 | ContentType.qname: 2, 61 | Refresh.qname: 3, 62 | None: 4} 63 | 64 | state = XMLElementChild('state', type=State, required=True, test_equal=True) 65 | last_active = XMLElementChild('last_active', type=LastActive, required=False, test_equal=True) 66 | content_type = XMLElementChild('content_type', type=ContentType, required=False, test_equal=True) 67 | refresh = XMLElementChild('refresh', type=Refresh, required=False, test_equal=True) 68 | 69 | def __init__(self, state=None, last_active=None, content_type=None, refresh=None): 70 | XMLRootElement.__init__(self) 71 | self.state = state 72 | self.last_active = last_active 73 | self.content_type = content_type 74 | self.refresh = refresh 75 | 76 | -------------------------------------------------------------------------------- /sipsimple/payloads/messagesummary.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Message summary and Message Waiting Indication handling according to RFC3842 4 | """ 5 | 6 | import re 7 | 8 | from io import StringIO 9 | from application.configuration.datatypes import Boolean 10 | 11 | from sipsimple.payloads import ValidationError 12 | 13 | 14 | class MessageSummary(object): 15 | content_type = "application/simple-message-summary" 16 | 17 | def __init__(self, messages_waiting=False, message_account=None, summaries=None, optional_headers=None): 18 | self.messages_waiting = messages_waiting 19 | self.message_account = message_account 20 | self.summaries = summaries if summaries is not None else {} 21 | self.optional_headers = optional_headers if optional_headers is not None else [] 22 | 23 | @classmethod 24 | def parse(cls, content): 25 | content = content.decode() if isinstance(content, bytes) else content 26 | message = StringIO(content) 27 | summary = cls() 28 | tmp_headers = [] 29 | for line in message: 30 | if line == '\r\n': 31 | if tmp_headers: 32 | summary.optional_headers.append(tmp_headers) 33 | tmp_headers = [] 34 | else: 35 | field, sep, rest = line.partition(':') 36 | if not field and not rest: 37 | raise ValidationError("incorrect line format") 38 | field = field.strip() 39 | rest = rest.strip() 40 | 41 | if field.lower() == "messages-waiting": 42 | summary.messages_waiting = Boolean(rest) 43 | elif field.lower() == "message-account": 44 | summary.message_account = rest 45 | elif field.lower() in {"voice-message", "fax-message", "pager-message", "multimedia-message", "text-message", "none"}: 46 | m = re.match(r"((\d+)/(\d+))( \((\d+)/(\d+)\))?", rest) 47 | if m: 48 | summary.summaries[field.lower()] = dict(new_messages=m.groups()[1], old_messages=m.groups()[2], new_urgent_messages=m.groups()[4] or 0, old_urgent_messages=m.groups()[5] or 0) 49 | else: 50 | raise ValidationError("invalid message context class") 51 | else: 52 | tmp_headers.append(line.strip()) 53 | if tmp_headers: 54 | summary.optional_headers.append(tmp_headers) 55 | tmp_headers = [] 56 | return summary 57 | 58 | def to_string(self): 59 | data = "Messages-Waiting: %s\r\n" % 'yes' if self.messages_waiting else 'no' 60 | if self.message_account: 61 | data += "Message-Account: %s\r\n" % self.message_account 62 | if self.summaries: 63 | for k, v in list(self.summaries.items()): 64 | data += "%s: %s/%s (%s/%s)\r\n" % (k.title(), v['new_messages'], v['old_messages'], v['new_urgent_messages'], v['old_urgent_messages']) 65 | if self.optional_headers: 66 | data += "\r\n" 67 | for headers in self.optional_headers: 68 | for h in headers: 69 | data += "%s\r\n" % h 70 | data += "\r\n" 71 | return data 72 | 73 | -------------------------------------------------------------------------------- /sipsimple/payloads/omapolicy.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Conditions extension handling according to OMA-TS-Presence_SIMPLE_XDM-V1_1 4 | 5 | This module provides an extension to RFC4745 (Common Policy) to 6 | support condition extensions defined by OMA. 7 | """ 8 | 9 | 10 | __all__ = ['namespace', 'OtherIdentity', 'ExternalList', 'AnonymousRequest'] 11 | 12 | 13 | from sipsimple.payloads import XMLElement, XMLEmptyElement, XMLListElement, XMLElementID 14 | from sipsimple.payloads.datatypes import AnyURI 15 | from sipsimple.payloads.commonpolicy import ConditionElement 16 | from sipsimple.payloads.presrules import PresRulesDocument 17 | 18 | 19 | namespace = 'urn:oma:xml:xdm:common-policy' 20 | PresRulesDocument.register_namespace(namespace, prefix='ocp', schema='oma-common-policy.xsd') 21 | 22 | 23 | class OtherIdentity(XMLEmptyElement, ConditionElement): 24 | _xml_tag = 'other-identity' 25 | _xml_namespace = namespace 26 | _xml_document = PresRulesDocument 27 | 28 | 29 | class Entry(XMLElement): 30 | _xml_tag = 'entry' 31 | _xml_namespace = namespace 32 | _xml_document = PresRulesDocument 33 | 34 | uri = XMLElementID('uri', xmlname='anc', type=AnyURI, required=True, test_equal=True) 35 | 36 | def __init__(self, uri): 37 | XMLElement.__init__(self) 38 | self.uri = uri 39 | 40 | def __unicode__(self): 41 | return self.uri 42 | 43 | def __str__(self): 44 | return str(self.uri) 45 | 46 | 47 | class ExternalList(XMLListElement, ConditionElement): 48 | _xml_tag = 'external-list' 49 | _xml_namespace = namespace 50 | _xml_document = PresRulesDocument 51 | _xml_item_type = Entry 52 | 53 | def __init__(self, entries=[]): 54 | XMLListElement.__init__(self) 55 | self.update(entries) 56 | 57 | def __iter__(self): 58 | return (str(item) for item in super(ExternalList, self).__iter__()) 59 | 60 | def __repr__(self): 61 | return '%s(%r)' % (self.__class__.__name__, list(self)) 62 | 63 | def add(self, item): 64 | if isinstance(item, str): 65 | item = Entry(item) 66 | super(ExternalList, self).add(item) 67 | 68 | def remove(self, item): 69 | if isinstance(item, str): 70 | try: 71 | item = next((entry for entry in super(ExternalList, self).__iter__() if entry == item)) 72 | except StopIteration: 73 | raise KeyError(item) 74 | super(ExternalList, self).remove(item) 75 | 76 | 77 | class AnonymousRequest(XMLEmptyElement, ConditionElement): 78 | _xml_tag = 'anonymous-request' 79 | _xml_namespace = namespace 80 | _xml_document = PresRulesDocument 81 | 82 | -------------------------------------------------------------------------------- /sipsimple/payloads/prescontent.py: -------------------------------------------------------------------------------- 1 | 2 | """Generates presence content application documents according to OMA TS Presence SIMPLE Content""" 3 | 4 | 5 | __all__ = ['namespace', 'PresenceContentDocument', 'MIMEType', 'Encoding', 'Description', 'Data', 'PresenceContent'] 6 | 7 | 8 | from sipsimple.payloads import XMLDocument, XMLRootElement, XMLStringElement, XMLLocalizedStringElement, XMLElementChild 9 | 10 | 11 | namespace = 'urn:oma:xml:prs:pres-content' 12 | 13 | 14 | class PresenceContentDocument(XMLDocument): 15 | content_type = "application/vnd.oma.pres-content+xml" 16 | 17 | PresenceContentDocument.register_namespace(namespace, prefix=None, schema='oma-pres-content.xsd') 18 | 19 | # Elements 20 | class MIMEType(XMLStringElement): 21 | _xml_tag = 'mime-type' 22 | _xml_namespace = namespace 23 | _xml_document = PresenceContentDocument 24 | 25 | 26 | class Encoding(XMLStringElement): 27 | _xml_tag = 'encoding' 28 | _xml_namespace = namespace 29 | _xml_document = PresenceContentDocument 30 | 31 | 32 | class Description(XMLLocalizedStringElement): 33 | _xml_tag = 'description' 34 | _xml_namespace = namespace 35 | _xml_document = PresenceContentDocument 36 | 37 | 38 | class Data(XMLStringElement): 39 | _xml_tag = 'data' 40 | _xml_namespace = namespace 41 | _xml_document = PresenceContentDocument 42 | 43 | 44 | class PresenceContent(XMLRootElement): 45 | _xml_tag = 'content' 46 | _xml_namespace = namespace 47 | _xml_document = PresenceContentDocument 48 | _xml_children_order = {MIMEType.qname: 0, 49 | Encoding.qname: 1, 50 | Description.qname: 2, 51 | Data.qname: 3, 52 | None: 4} 53 | 54 | mime_type = XMLElementChild('mime_type', type=MIMEType, required=False, test_equal=True) 55 | encoding = XMLElementChild('encoding', type=Encoding, required=False, test_equal=True) 56 | description = XMLElementChild('description', type=Description, required=False, test_equal=True) 57 | data = XMLElementChild('data', type=Data, required=True, test_equal=True) 58 | 59 | def __init__(self, data, mime_type=None, encoding=None, description=None): 60 | XMLRootElement.__init__(self) 61 | self.data = data 62 | self.mime_type = mime_type 63 | self.encoding = encoding 64 | self.description = description 65 | 66 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/addressbook.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/cipid.xsd: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | Describes CIPID tuple extensions for PIDF. 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/common-schema.xsd: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | Timestamp type 10 | 11 | 12 | 13 | 14 | 15 | 16 | Device ID, a URN 17 | 18 | 19 | 20 | 21 | 22 | 23 | Note type 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/data-model.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | Device ID, a URN 12 | 13 | 14 | 15 | 16 | 17 | 18 | Contains information about the device 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Contains information about the human user 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | Characteristic and status information 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/dialog-rules.xsd: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/im-iscomposing.xsd: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/oma-pres-content.xsd: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/pidf.xsd: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | This attribute may be used on any element within an optional 75 | PIDF extension to indicate that the corresponding element must 76 | be understood by the PIDF processor if the enclosing optional 77 | element is to be handled. 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/rcs-fthttp-ext.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/rcs-fthttp.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/resourcelists.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/rlmi.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/rlsservices.xsd: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/xcap-caps.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | Root element for xcap-caps 10 | 11 | 12 | 13 | 14 | 15 | List of supported AUID. 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | List of supported extensions. 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | List of supported namespaces. 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | AUID Type 51 | 52 | 53 | 54 | 55 | 56 | 57 | Extension Type 58 | 59 | 60 | 61 | 62 | 63 | 64 | Namespace type 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /sipsimple/payloads/xml-schemas/xcap-directory.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /sipsimple/storage.py: -------------------------------------------------------------------------------- 1 | 2 | """Definitions and implementations of storage backends""" 3 | 4 | __all__ = ['ISIPSimpleStorage', 'ISIPSimpleApplicationDataStorage', 'FileStorage', 'MemoryStorage'] 5 | 6 | import os 7 | 8 | from functools import partial 9 | from zope.interface import Attribute, Interface, implementer 10 | 11 | from sipsimple.account.xcap.storage.file import FileStorage as XCAPFileStorage 12 | from sipsimple.account.xcap.storage.memory import MemoryStorage as XCAPMemoryStorage 13 | from sipsimple.configuration.backend.file import FileBackend as ConfigurationFileBackend 14 | from sipsimple.configuration.backend.memory import MemoryBackend as ConfigurationMemoryBackend 15 | 16 | 17 | class ISIPSimpleStorage(Interface): 18 | """Interface describing the backends used for storage throughout SIP Simple""" 19 | 20 | configuration_backend = Attribute("The backend used for the configuration") 21 | xcap_storage_factory = Attribute("The factory used to create XCAP storage backends for each account") 22 | 23 | 24 | class ISIPSimpleApplicationDataStorage(Interface): 25 | """Interface describing the directory used for application data storage """ 26 | 27 | directory = Attribute("The directory used for application data") 28 | 29 | 30 | @implementer(ISIPSimpleStorage, ISIPSimpleApplicationDataStorage) 31 | class FileStorage(object): 32 | """Store/read SIP Simple data to/from files""" 33 | 34 | 35 | def __init__(self, directory): 36 | self.configuration_backend = ConfigurationFileBackend(os.path.join(directory, 'config')) 37 | self.xcap_storage_factory = partial(XCAPFileStorage, os.path.join(directory, 'xcap')) 38 | self.directory = directory 39 | 40 | 41 | @implementer(ISIPSimpleStorage) 42 | class MemoryStorage(object): 43 | """Store/read SIP Simple data to/from memory""" 44 | 45 | 46 | def __init__(self): 47 | self.configuration_backend = ConfigurationMemoryBackend() 48 | self.xcap_storage_factory = XCAPMemoryStorage 49 | 50 | 51 | -------------------------------------------------------------------------------- /sipsimple/util/_sha1.pyx: -------------------------------------------------------------------------------- 1 | # cython: language_level=3 2 | 3 | __all__ = ['sha1'] 4 | 5 | 6 | from libc.stddef cimport size_t 7 | from libc.stdint cimport uint8_t, uint32_t, uint64_t 8 | from libc.string cimport memcpy 9 | from cpython.buffer cimport PyObject_CheckBuffer, PyObject_GetBuffer, PyBuffer_Release 10 | from cpython.bytes cimport PyBytes_FromStringAndSize, PyBytes_AsString 11 | from cpython.unicode cimport PyUnicode_Check 12 | 13 | 14 | cdef extern from "_sha1.h": 15 | enum: 16 | SHA1_BLOCK_SIZE = 64 17 | SHA1_DIGEST_SIZE = 20 18 | 19 | ctypedef struct sha1_context: 20 | uint32_t state[(SHA1_DIGEST_SIZE/4)] # state variables 21 | uint64_t count # 64-bit block count 22 | uint8_t block[SHA1_BLOCK_SIZE] # data block buffer 23 | uint32_t index # index into buffer 24 | 25 | cdef void sha1_init(sha1_context *context) 26 | cdef void sha1_update(sha1_context *context, const uint8_t *data, size_t length) 27 | cdef void sha1_digest(sha1_context *context, uint8_t *digest) 28 | 29 | 30 | cdef class sha1(object): 31 | cdef sha1_context context 32 | 33 | def __cinit__(self, *args, **kw): 34 | sha1_init(&self.context) 35 | 36 | def __init__(self, data=b''): 37 | self.update(data) 38 | 39 | property name: 40 | def __get__(self): 41 | return 'sha1' 42 | 43 | property block_size: 44 | def __get__(self): 45 | return SHA1_BLOCK_SIZE 46 | 47 | property digest_size: 48 | def __get__(self): 49 | return SHA1_DIGEST_SIZE 50 | 51 | def __reduce__(self): 52 | state_variables = [self.context.state[i] for i in range(sizeof(self.context.state)//4)] 53 | block = PyBytes_FromStringAndSize(self.context.block, self.context.index) 54 | return self.__class__, (), (state_variables, self.context.count, block) 55 | 56 | def __setstate__(self, state): 57 | state_variables, count, block = state 58 | for i, number in enumerate(state_variables): 59 | self.context.state[i] = number 60 | self.context.count = count 61 | self.context.index = len(block) 62 | memcpy(self.context.block, PyBytes_AsString(block), self.context.index) 63 | 64 | def copy(self): 65 | cdef sha1 instance = self.__class__() 66 | instance.context = self.context 67 | return instance 68 | 69 | def update(self, data): 70 | cdef Py_buffer view 71 | 72 | if PyObject_CheckBuffer(data): 73 | PyObject_GetBuffer(data, &view, 0) 74 | if view.ndim > 1: 75 | raise BufferError('Buffer must be single dimension') 76 | sha1_update(&self.context, view.buf, view.len) 77 | PyBuffer_Release(&view) 78 | elif PyUnicode_Check(data): 79 | raise TypeError('Unicode-objects must be encoded before hashing') 80 | else: 81 | raise TypeError('object supporting the buffer API required') 82 | 83 | def digest(self): 84 | cdef sha1_context context_copy 85 | cdef uint8_t digest[SHA1_DIGEST_SIZE] 86 | 87 | context_copy = self.context 88 | sha1_digest(&context_copy, digest) 89 | return PyBytes_FromStringAndSize(digest, SHA1_DIGEST_SIZE) 90 | 91 | def hexdigest(self): 92 | return self.digest().hex() 93 | 94 | -------------------------------------------------------------------------------- /sipsimple/video.py: -------------------------------------------------------------------------------- 1 | 2 | """Video support""" 3 | 4 | 5 | 6 | __all__ = ['IVideoProducer', 'VideoDevice', 'VideoError'] 7 | 8 | from application.notification import NotificationCenter, NotificationData 9 | from zope.interface import Attribute, Interface, implementer 10 | 11 | from sipsimple.core import SIPCoreError, VideoCamera 12 | 13 | 14 | class IVideoProducer(Interface): 15 | """ 16 | Interface describing an object which can produce video data. 17 | All attributes of this interface are read-only. 18 | """ 19 | 20 | producer = Attribute("The core producer object which can be connected to a consumer") 21 | 22 | 23 | class VideoError(Exception): 24 | pass 25 | 26 | 27 | @implementer(IVideoProducer) 28 | class VideoDevice(object): 29 | 30 | def __init__(self, device_name, resolution, framerate): 31 | self._camera = self._open_camera(device_name, resolution, framerate) 32 | self._camera.start() 33 | 34 | def _open_camera(self, device_name, resolution, framerate): 35 | try: 36 | return VideoCamera(device_name, resolution, framerate) 37 | except SIPCoreError: 38 | try: 39 | return VideoCamera('system_default', resolution, framerate) 40 | except SIPCoreError: 41 | return VideoCamera(None, resolution, framerate) 42 | 43 | def set_camera(self, device_name, resolution, framerate): 44 | old_camera = self._camera 45 | old_camera.close() 46 | new_camera = self._open_camera(device_name, resolution, framerate) 47 | if not self.muted: 48 | new_camera.start() 49 | self._camera = new_camera 50 | notification_center = NotificationCenter() 51 | notification_center.post_notification('VideoDeviceDidChangeCamera', sender=self, data=NotificationData(old_camera=old_camera, new_camera=new_camera)) 52 | 53 | @property 54 | def producer(self): 55 | return self._camera 56 | 57 | @property 58 | def name(self): 59 | return self._camera.name 60 | 61 | @property 62 | def real_name(self): 63 | return self._camera.real_name 64 | 65 | @property 66 | def muted(self): 67 | return self.__dict__.get('muted', False) 68 | 69 | @muted.setter 70 | def muted(self, value): 71 | if not isinstance(value, bool): 72 | raise ValueError('illegal value for muted property: %r' % (value,)) 73 | if value == self.muted: 74 | return 75 | if value: 76 | self._camera.stop() 77 | else: 78 | self._camera.start() 79 | self.__dict__['muted'] = value 80 | --------------------------------------------------------------------------------