LIVE555 class Structure

Source: Internet
Author: User
Tags add time

Medium

LIVE555 almost all processing units inherit from the medium class, which abstracts the basic interfaces, including the environment,task and media names and media lookup functions (lookupbyname), as well as some auxiliary functions. It also includes returning the current environment class usageenvironment, and the environment pointing to the next Tasktoken pointer Nexttask, and so on.

Servermediasession

The object's creation function is in the file DynamicRTSPServer.cpp. the inheritance relationship of Dynamicrtspserver is

dynamicrtspserver:: rtspserversupportinghttpstreaming::rtspserver::medium

Dynamicrtspserver inherited from Rtspserver, adding only constructors and lookup functions, without adding other members. The constructor is to create a socket and then pass it to Rtspserver, looking for a stream service based on the parameters if there is no already open stream service. the Rtspserver properties are socket, port number,session point number, authentication mechanism and servermediasession table.   

When a request with a URI is received, the SMS is created first, the constructor of the servermediasession is called, the default value is used in addition to the timestamp , the copy file name , and the child session list is initialized. When the describe command is processed,servermediasession is generated by calling the generatesdpdescription function. Create the Servermediasession object in New_sms () , and then create the appropriate servermediasubsession and add the child session object to the add to session object.   

If the sub-reply is MPEG4, create the Mpeg4videofileservermediasubsession object, the object 's inheritance relationship:

mpeg4videofileservermediasubsession  :: fileservermediasubsession::ondemandservermediasubsession:: servermediasubsession:: Medium

Servermediasession::medium

Related class Description:

servermediasession: Added a sub-session list, anSDP description, and some media-related processing functions.   

servermediasubsession: Defines a pointer to the servermediasession, pointing to the next object. The media's SDP information, the media's read location function, and so on. The Servermediasubsession class is related to the specific stream play and is a pure virtual class. where Startstream and getstreamparameter are pure virtual functions.  

ondemandservermediasubsession: Added a streamsource processing and rtpsink handles functions and classic named properties. Package seek,pause and other processing, these interfaces Clientsessionid to here converted into framedsource.    the member functions of the class most and Servermediasubsession similar, in the streaming media complete positioning processing. createnewstreamsource and createnewrtpsink is two pure virtual functions that must be implemented in subclasses. Class getstreamparameters method creates streamstate. This method is called when processing rtp setup commands.   

fileservermediasubsession: Added filename and file size properties.

mpeg4videofileservermediasubsession: Added the rtpsink Property , and implemented the The two pure virtual functions defined in ondemandservermediasubsession, that is, the source and sink objects are created. This source is Mpeg4videostreamframer. The inner class of streamstate is also defined in this class.   

streamstate: Contains a reference to ondemandservermediasubsession,rtpsink pointer,basicudpsink pointer, rtcpinstance pointers framedsource pointers,Frtpgs and Frtcpgs (groupsock).

The Streamstate class can be directed with the Flaststreamtoken attribute of the Ondemandservermediasubsession .   

properties of the class Streamstate :

ondemandservermediasubsession& Fmaster;  Boolean farecurrentlyplaying;

unsigned freferencecount; Port Fserverrtpport, Fserverrtcpport;

rtpsink* frtpsink;                                                     Basicudpsink* fudpsink; 

float                        fstreamduration; unsigned ftotalbw; rtcpinstance* frtcpinstance;

framedsource* Fmediasource; groupsock* Frtpgs;  groupsock* Frtcpgs;

Sink

The sink class provides the total media playback interface. There are two types of sink, one is Basicudpsink, the other is rtpsink, and if there is no RTP information negotiated, then Basicudpsink is created . source and sink through functions createnewrtpsink and Createnewstreamsource. These two functions are defined in class ondemandservermeidasubsession as pure virtual functions, and if the media type is mpeg4videofileserver, then the corresponding function definition is in the class The mpeg4videofileservermediasubsession.   

Mpeg4esvideortpsink::videortpsink::multiframedrtpsink::rtpsink::mediasink::medium  

The mediasink definition has a media source pointer , and the main handler function has startplaying (),stopplaying (), and afterplayingfunc function pointers.

The Rtpsink class defines RTP-related processing and properties. Contains the socket group object, time processing series, statistics count processing and other related properties.   

Multiframedrtpsink is a subclass of Rtpsink that handles multiple RTP packets in buffer. The secondary SDP processing and vopispresent attributes and a judgmental handler are added to the class.

Multiframedrtpsink class complete multi-frame packet processing The main functions are buildandsendpacket,packframe,

