VLC was originally a project of several French university students, and later they took VLC as an open source project, attracting a lot of good programmers from all over the world to co-author and maintain VLC, which became the way it is now. As for why it is called VideoLAN Client, it is because there is a VideoLAN server project (abbreviated as VLS), and now VLS features have been merged into VLC, so VLC is not only a video player, it can also be used as a small video server, You can also play one side of the transcoding, the video stream sent to the network.
VLC is very powerful, it is not only a video player, but also as a small video server, you can play one side of the transcoding, the video stream sent to the network. VLC is the most prominent is the network stream playback functions, such as MPEG2 UDP TS stream playback and forwarding, almost irreplaceable. for ordinary users, VLC also has the advantage of not affecting the decoder in Windows. VLC usually does not affect or rely on the system's own decoder (in addition to the RealVideo and QuickTime types), very green and environmentally friendly, not to worry about rogue software, advertising plug-ins and other disgusting things.
The scalability of VLC is pretty good from a program structure. VLC is mostly written in an efficient C code (a small number of C + + and assembler), but fully dynamic modularity is implemented, and all features including the program framework itself are modules that can be loaded at runtime, which allows VLC to easily extend multiple functions and be easy to maintain. Its architecture is a bit similar to DirectShow's technology, which will be discussed in detail later.
VLC also attaches great importance to the issue of copyright, you can be assured of the freedom of use without needing to worry about copyright issues--VLC only includes free, free libraries. VLC is based on the GPL, so it can also be used in commercial applications, only to retain the GPL and open source code if you modify VLC.
Here are some links related to VLC
VLC official website: http://www.videolan.org/
VLC download page: http://www.videolan.org/vlc/
VLC download directory (source code and installation package): http://download.videolan.org/pub/videolan/vlc/
VLC Nightly builds: /http nightlies.videolan.org/
VLC Development wiki:http://wiki.videolan.org/developers_corner
VLC Win32 third-party Library precompiled package download directory: http:/ /download.videolan.org/pub/testing/win32/
VLC Official forum: http://forum.videolan.org/
VLC Mailing list: http://www.videolan.org/developers/lists.html
In general, there are 4 ways to embed your own application in VLC: direct call to VLC process VLC plugin for Mozilla VLC ActiveX plugin: VLC comes with ActiveX control--axvlc.dll, Under the ActiveX folder after compiling VLC. ActiveX is a good thing, axvlc.dll can be arbitrarily placed in any location, after successful registration can be easily applied in the program and Web pages. You can refer to test.html and README.TXT under the ActiveX folder. The interface of the ActiveX control has the first and second editions, the first version is simple, the function is few, it is no longer recommended to use the second version, more features. Dynamic Call Libvlc.dll
attached: basic flow of video playback
Almost all video players, such as VLC, MPlayer, Xine, including DirectShow, are very similar in the principle and architecture of playing video, and understanding this will have a multiplier effect on understanding VLC's source code.
Roughly speaking, playing a video is divided into 4 steps:
1. Acess access, or understand to receive, obtain, get
2. Demux is the separation of audio and video that is normally combined (and possible subtitles)
3. Decode decoding, including audio and video decoding
4. Output output, also divided into audio and video outputs (Aout and Vout)
Take the MPEG TS stream that plays a UDP multicast, the Access section is responsible for receiving multicast streams from the network and putting them into the memory buffers of VLC, and the Access module focuses on IP protocols such as whether IPV6, multicast addresses, multicast protocols, ports and other information If the RTP protocol is detected (the RTP protocol is simply a fixed 12-byte message on the UDP header), the RTP header information is also analyzed. This part can see VLC source code/MODULES/ACCESS/UDP.C.
You can also see a large number of access modules in the same directory, such as file, HTTP, DVD, FTP, SMB, TCP, DShow, MMS, v4l ... Wait a minute.
The Demux section first parses the information of the TS stream. TS format is part of the MPEG2 protocol, generally, TS is usually a fixed 188-byte packet, a TS stream can contain multiple programs, and a program can contain multiple video, audio, and text information es streams Each ES stream will have a different PID designation. And in order to be able to analyze these ES streams, TS has some fixed PID used to interval the form of program and ES stream information: Pat and PMT tables. VLC has dedicated a separate library libdvbpsi to parse and encode TS streams, and the code that calls it can be found in VLC source/modules/demux/ts.c. The reason why need to Demux, is because the audio and video in the production of the time is actually independent code, to get a separate data, in order to transport the convenience must be in some way to combine, this has a variety of packaging format also has a demux.
The Demux exploded audio and video streams are sent to the audio decoder and video decoder respectively. Because the original audio and video is a lot of space, and high redundancy of the data, usually at the time of production will be some kind of compression. This is our familiar audio and video encoding format, including MPEG1 (VCD), MPEG2 (DVD), MPEG4, H. S, RMVB, and so on. The function of the audio and video decoder is to restore the compressed data to the original audio and video data. VLC decoding MPEG2 uses a standalone library LIBMPEG2 that calls its source file is/modules/codec/libmpeg2.c. VLC modules for codec are placed in the/modules/codec directory, which includes the famous large FFmpeg decoder.
The video decoder output is a bitmap-like image, but to be seen from the screen, a video output module is also required. Of course can be like a WIN32 window program directly to the image to the window DC--vlc an output module WinGDI is so dry, but usually it is too slow, and consumes a lot of CPU. The better way to do this in Windows is to use the DirectX interface, which automatically calls the graphics card's acceleration function.
This decomposition of functionality makes modularity easier, and each module needs to focus on its own business, which is powerful and flexible in its entirety.
But things are not always that simple. Take access, media access is layered, such as RTSP involves IPv4, TCP, UDP, RTCP, RTSP and many other levels of protocol. Some video formats include transfer, package format and edit code format such as MPEG series, some packaging format is separate container, but many people will misunderstand it is codec format, such as MKV, AVI these.
Audio and video are independent after Demux, but need a mechanism to synchronize them. At the same time we need a set of mechanisms to control speed, pause, stop, jump in, access to a variety of media information, these are very complex and important things.
In addition, you may need to insert some changes somewhere to achieve some kind of effect. such as audio eq, video brightness adjustment and the like, VLC specifically designed the Access_filter, Audio_filter and Video_filter types of modules to do this kind of thing.
VLC's unique place is the integration of the original VLS function, which relies on the Stream_output type of VLC module, they can be playing the video in some way re-transcoding and send out, such as HTTP, UDP, files and so on.
The structure of MPlayer is similar to this, such as the/stream directory corresponding to the function of Access,/mpdemux corresponding Demux function,/libmpcodecs is the decoder,/LIBVO and/libao2 are the output of video and audio respectively.
DirectShow is similar, but the classification is a little bit more complicated. The module inside the DirectShow is called "filter" and is connected by a "pin" between the filter. The module for access corresponds to Sourcefilter in DirectShow, a filter that only has an output pin that does not have a pin entered. The Demux module corresponds to the splitter filter, which has an input pin and multiple output pins. The decoding module is a class of transform filter with an input pin, an output pin, an output module corresponding to the readering filter, an input pin, and no output pin. Of course transform filter is not necessarily a decoder, it may be some sort of other processing.
Also give a VLC API Document, see: Http://rogerfd.cn/doc/vlcapi.htm.
attached: VLC code framework analysis
1.vlc.c is just the entry program
2. LIBVLC.C is the binding point of each module, which is programmed for interface
vlc_create (): Two important data structures: libvlc_t & vlc_t, all parameters are passed in here
vlc_init (): Initialize parameter, Module_bank
vlc_addinf (): Add Module
3./src/misc/ CONFIGURE.C command-line arguments and parameter file parsing the
parameter file is ~/.VNC/VLCRC. Where you can set the location of the log file
4./include/The collection of all header files
5./src/interface/interface.h collection of all module
Where module_t * __module_need (vlc_object_t *p_this, const char *psz_capability, const char *psz_name, VLC _bool_t b_strict) method is to find the appropriate interface if found appropriate, call Allocateplugin () dynamically assign one.