Alexandre Lision | 8af73cb | 2013-12-10 14:11:20 -0500 | [diff] [blame] | 1 | |
| 2 | HOW TO ACTIVATE LIBSAMPLERATE |
| 3 | (a.k.a SRC/Secret Rabbit Code) |
| 4 | AS PJMEDIA'S SAMPLE RATE CONVERSION BACKEND |
| 5 | |
| 6 | by |
| 7 | Benny Prijono |
| 8 | PJSIP |
| 9 | |
| 10 | Background |
| 11 | ---------- |
| 12 | Secret Rabbit Code (aka libsamplerate) is a sample rate conversion |
| 13 | library, available from http://www.mega-nerd.com/SRC/index.html. |
| 14 | It is licensed under dual license, GPL and proprietary. |
| 15 | |
| 16 | |
| 17 | Supported Platforms |
| 18 | ------------------- |
| 19 | libsamplerate is available for Win32 with Visual Studio and the |
| 20 | Makefile based targets (such as Linux, MacOS X, *nix, etc.). |
| 21 | |
| 22 | It's not supported for WinCE/Windows Mobile and Symbian since it is |
| 23 | a floating point based implementation. |
| 24 | |
| 25 | |
| 26 | Installation |
| 27 | ------------ |
| 28 | - Download libsamplerate from http://www.mega-nerd.com/SRC/index.html |
| 29 | |
| 30 | - Untar libsamplerate-0.1.2.tar.gz into third_party directory |
| 31 | cd third_party |
| 32 | tar xzf libsamplerate-0.1.2.tar.gz |
| 33 | |
| 34 | - Rename libsamplerate-0.1.2 directory name to libsamplerate |
| 35 | On Windows: |
| 36 | ren libsamplerate-0.1.2 libsamplerate |
| 37 | |
| 38 | On Linux/Unix/MacOS X: |
| 39 | mv libsamplerate-0.1.2 libsamplerate |
| 40 | |
| 41 | |
| 42 | Visual Studio Build |
| 43 | ------------------- |
| 44 | For Visual Studio projects, only static linkage is supported |
| 45 | by PJMEDIA build system. If dynamic linking is desired, edit |
| 46 | pjmedia/src/pjmedia/resample_libresample.c to prevent it from |
| 47 | linking with the static library, and configure your project |
| 48 | to link with libsamplerate DLL library. |
| 49 | |
| 50 | To build libresample static library with Visual Studio: |
| 51 | |
| 52 | - Open third_party/build/samplerate/libsamplerate_static.dsp |
| 53 | - Build the project for both Debug and Release build |
| 54 | |
| 55 | |
| 56 | libresample dynamic library can be produced by following the |
| 57 | instructions in libresample source directory. |
| 58 | |
| 59 | |
| 60 | Makefile build |
| 61 | -------------- |
| 62 | - Build and install libsamplerate (configure && make && make install). |
| 63 | Please follow the instructions in libsamplerate documentation. |
| 64 | |
| 65 | - Re-run PJSIP's "configure" script with this option: |
| 66 | |
| 67 | ./configure --enable-libsamplerate |
| 68 | |
| 69 | this will detect the presence of libsamplerate library and add it |
| 70 | to the input library list. |
| 71 | |
| 72 | |
| 73 | Enabling libsamplerate for PJMEDIA's resample |
| 74 | --------------------------------------------- |
| 75 | For both Visual Studio and Makefile based build system, add this in |
| 76 | config_site.h: |
| 77 | |
| 78 | #define PJMEDIA_RESAMPLE_IMP PJMEDIA_RESAMPLE_LIBSAMPLERATE |
| 79 | |
| 80 | |
| 81 | Limitations |
| 82 | ----------- |
| 83 | Sample rate 22050 Hz is only supported with 20ms ptime, and sample rate 11025 Hz is only supported with 40ms ptime. This is the limitation of PJMEDIA rather than libsamplerate. |
| 84 | |
| 85 | |