sendnext, aftergettingframe, There are calls to each other between these functions. Internally there are outpacketbuffer attributes, which are set at creation time (1000 (hopefully Span lang= "en-us" xml:lang= "en-us"), 1448 (maximum  frtpinterface. Sendpacket (Foutbuf->packet (),  foutbuf->curpacketsize ()), implementation. This frtpinterface is a property of the parent class rtpsink.   

Videortpsink only added the sdpmediatype handler function , returning the SDP type is "video"

The handler function in Mpeg4esvideortpsink dospecialframehandling: First detects the four bytes at the beginning to see if it is vop_start_code, which processes the RTP the start / stop identity and add time stamp. Other processing includes whether the Shard is allowed, whether it is the start packet judgment, and the secondary SDP processing.

Source

Createnewstreamsource is called the definition in mpeg4videofileservermediasubsession. The createnewstreamsource definition in the class ondemandservermediasubsession is a pure virtual function.   

The source created is:

MPEG4VideoStreamFramer:MPEGVideoStreamFramer:FramedFilter:FramedSource:MediaSource:Medium

mediasource in media type judgments based on the "en-us" xml:lang= "en-US" >medium class, as h264,mpeg or jpeg. There is also a mime type.   

framedsource class handles frame-type media , such as  mpeg,mjpeg,h264,amr and other audio-type media. Function sub-frame processing media stream, the main processing is getnextframe, Aftergetting, as well as off media processing, also defines the dogetnextframe pure virtual functions, This function is called by getnextframe to handle the specific media stream. The class also defines two function pointers, aftergettingfunc*  Faftergettingfunc ;  onclosefunc*  fonclosefunc ; processing.    The properties of this class include a pointer to a copy of the data, the size of the frame, the display time, and the playback interval , Whether the playback flag is currently waiting.

Framedfilter is a subclass of Framedsource, which is an intermediate class that adds pointers to the input source primarily in the class framedsource*   Finputsource;

Mpegvideostreamframer: is a subclass of Framedfilter because MPEG is a time-dependent media stream, so the time-processing function is added on the basis of the parent class, and The Continuereadprocessing function. The main attributes are: Frame rate, end flag, picture count, display time,GOP time related content, picture time related attributes. There is also an important class attribute: Mpegvideostreamparser is used to analyze media streams.   

Mpeg4videostreamframer: The config information is added based on the parent class , such as the profile level information. The MPEG4 file Analysis class is also implemented in the definition file for this class , inheriting from Mpegvideostreamparser. Handle MEPG4 related information.   

Bytestreamfilesource::framedfilesource::framedsource   

In source there is a very important Streamparser (stream Analysis) object, which is used to parse and read stream data. Where aftergettingbytes is related to different media stream processing, there is a function inside fclientcontinuefunc that is registered for different media. and GetNextFrame calls aftergettingbytes.   

MPEG4ESVideoRTPSource:MultiFramedRTPSource:RTPSource:FramedSource:MediaSource:Medium

Rtpsource: Add RTP related processing, the main attributes are rtpinterface, time label, processing data frame splitting packetmarkerbit timestamp frequency and statistic information. RTP Statistics: The total number of packets received, the total number of packets received after reset, the number of bytes received, the initialization sequence identifier, the timestamp of the previous RTP packet, the time of the received sender's reported NTP time, and the received sender report time. Rtpsource only deals with issues related to RTP protocols. These processes are called in Networkhandler in Multiframedrtpsource.   

Playing

In the service-side operation is around thestreamstateunfolded,ondemandservermediasubsession class Startstream by calling streamstate startplaying started and initialized rtpseqnum and rtptimestamp  (= rtpsink ()->presetnexttimestamp ())   two variables. in mediasink defines the startplaying basicudpsink class continueplaying final call to  buildandsendpacket, function buildandsendpacket are processed separately based on whether the first frame is passed in. If this is the first frame, then take the current time label, as the Send time,

In the function packframe, call afterGettingFrame1 First, and then call

Fsource->getnextframe (foutbuf->curptr (), foutbuf->totalbytesavailable (), Aftergettingframe, this, Ourhandleclosure, this);

During playback, through nexttask () = EnviR (). TaskScheduler (). Scheduledelayedtask

(Usecondstogo, (taskfunc*) sendnext, this); each time the next send time is calculated and the package is added to the schedule.   

The read media data is processed in the Mpeg4videostreamparser class definition. The member function parse parses out the size of the read data. It then reads a frame of data and gives it the package code to handle.  

LIVE555 class Structure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.