-
Notifications
You must be signed in to change notification settings - Fork 92
Home
"MyRtspClient" is a RTSP client based on JRTPLIB. It is aimed at high performance on embeded system. Although, Live555 is good enough to make every thing in order, it takes too much CPU occupation for embeded system. That is why "MyRtspClient" is born.
Prerequisite:
- c++ compiler
- cmake
Compiling options are in files myRtspClient/config., such as config.linux, which specify the compiling tools and their flags. Here is an example for platform of x86/x64 linux.
$ cd myRtspClient/
$ ./genMakefiles linux
$ make
There are 3 example programs in myRtspClient/example/: simple_example, complete_example, common_example. Here is a usage example, which 'rtsp://192.168.81.145/ansersion' is thr RTSP URI:
$ ./common_example rtsp://192.168.81.145/ansersion
Then the program will get h264 data and write them into file 'test_packet_recv.h264'. Then you could use ffplay to play it.
string RtspUri(argv[1]);
RtspClient Client;
Client.SetURI(RtspUri);
Create RTSP client object and set the RTSP server URI.
Client.DoDESCRIBE();
Send 'DESCRIBE' command to RTSP server.
Client.ParseSDP();
Parse SDP which is the response from RTSP server after getting 'DESCRIBE' command.
Client.DoSETUP();
Client.DoPLAY("video");
Send 'DESCRIBE' and 'PLAY' commands to RTSP server.
if(!Client.GetMediaData("video", buf, &size, BufSize)) continue;
Get media data('video') and put it into buffer 'buf', and put the data size into 'size'. 'BufSize' is used for avoiding buffer over-flow.
If comething wrong, 'Client.GetMediaData' will return 'false'.