diff --git a/.gitignore b/.gitignore index 5b033ca6267d9b62e4564c0558c9e80325e08b2e..9bc9b148178fbfd64027a6bd293032c1eacd3d4d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,6 @@ config.guess config.* depcomp install-sh -INSTALL missing stamp-h1 ltmain.sh diff --git a/AUTHORS b/AUTHORS index ba49877300c52895aee036fee2e96c75fec83416..e57ef475a1329aaef72989941d7a1be71872de44 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,20 +1,23 @@ Current authors --------------- -Guillaume Roguez <guillaume dot roguez at savoirfairelinux dot com> - Adrien Béraud <adrien dot beraud at savoirfairelinux dot com> - -Emmanuel Lepage <emmanuel dot lepage at savoirfairelinux dot com> - Alexandre Lision <alexandre dot lision at savoirfairelinux dot com> - +Guillaume Roguez <guillaume dot roguez at savoirfairelinux dot com> +Edric Milaret <edric dot ladent-milaret at savoirfairelinux dot com> +Eloi BAIL <eloi dot bail at savoirfairelinux dot com> +Emmanuel Lepage <emmanuel dot lepage at savoirfairelinux dot com> Stepan Salenikovich <stepan dot salenikovich at savoirfairelinux dot com> Former authors -------------- +Philippe Groarke <philippe.groarke@savoirfairelinux.com> + - audio fixes + - windows port startup + Tristan Matthews <tristan dot matthews at savoirfairelinux dot com> + - Many portions of code Emmanuel Milou <emmanuel dot milou at savoirfairelinux dot com> - ALSA implementation ( replaces portaudio ) @@ -38,22 +41,22 @@ Guillaume Carmel-Archambault <guillaume.carmel-archambault at savoirfairelinux d - Contacts Yun Liu <yun.liu at savoirfairelinux dot com> - Change sip library to pjsip - - Support multiple accounts registration - - Add chinese translation - - Many portions of test and debugging + - Support multiple accounts registration + - Add chinese translation + - Many portions of test and debugging Polytechnic School of Montreal: - - Jean-Francois Blanchard-Dionne <jean-francois.blanchard-dionne at polymtl dot ca> - - Ala Eddine Limame <ala-eddine.limame at polymtl dot ca> - - Alexis S. Bourrelle <bourrelle at polymtl dot ca> - - Marilyne Mercier <marilyne.mercier at polymtl dot ca> - - Jean Tessier <jean.tessier at polymtl dot ca> + - Jean-Francois Blanchard-Dionne <jean-francois.blanchard-dionne at polymtl dot ca> + - Ala Eddine Limame <ala-eddine.limame at polymtl dot ca> + - Alexis S. Bourrelle <bourrelle at polymtl dot ca> + - Marilyne Mercier <marilyne.mercier at polymtl dot ca> + - Jean Tessier <jean.tessier at polymtl dot ca> - Video layer implementation - Video conference Pierre-Luc Beaudoin <pierre-luc.beaudoin at savoirfairelinux dot com> - - Many portions of code - - GTK client implementation + - Many portions of code + - GTK client implementation Yan Morin <yan dot morin at savoirfairelinux dot com> - zeroconf integration diff --git a/CODING b/CODING index 1ac0af8923237457abe3167ebfc03067a55edc63..696968e5de84a9019924a6b233813bb65a6c3a14 100644 --- a/CODING +++ b/CODING @@ -1,13 +1,12 @@ = Coding standards = Please follow our coding standards when developing -http://projects.savoirfairelinux.net/wiki/sflphone/Coding_Standards - +http://projects.savoirfairelinux.com/projects/ring-daemon/wiki/Daemon_Coding_Rules = Gerrit workflow = We are now using Gerrit as a code review tool. -Wiki documentation: https://projects.savoirfairelinux.com/projects/ring/wiki/WorkingWithGerrit +Wiki documentation: http://projects.savoirfairelinux.com/projects/ring/wiki/WorkingWithGerrit == commit messages == @@ -16,7 +15,7 @@ Use Issue: followed by the ticket number == commit-msg hook == You may want to install the commit-msg hook that inserts a Change-Id on commit messages: -$ gitdir=$(git rev-parse --git-dir); scp -p -P 29420 username@gerrit-sflphone.savoirfairelinux.com:hooks/commit-msg ${gitdir}/hooks/ +$ gitdir=$(git rev-parse --git-dir); scp -p -P 29420 username@gerrit-ring.savoirfairelinux.com:hooks/commit-msg ${gitdir}/hooks/ Other documentation source: diff --git a/ChangeLog b/ChangeLog index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..642e3492c5f75c1c0648f9258a693f779c35bf2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -0,0 +1,4 @@ +2.0.0 (2015-03-31) +------------------ + +First DRing release (formely SFLPhone - released as 1.4.1) diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000000000000000000000000000000000000..007e9396d0a2492cd2d6e17d42f359655dfe0b5e --- /dev/null +++ b/INSTALL @@ -0,0 +1,370 @@ +Installation Instructions +************************* + +Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, +Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `<wchar.h>' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf limitation. Until the limitation is lifted, you can use +this workaround: + + CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. diff --git a/Makefile.am b/Makefile.am index ceac6d1d950143d06648b40eb425aa2bac203dfb..939db31e1d55e167a55d70579608444b376f082a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,13 +37,13 @@ EXTRA_DIST = m4/libtool.m4 \ contrib/src coverage: - $(AM_V_at)lcov --directory $(top_builddir) --capture --output-file sflphone-coverage.info + $(AM_V_at)lcov --directory $(top_builddir) --capture --output-file dring-coverage.info $(MKDIR_P) html-output - genhtml -o html-output sflphone-coverage.info + genhtml -o html-output dring-coverage.info coverage-clean: $(AM_V_at)lcov --directory $(top_builddir) --zerocounters - $(AM_V_at)rm -rf sflphone-coverage.info + $(AM_V_at)rm -rf dring-coverage.info $(AM_V_at)rm -rf html-output $(AM_V_at)find -name '*.gcda' -exec rm -f {} + $(AM_V_at)find -name '*.gcno' -exec rm -f {} + diff --git a/NEWS b/NEWS index 4246258de44ff2fe0f7840ff7322c04360699497..f761319d22ef461aad85c176359550712e279f42 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,13 @@ +DRing (2.0.0) / 2015-03-31 + * Project renaming + * First release under this name + * Ring account (DHT) introduced + * Complete SIP/SDP protocol handling re-write + * Encrypted communication through TLS/SRTP + * NAT-traversal: ICE, UPnP + * UI are separate repository + * And a lot more... + SFLphoned (1.0.2) / 2012-07-02 * Stable version * Update Contact header from 200 OK diff --git a/README b/README index 0c9ad69fe3fe13c1fb5acc3c4586457bed27d3f6..067c976d4e56c0b15e1808327fbfa7fb9b1d0484 100644 --- a/README +++ b/README @@ -34,27 +34,31 @@ Ring is a Voice-over-IP software phone. We want it to be: - user friendly (fast, sleek, easy to learn interface) - professional grade (transfers, holds, optimal audio quality) - fully compatible with Asterisk (SIP and IAX protocols) +- de-centralized call (P2P-DHT) - customizable As the SIP/audio daemon and the user interface are separate processes, -it is easy to provide different user interfaces. SFLPhone comes with -a GTK graphical user interface and even scripts to control the daemon from +it is easy to provide different user interfaces. Ring comes with +various graphical user interfaces and even scripts to control the daemon from the shell. -SFLPhone is currently used by the support team of Savoir-Faire Linux Inc. +Ring is currently used by the support team of Savoir-Faire Linux Inc. More information is available on the project homepage: - http://www.sflphone.org/ + http://www.ring.cx/ + +This source tree contains the daemon application only, DRing, that handles +the business logic of Ring. UI are located in differents repositories. +Check our client subprojects here: +https://projects.savoirfairelinux.com/projects/ring Short description of content of source tree ------------------------------------------- -- src/ is the core of SFLphone. It contains main.cpp, the entry point and - managerimpl.cpp. - The ManagerImpl class is the intermediary between all the layers of the daemon. -- src/client/dbus, the D-Bus xml interfaces, and c++ bindings -- src/client/android, the JNI interfaces (Java bindings) +- src/ is the core of DRing. +- bin/ contains applications main code. +- bin/dbus, the D-Bus xml interfaces, and c++ bindings About Savoir-Faire Linux @@ -64,25 +68,21 @@ Savoir-Faire Linux is a consulting company based in Montreal, Quebec. For more information, please check out our website: http://www.savoirfairelinux.com/ + How to compile on Linux ----------------------- -# Compile the dependencies +1) Compile the dependencies first + cd ../contrib/ mkdir native cd native ../bootstrap make -# Then the daemon -cd ../../daemon -./autogen.sh -./configure -make -make install +2) Then the dring application -# And the GNOME client -cd ring-client-gnome +cd ../../ ./autogen.sh ./configure make @@ -93,17 +93,19 @@ Done ! More details available here: https://projects.savoirfairelinux.com/projects/ring/wiki/How_to_build + How to compile on OSX --------------------- + # These first steps are only necessary if you don't use a package manager. -cd daemon/extras/tools +cd extras/tools ./bootstrap make export PATH=$PATH:/location/of/ring/daemon/extras/tools/build/bin # Or, use your favorite package manager to install the necessary tools (macports or brew). -automake libtool check gettext libtoolize ... +automake libtool check gettext libtoolize yasm ... # Compile the dependencies cd contrib @@ -113,7 +115,7 @@ cd native make -j # Then the daemon -cd ../../daemon +cd ../../ ./autogen.sh ./configure --without-alsa --without-pulse --without-dbus --disable-video make @@ -123,51 +125,19 @@ add to ./configure: --prefix=<prefix_path> Do a little dance! + Common Issues ------------- +------------- -autopoint not found: When using Homebrew, autopoint is not find even when +autopoint not found: When using Homebrew, autopoint is not found even when gettext is installed, because symlinks are not created. Run: 'brew link --force gettext' to fix it. -How to cross-compile for Windows 64bit (from Linux) ---------------------------------------------------- - -# First, make sure you can compile the linux version. -# Install a few tools. -sudo apt-get install mingw-w64 cmake build-essential g++ automake autoconf -gnu-standards autoconf-doc libtool gettext autoconf-archive pkg-config - -# On certain distributions, mingw-w64 doesn't select POSIX threads by default. -You need to use the POSIX version. To do so, run the following commands and -select POSIX threads. -sudo update-alternatives --config x86_64-w64-mingw32-gcc -sudo update-alternatives --config x86_64-w64-mingw32-g++ - -# Compile the dependencies -cd ring/daemon/contrib/ -mkdir win64 && cd win64 -../bootstrap --host=x86_64-w64-mingw32 -make -# make -j seems to have problems!? - -Cross fingers and pray to the great cross-compiler in the sky! -... -Profit! - -# Compile the daemon -./autogen.sh -./configure --host=x86_64-w64-mingw32 - --without-alsa - --without-pulse - --without-dbus - --disable-video -make Clang compatibility (developers only) ------------------------------------- -It is possible to compile sflphone with Clang by setting CC and CXX variables +It is possible to compile dring with Clang by setting CC and CXX variables to 'clang' and 'clang++' respectively when calling ./configure. Currently it is not possible to use the DBus interface mechanism, and the @@ -175,29 +145,30 @@ interaction between daemon and client will not work; for each platform where dbus is not available the client should implement all the methods in the *_stub.cpp files. -SIP/IAx2 accounts + +SIP accounts --------------------- -You may register an existing SIP/IAX2 account through the account wizard in both +You may register an existing SIP account through the account wizard in both clients (KDE and GNOME). By doing this, you will be able to call other accounts known to this server. -Contributing to SFLPhone +Contributing to Ring ------------------------ Of course we love patches. And contributions. And spring rolls. -Development website: http://projects.savoirfairelinux.net/wiki/sflphone +Development website: http://projects.savoirfairelinux.com/projects/ring/wiki Do not hesitate to join us and post comments, suggestions, questions -and general feedback on the SFLphone mailing-list: -http://lists.savoirfairelinux.net/mailman/listinfo/sflphone +and general feedback on the Ring mailing-list: +http://lists.savoirfairelinux.net/mailman/listinfo/ring Bug reports: -https://projects.savoirfairelinux.com/projects/ring/wiki/BugReports +http://projects.savoirfairelinux.com/projects/ring/wiki/BugReports IRC (on #freenode): #sflphone - -- The SFLPhone Team + -- The Ring Team diff --git a/TODO b/TODO deleted file mode 100644 index ea479bc2c549c5d91e0f96c9fb6ab6101f568c3e..0000000000000000000000000000000000000000 --- a/TODO +++ /dev/null @@ -1,8 +0,0 @@ -For project core: ----------------- -Management Config like about:config in Mozilla -Management of exceptions -Remove all warnings in compilation - -Improvement of STUN (done?) -Better handling for an reINVITE request. (done?) diff --git a/astylerc b/astylerc index d38cbbf0f6ed52b6e978ad7e191d9ca8f4102945..86203e5287f7490d487e135b73e9703de3f6e6e3 100644 --- a/astylerc +++ b/astylerc @@ -1,9 +1,9 @@ -# Filename: sflphone-common/astylerc +# Filename: astylerc # Purpose: config file for astyle -# http://astyle.sourceforge.net/astyle.html +# http://astyle.sourceforge.net/astyle.html # Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> -# Savoir-faire Linux Inc -# http://www.sflphone.org +# Savoir-faire Linux Inc +# http://www.ring.cx style=stroustrup # stroustrup style http://astyle.sourceforge.net/astyle.html#_style=stroustrup indent=spaces=4 # Use spaces instead of tabs for indentation diff --git a/autogen.sh b/autogen.sh index 6980c6c34d9c42abfb0dcf4f962b2642e80f2425..b0d90830879d162a0c1ac7eac83490ca034dee1f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -24,7 +24,7 @@ fi # Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565663 mkdir -p m4 -HOOKS_DIR="../.git/hooks" +HOOKS_DIR=".git/hooks" # install pre-commit hook for doing clean commits if [ -d "$HOOKS_DIR" ]; then diff --git a/bin/dbus/dbusclient.cpp b/bin/dbus/dbusclient.cpp index 6a5c393aa4e8d02edc234c925e0181ff7a3136d7..7f0fcaa4809afcb7a21a8fe48fb3e826399da8ac 100644 --- a/bin/dbus/dbusclient.cpp +++ b/bin/dbus/dbusclient.cpp @@ -73,7 +73,7 @@ class EventCallback : const std::function<void()> callback_; }; -DBusClient::DBusClient(int sflphFlags, bool persistent) +DBusClient::DBusClient(int flags, bool persistent) : dispatcher_(new DBus::BusDispatcher) { try { @@ -106,7 +106,7 @@ DBusClient::DBusClient(int sflphFlags, bool persistent) throw std::runtime_error {"cannot initialize DBus stuff"}; } - if (initLibrary(sflphFlags) < 0) + if (initLibrary(flags) < 0) throw std::runtime_error {"cannot initialize libring"}; instanceManager_->started(); @@ -128,7 +128,7 @@ DBusClient::~DBusClient() } int -DBusClient::initLibrary(int sflphFlags) +DBusClient::initLibrary(int flags) { using namespace std::placeholders; @@ -203,7 +203,7 @@ DBusClient::initLibrary(int sflphFlags) }; #endif - if (!DRing::init(static_cast<DRing::InitFlag>(sflphFlags))) + if (!DRing::init(static_cast<DRing::InitFlag>(flags))) return -1; registerCallHandlers(callEvHandlers); diff --git a/bin/dbus/dbusclient.h b/bin/dbus/dbusclient.h index 93b19aca0e3793b8b6c558fcf717e3616087f9ad..52bb865e3a13d5d22e49b4602e12688fd118902b 100644 --- a/bin/dbus/dbusclient.h +++ b/bin/dbus/dbusclient.h @@ -55,14 +55,14 @@ namespace DBus { class DBusClient { public: - DBusClient(int sflphFlags, bool persistent); + DBusClient(int flags, bool persistent); ~DBusClient(); int event_loop() noexcept; int exit() noexcept; private: - int initLibrary(int sflphFlags); + int initLibrary(int flags); void finiLibrary() noexcept; std::unique_ptr<DBus::BusDispatcher> dispatcher_; diff --git a/bin/dbus/dbusconfigurationmanager.cpp b/bin/dbus/dbusconfigurationmanager.cpp index 7cb4a9ea6242b3a5a478c28bcfb456c637e41571..8013b3a408504708d1a080e6f809a1763700753d 100644 --- a/bin/dbus/dbusconfigurationmanager.cpp +++ b/bin/dbus/dbusconfigurationmanager.cpp @@ -28,6 +28,10 @@ * as that of the covered work. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "dbusconfigurationmanager.h" #include "configurationmanager_interface.h" @@ -278,7 +282,6 @@ DBusConfigurationManager::setAudioManager(const std::string& api) -> decltype(DR return DRing::setAudioManager(api); } -//FIXME std::vector<std::string> DBusConfigurationManager::getSupportedAudioManagers() { diff --git a/bin/main.cpp b/bin/main.cpp index 145f8e0f1fbde906bd20ea0f9fcdff96a2cfb8db..8451ad908097eafb991754009b41d87b6699a254 100644 --- a/bin/main.cpp +++ b/bin/main.cpp @@ -47,7 +47,7 @@ print_title() std::cout << "Ring Daemon " << DRing::version() << ", by Savoir-Faire Linux 2004-2015" << std::endl - << "http://www.sflphone.org/" << std::endl; + << "http://www.ring.cx/" << std::endl; } static void diff --git a/bin/osxmain.cpp b/bin/osxmain.cpp index a2cab51ae15ba5db7602222dbcbec601315efd16..57f8b5ee817f9f38087aaf55874cb38e9ef33c46 100644 --- a/bin/osxmain.cpp +++ b/bin/osxmain.cpp @@ -52,7 +52,7 @@ print_title() { std::cout << "Ring Daemon " << DRing::version() << ", by Savoir-Faire Linux 2004-2015" << std::endl - << "http://www.sflphone.org/" << std::endl; + << "http://www.ring.cx/" << std::endl; } static void diff --git a/configure.ac b/configure.ac index caa071e431f426c855b64e0c65ba873407b6d571..fb75c5fab0df58bb49d83d260ce1530e79c8a89c 100644 --- a/configure.ac +++ b/configure.ac @@ -2,9 +2,9 @@ dnl Ring - configure.ac for automake 1.9 and autoconf 2.59 dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.65]) -AC_INIT([Ring],[2.0.0],[sflphoneteam@savoirfairelinux.com],[ring]) +AC_INIT([Ring],[2.0.0],[ring@lists.savoirfairelinux.net],[ring]) -AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014]]) +AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004-2015]]) AC_REVISION([$Revision$]) dnl Where to find configure files diff --git a/contrib/src/libav/osx.patch b/contrib/src/libav/osx.patch index a4be9a98e89062a6898d78bc3202249eaf75c560..4f885fd6d14fe20309ff7304a90618ad39dac25d 100644 --- a/contrib/src/libav/osx.patch +++ b/contrib/src/libav/osx.patch @@ -242,10 +242,10 @@ index 5dbe277..8439b5b 100644 REGISTER_INDEV (FBDEV, fbdev); diff --git a/libavdevice/avfoundation_dec.m b/libavdevice/avfoundation_dec.m new file mode 100644 -index 0000000..581f845 +index 0000000..f1b9c03 --- /dev/null +++ b/libavdevice/avfoundation_dec.m -@@ -0,0 +1,449 @@ +@@ -0,0 +1,447 @@ +/* + * AVFoundation input device + * Copyright (c) 2015 Luca Barbato @@ -406,7 +406,7 @@ index 0000000..581f845 + +@end + -+NSString *pat = @"(\b[A-Z0-9]+\b)"; ++NSString *pat = @"\\[[^\\].]*\\]"; + +static int setup_stream(AVFormatContext *s, AVCaptureDevice *device) +{ @@ -491,7 +491,6 @@ index 0000000..581f845 + // Take stream info from the first frame. + while (ctx->frames_captured < 1) { + CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, YES); -+ av_log(s, AV_LOG_ERROR, "Waiting for incoming frame\n"); + } + + lock_frames(ctx); @@ -586,8 +585,7 @@ index 0000000..581f845 + if (matches.count > 0) { + for (NSTextCheckingResult *match in matches) { + NSRange range = [match rangeAtIndex:0]; -+ NSString *uniqueID = [filename substringWithRange:range]; -+ av_log(s, AV_LOG_INFO, "opening device with ID: %s\n",[uniqueID UTF8String]); ++ NSString *uniqueID = [filename substringWithRange:NSMakeRange(range.location + 1, range.length-2)]; av_log(s, AV_LOG_INFO, "opening device with ID: %s\n",[uniqueID UTF8String]); + if (!(device = [AVCaptureDevice deviceWithUniqueID:uniqueID])) { + // report error + av_log(s, AV_LOG_ERROR, "Device with name %s not found",[filename UTF8String]); diff --git a/contrib/src/libav/rules.mak b/contrib/src/libav/rules.mak index a77625b141adcd4af8c3a1d5b9ab257e77d15222..f010f45532770cc51587e37e995c7d74b0303e40 100644 --- a/contrib/src/libav/rules.mak +++ b/contrib/src/libav/rules.mak @@ -4,7 +4,12 @@ LIBAV_GITURL := git://git.libav.org/libav.git PKGS += libav +#disable everything +#ensure to add this option first LIBAVCONF = \ + --disable-everything + +LIBAVCONF += \ --cc="$(CC)" \ --pkg-config="$(PKG_CONFIG)" \ --enable-zlib \ @@ -12,9 +17,6 @@ LIBAVCONF = \ --enable-swscale \ --enable-protocols -#disable everything -LIBAVCONF += \ - --disable-everything #enable muxers/demuxers LIBAVCONF += \ diff --git a/contrib/src/main.mak b/contrib/src/main.mak index 845f78a14f1ad16f412916ee88c0bd7944ea87f3..046be757a40aa8cac23fdf20377ba41f1b50038a 100644 --- a/contrib/src/main.mak +++ b/contrib/src/main.mak @@ -369,9 +369,9 @@ distclean: clean unlink Makefile # TODO: set up the correct url -#PREBUILT_URL=$(URL)/contrib/$(HOST)/sflphone-contrib-$(HOST)-latest.tar.bz2 +#PREBUILT_URL=$(URL)/contrib/$(HOST)/ring-contrib-$(HOST)-latest.tar.bz2 -sflphone-contrib-$(HOST)-latest.tar.bz2: +ring-contrib-$(HOST)-latest.tar.bz2: $(call download,$(PREBUILT_URL)) prebuilt: sflphone-contrib-$(HOST)-latest.tar.bz2 @@ -388,7 +388,7 @@ package: install cd share; rm -Rf man doc gtk-doc info lua projectM gettext; cd ..; \ rm -Rf man sbin etc lib/lua lib/sidplay cd tmp/$(notdir $(PREFIX)) && $(abspath $(SRC))/change_prefix.sh $(PREFIX) @@CONTRIB_PREFIX@@ - (cd tmp && tar c $(notdir $(PREFIX))/) | bzip2 -c > ../sflphone-contrib-$(HOST)-$(DATE).tar.bz2 + (cd tmp && tar c $(notdir $(PREFIX))/) | bzip2 -c > ../ring-contrib-$(HOST)-$(DATE).tar.bz2 list: @echo All packages: diff --git a/contrib/src/opendht/rules.mak b/contrib/src/opendht/rules.mak index 63b99b9c9bc75e6565d174cb2d7f21a334b248d0..f69af07d5770d1e6d2b3fdee897aae920b3cfa77 100644 --- a/contrib/src/opendht/rules.mak +++ b/contrib/src/opendht/rules.mak @@ -1,5 +1,5 @@ # OPENDHT -OPENDHT_VERSION := e2878b104fa7ceb2c5e5d1189a17a4e437622023 +OPENDHT_VERSION := 97f8b633f090f36588e6dfe1569cfc9a305c14b7 OPENDHT_URL := https://github.com/savoirfairelinux/opendht/archive/$(OPENDHT_VERSION).tar.gz PKGS += opendht diff --git a/globals.mak b/globals.mak index 4ddafaf0fe88d259e877c44034ffc631d7cb1dc5..2f1b5bf855a25bd33c23345582e6f37b12b41b85 100644 --- a/globals.mak +++ b/globals.mak @@ -1,9 +1,7 @@ # Global variables src=$(abs_top_srcdir) -sfllibdir=$(DESTDIR)$(libdir)/ring -sflcodecdir=$(sfllibdir)/codecs -sflplugindir=$(sfllibdir)/plugins +ringlibdir=$(DESTDIR)$(libdir)/ring ASTYLERC="$(top_srcdir)/../astylerc" indent="/usr/bin/astyle" @@ -30,8 +28,6 @@ AM_CPPFLAGS = \ $(SIP_CFLAGS) \ -DPREFIX=\"$(prefix)\" \ -DPROGSHAREDIR=\"${datadir}/ring\" \ - -DCODECS_DIR=\""$(sflcodecdir)"\" \ - -DPLUGINS_DIR=\""$(sflplugindir)"\" \ -DENABLE_TRACE \ $(SPEEXCODEC) \ $(GSMCODEC) \ diff --git a/plugins/.gitignore b/plugins/.gitignore deleted file mode 100644 index 50fc06dc93c2af4f1544280ca11ea0b1352a8649..0000000000000000000000000000000000000000 --- a/plugins/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -m4 -aclocal.m4 -.cproject -.project -.settings/* -active -autom4te.cache/* -compile -config.guess -config.* -configure -depcomp -gnome-doc-utils.make -install-sh -ltmain.sh -missing -gnome.schemas -ring.desktop -ring.desktop.* -stamp-h.in -stamp-h1 diff --git a/plugins/AUTHORS b/plugins/AUTHORS deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/plugins/COPYING b/plugins/COPYING deleted file mode 100644 index 623b6258a134210f0b0ada106fdaab7f0370d9c5..0000000000000000000000000000000000000000 --- a/plugins/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/plugins/ChangeLog b/plugins/ChangeLog deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/plugins/Makefile.am b/plugins/Makefile.am deleted file mode 100644 index 9a81b2b2cdb35cf40bc57df9089538ca48656d91..0000000000000000000000000000000000000000 --- a/plugins/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = addressbook - -CFLAGS=-Wall -Werror -Wextra - -ACLOCAL_AMFLAGS = -I m4 diff --git a/plugins/NEWS b/plugins/NEWS deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/plugins/README b/plugins/README deleted file mode 100644 index 3c3393ccc7518e1c3e47151350af991bc7e1ef1d..0000000000000000000000000000000000000000 --- a/plugins/README +++ /dev/null @@ -1,5 +0,0 @@ -Welcome to Ring! - -Refer to the development site for further information: https://projects.savoirfairelinux.com/projects/show/sflphone - -Thank you diff --git a/plugins/addressbook/Makefile.am b/plugins/addressbook/Makefile.am deleted file mode 100644 index 9696609ba8d94b7fb5db4614fc737c550595fa89..0000000000000000000000000000000000000000 --- a/plugins/addressbook/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS=evolution test diff --git a/plugins/addressbook/evolution/Makefile.am b/plugins/addressbook/evolution/Makefile.am deleted file mode 100644 index 147bfb2a50b274341160fb2cecd48aede7ab1365..0000000000000000000000000000000000000000 --- a/plugins/addressbook/evolution/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -include ../../globals.mak - -noinst_PROGRAMS = libevladdrbook.so - -libevladdrbook_so_SOURCES = eds.c eds.h addressbook.c addressbook.h - -libevladdrbook_so_LDFLAGS = --shared $(GLIB_LDFLAGS) $(GTK_LDFLAGS) $(LIBEDATASERVER_LDFLAGS) $(LIBEBOOK_LDFLAGS) - -libevladdrbook_so_LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(LIBEDATASERVER_LIBS) $(LIBEBOOK_LIBS) - -libevladdrbook_so_CFLAGS = -fPIC -g -Wall $(GTK_CFLAGS) $(LIBEDATASERVER_CFLAGS) $(LIBEBOOK_CFLAGS) - -install-exec-local: install-libplugin_libevladdrbook_so - -uninstall-local: uninstall-libplugin_libevladdrbook_so - -install-libplugin_libevladdrbook_so: libevladdrbook.so - mkdir -p $(sflplugindir) - $(INSTALL_PROGRAM) libevladdrbook.so $(sflplugindir) - -uninstall-libplugin_libevladdrbook_so: - rm -f $(sflplugindir)/libevladdrbook.so - rmdir $(sflplugindir) diff --git a/plugins/addressbook/evolution/addressbook.c b/plugins/addressbook/evolution/addressbook.c deleted file mode 100644 index 14604b76bc1121ad229d4628050c7da727a71228..0000000000000000000000000000000000000000 --- a/plugins/addressbook/evolution/addressbook.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "eds.h" -#include "addressbook.h" - -/** - * Perform a search on address book - */ -void -addressbook_search (void (*search_cb)(GList *, gpointer), GtkEntry* entry, AddressBook_Config *addressbook_config) -{ - const gint max_results = addressbook_config ? addressbook_config->max_results : 10; - search_async_by_contacts (gtk_entry_get_text(entry), - max_results, - search_cb, - addressbook_config); -} - -/** - * Return addressbook state - */ -gboolean -addressbook_is_ready() -{ - return books_ready(); -} - -/** - * Return TRUE if at least one addressbook is active - */ -gboolean -addressbook_is_active() -{ - return books_active(); -} - -/** - * Good method to get books_data - */ -GSList * -addressbook_get_books_data() -{ - determine_default_addressbook(); - - return get_books_data(); -} - -book_data_t * -addressbook_get_book_data_by_uid(gchar *uid) -{ - return books_get_book_data_by_uid(uid); -} - -/** - * Initialize books. - * Set active/inactive status depending on config. - */ -void -addressbook_init() -{ - fill_books_data(); - determine_default_addressbook(); - - // Call books initialization - init_eds(); -} - -void addressbook_set_search_type(AddrbookSearchType searchType) { - if (searchType > ABOOK_QUERY_CONTAINS) - return; - - static const EBookQueryTest map[] = { - [ABOOK_QUERY_IS] = E_BOOK_QUERY_IS, - [ABOOK_QUERY_BEGINS_WITH] = E_BOOK_QUERY_BEGINS_WITH, - [ABOOK_QUERY_CONTAINS] = E_BOOK_QUERY_CONTAINS - }; - - set_current_addressbook_test(map[searchType]); -} - -void addressbook_set_current_book(const gchar *current) { - set_current_addressbook(current); -} diff --git a/plugins/addressbook/evolution/addressbook.h b/plugins/addressbook/evolution/addressbook.h deleted file mode 100644 index e4fdecb465af1ca690a123728fc9da1cf0d259bc..0000000000000000000000000000000000000000 --- a/plugins/addressbook/evolution/addressbook.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -/** - * This file contains functions specific for addressbook. - * It is used as a "mapping" between real search implementation - * and search bar. - */ - -#ifndef __ADDRESSBOOK_H__ -#define __ADDRESSBOOK_H__ - -#include <gtk/gtk.h> - -typedef enum { - ABOOK_QUERY_IS, - ABOOK_QUERY_BEGINS_WITH, - ABOOK_QUERY_CONTAINS -} AddrbookSearchType; - -/** - * Represent a contact entry - */ -typedef struct _Hit { - gchar *name; - GdkPixbuf *photo; - gchar *phone_business; - gchar *phone_home; - gchar *phone_mobile; -} Hit; - -/** - * Book structure for "outside world" - */ -typedef struct { - gchar *uid; - gchar *uri; - gchar *name; - gboolean active; -} book_data_t; - -typedef struct _AddressBook_Config { - // gint64: a signed integer guaranteed to be 64 bits on all platforms - // To print or scan values of this type, use G_GINT64_MODIFIER and/or G_GINT64_FORMAT - gint enable; - gint max_results; - gint display_contact_photo; - gint search_phone_home; - gint search_phone_business; - gint search_phone_mobile; -} AddressBook_Config; - -/** - * Initialize addressbook - */ -void addressbook_init(); - -/** - * Return addressbook state - */ -gboolean addressbook_is_ready(); - -/** - * Return addressbook state - */ -gboolean addressbook_is_enabled(); - -/** - * Return if at least one addressbook is active - */ -gboolean addressbook_is_active(); - - -/** - * Perform a search in addressbook - */ -void addressbook_search(void (*search_cb)(GList *, gpointer), GtkEntry *, AddressBook_Config *); - -/** - * Get a list of addressbook book - */ -GSList *addressbook_get_books_data(); - -book_data_t *addressbook_get_book_data_by_uid(gchar *); - -void addressbook_set_current_book(const gchar *); - -void addressbook_set_search_type(AddrbookSearchType); - -#endif diff --git a/plugins/addressbook/evolution/eds.c b/plugins/addressbook/evolution/eds.c deleted file mode 100644 index 3a5b6e58f2c6eaa862fb53a4415767749d0016e3..0000000000000000000000000000000000000000 --- a/plugins/addressbook/evolution/eds.c +++ /dev/null @@ -1,544 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * - * File originally copied from evolution module of deskbar-applet 2.24.1 - * Authors : - * Nigel Tao <nigel.tao@myrealbox.com> - * Raphaël Slinckx <raphael@slinckx.net> - * Mikkel Kamstrup Erlandsen <kamstrup@daimi.au.dk> - * Sebastian Pölsterl <marduk@k-d-w.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "config.h" - -#include <glib.h> -#include <string.h> -#include <pango/pango.h> -#include "eds.h" -#if EDS_CHECK_VERSION(3,5,3) -#include <libedataserver/libedataserver.h> -#else /* < EDS 3.5.3 */ -#include <libedataserver/e-source.h> -#include <libebook/e-book-client.h> -#endif - -#define GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) -/* Test for GCC < 4.7.0 */ -#if GCC_VERSION < 40700 -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif - -/** - * Structure used to store search callback and data - */ -typedef struct _Search_Handler_And_Data { - SearchAsyncHandler search_handler; - gpointer user_data; - GList *hits; - int max_results_remaining; - EBookQuery *equery; -} Search_Handler_And_Data; - -/** - * The global addressbook list - */ -static GSList *books_data = NULL; -static GMutex books_data_mutex; - -/** - * Current selected addressbook's uri and uid, initialized with default - */ -#if !EDS_CHECK_VERSION(3,5,3) -static gchar *current_uri = NULL; -#endif -static gchar *current_uid = NULL; - -static EBookQueryTest current_test = E_BOOK_QUERY_BEGINS_WITH; - -/** - * Public way to know if we can perform a search - */ -gboolean -books_ready() -{ - g_mutex_lock(&books_data_mutex); - - gboolean ret = books_data && g_slist_length(books_data) > 0; - - g_mutex_unlock(&books_data_mutex); - - return ret ; -} - -/** - * Public way to know if we enable at least one address book - */ -gboolean -books_active() -{ - gboolean ret = FALSE; - - g_mutex_lock(&books_data_mutex); - - for (GSList *iter = books_data; iter; iter = iter->next) - if (((book_data_t *) iter->data)->active) { - ret = TRUE; - break; - } - - g_mutex_unlock(&books_data_mutex); - - return ret; -} -/** - * Get a specific book data by UID - */ -book_data_t * -books_get_book_data_by_uid(gchar *uid) -{ - book_data_t *ret = NULL; - - g_mutex_lock(&books_data_mutex); - - for (GSList *iter = books_data; iter != NULL; iter = iter->next) - if (!strcmp(((book_data_t *)iter->data)->uid, uid) ) { - ret = iter->data; - break; - } - - g_mutex_unlock(&books_data_mutex); - - return ret; -} - - -/** - * Create a query which looks for the specified string in a contact's full name, email addresses and - * nick name. - */ -static EBookQuery* -create_query(const char* s, EBookQueryTest test, AddressBook_Config *conf) -{ - EBookQuery *queries[4]; - int cpt = 0; - - queries[cpt++] = e_book_query_field_test(E_CONTACT_FULL_NAME, test, s); - - if (!conf || conf->search_phone_home) - queries[cpt++] = e_book_query_field_test(E_CONTACT_PHONE_HOME, test, s); - - if (!conf || conf->search_phone_business) - queries[cpt++] = e_book_query_field_test(E_CONTACT_PHONE_BUSINESS, test, s); - - if (!conf || conf->search_phone_mobile) - queries[cpt++] = e_book_query_field_test(E_CONTACT_PHONE_MOBILE, test, s); - - return e_book_query_or(cpt, queries, TRUE); -} - -/** - * Create a query which looks any contact with a phone number - */ -static EBookQuery* -create_query_all_phones(AddressBook_Config *conf) -{ - EBookQuery *queries[3]; - int cpt = 0; - - if (!conf || conf->search_phone_home) - queries[cpt++] = e_book_query_field_exists(E_CONTACT_PHONE_HOME); - - if (!conf || conf->search_phone_business) - queries[cpt++] = e_book_query_field_exists(E_CONTACT_PHONE_BUSINESS); - - if (!conf || conf->search_phone_mobile) - queries[cpt++] = e_book_query_field_exists(E_CONTACT_PHONE_MOBILE); - - return e_book_query_or(cpt, queries, TRUE); -} - -/** - * Retrieve the contact's picture - */ -static GdkPixbuf* -pixbuf_from_contact(EContact *contact) -{ - GdkPixbuf *pixbuf = NULL; - EContactPhoto *photo = e_contact_get(contact, E_CONTACT_PHOTO); - - if (!photo) - return NULL; - - - if (photo->type == E_CONTACT_PHOTO_TYPE_INLINED) { - GdkPixbufLoader *loader = gdk_pixbuf_loader_new(); - if (gdk_pixbuf_loader_write(loader, (guchar *) photo->data.inlined.data, photo->data.inlined.length, NULL)) { - /* Force remaining parse operations to complete */ - gdk_pixbuf_loader_close(loader, NULL); - pixbuf = gdk_pixbuf_loader_get_pixbuf(loader); - /* Ensure that pixbuf isn't destroyed with loader */ - g_object_ref(pixbuf); - } - g_object_unref(loader); - } else if (photo->type == E_CONTACT_PHOTO_TYPE_URI) { - gchar *filename = g_filename_from_uri(photo->data.uri, NULL, NULL); - if (filename) { - pixbuf = gdk_pixbuf_new_from_file(filename, NULL); - g_free(filename); - } - } - - e_contact_photo_free(photo); - - if (!pixbuf) { - return NULL; - } - - // check size and resize if needed - gint width = gdk_pixbuf_get_width(pixbuf); - gint height = gdk_pixbuf_get_height(pixbuf); - double scale = 32 / (double) ((height > width) ? height : width); - - if (scale < 1.0) { - GdkPixbuf *tmp = gdk_pixbuf_scale_simple(pixbuf, width * scale, height - * scale, GDK_INTERP_BILINEAR); - g_object_unref(pixbuf); - pixbuf = tmp; - } - - return pixbuf; -} - -/** - * Final callback after all books have been processed. - */ -static void -view_finish_callback(Search_Handler_And_Data *had) -{ - SearchAsyncHandler had_handler = had->search_handler; - GList *had_hits = had->hits; - gpointer had_user_data = had->user_data; - - g_free(had); - - // Call display callback - had_handler(had_hits, had_user_data); -} - -/** - * Callback called after a contact have been found in EDS by search_async_by_contacts. - */ - -static void -eds_query_result_cb(GObject *object, GAsyncResult *result, gpointer user_data) -{ - EBookClient *book_client = E_BOOK_CLIENT(object); - if (!book_client) - return; - GSList *contacts; - if (!e_book_client_get_contacts_finish(book_client, result, &contacts, NULL)) - return; - Search_Handler_And_Data *had = (Search_Handler_And_Data *) user_data; - - // make sure we have a new list of hits - had->hits = NULL; - - for (GSList *l = contacts; l; l = l->next) { - Hit *hit = g_new0(Hit, 1); - EContact *contact = E_CONTACT(l->data); - - hit->photo = pixbuf_from_contact(contact); - hit->phone_business = g_strdup((char*)e_contact_get_const(contact, E_CONTACT_PHONE_BUSINESS)); - hit->phone_home = g_strdup((char*)e_contact_get_const(contact, E_CONTACT_PHONE_HOME)); - hit->phone_mobile = g_strdup((char*)e_contact_get_const(contact, E_CONTACT_PHONE_MOBILE)); - hit->name = g_strdup((char*)e_contact_get_const(contact, E_CONTACT_NAME_OR_ORG)); - - had->hits = g_list_append(had->hits, hit); - - if (--had->max_results_remaining <= 0) - break; - } - g_slist_foreach(contacts, (GFunc) g_object_unref, NULL); - g_slist_free(contacts); - - view_finish_callback(had); - - g_object_unref(object); -} - - -/** - * Callback for asynchronous opening of book client - */ -static void -client_open_async_callback(GObject *client, GAsyncResult *result, gpointer closure) -{ - if (!client) - return; - if (!e_client_open_finish(E_CLIENT(client), result, NULL)) - return; - - Search_Handler_And_Data *had = (Search_Handler_And_Data *) closure; - gchar *query_str = e_book_query_to_string(had->equery); - e_book_client_get_contacts(E_BOOK_CLIENT(client), query_str, NULL, eds_query_result_cb, closure); - g_free(query_str); -} - -/** - * Initialize address book - */ -void -init_eds() -{ - g_mutex_lock(&books_data_mutex); - - for (GSList *iter = books_data; iter != NULL; iter = iter->next) { - book_data_t *book_data = (book_data_t *) iter->data; - -#if !EDS_CHECK_VERSION(3,5,3) - current_uri = book_data->uri; -#endif - current_uid = book_data->uid; - } - - g_mutex_unlock(&books_data_mutex); -} - -static GSList * -free_books_data(GSList *list) -{ - for (GSList *iter = list; iter != NULL; iter = iter->next) { - book_data_t *book_data = (book_data_t *) iter->data; - - g_free(book_data->name); - g_free(book_data->uid); - g_free(book_data->uri); - } - return NULL; -} - -/** - * Fill books data - */ -#if EDS_CHECK_VERSION(3,5,3) - -static book_data_t * -create_book_data_from_source(ESource *source) -{ - book_data_t *book_data = g_new0(book_data_t, 1); - book_data->active = e_source_get_enabled(source); - book_data->name = g_strdup(e_source_get_display_name(source)); - book_data->uri = g_strdup(""); // No longer used - book_data->uid = g_strdup(e_source_get_uid(source)); - return book_data; -} - -static ESourceRegistry * -get_registry() -{ - static ESourceRegistry * registry; - if (registry == NULL) - registry = e_source_registry_new_sync(NULL, NULL); - return registry; -} - -void -fill_books_data() -{ - // FIXME: add error handling - ESourceRegistry *registry = get_registry(); - const gchar *extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK; - GList *list = e_source_registry_list_sources(registry, extension_name); - - g_mutex_lock(&books_data_mutex); - - books_data = free_books_data(books_data); - - for (GList *l = list; l != NULL; l = l->next) { - if (l->data) { - ESource *source = l->data; - book_data_t *book_data = create_book_data_from_source(source); - books_data = g_slist_prepend(books_data, book_data); - } - } - - g_mutex_unlock(&books_data_mutex); - - /* Free each source in the list and the list itself */ - g_list_free_full(list, g_object_unref); -} - -#else /* EDS < 3.5.3 */ - -static book_data_t * -create_book_data_from_source(ESource *source, ESourceGroup *group) -{ - book_data_t *book_data = g_new0(book_data_t, 1); - book_data->active = TRUE; - book_data->name = g_strdup(e_source_peek_name(source)); - book_data->uid = g_strdup(e_source_peek_uid(source)); - - book_data->uri = g_strconcat(e_source_group_peek_base_uri(group), e_source_peek_relative_uri(source), NULL); - return book_data; -} - - -void -fill_books_data() -{ - ESourceList *source_list = e_source_list_new_for_gconf_default("/apps/evolution/addressbook/sources"); - - if (source_list == NULL) - return; - - GSList *list = e_source_list_peek_groups(source_list); - - if (list == NULL) { - g_object_unref(source_list); - return; - } - - g_mutex_lock(&books_data_mutex); - - books_data = free_books_data(books_data); - - for (GSList *l = list; l != NULL; l = l->next) { - ESourceGroup *group = l->data; - - for (GSList *m = e_source_group_peek_sources(group); m != NULL; m = m->next) { - ESource *source = m->data; - book_data_t *book_data = create_book_data_from_source(source, group); - books_data = g_slist_prepend(books_data, book_data); - } - } - - g_mutex_unlock(&books_data_mutex); - - g_object_unref(source_list); -} -#endif - -// FIXME: should be obtained by e_source_registry_ref_default_address_book () -void -determine_default_addressbook() -{ - g_mutex_lock(&books_data_mutex); - - /* Just grabbing first addressbook as default */ - for (GSList *elm = books_data; elm ; elm = g_slist_next(elm)) { - book_data_t *book_data = elm->data; - -#if !EDS_CHECK_VERSION(3,5,3) - current_uri = book_data->uri; -#endif - current_uid = book_data->uid; - break; - } - - for (GSList *elm = books_data; elm ; elm = g_slist_next(elm)) { - book_data_t *book_data = elm->data; - - if (book_data->active) { -#if !EDS_CHECK_VERSION(3,5,3) - current_uri = book_data->uri; -#endif - current_uid = book_data->uid; - break; - } - } - - g_mutex_unlock(&books_data_mutex); -} - -void -search_async_by_contacts(const char *query, int max_results, SearchAsyncHandler handler, gpointer user_data) -{ - Search_Handler_And_Data *had = g_new0(Search_Handler_And_Data, 1); - - // initialize search data - had->search_handler = handler; - had->user_data = user_data; - had->hits = NULL; - had->max_results_remaining = max_results; - if (!g_strcmp0(query, "")) - had->equery = create_query_all_phones(user_data); - else - had->equery = create_query(query, current_test, user_data); - - -#if EDS_CHECK_VERSION(3,5,3) - ESourceRegistry *registry = get_registry(); - ESource *source = e_source_registry_ref_source(registry, current_uid); - EBookClient *book_client = e_book_client_new(source, NULL); - g_object_unref(source); -#else /* < EDS 3.5.3 */ - EBookClient *book_client = e_book_client_new_from_uri(current_uri, NULL); -#endif - if (!book_client) - return; - e_client_open(E_CLIENT(book_client), TRUE, NULL, client_open_async_callback, had); - -} - -void -set_current_addressbook(const gchar *name) -{ - if(name == NULL) - return; - - g_mutex_lock(&books_data_mutex); - - for (GSList *iter = books_data; iter != NULL; iter = iter->next) { - book_data_t *book_data = (book_data_t *) iter->data; - if (g_strcmp0(book_data->name, name) == 0) { -#if !EDS_CHECK_VERSION(3,5,3) - current_uri = book_data->uri; -#endif - current_uid = book_data->uid; - } - } - - g_mutex_unlock(&books_data_mutex); -} - - -void -set_current_addressbook_test(EBookQueryTest test) -{ - current_test = test; -} - -GSList * -get_books_data() -{ - return books_data; -} diff --git a/plugins/addressbook/evolution/eds.h b/plugins/addressbook/evolution/eds.h deleted file mode 100644 index 6ae8da03c0c002b2195125d8d1dc2bd0b60dcbf5..0000000000000000000000000000000000000000 --- a/plugins/addressbook/evolution/eds.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> - * - * File originally copied from evolution module of deskbar-applet 2.24.1 - * Authors : - * Nigel Tao <nigel.tao@myrealbox.com> - * Raphaël Slinckx <raphael@slinckx.net> - * Mikkel Kamstrup Erlandsen <kamstrup@daimi.au.dk> - * Sebastian Pölsterl <marduk@k-d-w.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#ifndef __EDS_H__ -#define __EDS_H__ - -#include <glib.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#include <libedataserver/eds-version.h> - -#if EDS_CHECK_VERSION(3,5,3) -#include <libebook/libebook.h> -#else -#include <libebook/e-book.h> -#include <libebook/e-book-query.h> -#endif - -#include "addressbook.h" - - -G_BEGIN_DECLS - -/** - * Template callback function for the asynchronous search - */ -typedef void -(* SearchAsyncHandler)(GList *hits, gpointer user_data); - -/** - * Initialize the address book. - * Connection to evolution data server - */ -void -init_eds(); - -/** - * Fill list of addressbooks - */ -void -fill_books_data(void); - -/** - * Asynchronous query to EDS using get contact method. - */ -void -search_async_by_contacts(const char *query, int max_results, SearchAsyncHandler handler, gpointer user_data); - -GSList* -get_books(void); - -book_data_t * -books_get_book_data_by_uid(gchar *uid); - -/** - * Public way to know if we can perform a search - */ -gboolean -books_ready(); - -/** - * Public way to know if we enabled an address book - */ -gboolean -books_active(); - -/** - * Good method to retrieve books_data (handle async) - */ -GSList * -addressbook_get_books_data(); - -/** - * Set the current address book - */ -void -set_current_addressbook(const gchar *name); - -void -set_current_addressbook_test(EBookQueryTest test); - -GSList * -get_books_data(); - -void -determine_default_addressbook(); - - -G_END_DECLS - -#endif /* __EDS_H__ */ diff --git a/plugins/addressbook/test/Makefile.am b/plugins/addressbook/test/Makefile.am deleted file mode 100644 index 7a29fe0f62769e25ccad82f8f03194883deef443..0000000000000000000000000000000000000000 --- a/plugins/addressbook/test/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -check_PROGRAMS=test_addressbook - -test_addressbook_CFLAGS=-g @GTK_CFLAGS@ -I../evolution/ -test_addressbook_LDADD=@GTK_LIBS@ $(top_builddir)/addressbook/evolution/libevladdrbook.so diff --git a/plugins/addressbook/test/test_addressbook.c b/plugins/addressbook/test/test_addressbook.c deleted file mode 100644 index 60a614789414132c20b8dc45be0efd66cf396bbe..0000000000000000000000000000000000000000 --- a/plugins/addressbook/test/test_addressbook.c +++ /dev/null @@ -1,115 +0,0 @@ - -#include <gtk/gtk.h> -#include "addressbook.h" - -/** - * Callback called after all book have been processed - */ - -enum { - COLUMN_NAME, - COLUMN_PHONE, - COLUMN_PIXBUF, - N_COLUMNS -}; - -// Evil! -static GtkListStore *list_store; - - -static void -add_contact(const gchar *name, const char *phone, GdkPixbuf *photo) -{ - if (g_strcmp0(phone, "") == 0) - return; - - g_print("name: %s, phone: %s, photo: %p\n", name, phone, photo); - GtkTreeIter iter; - // Add a new row to the model - gtk_list_store_append(list_store, &iter); - gtk_list_store_set(list_store, &iter, - COLUMN_NAME, name, - COLUMN_PHONE, phone, - COLUMN_PIXBUF, photo, - -1); -} - -static void -handler_async_search(GList *hits, G_GNUC_UNUSED gpointer data) -{ - for (GList *i = hits; i != NULL; i = i->next) { - Hit *hit = i->data; - - if (!hit) - continue; - - const gchar *phone = hit->phone_business ? hit->phone_business : - hit->phone_mobile ? hit->phone_mobile : - hit->phone_home ? hit->phone_home : ""; - add_contact(hit->name, phone, hit->photo); - - g_free(hit->name); - g_free(hit->phone_home); - g_free(hit->phone_mobile); - g_free(hit->phone_business); - g_free(hit); - } - - g_list_free(hits); -} - -static void -text_changed_cb(GtkEntry *entry) -{ - g_print("Text changed to %s\n", gtk_entry_get_text(entry)); - gtk_list_store_clear(list_store); - addressbook_search(handler_async_search, entry, NULL); -} - -int -main(int argc, char *argv[]) -{ - gtk_init(&argc, &argv); - - list_store = gtk_list_store_new(N_COLUMNS, - G_TYPE_STRING, - G_TYPE_STRING, - GDK_TYPE_PIXBUF); - GtkWidget *tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list_store)); - - GtkCellRenderer *text_renderer = gtk_cell_renderer_text_new(); - GtkCellRenderer *pixbuf_renderer = gtk_cell_renderer_pixbuf_new(); - GtkCellRenderer *renderers[] = {text_renderer, text_renderer, pixbuf_renderer}; - const char *column_header[]= {"Name", "Phone", "Photo"}; - const char *column_type[]= {"text", "text", "pixbuf"}; - - for (gint col = 0; col < N_COLUMNS; ++col) { - GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(column_header[col], - renderers[col], column_type[col], - col, - NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column); - } - - GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - - g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); - - addressbook_init(); - addressbook_set_current_book("Contacts"); - - GtkWidget *entry = gtk_entry_new(); - gtk_container_add(GTK_CONTAINER(vbox), tree_view); - gtk_container_add(GTK_CONTAINER(vbox), entry); - gtk_container_add(GTK_CONTAINER(window), vbox); - - addressbook_search(handler_async_search, GTK_ENTRY(entry), NULL); - g_signal_connect(entry, "notify::text", G_CALLBACK(text_changed_cb), NULL); - - gtk_widget_show_all(window); - - gtk_main(); - - return 0; -} diff --git a/plugins/autogen.sh b/plugins/autogen.sh deleted file mode 100755 index 839ab4aaf4d59197c89c0a18c8cecd83e9d94df6..0000000000000000000000000000000000000000 --- a/plugins/autogen.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -e - -# Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565663 -[ ! -e m4 ] && mkdir m4 - -autoreconf --force --install --verbose -Wall -I m4 diff --git a/plugins/configure.ac b/plugins/configure.ac deleted file mode 100644 index 66c20d89479f844a15c81ee9a9371a7d89996c51..0000000000000000000000000000000000000000 --- a/plugins/configure.ac +++ /dev/null @@ -1,50 +0,0 @@ -AC_INIT([Ring],[2.0.0],[sflphoneteam@savoirfairelinux.com],[ring-plugins]) -AC_CONFIG_HEADERS([config.h]) - -AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE -AC_CONFIG_MACRO_DIR([m4]) - -dnl Silent build by default. Use make V=1 to increase verbosity -m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) - -AC_ARG_WITH(debug, - AS_HELP_STRING( - [--with-debug], - [Set 'full' to enable debugging information @<:@default=no@:>@] - ), - [with_debug=${withval}], - [with_debug=no] - ) - -AC_PROG_CC_C99 -dnl For target specific flags -AM_PROG_CC_C_O -AC_PROG_INSTALL -AC_HEADER_STDC -LT_PREREQ([2.2]) -LT_INIT - -MIGRATION_FLAGS="-DE_BOOK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES" -if test "x$with_debug" = "xfull" -o "x$with_debug" = "xyes"; then - CFLAGS="-g -O0 -DDEBUG -Wall -Wextra $MIGRATION_FLAGS" -else - CFLAGS="$CFLAGS -g -Wall -Wextra -Wshadow $MIGRATION_FLAGS" -fi - -PKG_CHECK_MODULES(GTK, gtk+-3.0) -PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.2) -PKG_CHECK_MODULES(LIBEBOOK, libebook-1.2 >= 1.4) -PKG_CHECK_MODULES([LIBEDATASERVER], [libedataserver-1.2 >= 2.32], - [AC_DEFINE([LIBEDATASERVER_VERSION_2_32], [], [Using libedataserver-1.2 version 2.32 or higher])], - [PKG_CHECK_MODULES([LIBEDATASERVER], [libedataserver-1.2 >= 1.4])] - ) - -AC_CONFIG_FILES([ -Makefile -addressbook/evolution/Makefile -addressbook/Makefile -addressbook/test/Makefile -]) -AC_OUTPUT - diff --git a/plugins/globals.mak b/plugins/globals.mak deleted file mode 100644 index 83df0bb66396259148c7fcc7eec01dfb0b2400a3..0000000000000000000000000000000000000000 --- a/plugins/globals.mak +++ /dev/null @@ -1,34 +0,0 @@ -# Global variables -src = $(top_srcdir) - -ASTYLERC="$(top_srcdir)/../astylerc" -indent="/usr/bin/astyle" - -sfllibdir=$(DESTDIR)$(libdir)/ring -sflplugindir=$(sfllibdir)/plugins - -# Preprocessor flags -AM_CPPFLAGS = $(DEPS_CFLAGS) \ - $(LIBSEXY_CFLAGS) \ - -I$(src)/src \ - -I$(src)/src/config \ - -I$(src)/src/dbus \ - -I$(src)/src/contacts \ - -I$(src)/src/addressbook \ - -DDATA_DIR=\""$(prefix)/share/ring"\" \ - -DICONS_DIR=\""$(prefix)/share/ring"\" \ - -DCODECS_DIR=\""$(prefix)/lib/ring/codecs"\" \ - -DPREFIX=\"$(prefix)\" \ - -DENABLE_TRACE \ - -DPREFIX=\""$(prefix)"\" \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DDATADIR=\""$(datadir)"\" \ - -DLIBDIR=\""$(libdir)"\" \ - -DLOCALEDIR=\""$(localedir)"\" \ - -DRING_UIDIR=\""$(datadir)/ring/ui"\" \ - -DPLUGINS_DIR=\""$(sflplugindir)"\" -indent: - @echo "Indenting code:" - if [ -f $(ASTYLERC) ] ; then \ - find $(top_srcdir)/src/ -regex ".*\.\(h\|c\)" -exec $(indent) --options=$(ASTYLERC) {} \; ; \ - fi diff --git a/src/client/callmanager.cpp b/src/client/callmanager.cpp index 03db7663076348a18a0137c8e664b7cee7e9cc44..4d521e287864a8130e8cb6320f9b850595c450db 100644 --- a/src/client/callmanager.cpp +++ b/src/client/callmanager.cpp @@ -339,7 +339,7 @@ sendTextMessage(const std::string& callID, const std::string& message) #if HAVE_INSTANT_MESSAGING ring::Manager::instance().sendTextMessage(callID, message, "Me"); #else - RING_ERR("Could not send \"%s\" text message to %s since SFLphone daemon does not support it, please recompile with instant messaging support", message.c_str(), callID.c_str()); + RING_ERR("Could not send \"%s\" text message to %s since Ring daemon does not support it, please recompile with instant messaging support", message.c_str(), callID.c_str()); #endif } diff --git a/src/iax/iaxcall.h b/src/iax/iaxcall.h index 54bb031d9b8912b1b6d56f321b995eae6073dc82..6472330b2bdba23575b7d9b61bdc31443964cd28 100644 --- a/src/iax/iaxcall.h +++ b/src/iax/iaxcall.h @@ -47,6 +47,32 @@ class IAXAccount; class RingBuffer; class AudioBuffer; +/** Enumeration that contains known audio payloads */ +enum { + // http://www.iana.org/assignments/rtp-parameters + // http://www.gnu.org/software/ccrtp/doc/refman/html/formats_8h.html#a0 + // 0 PCMU A 8000 1 [RFC3551] + PAYLOAD_CODEC_ULAW = 0, + // 3 GSM A 8000 1 [RFC3551] + PAYLOAD_CODEC_GSM = 3, + // 8 PCMA A 8000 1 [RFC3551] + PAYLOAD_CODEC_ALAW = 8, + // 9 G722 A 8000 1 [RFC3551] + PAYLOAD_CODEC_G722 = 9, + // http://www.ietf.org/rfc/rfc3952.txt + // 97 iLBC/8000 + PAYLOAD_CODEC_ILBC_20 = 97, + PAYLOAD_CODEC_ILBC_30 = 98, + // http://www.speex.org/drafts/draft-herlein-speex-rtp-profile-00.txt + // 97 speex/8000 + // http://support.xten.com/viewtopic.php?p=8684&sid=3367a83d01fdcad16c7459a79859b08e + // 100 speex/16000 + PAYLOAD_CODEC_SPEEX_8000 = 110, + PAYLOAD_CODEC_SPEEX_16000 = 111, + PAYLOAD_CODEC_SPEEX_32000 = 112 +}; + + /** * @file: iaxcall.h * @brief IAXCall are IAX implementation of a normal Call diff --git a/src/iax/iaxvoiplink.h b/src/iax/iaxvoiplink.h index 5f0fbbd3989a94b00279c67215f94f48119a7946..09078ed76f8640ed31d109da5dbaaedffca7350c 100644 --- a/src/iax/iaxvoiplink.h +++ b/src/iax/iaxvoiplink.h @@ -38,7 +38,6 @@ #endif #include "audio/audiobuffer.h" -#include "audio/codecs/audiocodec.h" // for RAW_BUFFER_SIZE #include "ring_types.h" #include <iax/iax-client.h> @@ -47,6 +46,9 @@ #include <memory> #include <random> +#define RAW_BUFFER_SIZE (120 * 48000 / 1000) + + namespace ring { class IAXAccount; diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 317b39eb70d2c805b7094bd220d2d433c6a56821..d595750580325738b82e13d78df385c4fe763fd0 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -214,7 +214,7 @@ ManagerImpl::ManagerImpl() : std::seed_seq seed {rdev(), rdev()}; rand_.seed(seed); - ring::libav_utils::sfl_avcodec_init(); + ring::libav_utils::ring_avcodec_init(); } ManagerImpl::~ManagerImpl() diff --git a/src/media/audio/audiolayer.h b/src/media/audio/audiolayer.h index dd448a3e6cf04a1ec71e685cfb34c16e5bda79f0..78fad4f1d386cd351517bf5502a47b4dbb0a2d47 100644 --- a/src/media/audio/audiolayer.h +++ b/src/media/audio/audiolayer.h @@ -238,7 +238,7 @@ class AudioLayer { bool isStarted_; /** - * Sample Rate SFLphone should send sound data to the sound card + * Sample Rate Ring should send sound data to the sound card */ AudioFormat audioFormat_; diff --git a/src/media/audio/codecs/Makefile.am b/src/media/audio/codecs/Makefile.am deleted file mode 100644 index 275a2d523a3f36a84a84c0ec3c8412280e6e4302..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/Makefile.am +++ /dev/null @@ -1,120 +0,0 @@ -include $(top_srcdir)/globals.mak - -noinst_LTLIBRARIES = libcodecdescriptor.la - -libcodecdescriptor_la_SOURCES = audiocodecfactory.cpp audiocodec.cpp audiocodec.h audiocodecfactory.h -libcodecdescriptor_la_CXXFLAGS = -fPIC - -if BUILD_GSM -GSM_LIB = libcodec_gsm.so -libcodec_gsm_so_SOURCES = gsmcodec.cpp -libcodec_gsm_so_CXXFLAGS = -fPIC -g -Wall -libcodec_gsm_so_LDFLAGS = --shared -lc -lgsm -libcodec_gsm_so_LDADD = libcodecdescriptor.la -INSTALL_GSM_RULE = install-libcodec_gsm_so -endif - -if BUILD_SPEEX -SPEEX_LIB = libcodec_speex.so -libcodec_speex_so_SOURCES = speexcodec.cpp speexcodec.h -libcodec_speex_so_CXXFLAGS = -fPIC -g -Wall @SPEEX_CFLAGS@ -libcodec_speex_so_LDFLAGS = --shared -lc @SPEEX_LIBS@ -libcodec_speex_so_LDADD = libcodecdescriptor.la -INSTALL_SPEEX_RULE = install-libcodec_speex_so -endif - -if BUILD_OPUS -OPUS_LIB = libcodec_opus.so -libcodec_opus_so_SOURCES = opuscodec.cpp opuscodec.h -libcodec_opus_so_CXXFLAGS = -fPIC -g -Wall $(opus_CFLAGS) -libcodec_opus_so_LDFLAGS = --shared -lc -lstdc++ $(opus_LIBS) -libcodec_opus_so_LDADD = libcodecdescriptor.la -INSTALL_OPUS_RULE = install-libcodec_opus_so -endif - -if BUILD_ILBC -ILBC_LIB = libcodec_ilbc.so -libcodecdescriptor_la_CXXFLAGS += -DBUILD_ILBC -libcodec_ilbc_so_SOURCES = ilbc.cpp -libcodec_ilbc_so_CXXFLAGS = -fPIC -g -Wall $(libilbc_CFLAGS) -libcodec_ilbc_so_LDFLAGS = --shared -lc $(libilbc_LIBS) -libcodec_ilbc_so_LDADD = libcodecdescriptor.la -INSTALL_ILBC_RULE = install-libcodec_ilbc_so -endif - -noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so libcodec_g722.so libcodec_g729.so $(OPUS_LIB) $(GSM_LIB) $(SPEEX_LIB) $(ILBC_LIB) - -libcodec_ulaw_so_SOURCES = ulaw.cpp g711.h -libcodec_ulaw_so_CXXFLAGS = -fPIC -g -Wall -libcodec_ulaw_so_LDADD = libcodecdescriptor.la -libcodec_ulaw_so_LDFLAGS = --shared -lc - -libcodec_alaw_so_SOURCES = alaw.cpp g711.h -libcodec_alaw_so_CXXFLAGS = -fPIC -g -Wall -libcodec_alaw_so_LDADD = libcodecdescriptor.la -libcodec_alaw_so_LDFLAGS = --shared -lc - -libcodec_g722_so_SOURCES = g722.cpp g722.h -libcodec_g722_so_CXXFLAGS = -fPIC -g -Wall -libcodec_g722_so_LDADD = libcodecdescriptor.la -libcodec_g722_so_LDFLAGS = --shared -lc - -libcodec_g729_so_SOURCES = g729.cpp g729.h -libcodec_g729_so_CXXFLAGS = -fPIC -g -Wall -libcodec_g729_so_LDADD = libcodecdescriptor.la -libcodec_g729_so_LDFLAGS = --shared -lc -ldl -lstdc++ - -install-exec-local: install-libcodec_ulaw_so install-libcodec_alaw_so install-libcodec_g722_so install-libcodec_g729_so $(INSTALL_OPUS_RULE) $(INSTALL_GSM_RULE) $(INSTALL_SPEEX_NB_RULE) $(INSTALL_SPEEX_WB_RULE) $(INSTALL_SPEEX_UB_RULE) $(INSTALL_ILBC_RULE) -uninstall-local: uninstall-libcodec_ulaw_so uninstall-libcodec_alaw_so uninstall-libcodec_g722_so uninstall-libcodec_g729_so uninstall-libcodec_opus_so uninstall-libcodec_gsm_so uninstall-libcodec_speex_nb_so uninstall-libcodec_speex_wb_so uninstall-libcodec_speex_ub_so uninstall-libcodec_ilbc_so - -install-libcodec_ulaw_so: libcodec_ulaw.so - mkdir -p $(sflcodecdir) - $(INSTALL_PROGRAM) libcodec_ulaw.so $(sflcodecdir) -install-libcodec_alaw_so: libcodec_alaw.so - mkdir -p $(sflcodecdir) - $(INSTALL_PROGRAM) libcodec_alaw.so $(sflcodecdir) -install-libcodec_g722_so: libcodec_g722.so - mkdir -p $(sflcodecdir) - $(INSTALL_PROGRAM) libcodec_g722.so $(sflcodecdir) -install-libcodec_g729_so: libcodec_g729.so - mkdir -p $(sflcodecdir) - $(INSTALL_PROGRAM) libcodec_g729.so $(sflcodecdir) -install-libcodec_opus_so: libcodec_opus.so - mkdir -p $(sflcodecdir) - $(INSTALL_PROGRAM) libcodec_opus.so $(sflcodecdir) -install-libcodec_gsm_so: libcodec_gsm.so - mkdir -p $(sflcodecdir) - $(INSTALL_PROGRAM) libcodec_gsm.so $(sflcodecdir) -install-libcodec_speex_nb_so: libcodec_speex_nb.so - mkdir -p $(sflcodecdir) - $(INSTALL_PROGRAM) libcodec_speex_nb.so $(sflcodecdir) -install-libcodec_speex_wb_so: libcodec_speex_wb.so - mkdir -p $(sflcodecdir) - $(INSTALL_PROGRAM) libcodec_speex_wb.so $(sflcodecdir) -install-libcodec_speex_ub_so: libcodec_speex_ub.so - mkdir -p $(sflcodecdir) - $(INSTALL_PROGRAM) libcodec_speex_ub.so $(sflcodecdir) -install-libcodec_ilbc_so: libcodec_ilbc.so - mkdir -p $(sflcodecdir) - $(INSTALL_PROGRAM) libcodec_ilbc.so $(sflcodecdir) - -uninstall-libcodec_ulaw_so: - rm -f $(sflcodecdir)/libcodec_ulaw.so -uninstall-libcodec_alaw_so: - rm -f $(sflcodecdir)/libcodec_alaw.so -uninstall-libcodec_g722_so: - rm -f $(sflcodecdir)/libcodec_g722.so -uninstall-libcodec_g729_so: - rm -f $(sflcodecdir)/libcodec_g729.so -uninstall-libcodec_opus_so: - rm -f $(sflcodecdir)/libcodec_opus.so -uninstall-libcodec_gsm_so: - rm -f $(sflcodecdir)/libcodec_gsm.so -uninstall-libcodec_speex_nb_so: - rm -f $(sflcodecdir)/libcodec_speex_nb.so -uninstall-libcodec_speex_wb_so: - rm -f $(sflcodecdir)/libcodec_speex_wb.so -uninstall-libcodec_speex_ub_so: - rm -f $(sflcodecdir)/libcodec_speex_ub.so -uninstall-libcodec_ilbc_so: - rm -f $(sflcodecdir)/libcodec_ilbc.so diff --git a/src/media/audio/codecs/README b/src/media/audio/codecs/README deleted file mode 100644 index 0a82f9aab20d7cbe53e67419daf069a7d40a1899..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/README +++ /dev/null @@ -1,24 +0,0 @@ -How to build the codec shared libraries ---------------------------------------- - -CODEC_ALAW: - gcc -fPIC -g -c -Wall ulaw.cpp --------> gives you the object file ulaw.o. --------> option -g to include debug information --------> option -Wall to generate warnings --------> option -fPIC to enable position independant code generation - - gcc -shared -o libcodec_ulaw.so ulaw.o -lc --------> creates the shared library - -CODEC ALAW: - idem - -CODEC_GSM: - gcc -fPIC -g -c -Wall gsmcodec.cpp - gcc -shared -o -libcodec_gsm.so gsmcodec.o -lc -lgsm --------> You need the standard library libgsm1 installed (with dev package). - -REFERENCES: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html - -The shared library should be installed in $(libdir)/ring/codecs where libdir=$(PREFIX)/lib. diff --git a/src/media/audio/codecs/alaw.cpp b/src/media/audio/codecs/alaw.cpp deleted file mode 100644 index 5fe627791dd302c37cfebb13906320663b16158d..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/alaw.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Yan Morin <yan.morin@savoirfairelinux.com> - * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "ring_types.h" -#include "audiocodec.h" -#include "ring_plugin.h" -#include "g711.h" - -class Alaw : public ring::AudioCodec { - - public: - // 8 PCMA A 8000 1 [RFC3551] - Alaw() : ring::AudioCodec(8, "PCMA", 8000, 160, 1) { - bitrate_ = 64; - hasDynamicPayload_ = false; - } - - private: - AudioCodec * - clone() - { - return new Alaw; - } - - int decode(ring::AudioSample *pcm, unsigned char *data, size_t len) - { - for (unsigned char* end = data + len; data < end; ++data, ++pcm) - *pcm = ALawDecode(*data); - - return len; - } - - int encode(unsigned char *data, ring::AudioSample *pcm, size_t max_data_bytes) - { - unsigned char *end = std::min(data + frameSize_, data + max_data_bytes); - unsigned char *tmp = data; - - for (; tmp < end; ++pcm, ++tmp) - *tmp = ALawEncode(*pcm); - - return end - data; - } - - static ring::AudioSample ALawDecode(unsigned char alaw) { - return alaw_to_linear(alaw); - } - - static unsigned char ALawEncode(ring::AudioSample pcm16) { - return linear_to_alaw(pcm16); - } -}; - -// the class factories -// cppcheck-suppress unusedFunction -RING_PLUGIN_EXIT(pluginExit) {} - -// cppcheck-suppress unusedFunction -RING_PLUGIN_INIT_DYNAMIC(pluginAPI) -{ - std::unique_ptr<Alaw> codec(new Alaw); - - if (!pluginAPI->invokeService(pluginAPI, "registerAudioCodec", - reinterpret_cast<void*>(codec.get()))) { - codec.release(); - return pluginExit; - } - - return nullptr; -} diff --git a/src/media/audio/codecs/audiocodec.cpp b/src/media/audio/codecs/audiocodec.cpp deleted file mode 100644 index 0ba8676b1123e9356f38e443cacc74186c9b55eb..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/audiocodec.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * - * Mostly borrowed from asterisk's sources (Steve Underwood <steveu@coppice.org>) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "audiocodec.h" -#include <cassert> - -namespace ring { - -using std::ptrdiff_t; - -AudioCodec::AudioCodec(uint8_t payload, const std::string &codecName, uint32_t clockRate, unsigned frameSize, uint8_t channels) : - codecName_(codecName), - clockRate_(clockRate), - clockRateCur_(clockRate), - channels_(channels), - channelsCur_(channels), - frameSize_(frameSize), - bitrate_(0.0), - payload_(payload), - hasDynamicPayload_((payload_ >= 96 and payload_ <= 127) or payload_ == 9) -{} - -AudioCodec::AudioCodec(const AudioCodec& c) : - codecName_(c.codecName_), - clockRate_(c.clockRate_), - clockRateCur_(c.clockRateCur_), - channels_(c.channels_), - channelsCur_(c.channelsCur_), - frameSize_(c.frameSize_), - bitrate_(c.bitrate_), - payload_(c.payload_), - hasDynamicPayload_(c.hasDynamicPayload_) -{} - -int AudioCodec::decode(AudioSample *, unsigned char *, size_t) -{ - // Unimplemented! - assert(false); - return 0; -} - -int AudioCodec::encode(unsigned char *, AudioSample *, size_t) -{ - // Unimplemented! - assert(false); - return 0; -} - - -// Mono only, subclasses must implement multichannel support -int AudioCodec::decode(std::vector<std::vector<AudioSample> > &pcm, const uint8_t* data, size_t len) -{ - return decode(pcm[0].data(), const_cast<uint8_t*>(data), len); -} - -// Mono only, subclasses must implement multichannel support -size_t AudioCodec::encode(const std::vector<std::vector<AudioSample> > &pcm, uint8_t *data, size_t len) -{ - return encode(data, const_cast<AudioSample*>(pcm[0].data()), len); -} - -int AudioCodec::decode(std::vector<std::vector<AudioSample> > &pcm) -{ - pcm.clear(); - return frameSize_; -} - -std::string AudioCodec::getMimeSubtype() const -{ - return codecName_; -} - -uint8_t AudioCodec::getPayloadType() const -{ - return payload_; -} - -bool AudioCodec::hasDynamicPayload() const -{ - return hasDynamicPayload_; -} - -uint32_t AudioCodec::getClockRate() const -{ - return clockRate_; -} - -uint32_t AudioCodec::getCurrentClockRate() const -{ - return clockRateCur_; -} - -uint32_t AudioCodec::getSDPClockRate() const -{ - return clockRate_; -} - -unsigned AudioCodec::getFrameSize() const -{ - return frameSize_; -} - -double AudioCodec::getBitRate() const -{ - return bitrate_; -} - -uint8_t AudioCodec::getChannels() const -{ - return channels_; -} - -uint8_t AudioCodec::getCurrentChannels() const -{ - return channelsCur_; -} - -const char * -AudioCodec::getSDPChannels() const -{ - return ""; -} - -} // namespace ring diff --git a/src/media/audio/codecs/audiocodec.h b/src/media/audio/codecs/audiocodec.h deleted file mode 100644 index b012e7faa71795c7f3399d890ac84c03f5272c5c..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/audiocodec.h +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * - * Mostly borrowed from asterisk's sources (Steve Underwood <steveu@coppice.org>) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ -#ifndef __AUDIO_CODEC_H__ -#define __AUDIO_CODEC_H__ - -#include "ring_types.h" - -#include <string> -#include <vector> - -// Opus documentation: -// "If this is less than the maximum packet duration (120ms; 5760 for 48kHz), -// opus_decode will not be capable of decoding some packets." -#define RAW_BUFFER_SIZE (120 * 48000 / 1000) - -namespace ring { - -class AudioCodec { - public: - AudioCodec(uint8_t payload, const std::string &codecName, uint32_t clockRate, unsigned frameSize, uint8_t channels); - - /** - * Copy constructor. - */ - AudioCodec(const AudioCodec& codec); - - virtual AudioCodec * clone() = 0; - - virtual ~AudioCodec() {}; - - std::string getMimeSubtype() const; - - /** - * Multichannel version of decode(). - * Default implementation calls mono version - */ - virtual int decode(std::vector<std::vector<AudioSample> > &pcm, const uint8_t* data, size_t len); - - /** - * Inform the codec of a lost packet and perform packet loss concealment. - * Default implementation fills dst with 0. - */ - virtual int decode(std::vector<std::vector<AudioSample> > &pcm); - - /** - * Multichannel version of encode(). - * Default implementation calls encode() on the first channel (assume 1 channel). - * @return the number of bytes encoded - */ - virtual size_t encode(const std::vector<std::vector<AudioSample> > &pcm, uint8_t *data, size_t len); - - uint8_t getPayloadType() const; - - void setPayloadType(uint8_t pt) { - payload_ = pt; - } - - /** - * @return true if this payload is a dynamic one. - */ - bool hasDynamicPayload() const; - - /** - * Having Packet Loss Concealment (PLC) supported means decode(dst) won't - * fill the buffer with 0 but will rather try to conceal the loss. - * @return true if the codec supports PLC, false otherwise. - */ - virtual inline bool supportsPacketLossConcealment() const { - return false; - } - - /** - * @returns maximum supported clock rate (sample rate). - */ - uint32_t getClockRate() const; - - /** - * @returns currently configured clock rate (sample rate). - */ - uint32_t getCurrentClockRate() const; - - /** - * Clock-rate in SDP MAY be different than actual clock-rate - * (in derived classes). - * @returns Clock-rate as it should be reported by SDP - * during negociation. - */ - virtual uint32_t getSDPClockRate() const; - - double getBitRate() const; - - /** - * @returns maximum supported channel number. - */ - uint8_t getChannels() const; - - /** - * @returns currently configured channel number. - */ - uint8_t getCurrentChannels() const; - - /** - * Channels in SDP MAY be different than actual channels. - * Should be an empty string EXCEPT for Opus which returns "2". - * @returns Supported channel number as it should be reported by SDP - * during negociation. - */ - virtual const char * getSDPChannels() const; - - /** - * @return the framing size for this codec. - */ - unsigned int getFrameSize() const; - - /** - * Set the sampling rate and channel number preferred by the core. - * May or may not be considered by the codec. - * Use getCurrentClockRate() and getCurrentChannels() to get the format - * used by the codec. - */ - virtual void setOptimalFormat(uint32_t /* sample_rate */ , uint8_t /* channels */ ) {} - - protected: - /** - * Decode an input buffer and fill the output buffer with the decoded data - * @param pcm: output signal - * @param data: input buffer to decode - * @param len: length of input buffer - * @return the number of samples decoded - */ - virtual int decode(AudioSample *pcm, unsigned char *data, size_t len); - - /** - * Encode an input buffer and fill the output buffer with the encoded data - * @param data: output buffer, must be at least as big as max_data_bytes - * @param pcm: input signal - * @param max_data_bytes: the maximum size of the encoded data buffer (data) - * @return the number of bytes encoded - */ - virtual int encode(unsigned char *data, AudioSample *pcm, size_t max_data_bytes); - - /** Holds SDP-compliant codec name */ - std::string codecName_; // what we put inside sdp - - /** Clock rate or sample rate of the codec, in Hz */ - uint32_t clockRate_, clockRateCur_; - - /** Number of channels 1 = mono, 2 = stereo */ - uint8_t channels_, channelsCur_; - - /** codec frame size in samples*/ - unsigned frameSize_; - - /** Bitrate */ - double bitrate_; - - uint8_t payload_; - bool hasDynamicPayload_; - - private: - AudioCodec& operator=(const AudioCodec&); - -}; - -/** Enumeration that contains known audio payloads */ -enum { - // http://www.iana.org/assignments/rtp-parameters - // http://www.gnu.org/software/ccrtp/doc/refman/html/formats_8h.html#a0 - // 0 PCMU A 8000 1 [RFC3551] - PAYLOAD_CODEC_ULAW = 0, - // 3 GSM A 8000 1 [RFC3551] - PAYLOAD_CODEC_GSM = 3, - // 8 PCMA A 8000 1 [RFC3551] - PAYLOAD_CODEC_ALAW = 8, - // 9 G722 A 8000 1 [RFC3551] - PAYLOAD_CODEC_G722 = 9, - // http://www.ietf.org/rfc/rfc3952.txt - // 97 iLBC/8000 - PAYLOAD_CODEC_ILBC_20 = 97, - PAYLOAD_CODEC_ILBC_30 = 98, - // http://www.speex.org/drafts/draft-herlein-speex-rtp-profile-00.txt - // 97 speex/8000 - // http://support.xten.com/viewtopic.php?p=8684&sid=3367a83d01fdcad16c7459a79859b08e - // 100 speex/16000 - PAYLOAD_CODEC_SPEEX_8000 = 110, - PAYLOAD_CODEC_SPEEX_16000 = 111, - PAYLOAD_CODEC_SPEEX_32000 = 112 -}; - -} // namespace ring - -#endif diff --git a/src/media/audio/codecs/g711.h b/src/media/audio/codecs/g711.h deleted file mode 100644 index 3d9018471ca04fa873872c33c96fe69f15176821..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/g711.h +++ /dev/null @@ -1,354 +0,0 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * g711.h - In line A-law and u-law conversion routines - * - * Written by Steve Underwood <steveu@coppice.org> - * - * Copyright (C) 2001 Steve Underwood - * - * Despite my general liking of the GPL, I place this code in the - * public domain for the benefit of all mankind - even the slimy - * ones who might try to proprietize my work and use it to my - * detriment. - * - * $Id: g711.h,v 1.1 2006/06/07 15:46:39 steveu Exp $ - */ - -/*! \file */ - -/*! \page g711_page A-law and mu-law handling -Lookup tables for A-law and u-law look attractive, until you consider the impact -on the CPU cache. If it causes a substantial area of your processor cache to get -hit too often, cache sloshing will severely slow things down. The main reason -these routines are slow in C, is the lack of direct access to the CPU's "find -the first 1" instruction. A little in-line assembler fixes that, and the -conversion routines can be faster than lookup tables, in most real world usage. -A "find the first 1" instruction is available on most modern CPUs, and is a -much underused feature. - -If an assembly language method of bit searching is not available, these routines -revert to a method that can be a little slow, so the cache thrashing might not -seem so bad :( - -Feel free to submit patches to add fast "find the first 1" support for your own -favourite processor. - -Look up tables are used for transcoding between A-law and u-law, since it is -difficult to achieve the precise transcoding procedure laid down in the G.711 -specification by other means. -*/ - -#if !defined(_G711_H_) -#define _G711_H_ - -#include <stdint.h> - -#if defined(__i386__) -/*! \brief Find the bit position of the highest set bit in a word - \param bits The word to be searched - \return The bit number of the highest set bit, or -1 if the word is zero. */ -static __inline__ int top_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movl $-1,%%edx;\n" - " bsrl %%eax,%%edx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ - -/*! \brief Find the bit position of the lowest set bit in a word - \param bits The word to be searched - \return The bit number of the lowest set bit, or -1 if the word is zero. */ -static __inline__ int bottom_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movl $-1,%%edx;\n" - " bsfl %%eax,%%edx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ -#elif defined(__x86_64__) -static __inline__ int top_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movq $-1,%%rdx;\n" - " bsrq %%rax,%%rdx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ - -static __inline__ int bottom_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movq $-1,%%rdx;\n" - " bsfq %%rax,%%rdx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ -#else -static __inline__ int top_bit(unsigned int bits) -{ - int i; - - if (bits == 0) - return -1; - i = 0; - if (bits & 0xFFFF0000) - { - bits &= 0xFFFF0000; - i += 16; - } - if (bits & 0xFF00FF00) - { - bits &= 0xFF00FF00; - i += 8; - } - if (bits & 0xF0F0F0F0) - { - bits &= 0xF0F0F0F0; - i += 4; - } - if (bits & 0xCCCCCCCC) - { - bits &= 0xCCCCCCCC; - i += 2; - } - if (bits & 0xAAAAAAAA) - { - bits &= 0xAAAAAAAA; - i += 1; - } - return i; -} -/*- End of function --------------------------------------------------------*/ - -static __inline__ int bottom_bit(unsigned int bits) -{ - int i; - - if (bits == 0) - return -1; - i = 32; - if (bits & 0x0000FFFF) - { - bits &= 0x0000FFFF; - i -= 16; - } - if (bits & 0x00FF00FF) - { - bits &= 0x00FF00FF; - i -= 8; - } - if (bits & 0x0F0F0F0F) - { - bits &= 0x0F0F0F0F; - i -= 4; - } - if (bits & 0x33333333) - { - bits &= 0x33333333; - i -= 2; - } - if (bits & 0x55555555) - { - bits &= 0x55555555; - i -= 1; - } - return i; -} -/*- End of function --------------------------------------------------------*/ -#endif - -/* N.B. It is tempting to use look-up tables for A-law and u-law conversion. - * However, you should consider the cache footprint. - * - * A 64K byte table for linear to x-law and a 512 byte table for x-law to - * linear sound like peanuts these days, and shouldn't an array lookup be - * real fast? No! When the cache sloshes as badly as this one will, a tight - * calculation may be better. The messiest part is normally finding the - * segment, but a little inline assembly can fix that on an i386, x86_64 and - * many other modern processors. - */ - -/* - * Mu-law is basically as follows: - * - * Biased Linear Input Code Compressed Code - * ------------------------ --------------- - * 00000001wxyza 000wxyz - * 0000001wxyzab 001wxyz - * 000001wxyzabc 010wxyz - * 00001wxyzabcd 011wxyz - * 0001wxyzabcde 100wxyz - * 001wxyzabcdef 101wxyz - * 01wxyzabcdefg 110wxyz - * 1wxyzabcdefgh 111wxyz - * - * Each biased linear code has a leading 1 which identifies the segment - * number. The value of the segment number is equal to 7 minus the number - * of leading 0's. The quantization interval is directly available as the - * four bits wxyz. * The trailing bits (a - h) are ignored. - * - * Ordinarily the complement of the resulting code word is used for - * transmission, and so the code word is complemented before it is returned. - * - * For further information see John C. Bellamy's Digital Telephony, 1982, - * John Wiley & Sons, pps 98-111 and 472-476. - */ - -//#define ULAW_ZEROTRAP /* turn on the trap as per the MIL-STD */ -#define ULAW_BIAS 0x84 /* Bias for linear code. */ - -/*! \brief Encode a linear sample to u-law - \param linear The sample to encode. - \return The u-law value. -*/ -static __inline__ uint8_t linear_to_ulaw(int linear) -{ - uint8_t u_val; - int mask; - int seg; - - /* Get the sign and the magnitude of the value. */ - if (linear < 0) - { - linear = ULAW_BIAS - linear; - mask = 0x7F; - } - else - { - linear = ULAW_BIAS + linear; - mask = 0xFF; - } - - seg = top_bit(linear | 0xFF) - 7; - - /* - * Combine the sign, segment, quantization bits, - * and complement the code word. - */ - if (seg >= 8) - u_val = (uint8_t) (0x7F ^ mask); - else - u_val = (uint8_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask); -#ifdef ULAW_ZEROTRAP - /* Optional ITU trap */ - if (u_val == 0) - u_val = 0x02; -#endif - return u_val; -} -/*- End of function --------------------------------------------------------*/ - -/*! \brief Decode an u-law sample to a linear value. - \param ulaw The u-law sample to decode. - \return The linear value. -*/ -static __inline__ int16_t ulaw_to_linear(uint8_t ulaw) -{ - int t; - - /* Complement to obtain normal u-law value. */ - ulaw = ~ulaw; - /* - * Extract and bias the quantization bits. Then - * shift up by the segment number and subtract out the bias. - */ - t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4); - return (int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS)); -} -/*- End of function --------------------------------------------------------*/ - -/* - * A-law is basically as follows: - * - * Linear Input Code Compressed Code - * ----------------- --------------- - * 0000000wxyza 000wxyz - * 0000001wxyza 001wxyz - * 000001wxyzab 010wxyz - * 00001wxyzabc 011wxyz - * 0001wxyzabcd 100wxyz - * 001wxyzabcde 101wxyz - * 01wxyzabcdef 110wxyz - * 1wxyzabcdefg 111wxyz - * - * For further information see John C. Bellamy's Digital Telephony, 1982, - * John Wiley & Sons, pps 98-111 and 472-476. - */ - -#define ALAW_AMI_MASK 0x55 - -/*! \brief Encode a linear sample to A-law - \param linear The sample to encode. - \return The A-law value. -*/ -static __inline__ uint8_t linear_to_alaw(int linear) -{ - int mask; - int seg; - - if (linear >= 0) - { - /* Sign (bit 7) bit = 1 */ - mask = ALAW_AMI_MASK | 0x80; - } - else - { - /* Sign (bit 7) bit = 0 */ - mask = ALAW_AMI_MASK; - linear = -linear - 8; - } - - /* Convert the scaled magnitude to segment number. */ - seg = top_bit(linear | 0xFF) - 7; - if (seg >= 8) - { - if (linear >= 0) - { - /* Out of range. Return maximum value. */ - return (uint8_t) (0x7F ^ mask); - } - /* We must be just a tiny step below zero */ - return (uint8_t) (0x00 ^ mask); - } - /* Combine the sign, segment, and quantization bits. */ - return (uint8_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask); -} -/*- End of function --------------------------------------------------------*/ - -/*! \brief Decode an A-law sample to a linear value. - \param alaw The A-law sample to decode. - \return The linear value. -*/ -static __inline__ int16_t alaw_to_linear(uint8_t alaw) -{ - int i; - int seg; - - alaw ^= ALAW_AMI_MASK; - i = ((alaw & 0x0F) << 4); - seg = (((int) alaw & 0x70) >> 4); - if (seg) - i = (i + 0x108) << (seg - 1); - else - i += 8; - return (int16_t) ((alaw & 0x80) ? i : -i); -} -/*- End of function --------------------------------------------------------*/ - -#endif -/*- End of file ------------------------------------------------------------*/ diff --git a/src/media/audio/codecs/g722.cpp b/src/media/audio/codecs/g722.cpp deleted file mode 100644 index e3c5597d95272c40411a1230b84117c306ba6643..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/g722.cpp +++ /dev/null @@ -1,781 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * - * Mostly borrowed from asterisk's sources (Steve Underwood <steveu@coppice.org>) - * See: http://svnview.digium.com/svn/asterisk?view=revision&revision=194722 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "audiocodec.h" -#include "ring_types.h" -#include "ring_plugin.h" -#include "g722.h" - -#include <cstdlib> -#include <cstring> -#include <iostream> - -class G722 : public ring::AudioCodec { - - public: - G722() : ring::AudioCodec(9, "G722", 16000, 320, 1), decode_state_(), - encode_state_() { - bitrate_ = 64; - hasDynamicPayload_ = false; - - g722_state_init(decode_state_); - g722_state_init(encode_state_); - } - - private: - AudioCodec * - clone() - { - return new G722; - } - - int decode(ring::AudioSample *pcm, unsigned char *data, size_t len) - { - return g722_decode(pcm, data, len); - } - - int encode(unsigned char *data, ring::AudioSample *pcm, size_t max_data_bytes) - { - int out = g722_encode(data, pcm, std::min<size_t>(frameSize_, max_data_bytes)); - return out; - } - - static void g722_state_init(g722_state_t &state) { - state.itu_test_mode = false; - - // 8 => 64 kbps; 7 => 56 kbps; 6 => 48 kbps - state.bits_per_sample = 8; - - // Enable 8khz mode, encode using lower subband only - state.eight_k = false; - - // Never set packed true when using 64 kbps - state.packed = false; - - memset(state.band, 0, sizeof(state.band)); - state.band[0].det = 32; - state.band[1].det = 8; - - memset(state.x, 0, sizeof(state.x)); - - state.in_buffer = 0; - state.in_bits = 0; - state.out_buffer = 0; - state.out_bits = 0; - } - - ring::AudioSample saturate(int32_t amp) - { - ring::AudioSample amp16 = 0; - - /* Hopefully this is optimised for the common case - not clipping */ - amp16 = (ring::AudioSample) amp; - - if (amp == amp16) - return amp16; - - if (amp > INT16_MAX) - return INT16_MAX; - - return INT16_MIN; - } - - void block4_encode(int band, int d) { - int wd1 = 0; - int wd2 = 0; - int wd3 = 0; - int i = 0; - - /* Block 4, RECONS */ - encode_state_.band[band].d[0] = d; - encode_state_.band[band].r[0] = saturate(encode_state_.band[band].s + d); - - /* Block 4, PARREC */ - encode_state_.band[band].p[0] = saturate(encode_state_.band[band].sz + d); - - /* Block 4, UPPOL2 */ - - for (i = 0; i < 3; i++) - encode_state_.band[band].sg[i] = encode_state_.band[band].p[i] >> 15; - - wd1 = saturate(encode_state_.band[band].a[1] << 2); - - wd2 = (encode_state_.band[band].sg[0] == encode_state_.band[band].sg[1]) ? -wd1 : wd1; - - if (wd2 > 32767) - wd2 = 32767; - - wd3 = (wd2 >> 7) + ((encode_state_.band[band].sg[0] == encode_state_.band[band].sg[2]) ? 128 : -128); - - wd3 += (encode_state_.band[band].a[2]*32512) >> 15; - - if (wd3 > 12288) - wd3 = 12288; - else if (wd3 < -12288) - wd3 = -12288; - - encode_state_.band[band].ap[2] = wd3; - - /* Block 4, UPPOL1 */ - encode_state_.band[band].sg[0] = encode_state_.band[band].p[0] >> 15; - - encode_state_.band[band].sg[1] = encode_state_.band[band].p[1] >> 15; - - wd1 = (encode_state_.band[band].sg[0] == encode_state_.band[band].sg[1]) ? 192 : -192; - - wd2 = (encode_state_.band[band].a[1]*32640) >> 15; - - encode_state_.band[band].ap[1] = saturate(wd1 + wd2); - - wd3 = saturate(15360 - encode_state_.band[band].ap[2]); - - if (encode_state_.band[band].ap[1] > wd3) - encode_state_.band[band].ap[1] = wd3; - else if (encode_state_.band[band].ap[1] < -wd3) - encode_state_.band[band].ap[1] = -wd3; - - /* Block 4, UPZERO */ - wd1 = (d == 0) ? 0 : 128; - - encode_state_.band[band].sg[0] = d >> 15; - - for (i = 1; i < 7; i++) { - encode_state_.band[band].sg[i] = encode_state_.band[band].d[i] >> 15; - wd2 = (encode_state_.band[band].sg[i] == encode_state_.band[band].sg[0]) ? wd1 : -wd1; - wd3 = (encode_state_.band[band].b[i]*32640) >> 15; - encode_state_.band[band].bp[i] = saturate(wd2 + wd3); - } - - /* Block 4, DELAYA */ - for (i = 6; i > 0; i--) { - encode_state_.band[band].d[i] = encode_state_.band[band].d[i - 1]; - encode_state_.band[band].b[i] = encode_state_.band[band].bp[i]; - } - - for (i = 2; i > 0; i--) { - encode_state_.band[band].r[i] = encode_state_.band[band].r[i - 1]; - encode_state_.band[band].p[i] = encode_state_.band[band].p[i - 1]; - encode_state_.band[band].a[i] = encode_state_.band[band].ap[i]; - } - - /* Block 4, FILTEP */ - wd1 = saturate(encode_state_.band[band].r[1] + encode_state_.band[band].r[1]); - - wd1 = (encode_state_.band[band].a[1]*wd1) >> 15; - - wd2 = saturate(encode_state_.band[band].r[2] + encode_state_.band[band].r[2]); - - wd2 = (encode_state_.band[band].a[2]*wd2) >> 15; - - encode_state_.band[band].sp = saturate(wd1 + wd2); - - /* Block 4, FILTEZ */ - encode_state_.band[band].sz = 0; - - for (i = 6; i > 0; i--) { - wd1 = saturate(encode_state_.band[band].d[i] + encode_state_.band[band].d[i]); - encode_state_.band[band].sz += (encode_state_.band[band].b[i]*wd1) >> 15; - } - - encode_state_.band[band].sz = saturate(encode_state_.band[band].sz); - - /* Block 4, PREDIC */ - encode_state_.band[band].s = saturate(encode_state_.band[band].sp + encode_state_.band[band].sz); - - } - - void block4_decode(int band, int d) { - int wd1 = 0; - int wd2 = 0; - int wd3 = 0; - int i = 0; - - /* Block 4, RECONS */ - decode_state_.band[band].d[0] = d; - decode_state_.band[band].r[0] = saturate(decode_state_.band[band].s + d); - - /* Block 4, PARREC */ - decode_state_.band[band].p[0] = saturate(decode_state_.band[band].sz + d); - - /* Block 4, UPPOL2 */ - - for (i = 0; i < 3; i++) - decode_state_.band[band].sg[i] = decode_state_.band[band].p[i] >> 15; - - wd1 = saturate(decode_state_.band[band].a[1] << 2); - - wd2 = (decode_state_.band[band].sg[0] == decode_state_.band[band].sg[1]) ? -wd1 : wd1; - - if (wd2 > 32767) - wd2 = 32767; - - wd3 = (decode_state_.band[band].sg[0] == decode_state_.band[band].sg[2]) ? 128 : -128; - - wd3 += (wd2 >> 7); - - wd3 += (decode_state_.band[band].a[2]*32512) >> 15; - - if (wd3 > 12288) - wd3 = 12288; - else if (wd3 < -12288) - wd3 = -12288; - - decode_state_.band[band].ap[2] = wd3; - - /* Block 4, UPPOL1 */ - decode_state_.band[band].sg[0] = decode_state_.band[band].p[0] >> 15; - - decode_state_.band[band].sg[1] = decode_state_.band[band].p[1] >> 15; - - wd1 = (decode_state_.band[band].sg[0] == decode_state_.band[band].sg[1]) ? 192 : -192; - - wd2 = (decode_state_.band[band].a[1]*32640) >> 15; - - decode_state_.band[band].ap[1] = saturate(wd1 + wd2); - - wd3 = saturate(15360 - decode_state_.band[band].ap[2]); - - if (decode_state_.band[band].ap[1] > wd3) - decode_state_.band[band].ap[1] = wd3; - else if (decode_state_.band[band].ap[1] < -wd3) - decode_state_.band[band].ap[1] = -wd3; - - /* Block 4, UPZERO */ - wd1 = (d == 0) ? 0 : 128; - - decode_state_.band[band].sg[0] = d >> 15; - - for (i = 1; i < 7; i++) { - decode_state_.band[band].sg[i] = decode_state_.band[band].d[i] >> 15; - wd2 = (decode_state_.band[band].sg[i] == decode_state_.band[band].sg[0]) ? wd1 : -wd1; - wd3 = (decode_state_.band[band].b[i]*32640) >> 15; - decode_state_.band[band].bp[i] = saturate(wd2 + wd3); - } - - /* Block 4, DELAYA */ - for (i = 6; i > 0; i--) { - decode_state_.band[band].d[i] = decode_state_.band[band].d[i - 1]; - decode_state_.band[band].b[i] = decode_state_.band[band].bp[i]; - } - - for (i = 2; i > 0; i--) { - decode_state_.band[band].r[i] = decode_state_.band[band].r[i - 1]; - decode_state_.band[band].p[i] = decode_state_.band[band].p[i - 1]; - decode_state_.band[band].a[i] = decode_state_.band[band].ap[i]; - } - - /* Block 4, FILTEP */ - wd1 = saturate(decode_state_.band[band].r[1] + decode_state_.band[band].r[1]); - - wd1 = (decode_state_.band[band].a[1]*wd1) >> 15; - - wd2 = saturate(decode_state_.band[band].r[2] + decode_state_.band[band].r[2]); - - wd2 = (decode_state_.band[band].a[2]*wd2) >> 15; - - decode_state_.band[band].sp = saturate(wd1 + wd2); - - /* Block 4, FILTEZ */ - decode_state_.band[band].sz = 0; - - for (i = 6; i > 0; i--) { - wd1 = saturate(decode_state_.band[band].d[i] + decode_state_.band[band].d[i]); - decode_state_.band[band].sz += (decode_state_.band[band].b[i]*wd1) >> 15; - } - - decode_state_.band[band].sz = saturate(decode_state_.band[band].sz); - - /* Block 4, PREDIC */ - decode_state_.band[band].s = saturate(decode_state_.band[band].sp + decode_state_.band[band].sz); - } - - int g722_decode(ring::AudioSample amp[], const uint8_t g722_data[], int len) - { - static const int wl[8] = {-60, -30, 58, 172, 334, 538, 1198, 3042 }; - static const int rl42[16] = {0, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0 }; - static const int ilb[32] = { - 2048, 2093, 2139, 2186, 2233, 2282, 2332, - 2383, 2435, 2489, 2543, 2599, 2656, 2714, - 2774, 2834, 2896, 2960, 3025, 3091, 3158, - 3228, 3298, 3371, 3444, 3520, 3597, 3676, - 3756, 3838, 3922, 4008 - }; - static const int wh[3] = {0, -214, 798}; - static const int rh2[4] = {2, 1, 2, 1}; - static const int qm2[4] = {-7408, -1616, 7408, 1616}; - static const int qm4[16] = { - 0, -20456, -12896, -8968, - -6288, -4240, -2584, -1200, - 20456, 12896, 8968, 6288, - 4240, 2584, 1200, 0 - }; - static const int qm5[32] = { - -280, -280, -23352, -17560, - -14120, -11664, -9752, -8184, - -6864, -5712, -4696, -3784, - -2960, -2208, -1520, -880, - 23352, 17560, 14120, 11664, - 9752, 8184, 6864, 5712, - 4696, 3784, 2960, 2208, - 1520, 880, 280, -280 - }; - static const int qm6[64] = { - -136, -136, -136, -136, - -24808, -21904, -19008, -16704, - -14984, -13512, -12280, -11192, - -10232, -9360, -8576, -7856, - -7192, -6576, -6000, -5456, - -4944, -4464, -4008, -3576, - -3168, -2776, -2400, -2032, - -1688, -1360, -1040, -728, - 24808, 21904, 19008, 16704, - 14984, 13512, 12280, 11192, - 10232, 9360, 8576, 7856, - 7192, 6576, 6000, 5456, - 4944, 4464, 4008, 3576, - 3168, 2776, 2400, 2032, - 1688, 1360, 1040, 728, - 432, 136, -432, -136 - }; - static const int qmf_coeffs[12] = { - 3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11, - }; - - int dlowt = 0; - int rlow = 0; - int ihigh = 0; - int dhigh = 0; - int rhigh = 0; - int xout1 = 0; - int xout2 = 0; - int wd1 = 0; - int wd2 = 0; - int wd3 = 0; - int code = 0; - int outlen = 0; - int i = 0; - int j = 0; - - outlen = 0; - rhigh = 0; - - - - for (j = 0; j < len;) { - if (decode_state_.packed) { - /* Unpack the code bits */ - if (decode_state_.in_bits < decode_state_.bits_per_sample) { - decode_state_.in_buffer |= (g722_data[j++] << decode_state_.in_bits); - decode_state_.in_bits += 8; - } - - code = decode_state_.in_buffer & ((1 << decode_state_.bits_per_sample) - 1); - - decode_state_.in_buffer >>= decode_state_.bits_per_sample; - decode_state_.in_bits -= decode_state_.bits_per_sample; - } else { - code = g722_data[j++]; - } - - switch (decode_state_.bits_per_sample) { - - default: - - case 8: - wd1 = code & 0x3F; - ihigh = (code >> 6) & 0x03; - wd2 = qm6[wd1]; - wd1 >>= 2; - break; - - case 7: - wd1 = code & 0x1F; - ihigh = (code >> 5) & 0x03; - wd2 = qm5[wd1]; - wd1 >>= 1; - break; - - case 6: - wd1 = code & 0x0F; - ihigh = (code >> 4) & 0x03; - wd2 = qm4[wd1]; - break; - } - - /* Block 5L, LOW BAND INVQBL */ - wd2 = (decode_state_.band[0].det*wd2) >> 15; - - /* Block 5L, RECONS */ - rlow = decode_state_.band[0].s + wd2; - - /* Block 6L, LIMIT */ - if (rlow > 16383) - rlow = 16383; - else if (rlow < -16384) - rlow = -16384; - - /* Block 2L, INVQAL */ - wd2 = qm4[wd1]; - - dlowt = (decode_state_.band[0].det*wd2) >> 15; - - /* Block 3L, LOGSCL */ - wd2 = rl42[wd1]; - - wd1 = (decode_state_.band[0].nb*127) >> 7; - - wd1 += wl[wd2]; - - if (wd1 < 0) - wd1 = 0; - else if (wd1 > 18432) - wd1 = 18432; - - decode_state_.band[0].nb = wd1; - - /* Block 3L, SCALEL */ - wd1 = (decode_state_.band[0].nb >> 6) & 31; - - wd2 = 8 - (decode_state_.band[0].nb >> 11); - - wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2); - - decode_state_.band[0].det = wd3 << 2; - - block4_decode(0, dlowt); - - if (!decode_state_.eight_k) { - /* Block 2H, INVQAH */ - wd2 = qm2[ihigh]; - dhigh = (decode_state_.band[1].det*wd2) >> 15; - /* Block 5H, RECONS */ - rhigh = dhigh + decode_state_.band[1].s; - /* Block 6H, LIMIT */ - - if (rhigh > 16383) - rhigh = 16383; - else if (rhigh < -16384) - rhigh = -16384; - - /* Block 2H, INVQAH */ - wd2 = rh2[ihigh]; - - wd1 = (decode_state_.band[1].nb*127) >> 7; - - wd1 += wh[wd2]; - - if (wd1 < 0) - wd1 = 0; - else if (wd1 > 22528) - wd1 = 22528; - - decode_state_.band[1].nb = wd1; - - /* Block 3H, SCALEH */ - wd1 = (decode_state_.band[1].nb >> 6) & 31; - - wd2 = 10 - (decode_state_.band[1].nb >> 11); - - wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2); - - decode_state_.band[1].det = wd3 << 2; - - block4_decode(1, dhigh); - } - - if (decode_state_.itu_test_mode) { - amp[outlen++] = (ring::AudioSample)(rlow << 1); - amp[outlen++] = (ring::AudioSample)(rhigh << 1); - } else { - if (decode_state_.eight_k) { - amp[outlen++] = (ring::AudioSample) (rlow << 1); - } else { - /* Apply the receive QMF */ - for (i = 0; i < 22; i++) - decode_state_.x[i] = decode_state_.x[i + 2]; - - decode_state_.x[22] = rlow + rhigh; - - decode_state_.x[23] = rlow - rhigh; - - xout1 = 0; - - xout2 = 0; - - for (i = 0; i < 12; i++) { - xout2 += decode_state_.x[2*i]*qmf_coeffs[i]; - xout1 += decode_state_.x[2*i + 1]*qmf_coeffs[11 - i]; - } - - amp[outlen++] = (ring::AudioSample)(xout1 >> 11); - - amp[outlen++] = (ring::AudioSample)(xout2 >> 11); - } - } - } - - return outlen; - } - - int g722_encode(uint8_t g722_data[], const ring::AudioSample amp[], int len) - { - static const int q6[32] = { - 0, 35, 72, 110, 150, 190, 233, 276, - 323, 370, 422, 473, 530, 587, 650, 714, - 786, 858, 940, 1023, 1121, 1219, 1339, 1458, - 1612, 1765, 1980, 2195, 2557, 2919, 0, 0 - }; - static const int iln[32] = { - 0, 63, 62, 31, 30, 29, 28, 27, - 26, 25, 24, 23, 22, 21, 20, 19, - 18, 17, 16, 15, 14, 13, 12, 11, - 10, 9, 8, 7, 6, 5, 4, 0 - }; - static const int ilp[32] = { - 0, 61, 60, 59, 58, 57, 56, 55, - 54, 53, 52, 51, 50, 49, 48, 47, - 46, 45, 44, 43, 42, 41, 40, 39, - 38, 37, 36, 35, 34, 33, 32, 0 - }; - static const int wl[8] = { - -60, -30, 58, 172, 334, 538, 1198, 3042 - }; - static const int rl42[16] = { - 0, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0 - }; - static const int ilb[32] = { - 2048, 2093, 2139, 2186, 2233, 2282, 2332, - 2383, 2435, 2489, 2543, 2599, 2656, 2714, - 2774, 2834, 2896, 2960, 3025, 3091, 3158, - 3228, 3298, 3371, 3444, 3520, 3597, 3676, - 3756, 3838, 3922, 4008 - }; - static const int qm4[16] = { - 0, -20456, -12896, -8968, - -6288, -4240, -2584, -1200, - 20456, 12896, 8968, 6288, - 4240, 2584, 1200, 0 - }; - static const int qm2[4] = { - -7408, -1616, 7408, 1616 - }; - static const int qmf_coeffs[12] = { - 3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11, - }; - static const int ihn[3] = {0, 1, 0}; - static const int ihp[3] = {0, 3, 2}; - static const int wh[3] = {0, -214, 798}; - static const int rh2[4] = {2, 1, 2, 1}; - - int dlow = 0; - int dhigh = 0; - int el = 0; - int wd = 0; - int wd1 = 0; - int ril = 0; - int wd2 = 0; - int il4 = 0; - int ih2 = 0; - int wd3 = 0; - int eh = 0; - int mih = 0; - int i = 0; - int j = 0; - /* Low and high band PCM from the QMF */ - int xlow = 0; - int xhigh = 0; - int g722_bytes = 0; - /* Even and odd tap accumulators */ - int sumeven = 0; - int sumodd = 0; - int ihigh = 0; - int ilow = 0; - int code = 9; - - g722_bytes = 0; - xhigh = 0; - - for (j = 0; j < len;) { - if (encode_state_.itu_test_mode) { - xlow = - xhigh = amp[j++] >> 1; - } else { - if (encode_state_.eight_k) { - xlow = amp[j++] >> 1; - } else { - /* Apply the transmit QMF */ - /* Shuffle the buffer down */ - for (i = 0; i < 22; i++) - encode_state_.x[i] = encode_state_.x[i + 2]; - - encode_state_.x[22] = amp[j++]; - - encode_state_.x[23] = amp[j++]; - - /* Discard every other QMF output */ - sumeven = 0; - - sumodd = 0; - - for (i = 0; i < 12; i++) { - sumodd += encode_state_.x[2*i]*qmf_coeffs[i]; - sumeven += encode_state_.x[2*i + 1]*qmf_coeffs[11 - i]; - } - - xlow = (sumeven + sumodd) >> 14; - - xhigh = (sumeven - sumodd) >> 14; - } - } - - /* Block 1L, SUBTRA */ - el = saturate(xlow - encode_state_.band[0].s); - - /* Block 1L, QUANTL */ - wd = (el >= 0) ? el : - (el + 1); - - for (i = 1; i < 30; i++) { - wd1 = (q6[i]*encode_state_.band[0].det) >> 12; - - if (wd < wd1) - break; - } - - ilow = (el < 0) ? iln[i] : ilp[i]; - - /* Block 2L, INVQAL */ - ril = ilow >> 2; - wd2 = qm4[ril]; - dlow = (encode_state_.band[0].det*wd2) >> 15; - - /* Block 3L, LOGSCL */ - il4 = rl42[ril]; - wd = (encode_state_.band[0].nb*127) >> 7; - encode_state_.band[0].nb = wd + wl[il4]; - - if (encode_state_.band[0].nb < 0) - encode_state_.band[0].nb = 0; - else if (encode_state_.band[0].nb > 18432) - encode_state_.band[0].nb = 18432; - - /* Block 3L, SCALEL */ - wd1 = (encode_state_.band[0].nb >> 6) & 31; - - wd2 = 8 - (encode_state_.band[0].nb >> 11); - - wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2); - - encode_state_.band[0].det = wd3 << 2; - - block4_encode(0, dlow); - - if (encode_state_.eight_k) { - /* Just leave the high bits as zero */ - code = (0xC0 | ilow) >> (8 - encode_state_.bits_per_sample); - } else { - /* Block 1H, SUBTRA */ - eh = saturate(xhigh - encode_state_.band[1].s); - - /* Block 1H, QUANTH */ - wd = (eh >= 0) ? eh : - (eh + 1); - wd1 = (564*encode_state_.band[1].det) >> 12; - mih = (wd >= wd1) ? 2 : 1; - ihigh = (eh < 0) ? ihn[mih] : ihp[mih]; - - /* Block 2H, INVQAH */ - wd2 = qm2[ihigh]; - dhigh = (encode_state_.band[1].det*wd2) >> 15; - - /* Block 3H, LOGSCH */ - ih2 = rh2[ihigh]; - wd = (encode_state_.band[1].nb*127) >> 7; - encode_state_.band[1].nb = wd + wh[ih2]; - - if (encode_state_.band[1].nb < 0) - encode_state_.band[1].nb = 0; - else if (encode_state_.band[1].nb > 22528) - encode_state_.band[1].nb = 22528; - - /* Block 3H, SCALEH */ - wd1 = (encode_state_.band[1].nb >> 6) & 31; - - wd2 = 10 - (encode_state_.band[1].nb >> 11); - - wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2); - - encode_state_.band[1].det = wd3 << 2; - - block4_encode(1, dhigh); - - code = ((ihigh << 6) | ilow) >> (8 - encode_state_.bits_per_sample); - } - - if (encode_state_.packed) { - /* Pack the code bits */ - encode_state_.out_buffer |= (code << encode_state_.out_bits); - encode_state_.out_bits += encode_state_.bits_per_sample; - - if (encode_state_.out_bits >= 8) { - g722_data[g722_bytes++] = (uint8_t)(encode_state_.out_buffer & 0xFF); - encode_state_.out_bits -= 8; - encode_state_.out_buffer >>= 8; - } - } else { - g722_data[g722_bytes++] = (uint8_t) code; - } - } - - return g722_bytes; - } - - g722_state_t decode_state_; - g722_state_t encode_state_; -}; - -// the class factories -// cppcheck-suppress unusedFunction -RING_PLUGIN_EXIT(pluginExit) {} - -// cppcheck-suppress unusedFunction -RING_PLUGIN_INIT_DYNAMIC(pluginAPI) -{ - std::unique_ptr<G722> codec(new G722); - - if (!pluginAPI->invokeService(pluginAPI, "registerAudioCodec", - reinterpret_cast<void*>(codec.get()))) { - codec.release(); - return pluginExit; - } - - return nullptr; -} diff --git a/src/media/audio/codecs/g722.h b/src/media/audio/codecs/g722.h deleted file mode 100644 index 79146390f843b8c8ba50136abdaa01885508efdd..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/g722.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * - * Mostly borrowed from asterisk's sources (Steve Underwood <steveu@coppice.org>) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#ifndef G722_H_ -#define G722_H_ - -/** - -The G.722 module is a bit exact implementation of the ITU G.722 specification for all three -specified bit rates - 64000bps, 56000bps and 48000bps. It passes the ITU tests. - -To allow fast and flexible interworking with narrow band telephony, the encoder and decoder -support an option for the linear audio to be an 8k samples/second stream. In this mode the -codec is considerably faster, and still fully compatible with wideband terminals using G.722. - -*/ - -#include <stdint.h> - -enum { - G722_SAMPLE_RATE_8000 = 0x0001, - G722_PACKED = 0x0002 -}; - -#ifndef INT16_MAX -#define INT16_MAX 32767 -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32768) -#endif - -struct g722_state_t { - /*! TRUE if the operating in the special ITU test mode, with the band split filters - disabled. */ - int itu_test_mode; - /*! TRUE if the G.722 data is packed */ - int packed; - /*! TRUE if encode from 8k samples/second */ - int eight_k; - /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */ - int bits_per_sample; - - /*! Signal history for the QMF */ - int x[24]; - - struct { - int s; - int sp; - int sz; - int r[3]; - int a[3]; - int ap[3]; - int p[3]; - int d[7]; - int b[7]; - int bp[7]; - int sg[7]; - int nb; - int det; - } band[2]; - - unsigned int in_buffer; - int in_bits; - unsigned int out_buffer; - int out_bits; -}; - -#endif // G722_H_ diff --git a/src/media/audio/codecs/g729.cpp b/src/media/audio/codecs/g729.cpp deleted file mode 100644 index 0ed33fe3d669e78269774f682ac96bed09ed19dc..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/g729.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ -#include "g729.h" -#include "ring_types.h" -#include "ring_plugin.h" - -#include <iostream> -#include <dlfcn.h> -#include <stdexcept> - -#define G729_TYPE_ENCODER (void (*)(bcg729EncoderChannelContextStruct*, ring::AudioSample[], uint8_t[])) -#define G729_TYPE_DECODER (void (*)(bcg729DecoderChannelContextStruct*, uint8_t[], uint8_t, ring::AudioSample[])) - -#define G729_TYPE_DECODER_INIT (bcg729DecoderChannelContextStruct*(*)()) -#define G729_TYPE_ENCODER_INIT (bcg729EncoderChannelContextStruct*(*)()) - -static const int G729_PAYLOAD_TYPE = 18; - -G729::G729() : ring::AudioCodec(G729_PAYLOAD_TYPE, "G729", 8000, 160, 1), - decoderContext_(0), - encoderContext_(0), - handler_(0), - encoder_(0), - decoder_(0) -{ - handler_ = dlopen("libbcg729.so.0", RTLD_NOW); - - if (!handler_) - throw std::runtime_error("g729: did not open shared lib"); - - encoder_ = G729_TYPE_ENCODER dlsym(handler_, "bcg729Encoder"); - loadError(dlerror()); - decoder_ = G729_TYPE_DECODER dlsym(handler_, "bcg729Decoder"); - loadError(dlerror()); - - bcg729DecoderChannelContextStruct*(*decInit)() = G729_TYPE_DECODER_INIT dlsym(handler_, "initBcg729DecoderChannel"); - loadError(dlerror()); - bcg729EncoderChannelContextStruct*(*encInit)() = G729_TYPE_ENCODER_INIT dlsym(handler_, "initBcg729EncoderChannel"); - loadError(dlerror()); - - decoderContext_ = (*decInit)(); - encoderContext_ = (*encInit)(); -} - -G729::~G729() -{ - if (handler_) - dlclose(handler_); -} - -ring::AudioCodec * -G729::clone() -{ - return new G729; -} - -int G729::decode(ring::AudioSample *pcm, unsigned char *data, size_t len) -{ - decoder_(decoderContext_, data, false, pcm); - decoder_(decoderContext_, data + (len / 2), false, pcm + 80); - return 160; -} - -int G729::encode(unsigned char *data, ring::AudioSample *pcm, size_t) -{ - encoder_(encoderContext_, pcm, data); - encoder_(encoderContext_, pcm + (frameSize_ / 2), data + 10); - return 20; -} - -void G729::loadError(const char *error) -{ - if (error != NULL) - throw std::runtime_error("G729 failed to load"); -} - -// cppcheck-suppress unusedFunction -RING_PLUGIN_EXIT(pluginExit) {} - -// cppcheck-suppress unusedFunction -RING_PLUGIN_INIT_DYNAMIC(pluginAPI) -{ - std::unique_ptr<G729> codec(new G729); - - if (!pluginAPI->invokeService(pluginAPI, "registerAudioCodec", - reinterpret_cast<void*>(codec.get()))) { - codec.release(); - return pluginExit; - } - - return nullptr; -} diff --git a/src/media/audio/codecs/g729.h b/src/media/audio/codecs/g729.h deleted file mode 100644 index 23042b7e6fd9146282196c01b15668b7d138f527..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/g729.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ -#ifndef G729_H_ -#define G729_H_ - -#include <cstdlib> -#include "ring_types.h" -#include "noncopyable.h" - -#include "audiocodec.h" - -class bcg729DecoderChannelContextStruct; -class bcg729EncoderChannelContextStruct; - -class G729 : public ring::AudioCodec { -public: - G729(); - ~G729(); -private: - AudioCodec * clone(); - virtual int decode(ring::AudioSample *pcm, unsigned char *data, size_t len); - virtual int encode(unsigned char *data, ring::AudioSample *pcm, size_t max_data_bytes); - - NON_COPYABLE(G729); - //Attributes - bcg729DecoderChannelContextStruct* decoderContext_; - bcg729EncoderChannelContextStruct* encoderContext_; - void* handler_; - - //Extern functions - void (*encoder_) (bcg729EncoderChannelContextStruct *encoderChannelContext, ring::AudioSample inputFrame[], uint8_t bitStream[]); - void (*decoder_) (bcg729DecoderChannelContextStruct *decoderChannelContext, uint8_t bitStream[], uint8_t frameErasureFlag, ring::AudioSample signal[]); - - static void loadError(const char *error); -}; - -#endif // G729_H_ diff --git a/src/media/audio/codecs/gsmcodec.cpp b/src/media/audio/codecs/gsmcodec.cpp deleted file mode 100644 index 67c99e87ca85d1c204c626b07f45966cd7409e56..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/gsmcodec.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Yan Morin <yan.morin@savoirfairelinux.com> - * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - - -#include "audiocodec.h" -#include "ring_types.h" -#include "noncopyable.h" -#include "ring_plugin.h" - -#include <stdexcept> -#include <iostream> - -extern "C" { -#include <gsm/gsm.h> -} - -/** - * GSM audio codec C++ class (over gsm/gsm.h) - */ - -class Gsm : public ring::AudioCodec { - - public: - // _payload should be 3 - Gsm() : ring::AudioCodec(3, "GSM", 8000, 160, 1), - decode_gsmhandle_(NULL), encode_gsmhandle_(NULL) { - bitrate_ = 13.3; - hasDynamicPayload_ = false; - - if (!(decode_gsmhandle_ = gsm_create())) - throw std::runtime_error("Error in decode_gsm_create\n"); - - if (!(encode_gsmhandle_ = gsm_create())) - throw std::runtime_error("Error in encode_gsm_create\n"); - } - - ~Gsm() { - gsm_destroy(decode_gsmhandle_); - gsm_destroy(encode_gsmhandle_); - } -private: - AudioCodec * - clone() - { - return new Gsm; - } - - int decode(ring::AudioSample *pcm, unsigned char *data, size_t) - { - if (gsm_decode(decode_gsmhandle_, (gsm_byte*) data, (gsm_signal*) pcm) < 0) - throw std::runtime_error("Error in gsm_decode\n"); - - return frameSize_; - } - - int encode(unsigned char *data, ring::AudioSample *pcm, size_t) - { - gsm_encode(encode_gsmhandle_, (gsm_signal*) pcm, (gsm_byte*) data); - return sizeof(gsm_frame); - } - - NON_COPYABLE(Gsm); - gsm decode_gsmhandle_; - gsm encode_gsmhandle_; -}; - -// cppcheck-suppress unusedFunction -RING_PLUGIN_EXIT(pluginExit) {} - -// cppcheck-suppress unusedFunction -RING_PLUGIN_INIT_DYNAMIC(pluginAPI) -{ - std::unique_ptr<Gsm> codec(new Gsm); - - if (!pluginAPI->invokeService(pluginAPI, "registerAudioCodec", - reinterpret_cast<void*>(codec.get()))) { - codec.release(); - return pluginExit; - } - - return nullptr; -} diff --git a/src/media/audio/codecs/ilbc.cpp b/src/media/audio/codecs/ilbc.cpp deleted file mode 100644 index 290910417a09532d5c6655dcfb687ef0037538e5..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/ilbc.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2012-2015 Savoir-Faire Linux Inc. - * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "audiocodec.h" -#include "ring_types.h" -#include <algorithm> - -extern "C" { -#include <ilbc.h> -} - -class Ilbc: public ring::AudioCodec { - public: - Ilbc() : - ring::AudioCodec(ILBC_PAYLOAD, "iLBC", 8000, ILBC_FRAME_SIZE, 1), - ilbc_dec_(), - ilbc_enc_() { - bitrate_ = 13.3; - - initDecode(&ilbc_dec_, 20, 1); - initEncode(&ilbc_enc_, 20); - } - - private: - AudioCodec * - clone() - { - return new Ilbc; - } - - // iLBC expects floating point data, so we have to convert - int decode(ring::AudioSample *pcm, unsigned char *data, size_t) { - const int NORMAL_MODE = 1; - iLBC_decode(pcm, reinterpret_cast<WebRtc_UWord16*>(data), &ilbc_dec_, NORMAL_MODE); - return frameSize_; - } - - int encode(unsigned char *data, ring::AudioSample *pcm, size_t) { - iLBC_encode(reinterpret_cast<WebRtc_UWord16*>(data), pcm, &ilbc_enc_); - return frameSize_; - } - - static const int ILBC_FRAME_SIZE = 160; - static const int ILBC_PAYLOAD = 105; - iLBC_Dec_Inst_t ilbc_dec_; - iLBC_Enc_Inst_t ilbc_enc_; -}; - -// the class factories -extern "C" ring::AudioCodec* AUDIO_CODEC_ENTRY() -{ - return new Ilbc; -} - -extern "C" void destroy(ring::AudioCodec* a) -{ - delete a; -} diff --git a/src/media/audio/codecs/opuscodec.cpp b/src/media/audio/codecs/opuscodec.cpp deleted file mode 100644 index 4c32f85e8dc465935492a53252f5f5b20936cfb6..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/opuscodec.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> - * Author: Adrien Beraud <adrien.beraud@wisdomvibes.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ -#include "opuscodec.h" -#include "ring_types.h" -#include "ring_plugin.h" - -#include <stdexcept> -#include <iostream> -#include <array> - -constexpr uint32_t Opus::VALID_SAMPLING_RATE[]; - -Opus::Opus() : ring::AudioCodec(PAYLOAD_TYPE, "opus", CLOCK_RATE, FRAME_SIZE, CHANNELS), - encoder_(nullptr), - decoder_(nullptr), - lastDecodedFrameSize_(0) -{ - hasDynamicPayload_ = true; - setOptimalFormat(CLOCK_RATE, 1); -} - -Opus::~Opus() -{ - if (encoder_) - opus_encoder_destroy(encoder_); - if (decoder_) - opus_decoder_destroy(decoder_); -} - -ring::AudioCodec * -Opus::clone() -{ - return new Opus; -} - -void Opus::setOptimalFormat(uint32_t sample_rate, uint8_t channels) -{ - // Use a SR higher or equal to sample_rate. - // Typical case: 44.1kHz => 48kHz. - unsigned i = 0; - while (i < VALID_SAMPLING_RATE_NUM - 1 and VALID_SAMPLING_RATE[i] < sample_rate) - i++; - sample_rate = VALID_SAMPLING_RATE[i]; - - // Opus supports 1 or 2 channels. - channels = std::max(std::min(channels, (uint8_t) 2), (uint8_t) 1); - - if (not (!encoder_ || !decoder_ || sample_rate != clockRateCur_ || channels != channelsCur_)) - return; - - clockRateCur_ = sample_rate; - channelsCur_ = channels; - - int err; - if (encoder_) - opus_encoder_destroy(encoder_); - encoder_ = opus_encoder_create(sample_rate, channels, OPUS_APPLICATION_VOIP, &err); - if (err) - throw std::runtime_error("opus: could not create encoder"); - - if (decoder_) - opus_decoder_destroy(decoder_); - lastDecodedFrameSize_ = 0; - decoder_ = opus_decoder_create(sample_rate, channels, &err); - if (err) - throw std::runtime_error("opus: could not create decoder"); -} - -// Reference: http://tools.ietf.org/html/draft-spittka-payload-rtp-opus-03#section-6.2 -// "The RTP clock rate in "a=rtpmap" MUST be 48000..." -uint32_t Opus::getSDPClockRate() const -{ - return 48000; -} - -// "...and the number of channels MUST be 2." -const char * -Opus::getSDPChannels() const -{ - return "2"; -} - -int Opus::decode(std::vector<std::vector<ring::AudioSample> > &pcm, const uint8_t *data, size_t len) -{ - if (data == nullptr) return 0; - - int ret; - if (channelsCur_ == 1) { - ret = opus_decode(decoder_, data, len, pcm[0].data(), MAX_PACKET_SIZE, 0); - } else { - std::array<ring::AudioSample, 2 * MAX_PACKET_SIZE> ibuf; // deinterleave on stack, 11.25KiB used. - ret = opus_decode(decoder_, data, len, ibuf.data(), MAX_PACKET_SIZE, 0); - for (int i = 0; i < ret; i++) { - pcm[0][i] = ibuf[2 * i]; - pcm[1][i] = ibuf[2 * i + 1]; - } - } - if (ret < 0) - std::cerr << opus_strerror(ret) << std::endl; - lastDecodedFrameSize_ = ret; - return ret; -} - -int Opus::decode(std::vector<std::vector<ring::AudioSample> > &pcm) -{ - if (!lastDecodedFrameSize_) return 0; - int ret; - if (channelsCur_ == 1) { - ret = opus_decode(decoder_, nullptr, 0, pcm[0].data(), lastDecodedFrameSize_, 0); - } else { - std::array<ring::AudioSample, 2 * MAX_PACKET_SIZE> ibuf; // deinterleave on stack, 11.25KiB used. - ret = opus_decode(decoder_, nullptr, 0, ibuf.data(), lastDecodedFrameSize_, 0); - for (int i = 0; i < ret; i++) { - pcm[0][i] = ibuf[2 * i]; - pcm[1][i] = ibuf[2 * i + 1]; - } - } - if (ret < 0) - std::cerr << opus_strerror(ret) << std::endl; - return ret; -} - -size_t Opus::encode(const std::vector<std::vector<ring::AudioSample> > &pcm, uint8_t *data, size_t len) -{ - if (data == nullptr) return 0; - int ret; - if (channelsCur_ == 1) { - ret = opus_encode(encoder_, pcm[0].data(), FRAME_SIZE, data, len); - } else { - std::array<ring::AudioSample, 2 * FRAME_SIZE> ibuf; // interleave on stack, 1.875KiB used; - for (unsigned i = 0; i < FRAME_SIZE; i++) { - ibuf[2 * i] = pcm[0][i]; - ibuf[2 * i + 1] = pcm[1][i]; - } - ret = opus_encode(encoder_, ibuf.data(), FRAME_SIZE, data, len); - } - if (ret < 0) { - std::cerr << opus_strerror(ret) << std::endl; - ret = 0; - } - return ret; -} - -// cppcheck-suppress unusedFunction -RING_PLUGIN_EXIT(pluginExit) {} - -// cppcheck-suppress unusedFunction -RING_PLUGIN_INIT_DYNAMIC(pluginAPI) -{ - std::unique_ptr<Opus> codec(new Opus); - - if (!pluginAPI->invokeService(pluginAPI, "registerAudioCodec", - reinterpret_cast<void*>(codec.get()))) { - codec.release(); - return pluginExit; - } - - return nullptr; -} diff --git a/src/media/audio/codecs/opuscodec.h b/src/media/audio/codecs/opuscodec.h deleted file mode 100644 index d2e667c5d275b4c4826368700257b1963015406a..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/opuscodec.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> - * Author: Adrien Beraud <adrien.beraud@wisdomvibes.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ -#ifndef OPUS_H_ -#define OPUS_H_ - -#include "audiocodec.h" - -#include "noncopyable.h" -#include "ring_types.h" - -#include <opus.h> - -class Opus : public ring::AudioCodec { -public: - Opus(); - ~Opus(); - - static const uint8_t PAYLOAD_TYPE = 104; // dynamic payload type, out of range of video (96-99) - - virtual inline bool supportsPacketLossConcealment() const { - return true; - } - -private: - ring::AudioCodec * clone(); - - virtual int decode(std::vector<std::vector<ring::AudioSample> > &pcm, const uint8_t *data, size_t len); - virtual int decode(std::vector<std::vector<ring::AudioSample> > &pcm); - - virtual size_t encode(const std::vector<std::vector<ring::AudioSample> > &pcm, uint8_t *data, size_t len); - - virtual uint32_t getSDPClockRate() const; - virtual const char *getSDPChannels() const; - - virtual void setOptimalFormat(uint32_t sample_rate, uint8_t channels); - - NON_COPYABLE(Opus); - //Attributes - OpusEncoder *encoder_; - OpusDecoder *decoder_; - - unsigned lastDecodedFrameSize_; - - // Valid sampling rates allowed by the Opus library. - static constexpr uint32_t VALID_SAMPLING_RATE[] = {8000, 12000, 16000, 24000, 48000}; - static constexpr size_t VALID_SAMPLING_RATE_NUM = sizeof(VALID_SAMPLING_RATE)/sizeof(uint32_t); - - static const unsigned CLOCK_RATE = 48000; - static const unsigned FRAME_SIZE = 20 * CLOCK_RATE / 1000; // 20ms - static const unsigned CHANNELS = 2; - - // Opus documentation: - // "If this is less than the maximum packet duration (120ms; 5760 for 48kHz), - // opus_decode will not be capable of decoding some packets." - static const unsigned MAX_PACKET_SIZE = 120 * CLOCK_RATE / 1000; // 120ms -}; - -#endif diff --git a/src/media/audio/codecs/speexcodec.cpp b/src/media/audio/codecs/speexcodec.cpp deleted file mode 100644 index c730dd32d01c6a69d195aa157039fa15c3c8646c..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/speexcodec.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "audiocodec.h" -#include "speexcodec.h" -#include "ring_plugin.h" - -// cppcheck-suppress unusedFunction -RING_PLUGIN_EXIT(pluginExit) {} - -// cppcheck-suppress unusedFunction -RING_PLUGIN_INIT_DYNAMIC(pluginAPI) -{ - std::unique_ptr<Speex> codec_nb(new Speex(110, 8000, 160, 24, true, &speex_nb_mode)); - std::unique_ptr<Speex> codec_wb(new Speex(111, 16000, 320, 42, true, &speex_wb_mode)); - std::unique_ptr<Speex> codec_ub(new Speex(112, 32000, 640, 0, true, &speex_uwb_mode)); - - if (!pluginAPI->invokeService(pluginAPI, "registerAudioCodec", - reinterpret_cast<void*>(codec_nb.get()))) { - codec_nb.release(); - } - - if (!pluginAPI->invokeService(pluginAPI, "registerAudioCodec", - reinterpret_cast<void*>(codec_wb.get()))) { - codec_wb.release(); - } - - if (!pluginAPI->invokeService(pluginAPI, "registerAudioCodec", - reinterpret_cast<void*>(codec_ub.get()))) { - codec_ub.release(); - } - - return pluginExit; -} diff --git a/src/media/audio/codecs/speexcodec.h b/src/media/audio/codecs/speexcodec.h deleted file mode 100644 index ba3cf8254be4c3741688de6961680fe1c0849586..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/speexcodec.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "ring_types.h" -#include "audiocodec.h" -#include "noncopyable.h" -#include "array_size.h" -#include <speex/speex.h> -#include <cassert> - -class Speex : public ring::AudioCodec { -public: - Speex(int payload, unsigned clockRate, unsigned frameSize, - unsigned bitRate, bool dynamicPayload, const SpeexMode *mode) : - ring::AudioCodec(payload, "speex", clockRate, frameSize, 1), - speex_dec_bits_(), - speex_enc_bits_(), - speex_dec_state_(0), - speex_enc_state_(0), - speex_frame_size_(0), - mode_(mode) { - assert(payload >= 110 && payload <= 112); - assert(110 == ring::PAYLOAD_CODEC_SPEEX_8000 && - 111 == ring::PAYLOAD_CODEC_SPEEX_16000 && - 112 == ring::PAYLOAD_CODEC_SPEEX_32000); - - bitrate_ = bitRate; - hasDynamicPayload_ = dynamicPayload; - - // Init the decoder struct - speex_bits_init(&speex_dec_bits_); - speex_dec_state_ = speex_decoder_init(mode_); - - // Init the encoder struct - speex_bits_init(&speex_enc_bits_); - speex_enc_state_ = speex_encoder_init(mode_); - - speex_encoder_ctl(speex_enc_state_, SPEEX_SET_SAMPLING_RATE, &clockRate_); - speex_decoder_ctl(speex_dec_state_, SPEEX_GET_FRAME_SIZE, &speex_frame_size_); - } - - ~Speex() - { - // Destroy the decoder struct - speex_bits_destroy(&speex_dec_bits_); - speex_decoder_destroy(speex_dec_state_); - speex_dec_state_ = 0; - - // Destroy the encoder struct - speex_bits_destroy(&speex_enc_bits_); - speex_encoder_destroy(speex_enc_state_); - speex_enc_state_ = 0; - } - -private: - - AudioCodec * - clone() - { - return new Speex(payload_, clockRate_, frameSize_, bitrate_, hasDynamicPayload_, mode_); - } - - NON_COPYABLE(Speex); - - virtual int decode(ring::AudioSample *pcm, unsigned char *data, size_t len) { - speex_bits_read_from(&speex_dec_bits_, (char*) data, len); - speex_decode_int(speex_dec_state_, &speex_dec_bits_, pcm); - return frameSize_; - } - - virtual int encode(unsigned char *data, ring::AudioSample *pcm, size_t max_data_bytes) { - speex_bits_reset(&speex_enc_bits_); - speex_encode_int(speex_enc_state_, pcm, &speex_enc_bits_); - return speex_bits_write(&speex_enc_bits_, (char*) data, - std::min<size_t>(frameSize_, max_data_bytes)); - } - - SpeexBits speex_dec_bits_; - SpeexBits speex_enc_bits_; - void *speex_dec_state_; - void *speex_enc_state_; - int speex_frame_size_; - const SpeexMode *mode_; -}; diff --git a/src/media/audio/codecs/ulaw.cpp b/src/media/audio/codecs/ulaw.cpp deleted file mode 100644 index d840a05de6a929c036a30dc8df02829101c5bfdd..0000000000000000000000000000000000000000 --- a/src/media/audio/codecs/ulaw.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. - * Author: Yan Morin <yan.morin@savoirfairelinux.com> - * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "audiocodec.h" -#include "ring_types.h" -#include "ring_plugin.h" -#include "g711.h" - -class Ulaw : public ring::AudioCodec { - public: - // 0 PCMU A 8000 1 [RFC3551] - Ulaw() : ring::AudioCodec(0, "PCMU", 8000, 160, 1) { - bitrate_ = 64; - hasDynamicPayload_ = false; - } - - private: - AudioCodec * - clone() - { - return new Ulaw; - } - - int decode(ring::AudioSample *pcm, unsigned char *data, size_t len) - { - for (const unsigned char *end = data + len; data < end; - ++data, ++pcm) - *pcm = ULawDecode(*data); - - return len; - } - - int encode(unsigned char *data, ring::AudioSample *pcm, size_t max_data_bytes) - { - const unsigned char *end = data + - std::min<size_t>(frameSize_, max_data_bytes); - - unsigned char *tmp = data; - for (; tmp < end; ++tmp, ++pcm) - *tmp = ULawEncode(*pcm); - - return end - data; - } - - static ring::AudioSample ULawDecode(uint8_t ulaw) { - return ulaw_to_linear(ulaw); - } - - static uint8_t ULawEncode(ring::AudioSample pcm16) { - return linear_to_ulaw(pcm16); - } -}; - -// the class factories -// cppcheck-suppress unusedFunction -RING_PLUGIN_EXIT(pluginExit) {} - -// cppcheck-suppress unusedFunction -RING_PLUGIN_INIT_DYNAMIC(pluginAPI) -{ - std::unique_ptr<Ulaw> codec(new Ulaw); - - if (!pluginAPI->invokeService(pluginAPI, "registerAudioCodec", - reinterpret_cast<void*>(codec.get()))) { - codec.release(); - return pluginExit; - } - - return nullptr; -} diff --git a/src/media/audio/coreaudio/corelayer.cpp b/src/media/audio/coreaudio/corelayer.cpp index d7d1ea4e25371cf39b6595c0ec09176d74f8ff05..beb40b7e72a05e9b7b71479078c38733b13cc494 100644 --- a/src/media/audio/coreaudio/corelayer.cpp +++ b/src/media/audio/coreaudio/corelayer.cpp @@ -486,7 +486,7 @@ void CoreLayer::read(AudioUnitRenderActionFlags* ioActionFlags, &size)); - // Add them to sflphone ringbuffer. + // Add them to Ring ringbuffer. const AudioFormat mainBufferFormat = Manager::instance().getRingBufferPool().getInternalAudioFormat(); bool resample = info.mSampleRate != mainBufferFormat.sample_rate; diff --git a/src/media/audio/jack/jacklayer.cpp b/src/media/audio/jack/jacklayer.cpp index 9208ff26b84597b19393305cd5cbdb34ab771ad4..3ace332b5cdf857263c5890069e22b44c989a8dc 100644 --- a/src/media/audio/jack/jacklayer.cpp +++ b/src/media/audio/jack/jacklayer.cpp @@ -268,7 +268,7 @@ JackLayer::ringbuffer_worker() // wait until process() signals more data // FIXME: this checks for spurious wakes, but the predicate - // is rather arbitrary. We should wait until sflphone has/needs data + // is rather arbitrary. We should wait until ring has/needs data // and jack has/needs data. data_ready_.wait(lock, [&] { // Note: lock is released while waiting, and held when woken diff --git a/src/media/libav_utils.cpp b/src/media/libav_utils.cpp index 60643219aad6564c5df53e105689ba04ac3de620..95af5d2080336c1a4c80c54ab2d4eec8f5f5bbc6 100644 --- a/src/media/libav_utils.cpp +++ b/src/media/libav_utils.cpp @@ -97,7 +97,7 @@ static void init_once() static std::once_flag already_called; -void sfl_avcodec_init() +void ring_avcodec_init() { std::call_once(already_called, init_once); } @@ -112,7 +112,7 @@ int libav_pixel_format(int fmt) return fmt; } -int sfl_pixel_format(int fmt) +int ring_pixel_format(int fmt) { switch (fmt) { case PIXEL_FORMAT(YUV420P): return video::VIDEO_PIXFMT_YUV420P; @@ -120,7 +120,7 @@ int sfl_pixel_format(int fmt) return fmt; } -void sfl_url_split(const char *url, +void ring_url_split(const char *url, char *hostname, size_t hostname_size, int *port, char *path, size_t path_size) { diff --git a/src/media/libav_utils.h b/src/media/libav_utils.h index 46bb441c3b3f731a82b28077b1a97c92c07cb57c..f12147b5d0f6d5f725a2b9b2faefb2179497e28d 100644 --- a/src/media/libav_utils.h +++ b/src/media/libav_utils.h @@ -37,15 +37,15 @@ namespace ring { namespace libav_utils { - void sfl_avcodec_init(); + void ring_avcodec_init(); int libav_pixel_format(int fmt); - int sfl_pixel_format(int fmt); + int ring_pixel_format(int fmt); const char *const DEFAULT_H264_PROFILE_LEVEL_ID = "profile-level-id=428014"; const char *const MAX_H264_PROFILE_LEVEL_ID = "profile-level-id=640034"; - void sfl_url_split(const char *url, + void ring_url_split(const char *url, char *hostname, size_t hostname_size, int *port, char *path, size_t path_size); diff --git a/src/media/media_buffer.cpp b/src/media/media_buffer.cpp index 4e1a2d43a7de17d7857a9407687414a03d0356d0..2a0df42b819f2dab7886f31c99bdfef7a8cb3c18 100644 --- a/src/media/media_buffer.cpp +++ b/src/media/media_buffer.cpp @@ -70,7 +70,7 @@ VideoFrame::size() const noexcept int VideoFrame::format() const noexcept { - return libav_utils::sfl_pixel_format(frame_->format); + return libav_utils::ring_pixel_format(frame_->format); } int diff --git a/src/media/media_decoder.cpp b/src/media/media_decoder.cpp index bf7c198100579755b232d6902b06d2b36f855036..c92564146730f82e7a0d931c525e0e1e3b948977 100644 --- a/src/media/media_decoder.cpp +++ b/src/media/media_decoder.cpp @@ -429,7 +429,7 @@ int MediaDecoder::getHeight() const { return decoderCtx_->height; } int MediaDecoder::getPixelFormat() const -{ return libav_utils::sfl_pixel_format(decoderCtx_->pix_fmt); } +{ return libav_utils::ring_pixel_format(decoderCtx_->pix_fmt); } void MediaDecoder::writeToRingBuffer(const AudioFrame& decodedFrame, diff --git a/src/media/media_encoder.cpp b/src/media/media_encoder.cpp index 3c81e3ed07f73ffd904afec4079491b9ea2c6633..963ea574f79867d844a88ff1cf211f5ec7035859 100644 --- a/src/media/media_encoder.cpp +++ b/src/media/media_encoder.cpp @@ -168,7 +168,7 @@ MediaEncoder::openOutput(const char *filename, // allocate buffers for both scaled (pre-encoder) and encoded frames const int width = encoderCtx_->width; const int height = encoderCtx_->height; - const int format = libav_utils::sfl_pixel_format((int)encoderCtx_->pix_fmt); + const int format = libav_utils::ring_pixel_format((int)encoderCtx_->pix_fmt); scaledFrameBufferSize_ = videoFrameSize(format, width, height); if (scaledFrameBufferSize_ <= FF_MIN_BUFFER_SIZE) throw MediaEncoderException("buffer too small"); diff --git a/src/media/socket_pair.cpp b/src/media/socket_pair.cpp index 6688104b5206792d4bf876f9debad197aa0e5240..b7f0ab1379f4345f55d22f01215258c196bd6fd9 100644 --- a/src/media/socket_pair.cpp +++ b/src/media/socket_pair.cpp @@ -246,7 +246,7 @@ void SocketPair::openSockets(const char *uri, int local_rtp_port) char path[1024]; int rtp_port; - libav_utils::sfl_url_split(uri, hostname, sizeof(hostname), &rtp_port, path, + libav_utils::ring_url_split(uri, hostname, sizeof(hostname), &rtp_port, path, sizeof(path)); const int rtcp_port = rtp_port + 1; diff --git a/src/media/video/osxvideo/video_device_impl.mm b/src/media/video/osxvideo/video_device_impl.mm index 7d491f98e8f2394e8440fadf112cca0091d41169..ffb26eb5440dc4152a9a756c32a2e1f66930c5ae 100644 --- a/src/media/video/osxvideo/video_device_impl.mm +++ b/src/media/video/osxvideo/video_device_impl.mm @@ -154,13 +154,13 @@ std::vector<std::string> VideoDeviceImpl::getRateList(const std::string& channel, const std::string& size) const { auto format = [avDevice_ activeFormat]; - auto frameRate = (AVFrameRateRange*) - [format.videoSupportedFrameRateRanges objectAtIndex:0]; - std::vector<std::string> v; - std::stringstream ss; - ss << frameRate.maxFrameRate; - v.push_back(ss.str()); + + for (AVFrameRateRange* frameRateRange in format.videoSupportedFrameRateRanges) { + std::stringstream ss; + ss << frameRateRange.maxFrameRate; + v.push_back(ss.str()); + } return v; } @@ -169,14 +169,12 @@ VideoDeviceImpl::getSizeList(const std::string& channel) const { std::vector<std::string> v; - auto format = [avDevice_ activeFormat]; - auto dimensions = - CMVideoFormatDescriptionGetDimensions(format.formatDescription); - - std::stringstream ss; - ss << dimensions.width << "x" << dimensions.height; - v.push_back(ss.str()); - + for (AVCaptureDeviceFormat* format in avDevice_.formats) { + std::stringstream ss; + auto dimensions = CMVideoFormatDescriptionGetDimensions(format.formatDescription); + ss << dimensions.width << "x" << dimensions.height; + v.push_back(ss.str()); + } return v; } diff --git a/src/media/video/osxvideo/video_device_monitor_impl.mm b/src/media/video/osxvideo/video_device_monitor_impl.mm index eb3242be7a87f91fceec284d5de67b99f35d6a48..2eeee8e0f487aaa7d8bfe627b38ae60b90b94bcf 100644 --- a/src/media/video/osxvideo/video_device_monitor_impl.mm +++ b/src/media/video/osxvideo/video_device_monitor_impl.mm @@ -66,19 +66,12 @@ class VideoDeviceMonitorImpl { NON_COPYABLE(VideoDeviceMonitorImpl); VideoDeviceMonitor* monitor_; - - void run(); - - mutable std::mutex mutex_; - std::atomic_bool probing_; - std::thread thread_; + NSArray* observers; }; VideoDeviceMonitorImpl::VideoDeviceMonitorImpl(VideoDeviceMonitor* monitor) : - monitor_(monitor), - mutex_(), probing_(false), - thread_() + monitor_(monitor) { /* Enumerate existing devices */ auto myVideoDevices = [[AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo] @@ -95,7 +88,7 @@ VideoDeviceMonitorImpl::VideoDeviceMonitorImpl(VideoDeviceMonitor* monitor) : for ( ivideo = 0; ivideo < deviceCount; ++ivideo ) { AVCaptureDevice* avf_device = [myVideoDevices objectAtIndex:ivideo]; - RING_DBG("avcapture %lu/%lu %s %s", ivideo, + printf("avcapture %d/%d %s %s\n", ivideo + 1, deviceCount, [[avf_device modelID] UTF8String], [[avf_device uniqueID] UTF8String]); @@ -110,23 +103,31 @@ VideoDeviceMonitorImpl::VideoDeviceMonitorImpl(VideoDeviceMonitor* monitor) : void VideoDeviceMonitorImpl::start() { - probing_ = true; - //thread_ = std::thread(&VideoDeviceMonitorImpl::run, this); + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + id deviceWasConnectedObserver = [notificationCenter addObserverForName:AVCaptureDeviceWasConnectedNotification + object:nil + queue:[NSOperationQueue mainQueue] + usingBlock:^(NSNotification *note) { + AVCaptureDevice* dev = (AVCaptureDevice*)note.object; + monitor_->addDevice([[dev uniqueID] UTF8String]); + }]; + id deviceWasDisconnectedObserver = [notificationCenter addObserverForName:AVCaptureDeviceWasDisconnectedNotification + object:nil + queue:[NSOperationQueue mainQueue] + usingBlock:^(NSNotification *note) { + AVCaptureDevice* dev = (AVCaptureDevice*)note.object; + monitor_->removeDevice([[dev uniqueID] UTF8String]); + }]; + observers = [[NSArray alloc] initWithObjects:deviceWasConnectedObserver, deviceWasDisconnectedObserver, nil]; } VideoDeviceMonitorImpl::~VideoDeviceMonitorImpl() { - probing_ = false; - if (thread_.joinable()) - thread_.join(); -} + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + for (id observer in observers) + [notificationCenter removeObserver:observer]; -void VideoDeviceMonitorImpl::run() -{ - while (probing_) { - //TODO: Enable detection of new devices - sleep(1); - } + [observers release]; } VideoDeviceMonitor::VideoDeviceMonitor() : diff --git a/src/media/video/video_input.cpp b/src/media/video/video_input.cpp index 5cae5b9b08e53f88e83b14cadaa53dec9950f71d..a3d5a7b4dcb322c0ce015b2fc9327d8254b2880d 100644 --- a/src/media/video/video_input.cpp +++ b/src/media/video/video_input.cpp @@ -154,7 +154,7 @@ void VideoInput::createDecoder() { if (decOpts_.input.empty()) { - foundDecOpts_.set_value(decOpts_); + foundDecOpts(decOpts_); return; } @@ -170,7 +170,7 @@ VideoInput::createDecoder() delete decoder_; decoder_ = nullptr; //foundDecOpts_.set_exception(std::runtime_error("Could not open input")); - foundDecOpts_.set_value(decOpts_); + foundDecOpts(decOpts_); return; } @@ -180,12 +180,12 @@ VideoInput::createDecoder() delete decoder_; decoder_ = nullptr; //foundDecOpts_.set_exception(std::runtime_error("Could not read data")); - foundDecOpts_.set_value(decOpts_); + foundDecOpts(decOpts_); return; } decOpts_.width = decoder_->getWidth(); decOpts_.height = decoder_->getHeight(); - foundDecOpts_.set_value(decOpts_); + foundDecOpts(decOpts_); } void @@ -288,6 +288,7 @@ VideoInput::switchInput(const std::string& resource) } currentResource_ = resource; + decOptsFound_ = false; std::promise<DeviceParams> p; foundDecOpts_.swap(p); @@ -353,4 +354,13 @@ int VideoInput::getPixelFormat() const DeviceParams VideoInput::getParams() const { return decOpts_; } +void +VideoInput::foundDecOpts(const DeviceParams& params) +{ + if (not decOptsFound_) { + decOptsFound_ = true; + foundDecOpts_.set_value(params); + } +} + }} // namespace ring::video diff --git a/src/media/video/video_input.h b/src/media/video/video_input.h index 8cada82677c3eabce229c74fed9f166cdd5954cc..6e9130f9f16bc8fa3b477a27aef8f8fb589c7893 100644 --- a/src/media/video/video_input.h +++ b/src/media/video/video_input.h @@ -78,6 +78,9 @@ private: std::promise<DeviceParams> foundDecOpts_; std::shared_future<DeviceParams> futureDecOpts_; + std::atomic_bool decOptsFound_ {false}; + void foundDecOpts(const DeviceParams& params); + bool emulateRate_ = false; ThreadLoop loop_; diff --git a/src/media/video/video_rtp_session.cpp b/src/media/video/video_rtp_session.cpp index 22877c6a50f44475935be318a89ae0de318e3db5..97d831fa251bf6a6fef3d6fcfe7fabff02e598b4 100644 --- a/src/media/video/video_rtp_session.cpp +++ b/src/media/video/video_rtp_session.cpp @@ -74,11 +74,16 @@ void VideoRtpSession::startSender() videoLocal_ = getVideoCamera(); if (auto input = videoManager.videoInput.lock()) { auto newParams = input->switchInput(input_); - if (newParams.valid() && - newParams.wait_for(NEWPARAMS_TIMEOUT) == std::future_status::ready) - localVideoParams_ = newParams.get(); - else - RING_WARN("No valid new video parameters."); + try { + if (newParams.valid() && + newParams.wait_for(NEWPARAMS_TIMEOUT) == std::future_status::ready) + localVideoParams_ = newParams.get(); + else + RING_ERR("No valid new video parameters."); + } catch (const std::exception& e) { + RING_ERR("Exception during retriving video parameters: %s", + e.what()); + } } else { RING_WARN("Can't lock video input"); } diff --git a/src/preferences.cpp b/src/preferences.cpp index ef906a2a4cf7dfd2fde66648595a249ec3573aa0..473b252dcc9aeb3a538a66af63215462f6f1ebfc 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -247,7 +247,7 @@ HookPreference::HookPreference() : , numberEnabled_(false) , sipEnabled_(false) , urlCommand_("x-www-browser") - , urlSipField_("X-sflphone-url") + , urlSipField_("X-ring-url") {} HookPreference::HookPreference(const std::map<std::string, std::string> &settings) : diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp index ff3386ea86be702c6501ea8282de81755f957bc9..415bc5c6cee35a0645f5cdf0e9475ff9148bcea3 100644 --- a/src/ringdht/ringaccount.cpp +++ b/src/ringdht/ringaccount.cpp @@ -98,7 +98,6 @@ RingAccount::RingAccount(const std::string& accountID, bool /* presenceEnabled * fileutils::check_dir(idPath_.c_str()); caPath_ = idPath_ + DIR_SEPARATOR_STR "certs"; caListPath_ = idPath_ + DIR_SEPARATOR_STR "ca_list.pem"; - checkIdentityPath(); } RingAccount::~RingAccount() @@ -413,8 +412,10 @@ void RingAccount::unserialize(const YAML::Node &node) void RingAccount::checkIdentityPath() { - if (not tlsPrivateKeyFile_.empty() and not tlsCertificateFile_.empty()) + if (not tlsPrivateKeyFile_.empty() and not tlsCertificateFile_.empty()) { + loadIdentity(); return; + } const auto idPath = fileutils::get_data_dir()+DIR_SEPARATOR_STR+getAccountID(); tlsPrivateKeyFile_ = idPath + DIR_SEPARATOR_STR "dht.key"; @@ -456,9 +457,11 @@ RingAccount::loadIdentity() tlsCertificateFile_ = idPath_ + DIR_SEPARATOR_STR "dht.crt"; tlsPrivateKeyFile_ = idPath_ + DIR_SEPARATOR_STR "dht.key"; + username_ = id.second->getId().toString(); return {ca.second, id}; } + username_ = dht_cert.getId().toString(); return { std::make_shared<dht::crypto::Certificate>(std::move(ca_cert)), { diff --git a/src/ringdht/ringaccount.h b/src/ringdht/ringaccount.h index a2def3eafd3e30437525e12c63b49c84fc325be1..84cb1411a5b3cf17e6dbc5bb3956e142671b86ca 100644 --- a/src/ringdht/ringaccount.h +++ b/src/ringdht/ringaccount.h @@ -148,7 +148,7 @@ class RingAccount : public SIPAccountBase { std::string getToUri(const std::string& username) const; /** - * In the current version of SFLPhone, "srv" uri is obtained in the preformated + * In the current version of Ring, "srv" uri is obtained in the preformated * way: hostname:port. This method adds the correct scheme and append * the ;transport= parameter at the end of the uri, in accordance with RFC3261. * diff --git a/src/ringdht/sips_transport_ice.cpp b/src/ringdht/sips_transport_ice.cpp index b9cc114634f2b7cbf1d8c00370035cc04c62cabb..db3d54b7c6a7f38c4304ccb999fd35b2f8abbe68 100644 --- a/src/ringdht/sips_transport_ice.cpp +++ b/src/ringdht/sips_transport_ice.cpp @@ -30,6 +30,7 @@ #include "sips_transport_ice.h" #include "ice_transport.h" +#include "manager.h" #include "logger.h" #include "gnutls_support.h" @@ -205,6 +206,7 @@ SipsIceTransport::SipsIceTransport(pjsip_endpoint* endpt, }); tlsThread_.start(); + Manager::instance().registerEventHandler((uintptr_t)this, [this]{ handleEvents(); }); } SipsIceTransport::~SipsIceTransport() @@ -213,6 +215,7 @@ SipsIceTransport::~SipsIceTransport() shutdown(); ice_->setOnRecv(comp_id_, nullptr); tlsThread_.join(); + Manager::instance().unregisterEventHandler((uintptr_t)this); pj_lock_destroy(trData_.base.lock); pj_atomic_destroy(trData_.base.ref_cnt); @@ -653,6 +656,37 @@ SipsIceTransport::setup() return startTlsSession() == PJ_SUCCESS; } +void +SipsIceTransport::handleEvents() +{ + std::lock_guard<std::mutex> l(rxMtx_); + while (not rxPending_.empty()) { + auto pck_it = rxPending_.begin(); + auto& pck = *pck_it; + pj_pool_reset(rdata_.tp_info.pool); + pj_gettimeofday(&rdata_.pkt_info.timestamp); + rdata_.pkt_info.len = pck.size(); + std::copy_n(pck.data(), pck.size(), rdata_.pkt_info.packet); + auto eaten = pjsip_tpmgr_receive_packet(trData_.base.tpmgr, &rdata_); + if (eaten != rdata_.pkt_info.len) { + // partial sip packet received + auto npck_it = std::next(pck_it); + if (npck_it != rxPending_.end()) { + // drop current packet, merge reminder with next one + auto& npck = *npck_it; + npck.insert(npck.begin(), pck.begin()+eaten, pck.end()); + rxPendingPool_.splice(rxPendingPool_.end(), rxPending_, pck_it); + } else { + // erase eaten part, keep reminder + pck.erase(pck.begin(), pck.begin()+eaten); + break; + } + } else { + rxPendingPool_.splice(rxPendingPool_.end(), rxPending_, pck_it); + } + } +} + void SipsIceTransport::loop() { @@ -720,24 +754,16 @@ SipsIceTransport::loop() return; while (canRead_) { - if (rdata_.pkt_info.len < 0) - rdata_.pkt_info.len = 0; - const auto decrypted_size = gnutls_record_recv(session_, - (uint8_t*)rdata_.pkt_info.packet + rdata_.pkt_info.len, - sizeof(rdata_.pkt_info.packet)-rdata_.pkt_info.len); - rdata_.pkt_info.len += decrypted_size; + std::lock_guard<std::mutex> l(rxMtx_); + if (rxPendingPool_.empty()) + rxPendingPool_.emplace_back(PJSIP_MAX_PKT_LEN); + auto& buf = rxPendingPool_.front(); + buf.resize(PJSIP_MAX_PKT_LEN); + const auto decrypted_size = gnutls_record_recv(session_, buf.data(), buf.size()); + if (decrypted_size > 0/* || transport error */) { - rdata_.pkt_info.zero = 0; - pj_gettimeofday(&rdata_.pkt_info.timestamp); - auto eaten = pjsip_tpmgr_receive_packet(trData_.base.tpmgr, &rdata_); - auto rem = rdata_.pkt_info.len - eaten; - if (rem > 0 && rem != rdata_.pkt_info.len) { - std::move(rdata_.pkt_info.packet + eaten, - rdata_.pkt_info.packet + eaten + rem, - rdata_.pkt_info.packet); - } - rdata_.pkt_info.len = rem; - pj_pool_reset(rdata_.tp_info.pool); + buf.resize(decrypted_size); + rxPending_.splice(rxPending_.end(), rxPendingPool_, rxPendingPool_.begin()); } else if (decrypted_size == 0) { /* EOF */ shutdown(); @@ -795,6 +821,7 @@ SipsIceTransport::clean() cookie_key_.data = nullptr; cookie_key_.size = 0; } + rxPendingPool_.clear(); bool event = state_ == TlsConnectionState::ESTABLISHED; closeTlsSession(); @@ -850,10 +877,10 @@ SipsIceTransport::tlsRecv(void* d , size_t s) errno = EAGAIN; return -1; } - RING_DBG("SipsIceTransport::tlsRecv %lu at %lu", - s, clock::now().time_since_epoch().count()); const auto& front = tlsInputBuff_.front(); const auto n = std::min(front.size(), s); + RING_DBG("SipsIceTransport::tlsRecv %lu at %lu", + n, clock::now().time_since_epoch().count()); std::copy_n(front.begin(), n, (uint8_t*)d); tlsInputBuff_.pop_front(); if (tlsInputBuff_.empty()) diff --git a/src/ringdht/sips_transport_ice.h b/src/ringdht/sips_transport_ice.h index b0bd6ba060dc203e9888c7b7d60e03c577ff04aa..1517b2e6c5ae059062346402229cd89fdd390c56 100644 --- a/src/ringdht/sips_transport_ice.h +++ b/src/ringdht/sips_transport_ice.h @@ -144,6 +144,11 @@ private: gnutls_datum_t cookie_key_ {nullptr, 0}; gnutls_dtls_prestate_st prestate_; + /** + * To be called on a regular basis to receive packets + */ + void handleEvents(); + // ThreadLoop bool setup(); void loop(); @@ -157,6 +162,10 @@ private: pj_status_t flushOutputBuff(); std::list<DelayedTxData> outputBuff_; std::mutex outputBuffMtx_; + + std::mutex rxMtx_; + std::list<std::vector<uint8_t>> rxPending_; + std::list<std::vector<uint8_t>> rxPendingPool_; pjsip_rx_data rdata_; // GnuTLS <-> ICE diff --git a/src/sip/sipaccount.h b/src/sip/sipaccount.h index 0d832a3cba9a6cb3775eba719c0fb9fcf6ab70cf..8aeb31e4ee8db82612daa35e30282206e5092fdf 100644 --- a/src/sip/sipaccount.h +++ b/src/sip/sipaccount.h @@ -383,7 +383,7 @@ class SIPAccount : public SIPAccountBase { std::string getToUri(const std::string& username) const; /** - * In the current version of SFLPhone, "srv" uri is obtained in the preformated + * In the current version of Ring, "srv" uri is obtained in the preformated * way: hostname:port. This method adds the correct scheme and append * the ;transport= parameter at the end of the uri, in accordance with RFC3261. * @@ -628,7 +628,7 @@ class SIPAccount : public SIPAccountBase { * If username is not provided, as it happens for Direct ip calls, * fetch the Real Name field of the user that is currently * running this program. - * @return std::string The login name under which SFLPhone is running. + * @return std::string The login name under which Ring is running. */ static std::string getLoginName(); diff --git a/src/sip/tlsvalidator.cpp b/src/sip/tlsvalidator.cpp index fdc560620c65d14c6651930c446f23ab6268b921..2837bf2dc1290218dd449ee765e68fc27dba36c0 100644 --- a/src/sip/tlsvalidator.cpp +++ b/src/sip/tlsvalidator.cpp @@ -916,7 +916,7 @@ TlsValidator::CheckResult TlsValidator::authorityMatch() */ TlsValidator::CheckResult TlsValidator::knownAuthority() { - // TODO SFLphone need a new boolean account setting "require trusted authority" or something defaulting to true + // TODO Ring need a new boolean account setting "require trusted authority" or something defaulting to true // using GNUTLS_CERT_SIGNER_NOT_FOUND is a temporary placeholder as it is close enough return TlsValidator::CheckResult(compareToCa() & GNUTLS_CERT_SIGNER_NOT_FOUND ? CheckValues::FAILED : CheckValues::PASSED, "");