By comparing the filtergraph of both DirectShow and FFmpeg, the filtergraph operation of FFmpeg was analyzed.
The first filtergraph is a graph, which consists of points and edges. The point in Filtergraph is the filter. In DirectShow, there is no edge object, the connection of filter depends on the pin component and the Ipin interface, and a pair of inputpin and Outputpin form an edge. Each filter can have at least one pin, that is, each point has at least one edge (excluding a plot with only one point, and a point without adjacent edges). The Inputpin and outputpin that make up the connection hold each other's references. The operation of the Filtergraph relies on the three methods of the Ipin interface Read,async_read and receive. The high data is pushed downstream by the receive of the Out Edge (Outputpin) call to the side (Inputpin). Reverse, downstream through the input edge (Inputpin) calls to the side of the Out Edge (Outputpin) of the read or async_read to the high pull data. Upstream source data can be reached downstream by a path in the diagram.
In the FFmpeg, Avfiltercontext is the point, Avfilterlink is the edge. Avfilterlink is the avfiltercontext of the entrance, Avfiltercontext is the neighboring point of Avfilterlink. The Avfilterpad is a pin-equivalent component that enables Filtergraph to run. The main functions of avfilterpad are three interface functions, Poll_frame,request_frame and Filter_frame.
Pushes frame data by recursion to downstream "first order" traversal
Filter_frame (link, frame) { filter (frame); Input_pad->filter_frame (link, frame);}
Pull frame data by recursive upstream "post-shipment" traversal
Request_frame (link, frame) { output_pad->request_frame (link, frame); Filter (frame);}
Object Diagram Please see a "deconstruction FFmpeg (a)".
Deconstruction FFmpeg (II.)