www.pudn.com > vls-0.5.6.rar > overview.sgml


VLS overview

VLS design


The VideoLAN Server is programmed in C++, with an entirely "hand-made" 
framework. It means that VLS does not (and will not) use Standard Template 
Library classes such as iostreams or vectors. The internal VLS framework is 
supposed to be complete enough, so nothing should have to be written any more 
(except maybe for porting VLS to other operating systems).



VLS is made up of three parts: a framework (located in src/core
), common classes (in src/server  and 
src/mpeg) and optional classes called modules
 (in src/modules). Modules are actually classes 
inherited from common classes. Some classes that are considered as common 
classes at the moment may become modules in the future.


  
    
  
  
    
  
  
    VLC overview
  


Since version 0.3.1, modules can be either built-in (i.e.
statically linked) or plug-in (i.e. dynamically loaded). 
Whether a module is built-in or plug-in is defined in configure.in
.





General architecture


The general architecture of the VLS is shows on the diagram below : 


   
    
   
   
    
  
   
      VLC architecture
   




We can isolate 3 main parts : the source thread (Reader and
MpegConverter), the consumer thread (TsStreamer and the Output) and the
Management part (Input, Admin and Manager).



The Management part spawns all the needed parts and modules, when the
Vls is strarted or when a new stream is started.



The source thread reads the data through the reader as fast as possible
to fill up the SyncFifo. 



Then, the consumer thread gets the packets from
the SyncFifo and stream them. The timing of this streaming is managed
by the TsStreamer, which give them the Output module. The m_cFifo of
TS_IN_ETHER packet length is used to gather several TS Packets before
sending them together in one UDP packet (for the NetOutput module).



To improve the efficiency and avoid too many memory allocations, a pool
of TS Packet is allocated once : it is the TsProvider. That means that
at the beginning of the chain, a new TsPacket is called by the Converter
(TsProvider->GetPacket()), filled up with bytes from the reader, goes
through the TsStreamer and the Output. After being send, the TsPacket is
reset available in the TsProvider (TsProvider->ReleasePacket()).

  
    
  
  
    
  
  
    VLC overview
  





The size of the TsProvider is calculated to be able to handle about 3
seconds of stream.




Common classes overview


Here is an overview of some common classes present in VLS (be careful: a class
drawn within another one is a member of that class, not a 
child) :


   
      
   
   
      
   
   
      VLC overview
   





  
    C_Vls
    
      It is the main class of the VideoLAN Server. Its role is to load
      modules, launch the Admin and the Manager, and forward messages between
      them.
    
  
  
    C_Admin
    
      It is the main administration class, whose role is to control the various
      administration interfaces, and to parse and handle the commands sent to 
      these interfaces.
    
  
  
    C_Telnet
    
      This is the telnet administration interface, the only one supported at 
      the moment.
    
  
  
    C_Manager
    
      The Manager is one of the most important classes of VLS. It launches the
      various inputs and channels according to the configuration file 
      vls.cfg, contains a list of all the available 
      programs and a list of the currently broadcasted programs. It is this
      class which interprets the commands sent to the Admin, and can tell
      inputs to start, stop, suspend or resume streams.
    
  
  
    C_Channel
    
      This is the parent class of all the channel (i.e. output) modules.
      Currently implemented channels are network and file.
    
  
  
    C_PgrmDirectory
    
      It is the list of all the programs available in the various inputs.
    
  
  
    C_Broadcast
    
      A "broadcast" is defined by an input/program/channel combination.
      It represents a stream that is currently broadcasted by VLS.
    
  
  
    C_Input
    
      This is the parent class of all the input modules. An input basically
      gets a MPEG stream from a source (thanks to a "reader") and sends it to 
      a converter. Each input contains a list of the available programs it can
      provide.
    
   
  
    C_MpegReader
    
      An MpegReader reads data from a source (file, DVD, ...) and delivers a
      continuous MPEG (PS or TS) stream.
    
  
  
    C_MpegConverter
    
      An MpegConverter converts the stream provided by the Reader into a valid
      MPEG-TS stream.
    
  
  
    C_TsStreamer
    
      The Streamer reads data from a Converter and sends it to a Channel at
      the right speed.