1. 程式人生 > >Live555分析(一):VS2008編譯

Live555分析(一):VS2008編譯

背景:

RTSP(Real Time Streaming Protocol)實時流媒體協議: RFC 2326

The Real Time Streaming Protocol, or RTSP, is an application-level protocol for control over the delivery of data with real-time properties. RTSP provides an extensible framework to  enable controlled, on-demand delivery of real-time data, such as audio and video. Sources of data can include both live data feeds and stored clips. This protocol is intended to control multiple data delivery sessions, provide a means for choosing delivery channels such as UDP, multicast UDP and TCP, and provide a means for choosing delivery mechanisms based upon RTP (

RFC 1889).

Live555是一個完整的RTSP伺服器應用程式。

This code forms a set of C++ libraries for multimedia streaming, using open standard protocols (RTP/RTCP, RTSP, SIP). These libraries - which can be compiled for Unix (including Linux and Mac OS X), Windows, and QNX (and other POSIX-compliant systems) - can be used to build streaming applications. The libraries are already being used to implement applications such as the "

LIVE555 Media Server" and "LIVE555 Proxy Server" (RTSP server applications), and "vobStreamer" (for streaming DVD content using RTP/RTCP/RTSP). The libraries can also be used to stream, receive, and process MPEG, H.265, H.264, H.263+, DV or JPEG video, and several audio codecs. They can easily be extended to support additional (audio and/or video) codecs, and can also be used to build basic 
RTSP
 or SIP clients and servers, and have been used to add streaming support to existing media player applications, such as "VLC" and "MPlayer". (For some specific examples of how these libraries can be used, see the test programs below.)

Q.Windows下如何編譯Live555?

Live555釋出的程式碼中沒有提供vs solution工程,但是通過nmake編譯還是比較方便的,幾乎不費周折。

開啟genWindowsMakefile.cmd檔案, 可以看出此bat指令碼還是比較簡單的,只是根據各目錄中的Makefile.head, Makefile.tail以及win32config檔案生成.mak檔案。

檢視一下win32config檔案

其中的兩項需要做修改:

第一項是:

TOOLS32	=		C:\Program Files\Microsoft Visual Studio 9.0\VC

第二項是:
LINK_OPTS_0 =		$(linkdebug) msvcrt.lib

執行genWindowsMakefile.cmd指令碼後,在各個目錄中將會生成.mak檔案。利用vs自帶的nmake可以直接編譯了。

為了方便,不妨寫一bat指令碼:

call "c:\Program Files\Microsoft Visual Studio 9.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

執行一下上面的指令碼,就會在目錄中生成.lib和.exe檔案。

然而,沒有solution工程,分析程式碼確實不太舒服。為了長久打算本人新建了一份solution工程,結構為:

live

vs2008_live555

│  clean.bat
│  vs2008_live555.sln

├─BasicUsageEnvironment
│      BasicUsageEnvironment.vcproj

├─Groupsock
│      Groupsock.vcproj

├─liveMedia
│      LiveMedia.vcproj

├─MediaServer
│      MediaServer.vcproj

├─ProxyServer
│      ProxyServer.vcproj

└─UsageEnvironment
        UsageEnvironment.vcproj

其中, live目錄是程式碼所在的目錄。目錄意義請參考:http://www.live555.com/liveMedia/。

為了省去諸君的麻煩,本人把整個工程上傳了一份。請猛擊

至於如何測試RTSP Server,可以參考,http://www.cnblogs.com/skyseraph/archive/2012/04/11/2442840.html及

http://blog.csdn.net/beitiandijun/article/details/9232405。