live555编译与vc2010工程创建
Live555是一个为流媒体提供解决方案的跨平台的C++开源项目,它实现了对标准流媒体传输是一个为流媒体提供解决方案的跨平台的C++开源项目,它实现了对标准流媒体传输协议如RTP/RTCP、RTSP、SIP等的支持。Live555实现了对多种音视频编码格式的音视频数据的流化、接收和处理等支持,包括MPEG、H.263+、DV、JPEG视频和多种音频编码。同时由于良好的设计,Live555非常容易扩展对其他格式的支持。
为了熟悉rtsp协议,选择live555是个很好的选择。
根据live555官网的描述, window系统下的编译需要做几步修改工作。原文描述如下
How to configure and build the code on Windows
Unpack and extract the ‘.tar.gz’ file (using an application such as “WinZip”).
If the ‘tools’ directory on your Windows machine is something other than “c:\Program Files\DevStudio\Vc”, change the “TOOLS32 =” line in the file “win32config”.
In a command shell, ‘cd’ to the “live” directory, and run
genWindowsMakefiles
This will generate - in each subdirectory - a “*.mak” makefile suitable for use by (e.g.) Microsoft Visual Studio.
Alternatively, if you’re starting from a Unix machine, you can generate the Windows Makefiles by running
./genWindowsMakefiles
(after - if necessary - changing the “TOOLS32 =” line in the file “win32config”, as noted above). Then, copy the “live” directories and its subdirectories (in ASCII mode) to a Windows machine.
To use these Makefiles from within Visual Studio, use the “Open Workspace” menu command, then (in the file selection dialog) for “Files of type”, choose “Makefiles (.mak)”. Visual Studio should then prompt you, asking if you want to use this Makefile to set up a new project. Say “OK”.
Note that you will need to build each of the “UsageEnvironment”, “groupsock”, “liveMedia”, and “BasicUsageEnvironment” projects first, before building “testProgs”.
If you wish, you can build the “WindowsAudioInputDevice” project also.
Doug Kosovic notes: Visual C++ 2003 no longer comes with the old I/O Streams headers iostreams.h et al, or the corresponding library msvcirt.lib. So anybody trying to build the LIVE555 code with VC++ 2003 might find the following useful: A non-sourcecode modification workaround for VC++ 2003 is to copy the missing headers and msvcirt.lib from VC++ 2002. In file ‘win32config’ add an extra -I switch to COMPILE_OPTS to find the old headers and a -LIBPATH: switch to LINK_OPTS_0 to find msvcirt.lib.
命令行方式编译修改步骤如下
- 下载live555源码并解压 下载地址http://www.live555.com/liveMedia/public/;
- 修改win32config 文件将 TOOLS32 = 你的vc2010安装路径;LINK_OPTS_0 = $(linkdebug) msvcrt.lib
- 修改groupsock目录下的Makefile.head文件,添-DNO_STRSTREAM;
命令行编译
1.命令行切换到源码解压目录:执行genWindowsMakefiles.cmd生成.mak文件用于编译
2.编写一个compile.bat的文件内容如下:
call “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat”
cd liveMedia
nmake /B -f liveMedia.mak
cd …/groupsock
nmake /B -f groupsock.mak
cd …/UsageEnvironment
nmake /B -f UsageEnvironment.mak
cd …/BasicUsageEnvironment
nmake /B -f BasicUsageEnvironment.mak
cd …/testProgs
nmake /B -f testProgs.mak
cd …/mediaServer
nmake /B -f mediaServer.mak
pause
3.在命令行执行 compile.bat即可生成live555MediaServer.exe程序,也可以双击 compile.bat执行。
创建vs2010工程便于调试
用vs2010打开生成的.mak 文件会提示无法加载。因此我们将创建几个win32 console application工程。如下:
liveMedia
groupsock
UsageEnvironment
BasicUsageEnvironment
liveMedia
mediaServer
注意:mediaServer设置为
其他的工程都设置为 static library
创建完成后工程如下
工程创建完成之后,就把相应的源码添加到工程
如 liveMedia目录下文件添加到liveMedia工程
都添加完成后,再设置下工程
我的目录结构如下
右键每个工程属性,设置include
右键mediaServer属性工程设置input lib
设置lib查找目录,这里设置工程输出目录
(
S
o
l
u
t
i
o
n
D
i
r
)
(SolutionDir)
(SolutionDir)(Configuration)
注意设置都要选择 all configurations,这样 debug、release 都设置了
如需要testProgs,按照 mediaServer的步骤设置即可。
接下来编译即可。
不想一步一步设置的,这里提供下完整的工程地址
git地址 : https://github.com/itbread/live555vcproject.git
码云地址:https://gitee.com/itbread/live555vcproject.git
csdn地址:https://download.csdn.net/download/itbread/10684238