概述
live555官方地址:http://www.live555.com/liveMedia/public/。该地址下有live555的工程包(比如:live.2019.10.20.tar.gz),以及h264/h265的测试流文件。本文以live.2019.10.20.tar.gz为例,介绍live555 rtspserver示例代码。
live555工程的目录结构如下所示,其中testProgs则为测试用例,本文将以OnDemandServerMediaSubsession.cpp为例,解说示例如何运行,以及代码结构。
├── BasicUsageEnvironment
│ └── include
├── groupsock
│ └── include
├── liveMedia
│ └── include
├── mediaServer
├── proxyServer
├── testProgs
├── UsageEnvironment
│ └── include
└── WindowsAudioInputDevice
运行示例
1、编译live555工程,确认testProgs中的源文件被编译。
2、执行OnDemandServerMediaSubsession,在执行该程序的目录下必须存在test.h264的码流文件。比如笔者在userdata目录下存在test.h264,则可直接在userdata目录下运行OnDemandServerMediaSubsession。完整的步骤和log如下所示:
[root@rk3328:/userdata]# ls test.264 -al
-rwxrwxrwx 1 root root 87402 Oct 17 06:56 test.264
[root@rk3328:/userdata]#
[root@rk3328:/userdata]# /usr/bin/testOnDemandRTSPServer
"mpeg4ESVideoTest" stream, from the file "test.m4e"
Play this stream using the URL "rtsp://xxx.xxx.xxx.xxx:8554/mpeg4ESVideoTest"
"h264ESVideoTest" stream, from the file "test.264"
Play this stream using the URL "rtsp://xxx.xxx.xxx.xxx:8554/h264ESVideoTest"
"h265ESVideoTest" stream, from the file "test.265"
Play this stream using the URL "rtsp://xxx.xxx.xxx.xxx:8554/h265ESVideoTest"
"mpeg1or2AudioVideoTest" stream, from the file "test.mpg"
Play this stream using the URL "rtsp://xxx.xxx.xxx.xxx:8554/mpeg1or2AudioVideoTest"
"mpeg1or2ESVideoTest" stream, from the file "testv.mpg"
Play this stream using the URL "rtsp://xxx.xxx.xxx.xxx:8554/mpeg1or2ESVideoTest"
"mp3AudioTest" stream, from the file "test.mp3"
Play this stream using the URL "rtsp://xxx.xxx.xxx.xxx:8554/mp3AudioTest"
"wavAudioTest" stream, from the file "test.wav"
Play this stream using the URL "rtsp://xxx.xxx.xxx.xxx:8554/wavAudioTest"
"amrAudioTest" stream, from the file "test.