mingw下编译mplayer支持rtsp播放

来源:互联网 发布:mac 修图软件推荐 编辑:程序博客网 时间:2024/05/17 04:53

mplayer使用live555实现了播放rtsp流的功能。

那么怎么编译mplayer支持rtsp播放呢?

我尝试这个问题两天,现在终于搞明白了一些东东。

你需要先在mingw下编译live555,见http://blog.csdn.net/qiuchangyong/article/details/7955835

然后你要把live目录(包括live这个文件夹)放到/usr/local/lib/下面,其实就是c:\MinGW\msys\1.0\local\lib,我的是c盘下,如果不是c盘,对应相应的目录。

到mplayer源码下,直接执行./configure,不用带任何参数,会发现找到了/usr/local/lib/live路径就是live555的路径,一路make,ok!

需要说明的是,我先前不知道一些事实,参考了一些网站上说的加了一些参数,像下面这样:

./configure --enable-live --extra-cflags="-I/usr/local/lib/live/UsageEnvironment/include -I/usr/local/lib/live/BasicUsageEnvironment/include -I/usr/local/lib/live/groupsock/include -I/usr/local/lib/live/liveMedia/include" --extra-ldflags="-L/usr/local/lib/live/UsageEnvironment/libUsageEnvironment.a -L/usr/local/lib/live/BasicUsageEnvironment/libBasicUsageEnvironment.a -L/usr/local/lib/live/groupsock/libgroupsock.a -L/usr/local/lib/live/liveMedia/libliveMedia.a"

结果编译失败!死在libmpdemux/demux_rtp.cpp和libmpdemux/demux_rtp_codec.cpp这两个c++文件的编译上,报了一大堆错误:

libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xc6): undefined reference to `RTSPC
lient::teardownMediaSession(MediaSession&)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xdf): undefined reference to `Mediu
m::close(Medium*)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xea): undefined reference to `Mediu
m::close(Medium*)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xf5): undefined reference to `Mediu
m::close(Medium*)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x121): undefined reference to `oper
ator delete[](void*)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x129): undefined reference to `oper
ator delete(void*)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x13d): undefined reference to `Usag
eEnvironment::reclaim()'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x17f): undefined reference to `SIPC
lient::sendBYE()'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x418): undefined reference to `Basi
cTaskScheduler::createNew()'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x428): undefined reference to `Basi
cUsageEnvironment::createNew(TaskScheduler&)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x487): undefined reference to `Medi
aSession::createNew(UsageEnvironment&, char const*)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x49f): undefined reference to `oper
ator new(unsigned int)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x4fa): undefined reference to `Medi
aSubsessionIterator::MediaSubsessionIterator(MediaSession&)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x52a): undefined reference to `Medi
aSubsessionIterator::next()'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x576): undefined reference to `Medi
aSubsession::setClientPortNum(unsigned short)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x586): undefined reference to `Medi
aSubsession::initiate(int)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x5cb): undefined reference to `Medi
aSubsessionIterator::next()'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x60b): undefined reference to `RTSP
Client::playMediaSession(MediaSession&, double, double, float)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x61f): undefined reference to `Medi
aSubsessionIterator::reset()'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x66a): undefined reference to `Medi
aSubsessionIterator::next()'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x6a2): undefined reference to `oper
ator new(unsigned int)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x7d6): undefined reference to `incr
easeReceiveBufferTo(UsageEnvironment&, int, unsigned int)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x834): undefined reference to `RTSP
Client::setupMediaSubsession(MediaSubsession&, unsigned int, unsigned int, unsig
ned int)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x8f8): undefined reference to `oper
ator new(unsigned int)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x998): undefined reference to `Medi
aSubsessionIterator::~MediaSubsessionIterator()'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xa35): undefined reference to `SIPC
lient::sendACK()'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xa89): undefined reference to `RTSP
Client::createNew(UsageEnvironment&, int, char const*, unsigned short)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xadb): undefined reference to `RTSP
Client::describeWithPassword(char const*, char const*, char const*, unsigned int
, int)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xb59): undefined reference to `SIPC
lient::createNew(UsageEnvironment&, unsigned char, char const*, int, char const*
)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xba4): undefined reference to `SIPC
lient::inviteWithPassword(char const*, char const*, char const*)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xbe9): undefined reference to `Medi
aSubsessionIterator::~MediaSubsessionIterator()'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xc21): undefined reference to `RTSP
Client::describeURL(char const*, Authenticator*, unsigned int, int)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xc48): undefined reference to `SIPC
lient::invite(char const*, Authenticator*)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xc5d): undefined reference to `Medi
aSubsessionIterator::~MediaSubsessionIterator()'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x16a6): undefined reference to `Fra
medSource::getNextFrame(unsigned char*, unsigned int, void (*)(void*, unsigned i
nt, unsigned int, timeval, unsigned int), void*, void (*)(void*), void*)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x1ef7): undefined reference to `DEL
AY_SECOND'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x1f03): undefined reference to `ope
rator*(short, DelayInterval const&)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x1f22): undefined reference to `ope
rator*(short, DelayInterval const&)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0x1f41): undefined reference to `ope
rator*(short, DelayInterval const&)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.text+0xfcb): undefined reference to `oper
ator delete(void*)'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.rdata$_ZTI15ReadBufferQueue[typeinfo for
ReadBufferQueue]+0x0): undefined reference to `vtable for __cxxabiv1::__class_ty
pe_info'
libmpdemux/demux_rtp.o:demux_rtp.cpp:(.eh_frame+0x12): undefined reference to `_
_gxx_personality_v0'
libmpdemux/demux_rtp_codec.o:demux_rtp_codec.cpp:(.text+0x60b): undefined refere
nce to `parseGeneralConfigStr(char const*, unsigned int&)'
libmpdemux/demux_rtp_codec.o:demux_rtp_codec.cpp:(.text+0x66b): undefined refere
nce to `operator new[](unsigned int)'
libmpdemux/demux_rtp_codec.o:demux_rtp_codec.cpp:(.text+0x77e): undefined refere
nce to `operator delete[](void*)'
libmpdemux/demux_rtp_codec.o:demux_rtp_codec.cpp:(.text+0xe55): undefined refere
nce to `parseStreamMuxConfigStr(char const*, unsigned int&)'
libmpdemux/demux_rtp_codec.o:demux_rtp_codec.cpp:(.text+0xe77): undefined refere
nce to `MPEG4LATMAudioRTPSource::omitLATMDataLengthField()'
libmpdemux/demux_rtp_codec.o:demux_rtp_codec.cpp:(.text+0xe9e): undefined refere
nce to `parseGeneralConfigStr(char const*, unsigned int&)'
collect2: ld returned 1 exit status
make: *** [mplayer.exe] Error 1

简言之,configure的时候不要像我之前那样胡乱的带上一些参数就可以避免这些错误了。

我用的live版本是live.2011.12.23.tar.gz,如果是更新的版本需要在RTSPClient.hh前加上一句#define RTSPCLIENT_SYNCHRONOUS_INTERFACE 1

我用mplayer版本是MPlayer-1.0rc4