嵌入式 live555Media编译详解

Live555是一个为流媒体提供解决方案的跨平台的C++开源项目,它实现了对标准流媒体传输协议如RTP/RTCP、RTSP、SIP等的支持。Live555实现了对多种音视频编码格式的音视频数据的流化、接收和处理等支持,包括MPEG、H.263+、DV、JPEG视频和多种音频编码。同时由于良好的设计,Live555非常容易扩展对其他格式的支持。目前,Live555已经被用于多款播放器的流媒体播放功能的实现,如VLC(VideoLan)、MPlayer。下面介绍Live555的基本使用方法。

编译

编译方法:

./genMakefiles

如在Linux下解压Live555后进入目录:

#./genMakefileslinux

#Make

使用

1)进入mediaServer目录启动服务器:

[root@localhostmediaServer]# cd mediaServer]

[root@localhostmediaServer]# ./live555MediaServer

LIVE555 MediaServer

       version 0.5 (LIVE555 Streaming Media library version2010.07.29).

Play streams fromthis server using the URL

       rtsp://192.168.1.120/

where is a filepresent in the current directory.

Each file's typeis inferred from its name suffix:

       ".aac" => an AAC Audio (ADTS format) file

       ".amr" => an AMR Audio file

       ".m4e" => a MPEG-4 Video Elementary Streamfile

       ".dv" => a DV Video file

       ".mp3" => a MPEG-1 or 2 Audio file

       ".mpg" => a MPEG-1 or 2 Program Stream (audio+video)file

       ".ts" => a MPEG Transport Stream file

               (a ".tsx" index file - if present - provides server 'trick play'support)

       ".wav" => a WAV Audio file

Seehttp://www.live555.com/mediaServer/ for additionaldocumentation.

2)进入testProgs使用客户端工具播放mp3

[root@localhosttestProgs]# ./openRTSP rtsp://192.168.1.120/1.mp3

Opening connectionto 192.168.1.120, port 554...

...remoteconnection opened

Sending request:OPTIONS rtsp://192.168.1.120/1.mp3 RTSP/1.0

CSeq:2

User-Agent:./openRTSP (LIVE555 Streaming Media v2010.07.29)

Received 152 newbytes of response data.

Received acomplete OPTIONS response:

RTSP/1.0 200OK

CSeq:2

Date: Sun, Aug 012010 05:17:32 GMT

Public: OPTIONS,DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER,SET_PARAMETER

Sending request:DESCRIBE rtsp://192.168.1.120/1.mp3 RTSP/1.0

CSeq:3

User-Agent:./openRTSP (LIVE555 Streaming Media v2010.07.29)

Accept:application/sdp

Received 547 newbytes of response data.

Received acomplete DESCRIBE response:

RTSP/1.0 200OK

CSeq:3

Date: Sun, Aug 012010 05:17:32 GMT

Content-Base:rtsp://192.168.1.120/1.mp3/

Content-Type:application/sdp

Content-Length:387

v=0

o=-1280639653739259 1 IN IP4 192.168.1.120

s=MPEG-1 or 2Audio, streamed by the LIVE555 Media Server

i=1.mp3

t=00

a=tool:LIVE555Streaming Media v2010.07.29

a=type:broadcast

a=control:*

a=range:npt=0-219.555

a=x-qt-text-nam:MPEG-1 or 2 Audio, streamed by the LIVE555Media Server

a=x-qt-text-inf:1.mp3

m=audio 0 RTP/AVP14

c=IN IP40.0.0.0

b=AS:128

a=control:track1

Opened URL"rtsp://192.168.1.120/1.mp3", returning a SDPdescription:

v=0

o=-1280639653739259 1 IN IP4 192.168.1.120

s=MPEG-1 or 2Audio, streamed by the LIVE555 Media Server

i=1.mp3

t=00

a=tool:LIVE555Streaming Media v2010.07.29

a=type:broadcast

a=control:*

a=range:npt=0-219.555

a=x-qt-text-nam:MPEG-1 or 2 Audio, streamed by the LIVE555Media Server

a=x-qt-text-inf:1.mp3

m=audio 0 RTP/AVP14

c=IN IP40.0.0.0

b=AS:128

a=control:track1

Created receiverfor "audio/MPA" subsession (client ports32772-32773)

Sending request:SETUP rtsp://192.168.1.120/1.mp3/track1 RTSP/1.0

CSeq:4

User-Agent:./openRTSP (LIVE555 Streaming Media v2010.07.29)

Transport:RTP/AVP;unicast;client_port=32772-32773

Received 205 newbytes of response data.

Received acomplete SETUP response:

RTSP/1.0 200OK

CSeq:4

Date: Sun, Aug 012010 05:17:32 GMT

Transport:RTP/AVP;unicast;destination=192.168.1.120;source=192.168.1.120;client_port=32772-32773;server_port=6970-6971

Session:624DAEF4

Setup "audio/MPA"subsession (client ports 32772-32773)

Created outputfile: "audio-MPA-1"

Sending request:PLAY rtsp://192.168.1.120/1.mp3/ RTSP/1.0

CSeq:5

User-Agent:./openRTSP (LIVE555 Streaming Media v2010.07.29)

Session:624DAEF4

Range:npt=0.000-219.555

Received 188 newbytes of response data.

Received acomplete PLAY response:

RTSP/1.0 200OK

CSeq:5

Date: Sun, Aug 012010 05:17:33 GMT

Range:npt=0.000-219.555

Session:624DAEF4

RTP-Info:url=rtsp://192.168.1.120/1.mp3/track1;seq=38835;rtptime=1769974566

Started playingsession

Receiving streameddata (for up to 224.555000 seconds)...

Sending request:TEARDOWN rtsp://192.168.1.120/1.mp3/ RTSP/1.0

CSeq:6

User-Agent:./openRTSP (LIVE555 Streaming Media v2010.07.29)

Session:624DAEF4

Received 65 newbytes of response data.

Received acomplete TEARDOWN response:

RTSP/1.0 200OK

CSeq:6

Date: Sun, Aug 012010 05:21:17 GMT

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值