1,安装mingw
2,在mingw中安装:msys-base,mingw32-gcc,mingw32-gcc-g++和mingw32-libz
把mingw的bin目录(如C:\MinGW\bin)添加到系统环境变量path
3,解压pjsip2.3.0,在pjsip目录下(如D:\pjproject-2.3\pjlib\include\pj)创建config_site.h,添加
- #define PJMEDIA_HAS_VIDEO 1
- //添加下面一行
- #include "SDL.h"
修改D:\pjproject-2.3\pjsip-apps\src\samples\pjsua2_demo.cpp,添加并修改
- //添加下面一行
- #include "SDL.h"
- //int main()
- int main(int argc, char *argv[])
4,安装sdl2
从sdl网站https://www.libsdl.org/download-2.0.php下载Development Libraries:SDL2-devel-2.0.3-mingw.tar.gz
将子目录i686-w64-mingw32解压到D:\video\目录下,并将附件中的SDL_platform.h覆盖include/SDL2下的原文件
将D:\video\i686-w64-mingw32\bin添加到系统环境变量path
5,安装ffmpeg1.2
从zeranoe ffmpeg(https://ffmpeg.zeranoe.com/blog/?p=178)下载ffmpeg的windows版本:FFmpeg 1.2 Win32 Shared和FFmpeg 1.2 Win32 Dev解压到D:\video\目录下
将附件中pkgconfig中的.pc文件复制到D:\video\ffmpeg-1.2-win32-dev\lib\pkgconfig,修改.pc文件
- prefix=/video/ffmpeg-1.2-win32-dev/
6,安装pkg-config
从GTK+ for Windows下载GLib DLL和pkg-config.exe,解压libglib-2.0-0.dll和pkg-config.exe到C:\MinGW\bin,将libintl-8.dll复制另命名intl.dll
7,创建msys目录下的fstab文件(如C:\MinGW\msys\1.0\etc),添加内容:如d:/pjproject-2.3 /pjsip和d:/video /video
8,启动msys.bat
- cd /pjsip
- export PKG_CONFIG_PATH=/video/ffmpeg-1.2-win32-dev/lib/pkgconfig
- ./configure CFLAGS="-I/video/i686-w64-mingw32/include/SDL2" LDFLAGS="-L/video/i686-w64-mingw32/lib"
- make dep
- make
9,安装pjsua2
安装python2.7.7
将python目录(如C:\Python27)添加到系统环境变量path
下载swig,将swig目录(如D:\swigwin-3.0.2)添加到系统环境变量path
- cd /pjsip/pjsip-apps/src/swig
- make
- make install
10,测试安装是否成功
在cmd里启动python,输入:
- import pjsua2
注1:修改完系统环境变量path后,要重新打开msys
注2:相关下载
mingw: http://sourceforge.net/projects/mingw/files/
pjsip: http://www.pjsip.org/release/2.3/pjproject-2.3.zip
python: https://www.python.org/ftp/python/2.7.7/python-2.7.7.msi
swig: http://prdownloads.sourceforge.net/swig/swigwin-3.0.2.zip
sdl: https://www.libsdl.org/release/SDL2-devel-2.0.3-mingw.tar.gz
ffmpeg: http://ffmpeg.zeranoe.com/builds/win32/shared/ffmpeg-1.2-win32-shared.7z和http://ffmpeg.zeranoe.com/builds/win32/dev/ffmpeg-1.2-win32-dev.7z
pkg-config: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.23-3_win32.zip
glib dll: http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.1-1_win32.zip
pkgconfig-ffmpeg.zip
SDL_platform.zip