live555-based video live DM368IPNC RTSP analysis
This is my Code analysis of the TI DM368IPNC RTSP live part.
Appro IPNC Video Stream live part of the RTSP, based on live555, by rewriting Wis-streamer implementation, live555 official on the internet has wis-streamer code download, appro modify it, The Getavdata interface is added to the framedsource so that the IPNC can be streamed.
The feeling: C + + really is very useful
Now lazy, the text part is copied directly, the source document uses Excel,
LIVE555-based video live DM368IPNC RTSP analysis
First, describe
Appro uses live555 to achieve three video streams and a live audio stream
1. MJPEG Video
2. H264 Video
3. MPEG4 Video
4. PCM Audio
LIVE555 is an open source RTSP C + + class library, the default implementation of audio and video files on-demand, but can be inherited by the relevant classes, the implementation of relevant methods to implement video live
The general steps that LIVE555 provides for implementing live streaming are:
Screenshot from the previous "live555 analysis and development. xlsx"
Appro is also implemented in this way
Ii. added live555 source files for Appro
The file complexity is due to the realization of a variety of audio and video streams, if only one left, the source file will be very concise
The diagram below is a UML class diagram of Appro source code.
The Approinput class is similar to the simple factory pattern in design mode for creating specific Framedsource, and for wisservermediasubsession classes, the interfaces that handle Framedsource are the same.
But for Framedsource, the specific frame acquisition of VideoSource and Audiosource is different,
In this way, you need to use Approinput to create VideoSource and Audiosource separately.
The VideoSource () method of the class Approinput returns an instance of the Videoopenfilesource class
The Audiosource () method of the class Approinput returns an instance of the Audioopenfilesource class
Third, the important Framedsource
The Dogetnextframe () method of the Framedsource class is used to obtain the frame data of the audio and video, the subclass needs to implement this method
The incomingDataHandler1 in Openfilesource called the virtual function readfromfile, which is related to the underlying,
All subclasses Videoopenfilesource and Audioopenfilesource classes implemented by the Openfilesource
In Appro's IPNC, both video and audio data are obtained through the Getavdata () function,
Therefore, the Getavdata () function is encapsulated in the ReadFromFile method of the Videoopenfilesource class and the Audioopenfilesource class.
What type of data is specifically obtained is passed by the attribute Approinput &finput in the class Openfilesource.
In the main function all the code for the Framedsource operation is shown below, taking H264 as an example
Revelation: In porting Appro live555 to HD cameras, I think the best way is to follow IPNC's getavdata () function structure,
Getavdata () function with high-definition camera, live555rtsp part of high-level can not make any changes
Iv. RTSP Live Main main program
This is not much different from the normal live555 RTSP service structure, just because there are more types of video to be transmitted, so much more if else, this part is relatively simple, not for analysis.
Appro is also implemented in this way