Commit 1a03af9a authored by Christophe Massiot's avatar Christophe Massiot

* Added IDEALX developer documentation into main CVS - PLEASE UPDATE

REGULARLY ;
* Cleaned up doc/ directory.
parent a707befb
%
% common.tex: common definitions for LaTeX files.
% (c)1999 VideoLAN
%
% Included packages
\usepackage{alltt}
% C-related commands
\newcommand{\csymbol}[1]{\texttt{#1}}
% C-related environments
\newenvironment{csource}
{\begin{alltt}}
{\end{alltt}}
- Pas de tabulations dans les sources
- Pas de include dans les headers sauf all.h
- Utiliser systématiquement NULL pour les pointeurs nuls, et non pas 0
- Eviter le if( (a=toto()) != b ), preferer l'ecriture sur 2 lignes, en
particulier pour les malloc(s):
a = toto();
if( a != b )
- A propos des mallocs, plus une remarque qu'une convention: il n'est
spécifié nul part que errno est mis à jour si malloc renvoie NULL.
Préférez donc strerror(ENOMEM) à strerror(errno) !
# Extract from the Debian SGML/XML HOWTO by Stphane Bortzmeyer
MAX_TEX_RECURSION=4
# For Debian :
XML_DECL=/usr/lib/sgml/declaration/xml.decl
HTML_SS=/usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/html/docbook.dsl
PRINT_SS=/usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/print/docbook.dsl
# For RedHat :
#XML_DECL=/usr/lib/sgml/stylesheets/nwalsh-modular/dtds/decls/xml.dcl
#HTML_SS=/usr/lib/sgml/stylesheets/nwalsh-modular/html/docbook.dsl
#PRINT_SS=/usr/lib/sgml/stylesheets/nwalsh-modular/print/docbook.dsl
all: manual
JADE=jade
manual: manual.txt manual.ps manual.html
%.tex: %.xml
$(JADE) -t tex -V %section-autolabel% -d $(PRINT_SS) $(XML_DECL) $<
perl -i.bak -pe 's/\000//g' $@ && rm $*.tex.bak
# No it's not a joke
%.html: %.xml
$(JADE) -t sgml -V %section-autolabel% -V nochunks \
-d $(HTML_SS) $(XML_DECL) $< > $@
%.dvi: %.tex
jadetex $<
jadetex $<
jadetex $<
%.ps: %.dvi
dvips -f $< > $@
%.txt: %.xml
$(JADE) -t sgml -V nochunks -d $(HTML_SS) $(XML_DECL) $< > dump.html
lynx -force_html -dump dump.html > $@
-rm -f dump.html
clean:
rm -f manual.txt
rm -f *.html *.aux *.log *.dvi *.ps *.tex
rm -f *.bck *~ .\#* \#*
<chapter> <title> The audio output layer </title>
<sect1> <title> Data exchanges between a decoder and the audio output
</title>
<para>
The audio output basically takes audio samples from one or several
FIFOs, mixes and resamples them, and plays them through the audio
chip. Data exchanges are simple and described in <filename>
src/audio_output/audio_output.c.</filename> A decoder needs to open
a channel FIFO with <function> aout_CreateFifo </function>, and
then write the data to the buffer. The buffer is in <parameter>
p_aout_fifo-&gt;buffer + p_aout_fifo-&gt;l_end_frame </parameter>
* <constant> ADEC_FRAME_SIZE</constant>.
</para>
</sect1>
<sect1> <title> How to write an audio output plugin </title>
<para>
[This API is subject to change in the very near future.] Have a look at
<filename> plugins/dsp/aout_dsp.c</filename>. You need to write six
functions :
</para>
<itemizedlist>
<listitem> <para> <type> int </type> <function> aout_Probe </function>
<parameter> ( probedata_t *p_data ) </parameter> :
Returns a score between 0 and 999 to tell whether the plugin
can be used. <parameter> p_data </parameter> is currently
unused.
</para> </listitem>
<listitem> <para> <type> int </type> <function> aout_Open </function>
<parameter> ( aout_thread_t *p_aout ) </parameter> :
Opens the audio device.
</para> </listitem>
<listitem> <para> <type> int </type> <function> aout_SetFormat
</function> <parameter> ( aout_thread_t *p_aout ) </parameter> :
Sets the output format, the number of channels, and the output
rate.
</para> </listitem>
<listitem> <para> <type> long </type> <function> aout_GetBufInfo
</function> <parameter> ( aout_thread_t *p_aout,
long l_buffer_limit ) </parameter> :
Gets the status of the audio buffer.
</para> </listitem>
<listitem> <para> <function> aout_Play </function> <parameter>
( aout_thread_t *p_aout, byte_t *buffer, int i_size )
</parameter> :
Writes the audio output buffer to the audio device.
</para> </listitem>
<listitem> <para> <function> aout_Close </function> <parameter>
( aout_thread_t *p_aout ) </parameter> :
Closes the audio device.
</para> </listitem>
</itemizedlist>
</sect1>
</chapter>
<appendix> <title> Advanced debugging </title>
<para>
We never debug our code, because we don't put bugs in. Okay, you want
some real stuff. Sam still uses <function> printf() </function> to
find out where it crashes. For real programmers, here is a summary
of what you can do if you have problems.
</para>
<sect1> <title> Where does it crash ? </title>
<para>
The best way to know that is to use gdb. You can start using it with
good chances by configuring with <parameter> --enable-debug </parameter>.
It will add <parameter> -g </parameter> to the compiler <parameter>
CFLAGS</parameter>, and activate some additional safety checks. Just
run <command> gdb vlc</command>, type <command> run myfile.vob</command>,
and wait until it crashes. You can view where it stopped with
<command>bt</command>, and print variables with <command>print
&lt;C-style&gt;</command>.
</para>
<para>
If you run into troubles, you may want to turn the optimizations off.
Optimizations (especially inline functions) may confuse the debugger.
Use <parameter> --disable-optimizations </parameter> in that case.
</para>
</sect1>
<sect1> <title> Other problems </title>
<para>
It may be more complicated than that, for instance unpredictable
behaviour, random bug or performance issue. You have several options
to deal with this. If you experience unpredictable behaviour, I hope
you don't have a heap or stack corruption (eg. writing in an unallocated
space), because they are hard to find. If you are really desperate, have
a look at something like ElectricFence or dmalloc. Under GNU/Linux, an
easy check is to type <command> export MALLOC_CHECK_=2 </command> before
launching vlc (see <command> malloc(3) </command> for more information).
</para>
<para>
VLC offers a "trace-mode". It can create a log file with very accurate dates
and messages of what it does, so it is useful to detect performance
issues or lock-ups. Compile with <parameter> --enable-trace </parameter>
and tune the <parameter> TRACE_* </parameter> flags in <filename>
include/config.h </filename> to enable certain types of messages (log
file writing can take up a lot of time, and will have side effects).
</para>
</sect1>
</appendix>
This diff is collapsed.
This diff is collapsed.
<glossary>
<warning> <para>
Please note that this book is in no way a reference documentation
on how DVDs work. Its only purpose is to describe the API
available for programmers in VideoLAN Client. It is assumed that
you have basic knowledge of what MPEG is. The following paragraph
is just here as a reminder :
</para> </warning>
<glossentry>
<glossterm> <acronym> AC3 </acronym> :
Digital Audio Compression Standard </glossterm>
<glossdef> <para> Specification for coding audio data, used in DVD.
The documentation is
<ulink url="http://www.linuxvideo.org/devel/library/ac3-standard_a_52.pdf">
freely available </ulink>.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> B </acronym> (bi-directional) picture </glossterm>
<glossdef> <para> Picture decoded from its own data, <emphasis>
and </emphasis> from the data of the previous and next (that
means <emphasis>in the future</emphasis>) reference
pictures (I or P pictures). It is the most compressed picture
format, but it is less fault-tolerant.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> DVD </acronym> :
Digital Versatile Disc </glossterm>
<glossdef> <para> Disc hardware format, using the UDF file system,
an extension of the ISO 9660 file system format and a video format
which is an extension of the MPEG-2 specification.
It basically uses MPEG-2 PS files, with subtitles and sound
tracks encoded as private data and fed into non-MPEG decoders,
along with .ifo files describing the contents of the DVD. DVD
specifications are very hard to get, and it takes some
time to reverse-engineer it. Sometimes DVD are zoned and
scrambled, so we use a brute-force algorithm to find the key.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> ES </acronym> : Elementary Stream </glossterm>
<glossdef> <para> Continuous stream of data fed into a decoder,
without any multiplexing layer. ES streams can be MPEG video
MPEG audio, AC3 audio, LPCM audio, SPU subpictures...
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> Field picture </glossterm>
<glossdef> <para> Picture split in two fields, even and odd, like
television does. DVDs coming from TV shows typically use field
pictures.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> Frame picture </glossterm>
<glossdef> <para> Picture without even/odd discontinuities, unlike
field pictures. DVDs coming from movies typically use frame
pictures.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym>I</acronym> (intra) picture </glossterm>
<glossdef> <para> Picture independantly coded. It can be
decoded without any other reference frame. It is regularly
sent (like twice a second) for resynchronization purposes.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> IDCT </acronym> : Inverse Discrete
Cosinus Transform </glossterm>
<glossdef> <para> IDCT is a classical mathematical algorithm
to convert from a space domain to a frequency domain. In a
nutshell, it codes differences instead of coding all absolute
pixels. MPEG uses an 2-D IDCT in the video decoder, and a 1-D
IDCT in the audio decoder.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> LPCM </acronym> :
Linear Pulse Code Modulation </glossterm>
<glossdef> <para> LPCM is a non-compressed audio encoding,
available in DVDs.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> MPEG </acronym> :
Motion Picture Expert Group </glossterm>
<glossdef> <para> Specification describing a standard syntax of files
and streams for carrying motion pictures and sound. MPEG-1 is
ISO/IEC 11172 (three books), MPEG-2 is ISO/IEC 13818. MPEG-4
version 1 is out, but this player doesn't support it. It is
relatively easy to get an MPEG specification from ISO or
equivalent, drafts are even freely available on the Internet.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> P </acronym> (predictive) picture </glossterm>
<glossdef> <para> Picture decoded from its own data <emphasis>
and </emphasis> data from a reference picture, which is the
last I or P picture received.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> PES </acronym> :
Packetized Elementary Stream </glossterm>
<glossdef> <para> A chunk of elementary stream. It often corresponds
to a logical boundary of the stream (for instance a picture
change), but it is not mandatory. PES carry the synchronization
information.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> PTS </acronym> :
Presentation Time Stamp </glossterm>
<glossdef> <para> Time at which the content of a PES packet is supposed
to be played. It is used for A/V synchronization.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> PS </acronym> : Program Stream </glossterm>
<glossdef> <para> File format obtained by concatenating PES packets
and inserting Pack headers and System headers (for timing
information). It is the only format described in MPEG-1, and
the most used format in MPEG-2.
</para></glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> RGB </acronym> : Red Green Blue </glossterm>
<glossdef> <para> Picture format where every pixel is calculated in a
vector space whose coordinates are red, green, and blue. This
is natively used by monitors and TV sets.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> SPU </acronym> : Sub Picture Unit </glossterm>
<glossdef> <para> Picture format allowing to do overlays, such
as subtitles or DVD menus.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> SCR </acronym> :
System Clock Reference </glossterm>
<glossdef> <para> Time at which the first byte of a particular pack
is supposed to be fed to the decoder. VLC uses it to read the
stream at the right pace.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> SDL </acronym> :
Simple DirectMedia Layer </glossterm>
<glossdef> <para> <ulink url="http://www.libsdl.org/"> SDL </ulink>
is a cross-platform multimedia library
designed to provide fast access to the video framebuffer and
the audio device. Since version 1.1, it features YUV overlay
support, which reduces decoding times by a third.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> TS </acronym> : Transport Stream </glossterm>
<glossdef> <para> Stream format constituted of fixed size packets
(188 bytes), defined by ISO/IEC 13818-1. PES packets are
split among several TS packets.
A TS stream can contain several programs. It is used in
streaming applications, in particular for satellite or cable
broadcasting.
</para> </glossdef>
</glossentry>
<glossentry>
<glossterm> <acronym> YUV </acronym> :
Luminance/Chrominance </glossterm>
<glossdef> <para> Picture format with 1 coordinate of luminance (black
and white) and 2 coordinates of chrominance (red and blue).
This is natively used by PAL video system, for backward
compatibility with older black and white TV sets. Your eyes
distinguish luminance variations much better than chrominance
variations, so you can compress them more. It is therefore
well suited for image compression, and is used by the MPEG
specification. The RGB picture can be obtained from the YUV one
via a costly matrix multiply operation, which can be done in
hardware by most modern video cards ("YUV acceleration").
</para> </glossdef>
</glossentry>
</glossary>
<appendix> <title> Project history </title>
<sect1> <title> VIA and the Network2000 project </title>
<para>
The whole project started back in 1995. At that time, students of the
<ulink url="http://www.ecp.fr/"> &Eacute;cole Centrale de Paris </ulink>
enjoyed a TokenRing network, managed by the <ulink
url="http://www.via.ecp.fr/"> VIA Centrale R&eacute;seaux
association</ulink>, and were looking
for a solution to upgrade to a modern network. So the idea behind
Network2000 was to find a project students would realize that would
be interesting, would require a high-quality network, and could
provide enough fame so that sponsors would be interested.
</para>
<para>
Someone came up with the idea of doing television broadcast on the
network, so that students could watch TV in their room. This was
interesting, mixed a lot of cool technologies, and provided fame
because no one had written a free MPEG-2 decoder so far.
</para>
</sect1>
<sect1> <title> Foundation of the VideoLAN project </title>
<para>
<ulink url="http://www.3com.com/"> 3Com</ulink>,
<ulink url="http://www.bouygues.com/"> Bouygues </ulink> and
la Soci&eacute;t&eacute; des Amis were
interested and financed the project, which was then known after
the name of VideoLAN.
</para>
<para>
The VideoLAN team, in particular <ulink url="mailto:walken@via.ecp.fr">
Michel Lespinasse </ulink> (current maintainer of <ulink
url="http://www.linuxvideo.org/">LiViD</ulink>'s mpeg2dec)
and <ulink url="mailto:hpreg@via.ecp.fr"> R&eacute;gis
Duchesne</ulink>, started writing code in 1996. By the end of 1997 they had
a working client-server solution, but it would crash a lot and was
hard to extend.
</para>
<para>
At that time it was still closed-source and only-for-demo code.
</para>
</sect1>
<sect1> <title> VideoLAN Client design </title>
<para>
In 1998, <ulink url="mailto:seguin@via.ecp.fr"> Vincent Seguin</ulink>
(structure, interface and video output),
<ulink url="mailto:massiot@via.ecp.fr"> Christophe Massiot</ulink>
(input and video decoder),
<ulink url="mailto:maxx@via.ecp.fr"> Michel Kaempf</ulink>
(audio decoder and audio output) and
<ulink url="mailto:polux@via.ecp.fr"> Jean-Marc Dressler</ulink>
(synchronization) decided to write a brand new player from scratch,
called VideoLAN Client (VLC), so that it could be easily open sourced.
Of course we based it on code written by our predecessors, but in
an advanced structure, described in the first chapter (it hasn't been
necessary to change it a lot).
</para>
<para>
At the same time, <ulink url="mailto:benny@via.ecp.fr"> Beno&icirc;t
Steiner </ulink> started the writing of an advanced stream server, called
VideoLAN Server (VLS).
</para>
<para>
Functional test seeds have been released internally in June 1999
(vlc-DR1) and November 1999 (vlc-DR2), and we started large scale tests
and presentations. The French audience discovered us at Linux Expo
in June 1999, presenting our 20 minutes of Golden Eye (which is now
a legend among developers :-). At that time only a network input was
possible, file input was added later, but it remained kludgy for a while.
</para>
<para>
In early 2000, we (especially <ulink url="mailto:sam@via.ecp.fr"> Samuel
Hocevar</ulink>, who is still a major contributor) started working
on DVDs (PS files, AC3, SPU). In the summer 2000, pre-release builds
have been seeded (0.2.0 versions), but they still lacked essential
features.
</para>
<para>
In late 2000, <ulink url="mailto:massiot@via.ecp.fr"> Christophe Massiot
</ulink> with the support of his company,
<ulink url="http://www.idealx.com/"> IDEALX</ulink>, rewrote major
parts of the input to allow modularization and advanced navigation, and <ulink
url="mailto:stef@via.ecp.fr"> Stéphane Borel </ulink> worked on a
fully-featured DVD plug-in for VLC.
</para>
</sect1>
<sect1> <title> The Opening </title>
<para>
For Linux Expo in February 2001, the <ulink url="http://www.gnu.org/">
Free Software Foundation </ulink> and <ulink url="http://www.idealx.com/">
IDEALX </ulink> wanted to make live streaming of the 2001 FSF awards
from Paris to New York. VideoLAN was the chosen solution. Finally
it couldn't be done live because of bandwidth considerations, but a
<ulink url="http://www.via.ecp.fr/~massiot/encoding.html"> chain of
fully open-source solutions </ulink> made it possible to record it.
</para>
<para>
At the same time, the president of the <ulink url="http://www.ecp.fr/">
&Eacute;cole Centrale Paris</ulink> officially decided to place the software
under GNU General Public Licence, thanks to <ulink
url="mailto:henri@via.ecp.fr"> Henri Fallon</ulink>, <ulink
url="mailto:jprey@ads.ecp.fr"> Jean-Philippe Rey</ulink>, and the IDEALX team.
</para>
<para>
VideoLAN software is now one of the most popular open source DVD
players available, and has contributors all around the world. The
last chapter of this appendix is not written yet :-).
</para>
</sect1>
</appendix>
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.3//EN" "docbookx.dtd"
[
<!ENTITY glossary SYSTEM "glossary.xml">
<!ENTITY overview SYSTEM "overview.xml">
<!ENTITY interface SYSTEM "interface.xml">
<!ENTITY input SYSTEM "input.xml">
<!ENTITY decoders SYSTEM "decoders.xml">
<!ENTITY video_output SYSTEM "video_output.xml">
<!ENTITY audio_output SYSTEM "audio_output.xml">
<!ENTITY ports SYSTEM "ports.xml">
<!ENTITY debugging SYSTEM "debugging.xml">
<!ENTITY history SYSTEM "history.xml">
<!ENTITY gfdl SYSTEM "gfdl.xml">
]>
<book>
<title> VideoLAN Client API Documentation </title>
<bookinfo>
<author>
<firstname> Christophe </firstname>
<surname> Massiot </surname>
<affiliation>
<jobtitle> <ulink url="mailto:christophe.massiot@idealx.com">
Developer </ulink> </jobtitle>
<orgname> <ulink url="http://www.idealx.com"> IDEALX
S.A.S. </ulink> </orgname>
<orgdiv> Industrial Computing </orgdiv>
</affiliation>
</author>
<collab>
<collabname> <ulink url="mailto:sam@zoy.org"> Samuel Hocevar
</ulink> </collabname>
<affiliation>
<jobtitle> Developer </jobtitle>
<orgname> VideoLAN project </orgname>
</affiliation>
</collab>
<collab>
<collabname> Jean-Fran&ccedil;ois Lecomte </collabname>
<affiliation>
<jobtitle> <ulink url="mailto:jean-francois.lecomte@idealx.com">
Developer </ulink> </jobtitle>
<orgname> <ulink url="http://www.idealx.com"> IDEALX
S.A.S. </ulink> </orgname>
</affiliation>
</collab>
<pubdate> $Id: manual.xml,v 1.1 2001/07/16 15:54:59 massiot Exp $ </pubdate>
<copyright> <year> 2001 </year>
<holder> Christophe Massiot, for IDEALX S.A.S. </holder>
</copyright>
<legalnotice> <para>
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
A copy of the license is included in the section entitled "GNU
Free Documentation License".
</para> </legalnotice>
</bookinfo>
<toc />
<!-- ============================ GLOSSARY ============================
-->
&glossary;
<!-- ============================ OVERVIEW ============================
-->
&overview;
<!-- =========================== INTERFACE ============================
-->
&interface;
<!-- ============================= INPUT ==============================
-->
&input;
<!-- ============================ DECODERS ============================
-->
&decoders;
<!-- ========================== VIDEO OUTPUT ==========================
-->
&video_output;
<!-- ========================== AUDIO OUTPUT ==========================
-->
&audio_output;
<!-- ============================= PORTS ==============================
-->
&ports;
<!-- ======================= ADVANCED DEBUGGING =======================
-->
&debugging;
<!-- ======================== PROJECT HISTORY =========================
-->
&history;
<!-- ============================= GFDL ===============================
-->
&gfdl;
</book>
This diff is collapsed.
<chapter> <title> VLC Overview </title>
<sect1> <title> Code modules </title>
<para>
The VLC code uses modules and plugins. A module is a group of compiled-in
C source files. They are linked against the main application at build time.
At present, these modules are :
</para>
<itemizedlist>
<listitem> <para> Interface : this is the entry point of the program. It manages
all user interactions and thread spawning. </para> </listitem>
<listitem> <para> Input : it opens the input socket, reads packets, parses
them and passes reconstituted elementary streams to the decoder(s).
</para> </listitem>
<listitem> <para> Video output : it initializes the video display. Then it
gets all pictures and subpictures (ie. subtitles) from the decoder(s),
optionally converts them to RGB format (from YUV), and displays them.
</para> </listitem>
<listitem> <para> Audio output : it initializes the audio mixer, ie.
finds the right playing frequency, and then resamples audio frames
received from the decoder(s). </para> </listitem>
<listitem> <para> Misc : miscellaneous utilities used in other modules.
This is the only module that will never launch a thread.
</para> </listitem>
<listitem> <para> ac3_decoder, audio_decoder, generic_decoder, lpcm_decoder,
spu_decoder, video_decoder, video_parser : decoders used by VLC to
decode different kinds of elementary stream data. [these are subject
to move to <filename> plugins/ </filename> in a forthcoming
version]</para> </listitem>
</itemizedlist>
<mediaobject>
<imageobject>
<imagedata fileref="modules.eps" format="EPS" scalefit="1" scale="80"/>
</imageobject>
<imageobject>
<imagedata fileref="modules.gif" format="GIF" />
</imageobject>
<textobject>
<phrase> Data flow between modules </phrase>
</textobject>
</mediaobject>
</sect1>
<sect1> <title> Plug-ins </title>
<para>
Plugins are located in the <filename> plugins/ </filename> subdirectory
and are loaded at runtime. Every plug-in
may offer different features that will best suit a particular file or
a particular environment. Besides, most portability works result in the writing
of an audio_output/video_output/interface plug-in to support a new
platform (eg. BeOS or MacOS X).
</para>
<para>
Plug-ins are loaded and unloaded dynamically by functions in
<filename> src/misc/modules.c </filename> and <filename> include/modules*.h
</filename>. The API for writing plugins will be discussed in a
following chapter.
</para>
<para>
Plugins can also be built into the VLC main application by changing the
<parameter> BUILTINS </parameter> line in <filename>
Makefile.opts</filename>.
</para>
</sect1>
<sect1> <title> Threads </title>
<sect2> <title> Thread management </title>
<para>
VLC is heavily multi-threaded. We chose against a single-thread approach
because decoder preemptibility and scheduling would be a mastermind (for
instance decoders and outputs have to be separated, otherwise it cannot
be warrantied that a frame will be played at the exact presentation
time), and
we currently have no plan to support a single-threaded client.
Multi-process decoders usually imply more overhead (problems of shared
memory) and communication between processes is harder.
</para>
<para>
Our threading structure is modeled on pthreads. However, for portability
reasons, we don't call <function>pthread_*</function> functions
directly, but use a similar wrapper, made of <function> vlc_thread_create,
vlc_thread_exit, vlc_thread_join, vlc_mutex_init, vlc_mutex_lock,
vlc_mutex_unlock, vlc_mutex_destroy, vlc_cond_init, vlc_cond_signal,
vlc_cond_wait, vlc_cond_destroy</function>, and structures <type>
vlc_thread_t, vlc_mutex_t, and vlc_cond_t</type>.
</para>
</sect2>
<sect2> <title> Synchronization </title>
<para>
Another key feature of VLC is that decoding and playing are asynchronous :
decoding is done by a *_decoder thread, playing is done by audio_output
or video_output thread. The design goal is to ensure that an audio or
video frame is played exactly at the right time, without blocking any
of the decoder threads. This leads to a complex communication structure
between the interface, the input, the decoders and the outputs.
</para>
<para>
Having several input and video_output threads reading multiple files at
the same time is permitted, despite the fact that the current interface
doesn't allow any way to do it [this is subject to change in the near
future]. Anyway the client has been written from the ground up
with this in mind. This also implies that a non-reentrant
library (including in particular LiViD's libac3) cannot be used.
</para>
<para>
Presentation Time Stamps located in the system layer of the stream are
passed to the decoders, and all resulting samples are dated accordingly.
The output layers are supposed to play them at the right time. Dates are
converted to microseconds ; an absolute date is the number of microseconds
since Epoch (Jan 1st 1970). The <type> mtime_t </type> type is a signed
64-bit integer.
</para>
<para>
The current date can be retrieved with <function> mdate()</function>.
Te execution of a thread can be suspended until a certain <parameter>
date </parameter> via <function> mwait </function> <parameter>
( mtime_t date )</parameter>. You can sleep for a fixed number of
microseconds with <function> msleep </function> <parameter>
( mtime_t delay )</parameter>.
</para>
<warning> <para>
Please remember to wake up a little while <emphasis> before
</emphasis> the presentation date, if some particular treatment
needs to be done (e.g. a YUV transform). For instance in <filename>
src/video_parser/vpar_synchro.c</filename>, track of the average
decoding times is kept to ensure pictures are not decoded too
late.
</para> </warning>
</sect2>
</sect1>
<sect1> <title> Code conventions </title>
<sect2> <title> Function naming </title>
<para>
All functions are named accordingly : module name (in lower case) + _ +
function name (in mixed case, <emphasis> without underscores</emphasis>).
For instance : <function>intf_FooFunction</function>. Static functions
don't need usage of the module name.
</para>
</sect2>
<sect2> <title> Variable naming </title>
<para>
Hungarian notations used, that means we have the following prefixes :
</para>
<itemizedlist>
<listitem> <para> i_ for integers (sometimes l_ for long integers) ;
</para> </listitem>
<listitem> <para> b_ for booleans ; </para> </listitem>
<listitem> <para> d_ for doubles (sometimes f_ for floats) ;
</para> </listitem>
<listitem> <para> pf_ for function pointers ; </para> </listitem>
<listitem> <para> psz_ for a Pointer to a String terminated by a
Zero (C-string) ;
</para> </listitem>
<listitem> <para> More generally, we add a p when the variable is
a pointer to a type. </para> </listitem>
</itemizedlist>
<para>
If one variable has no basic type (for instance a complex structure), don't
put any prefix (except p_* if it's a pointer). After one prefix, put
an <emphasis> explicit </emphasis> variable name <emphasis> in lower
case</emphasis>. If several words are required, join them with an
underscore (no mixed case). Examples :
</para>
<itemizedlist>
<listitem> <para>
<type> data_packet_t * </type> <varname> p_buffer; </varname>
</para> </listitem> <listitem> <para>
<type> char </type> <varname> psz_msg_date[42]; </varname>
</para> </listitem> <listitem> <para>
<type> int </type> <varname> pi_es_refcount[MAX_ES]; </varname>
</para> </listitem> <listitem> <para>
<type> void </type> <varname> (* pf_next_data_packet)( int * ); </varname>
</para> </listitem>
</itemizedlist>
</sect2>
<sect2> <title> A few words about white spaces </title>
<para>
First, never use tabs in the source (you're entitled to use them in the
Makefile :-). Use <command> set expandtab </command> under <application>
vim </application> or the equivalent under <application>
emacs</application>. Indents are 4 spaces long.
</para>
<para>
Second, put spaces <emphasis> before and after </emphasis> operators, and
inside brackets. For instance :
<programlisting> for( i = 0; i &lt; 12; i++, j += 42 ); </programlisting>
</para>
<para>
Third, leave braces alone on their lines (GNU style). For instance :
<programlisting>
if( i_es == 42 )
{
p_buffer[0] = 0x12;
}
</programlisting>
</para>
<para>
We write C, so use C-style comments /* ... */.
</para>
</sect2>
</sect1>
</chapter>
<appendix> <title> Ports </title>
<sect1> <title> Port steps </title>
<para>
Basically, porting to a new architecture boils down to follow the
following steps :
</para>
<orderedlist>
<listitem> <para> <emphasis> Building the VLC : </emphasis>
That may be the most difficult part, depending on how POSIX
the architecture is. You have to produce valid C.
</para> </listitem>
<listitem> <para> <emphasis> Having video : </emphasis>
If your architecture features an X server, it should be
straightforward, though you might have problems with xvideo
or xshm. Otherwise you can try to use SDL if it is supported,
or end up writing your own video output plugin.
</para> </listitem>
<listitem> <para> <emphasis> Having audio : </emphasis>
If your architecture features an OSS compatible DSP or ALSA, you
can reuse an existing plugin. Otherwise you will have to write
your own audio output plugin.
</para> </listitem>
<listitem> <para> <emphasis> Accessing DVDs : </emphasis>
You are going to need a write access to the DVD device.
Every system has specific ioctl() for key negociation with
the DVD drive, so we have set up an abstration layer in
<filename> plugins/dvd/dvd_ioctl.c</filename>. You might
need to add stuff here. Some operating systems won't give
you access to the key negociation (MacOS X), so you will
have to write a kernel extension or you will only be able to read
unencrypted DVDs. Other operating systems might only give
you read access to the DVD device if you are root. Your mileage
may vary.
</para> </listitem>
<listitem> <para> <emphasis> Writing a native interface : </emphasis>
If your system doesn't support GTK or Qt, you will have to
write a native interface plugin (for instance Aqua or Win32).
You may also need to rewrite the video output plugin if
you're currently using a slow compatibility layer.
</para> </listitem>
<listitem> <para> <emphasis> Optimizing : </emphasis>
If your architecture features a special set of multimedia
instructions (such as MMX) that is not supported by VLC, you
may want to write specific optimizations. Heavy calculation
parts are : IDCT (see idct plugin), motion compensation
(see motion plugin), and YUV (see video output) if you don't
use the YUV overlay support of your video board (SDL or
XVideo extension).
</para> </listitem>
</orderedlist>
</sect1>
<sect1> <title> Building </title>
<para>
This is probably the most complicated part. If your platform is fully
POSIX-compliant (such as GNU/Linux), it should be quick, otherwise
expect troubles. Known issues are :
</para>
<itemizedlist>
<listitem> <para> Finding a compiler : We use <application> gcc
</application> on all platforms, and <application> mingw32
</application> to cross-compile the win32 port. If you don't you're
probably in <emphasis> very big </emphasis> trouble. Good luck.
</para> </listitem>
<listitem> <para> Finding <application> GNU make </application> : Our
<filename>Makefile</filename> is heavily <application>GNU make
</application> specific, so I suggest you install it.
</para> </listitem>
<listitem> <para> Running the <filename> configure </filename>
script : This is basically a shell script, so if you have a UNIX
shell on your platform it shouldn't be a problem. It will probe
your system for headers and libraries needed. It needs
adequate <filename> config.sub </filename> and <filename>
config.guess</filename>, so if your platform is young your
provider may have supplied customized versions. Check with it.
</para> </listitem>
<listitem> <para> Compiling the VLC binary : This is the most
difficult. Type <command> make </command> or <command> gmake
</command> and watch the results. It will probably break soon
on a parse error. Add the headers missing, fix mistakes. If
you cannot make it to also compiles on other platforms, use
#ifdef directives. Add tests for functions or libraries in
<filename> configure.in </filename> and run <command> autoheader
</command> and <command> autoconf</command>. Always prefer
tests on <property> #ifdef HAVE_MY_HEADER_T</property>,
instead of <property> #ifdef SYS_MYOPERATINGSYSTEM</property>.
You may especially experience problems with the network code
in <filename> src/input/input.c</filename>.
</para> </listitem>
<listitem> <para> Threads : If your system has an exotic thread
implementation, you will probably need to fill the wrappers in
<filename> include/threads.h </filename> for your system.
Currently supported implementations include the POSIX pthreads,
the BeOS threads, and the Mach cthreads.
</para> </listitem>
<listitem> <para> Linking : You will need special flags to the
compiler, to allow symbol exports (otherwise plug-ins won't
work). For instance under GNU/Linux you need <parameter>
-rdynamic</parameter>.
</para> </listitem>
<listitem> <para> Compiling plug-ins : You do not need external
plug-ins at first, you can build all you need in (see <filename>
Makefile.opts</filename>). In the long run though, it is a
good idea to change <parameter> PCFLAGS</parameter> and <parameter>
PLCFLAGS</parameter> to allow run-time loading of libraries.
You are going to need <application> libdl</application>, or a
similar dynamic loader. To add support for an exotic dynamic
loader, have a look at <filename> include/modules_core.h
</filename>. Currently supported implementations include the
UNIX dynamic loader and the BeOS image loader.
</para> </listitem>
<listitem> <para> Assembling : If you use specific optimizations
(such as MMX), you may have problem assembling files, because
the assembler syntax may be different on your platform. Try
without it at first. Pay attention to the optimization flags
too, you may see a <emphasis>huge</emphasis> difference.
</para> </listitem>
</itemizedlist>
<para>
VLC should work both on little endian and big endian systems. All
load operations should be aligned on the native size of the type, so
that it works on exotic processors like Sparc or Alpha. It should
work on 64-bit platforms, though it has not been optimized for it.
A big boost for them would be to have a WORD_TYPE = u64 in <filename>
include/input_ext-dec.h</filename>, but it is currently broken for
unknown reasons.
</para>
<para>
If you experience run-time problems, see the following appendix and
pray for you to have <command> gdb</command>...
</para>
</sect1>
</appendix>
%!PS-Adobe-2.0 EPSF-2.0
%%Title: ps.eps
%%Creator: fig2dev Version 3.2 Patchlevel 3a
%%CreationDate: Fri May 4 16:12:26 2001
%%For: cmassiot@salomon (Christophe Massiot,,,)
%%BoundingBox: 0 0 399 164
%%Magnification: 1.0000
%%EndComments
/$F2psDict 200 dict def
$F2psDict begin
$F2psDict /mtrx matrix put
/col-1 {0 setgray} bind def
/col0 {0.000 0.000 0.000 srgb} bind def
/col1 {0.000 0.000 1.000 srgb} bind def
/col2 {0.000 1.000 0.000 srgb} bind def
/col3 {0.000 1.000 1.000 srgb} bind def
/col4 {1.000 0.000 0.000 srgb} bind def
/col5 {1.000 0.000 1.000 srgb} bind def
/col6 {1.000 1.000 0.000 srgb} bind def
/col7 {1.000 1.000 1.000 srgb} bind def
/col8 {0.000 0.000 0.560 srgb} bind def
/col9 {0.000 0.000 0.690 srgb} bind def
/col10 {0.000 0.000 0.820 srgb} bind def
/col11 {0.530 0.810 1.000 srgb} bind def
/col12 {0.000 0.560 0.000 srgb} bind def
/col13 {0.000 0.690 0.000 srgb} bind def
/col14 {0.000 0.820 0.000 srgb} bind def
/col15 {0.000 0.560 0.560 srgb} bind def
/col16 {0.000 0.690 0.690 srgb} bind def
/col17 {0.000 0.820 0.820 srgb} bind def
/col18 {0.560 0.000 0.000 srgb} bind def
/col19 {0.690 0.000 0.000 srgb} bind def
/col20 {0.820 0.000 0.000 srgb} bind def
/col21 {0.560 0.000 0.560 srgb} bind def
/col22 {0.690 0.000 0.690 srgb} bind def
/col23 {0.820 0.000 0.820 srgb} bind def
/col24 {0.500 0.190 0.000 srgb} bind def
/col25 {0.630 0.250 0.000 srgb} bind def
/col26 {0.750 0.380 0.000 srgb} bind def
/col27 {1.000 0.500 0.500 srgb} bind def
/col28 {1.000 0.630 0.630 srgb} bind def
/col29 {1.000 0.750 0.750 srgb} bind def
/col30 {1.000 0.880 0.880 srgb} bind def
/col31 {1.000 0.840 0.000 srgb} bind def
end
save
newpath 0 164 moveto 0 0 lineto 399 0 lineto 399 164 lineto closepath clip newpath
-27.0 171.0 translate
1 -1 scale
/cp {closepath} bind def
/ef {eofill} bind def
/gr {grestore} bind def
/gs {gsave} bind def
/sa {save} bind def
/rs {restore} bind def
/l {lineto} bind def
/m {moveto} bind def
/rm {rmoveto} bind def
/n {newpath} bind def
/s {stroke} bind def
/sh {show} bind def
/slc {setlinecap} bind def
/slj {setlinejoin} bind def
/slw {setlinewidth} bind def
/srgb {setrgbcolor} bind def
/rot {rotate} bind def
/sc {scale} bind def
/sd {setdash} bind def
/ff {findfont} bind def
/sf {setfont} bind def
/scf {scalefont} bind def
/sw {stringwidth} bind def
/tr {translate} bind def
/tnt {dup dup currentrgbcolor
4 -2 roll dup 1 exch sub 3 -1 roll mul add
4 -2 roll dup 1 exch sub 3 -1 roll mul add
4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
bind def
/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
4 -2 roll mul srgb} bind def
/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
/$F2psEnd {$F2psEnteredState restore end} def
$F2psBegin
%%Page: 1 1
10 setmiterlimit
0.06299 0.06299 sc
% Polyline
7.500 slw
n 450 135 m 6750 135 l 6750 2295 l 450 2295 l
cp gs col0 s gr
% Polyline
n 900 405 m 1800 405 l 1800 900 l 900 900 l
cp gs col7 0.95 shd ef gr gs col0 s gr
% Polyline
n 1800 405 m 2790 405 l 2790 900 l 1800 900 l
cp gs col7 0.90 shd ef gr gs col0 s gr
% Polyline
n 2790 405 m 6300 405 l 6300 900 l 2790 900 l
cp gs col0 s gr
% Polyline
n 900 405 m 630 405 l 630 900 l 900 900 l
cp gs col7 0.35 shd ef gr gs col0 s gr
% Polyline
n 6300 405 m 6570 405 l 6570 900 l 6300 900 l
cp gs col7 0.35 shd ef gr gs col0 s gr
% Polyline
gs clippath
660 930 m 600 930 l 600 1081 l 630 961 l 660 1081 l cp
eoclip
n 630 1350 m
630 945 l gs col0 s gr gr
% arrowhead
n 660 1081 m 630 961 l 600 1081 l 660 1081 l cp gs 0.00 setgray ef gr col0 s
% Polyline
gs clippath
2820 930 m 2760 930 l 2760 1081 l 2790 961 l 2820 1081 l cp
eoclip
n 2790 1395 m
2790 945 l gs col0 s gr gr
% arrowhead
n 2820 1081 m 2790 961 l 2760 1081 l 2820 1081 l cp gs 0.00 setgray ef gr col0 s
% Polyline
gs clippath
6330 930 m 6270 930 l 6270 1081 l 6300 961 l 6330 1081 l cp
eoclip
n 6300 1395 m
6300 945 l gs col0 s gr gr
% arrowhead
n 6330 1081 m 6300 961 l 6270 1081 l 6330 1081 l cp gs 0.00 setgray ef gr col0 s
% Polyline
gs clippath
6600 930 m 6540 930 l 6540 1081 l 6570 961 l 6600 1081 l cp
eoclip
n 6570 1710 m
6570 945 l gs col0 s gr gr
% arrowhead
n 6600 1081 m 6570 961 l 6540 1081 l 6600 1081 l cp gs 0.00 setgray ef gr col0 s
/Times-Roman ff 180.00 scf sf
990 720 m
gs 1 -1 sc (PS header) col0 sh gr
/Times-Roman ff 180.00 scf sf
1845 720 m
gs 1 -1 sc (PES header) col0 sh gr
/Times-Roman ff 180.00 scf sf
2970 720 m
gs 1 -1 sc (PES payload \(ES data\)) col0 sh gr
/Times-Roman ff 180.00 scf sf
585 1575 m
gs 1 -1 sc (p_buffer) col0 sh gr
/Times-Roman ff 180.00 scf sf
2745 1620 m
gs 1 -1 sc (p_payload_start) col0 sh gr
/Times-Roman ff 180.00 scf sf
5220 1575 m
gs 1 -1 sc (p_payload_end) col0 sh gr
/Times-Roman ff 180.00 scf sf
6615 1890 m
gs 1 -1 sc (p_buffer + i_size) dup sw pop neg 0 rm col0 sh gr
/Times-Roman ff 210.00 scf sf
2205 2025 m
gs 1 -1 sc (First \(and last\) data packet) col0 sh gr
/Times-Roman ff 210.00 scf sf
2835 2655 m
gs 1 -1 sc (PES packet) col0 sh gr
$F2psEnd
rs
#FIG 3.2
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
450 135 6750 135 6750 2295 450 2295 450 135
2 2 0 1 0 7 50 0 19 0.000 0 0 -1 0 0 5
900 405 1800 405 1800 900 900 900 900 405
2 2 0 1 0 7 50 0 18 0.000 0 0 -1 0 0 5
1800 405 2790 405 2790 900 1800 900 1800 405
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
2790 405 6300 405 6300 900 2790 900 2790 405
2 2 0 1 0 7 50 0 7 0.000 0 0 -1 0 0 5
900 405 630 405 630 900 900 900 900 405
2 2 0 1 0 7 50 0 7 0.000 0 0 -1 0 0 5
6300 405 6570 405 6570 900 6300 900 6300 405
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
630 1350 630 945
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
2790 1395 2790 945
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
6300 1395 6300 945
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
6570 1710 6570 945
4 0 0 50 0 0 12 0.0000 4 135 765 990 720 PS header\001
4 0 0 50 0 0 12 0.0000 4 135 885 1845 720 PES header\001
4 0 0 50 0 0 12 0.0000 4 180 1755 2970 720 PES payload (ES data)\001
4 0 0 50 0 0 12 0.0000 4 180 630 585 1575 p_buffer\001
4 0 0 50 0 0 12 0.0000 4 180 1215 2745 1620 p_payload_start\001
4 0 0 50 0 0 12 0.0000 4 180 1125 5220 1575 p_payload_end\001
4 2 0 50 0 0 12 0.0000 4 180 1275 6615 1890 p_buffer + i_size\001
4 0 0 50 0 0 14 0.0000 4 195 2295 2205 2025 First (and last) data packet\001
4 0 0 50 0 0 14 0.0000 4 195 1005 2835 2655 PES packet\001
%!PS-Adobe-2.0 EPSF-2.0
%%Title: stream.eps
%%Creator: fig2dev Version 3.2 Patchlevel 3a
%%CreationDate: Wed May 2 18:55:53 2001
%%For: cmassiot@salomon (Christophe Massiot,,,)
%%BoundingBox: 0 0 323 476
%%Magnification: 1.0000
%%EndComments
/$F2psDict 200 dict def
$F2psDict begin
$F2psDict /mtrx matrix put
/col-1 {0 setgray} bind def
/col0 {0.000 0.000 0.000 srgb} bind def
/col1 {0.000 0.000 1.000 srgb} bind def
/col2 {0.000 1.000 0.000 srgb} bind def
/col3 {0.000 1.000 1.000 srgb} bind def
/col4 {1.000 0.000 0.000 srgb} bind def
/col5 {1.000 0.000 1.000 srgb} bind def
/col6 {1.000 1.000 0.000 srgb} bind def
/col7 {1.000 1.000 1.000 srgb} bind def
/col8 {0.000 0.000 0.560 srgb} bind def
/col9 {0.000 0.000 0.690 srgb} bind def
/col10 {0.000 0.000 0.820 srgb} bind def
/col11 {0.530 0.810 1.000 srgb} bind def
/col12 {0.000 0.560 0.000 srgb} bind def
/col13 {0.000 0.690 0.000 srgb} bind def
/col14 {0.000 0.820 0.000 srgb} bind def
/col15 {0.000 0.560 0.560 srgb} bind def
/col16 {0.000 0.690 0.690 srgb} bind def
/col17 {0.000 0.820 0.820 srgb} bind def
/col18 {0.560 0.000 0.000 srgb} bind def
/col19 {0.690 0.000 0.000 srgb} bind def
/col20 {0.820 0.000 0.000 srgb} bind def
/col21 {0.560 0.000 0.560 srgb} bind def
/col22 {0.690 0.000 0.690 srgb} bind def
/col23 {0.820 0.000 0.820 srgb} bind def
/col24 {0.500 0.190 0.000 srgb} bind def
/col25 {0.630 0.250 0.000 srgb} bind def
/col26 {0.750 0.380 0.000 srgb} bind def
/col27 {1.000 0.500 0.500 srgb} bind def
/col28 {1.000 0.630 0.630 srgb} bind def
/col29 {1.000 0.750 0.750 srgb} bind def
/col30 {1.000 0.880 0.880 srgb} bind def
/col31 {1.000 0.840 0.000 srgb} bind def
end
save
newpath 0 476 moveto 0 0 lineto 323 0 lineto 323 476 lineto closepath clip newpath
1.0 480.0 translate
1 -1 scale
/cp {closepath} bind def
/ef {eofill} bind def
/gr {grestore} bind def
/gs {gsave} bind def
/sa {save} bind def
/rs {restore} bind def
/l {lineto} bind def
/m {moveto} bind def
/rm {rmoveto} bind def
/n {newpath} bind def
/s {stroke} bind def
/sh {show} bind def
/slc {setlinecap} bind def
/slj {setlinejoin} bind def
/slw {setlinewidth} bind def
/srgb {setrgbcolor} bind def
/rot {rotate} bind def
/sc {scale} bind def
/sd {setdash} bind def
/ff {findfont} bind def
/sf {setfont} bind def
/scf {scalefont} bind def
/sw {stringwidth} bind def
/tr {translate} bind def
/tnt {dup dup currentrgbcolor
4 -2 roll dup 1 exch sub 3 -1 roll mul add
4 -2 roll dup 1 exch sub 3 -1 roll mul add
4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
bind def
/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
4 -2 roll mul srgb} bind def
/reencdict 12 dict def /ReEncode { reencdict begin
/newcodesandnames exch def /newfontname exch def /basefontname exch def
/basefontdict basefontname findfont def /newfont basefontdict maxlength dict def
basefontdict { exch dup /FID ne { dup /Encoding eq
{ exch dup length array copy newfont 3 1 roll put }
{ exch newfont 3 1 roll put } ifelse } { pop pop } ifelse } forall
newfont /FontName newfontname put newcodesandnames aload pop
128 1 255 { newfont /Encoding get exch /.notdef put } for
newcodesandnames length 2 idiv { newfont /Encoding get 3 1 roll put } repeat
newfontname newfont definefont pop end } def
/isovec [
8#055 /minus 8#200 /grave 8#201 /acute 8#202 /circumflex 8#203 /tilde
8#204 /macron 8#205 /breve 8#206 /dotaccent 8#207 /dieresis
8#210 /ring 8#211 /cedilla 8#212 /hungarumlaut 8#213 /ogonek 8#214 /caron
8#220 /dotlessi 8#230 /oe 8#231 /OE
8#240 /space 8#241 /exclamdown 8#242 /cent 8#243 /sterling
8#244 /currency 8#245 /yen 8#246 /brokenbar 8#247 /section 8#250 /dieresis
8#251 /copyright 8#252 /ordfeminine 8#253 /guillemotleft 8#254 /logicalnot
8#255 /hyphen 8#256 /registered 8#257 /macron 8#260 /degree 8#261 /plusminus
8#262 /twosuperior 8#263 /threesuperior 8#264 /acute 8#265 /mu 8#266 /paragraph
8#267 /periodcentered 8#270 /cedilla 8#271 /onesuperior 8#272 /ordmasculine
8#273 /guillemotright 8#274 /onequarter 8#275 /onehalf
8#276 /threequarters 8#277 /questiondown 8#300 /Agrave 8#301 /Aacute
8#302 /Acircumflex 8#303 /Atilde 8#304 /Adieresis 8#305 /Aring
8#306 /AE 8#307 /Ccedilla 8#310 /Egrave 8#311 /Eacute
8#312 /Ecircumflex 8#313 /Edieresis 8#314 /Igrave 8#315 /Iacute
8#316 /Icircumflex 8#317 /Idieresis 8#320 /Eth 8#321 /Ntilde 8#322 /Ograve
8#323 /Oacute 8#324 /Ocircumflex 8#325 /Otilde 8#326 /Odieresis 8#327 /multiply
8#330 /Oslash 8#331 /Ugrave 8#332 /Uacute 8#333 /Ucircumflex
8#334 /Udieresis 8#335 /Yacute 8#336 /Thorn 8#337 /germandbls 8#340 /agrave
8#341 /aacute 8#342 /acircumflex 8#343 /atilde 8#344 /adieresis 8#345 /aring
8#346 /ae 8#347 /ccedilla 8#350 /egrave 8#351 /eacute
8#352 /ecircumflex 8#353 /edieresis 8#354 /igrave 8#355 /iacute
8#356 /icircumflex 8#357 /idieresis 8#360 /eth 8#361 /ntilde 8#362 /ograve
8#363 /oacute 8#364 /ocircumflex 8#365 /otilde 8#366 /odieresis 8#367 /divide
8#370 /oslash 8#371 /ugrave 8#372 /uacute 8#373 /ucircumflex
8#374 /udieresis 8#375 /yacute 8#376 /thorn 8#377 /ydieresis] def
/Times-Roman /Times-Roman-iso isovec ReEncode
/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
/$F2psEnd {$F2psEnteredState restore end} def
$F2psBegin
%%Page: 1 1
10 setmiterlimit
0.06299 0.06299 sc
% Polyline
7.500 slw
n 1305 90 m 3915 90 l 3915 1170 l 1305 1170 l
cp gs col0 s gr
% Polyline
gs clippath
1001 3421 m 1056 3445 l 1116 3306 l 1042 3405 l 1061 3282 l cp
eoclip
n 1980 1215 m
1035 3420 l gs col0 s gr gr
% arrowhead
n 1061 3282 m 1042 3405 l 1116 3306 l col0 s
% Polyline
n 225 3465 m 1800 3465 l 1800 4275 l 225 4275 l
cp gs col0 s gr
% Polyline
gs clippath
373 6221 m 433 6228 l 450 6078 l 407 6194 l 391 6071 l cp
eoclip
n 630 4275 m
405 6210 l gs col0 s gr gr
% arrowhead
n 391 6071 m 407 6194 l 450 6078 l col0 s
% Polyline
n 0 6300 m 1845 6300 l 1845 7605 l 0 7605 l
cp gs col0 s gr
% Polyline
gs clippath
960 5640 m 1020 5640 l 1020 5488 l 990 5608 l 960 5488 l cp
eoclip
n 990 4275 m
990 5625 l gs col0 s gr gr
% arrowhead
n 960 5488 m 990 5608 l 1020 5488 l col0 s
% Polyline
n 720 5670 m 1260 5670 l 1260 5985 l 720 5985 l
cp gs col0 s gr
% Polyline
gs clippath
1638 5600 m 1697 5588 l 1667 5440 l 1662 5564 l 1608 5452 l cp
eoclip
n 1395 4275 m
1665 5580 l gs col0 s gr gr
% arrowhead
n 1608 5452 m 1662 5564 l 1667 5440 l col0 s
% Polyline
n 1440 5670 m 2025 5670 l 2025 5985 l 1440 5985 l
cp gs col0 s gr
% Polyline
gs clippath
4073 3400 m 4128 3377 l 4070 3237 l 4089 3360 l 4015 3260 l cp
eoclip
n 3195 1215 m
4095 3375 l gs col0 s gr gr
% arrowhead
n 4015 3260 m 4089 3360 l 4070 3237 l col0 s
% Polyline
n 3645 3375 m 4590 3375 l 4590 3780 l 3645 3780 l
cp gs col0 s gr
% Polyline
gs clippath
3387 5676 m 3445 5692 l 3483 5545 l 3424 5654 l 3425 5530 l cp
eoclip
n 3915 3780 m
3420 5670 l gs col0 s gr gr
% arrowhead
n 3425 5530 m 3424 5654 l 3483 5545 l col0 s
% Polyline
n 3060 5760 m 3690 5760 l 3690 6120 l 3060 6120 l
cp gs col0 s gr
% Polyline
gs clippath
4790 5692 m 4847 5676 l 4805 5530 l 4810 5654 l 4748 5546 l cp
eoclip
n 4275 3780 m
4815 5670 l gs col0 s gr gr
% arrowhead
n 4748 5546 m 4810 5654 l 4805 5530 l col0 s
% Polyline
n 4545 5760 m 5085 5760 l 5085 6120 l 4545 6120 l
cp gs col0 s gr
/Times-Roman-iso ff 180.00 scf sf
1485 360 m
gs 1 -1 sc (Stream :) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
1485 585 m
gs 1 -1 sc (- b_pace_control, b_seekable) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
1485 810 m
gs 1 -1 sc (- i_size, i_tell) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
1485 1035 m
gs 1 -1 sc (- control) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
360 3690 m
gs 1 -1 sc (Program 1 :) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
360 3915 m
gs 1 -1 sc (- synchro info) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
360 4140 m
gs 1 -1 sc (- p_vout, p_aout) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
90 6525 m
gs 1 -1 sc (ES 1 :) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
90 6750 m
gs 1 -1 sc (- audio, video or SPU) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
90 6975 m
gs 1 -1 sc (- ID) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
90 7200 m
gs 1 -1 sc (- i_type) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
90 7425 m
gs 1 -1 sc (- p_decoder_fifo) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
810 5895 m
gs 1 -1 sc (ES 2) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
1575 5895 m
gs 1 -1 sc (ES 3) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
3735 3645 m
gs 1 -1 sc (Program 2) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
3195 6030 m
gs 1 -1 sc (ES 4) col0 sh gr
/Times-Roman-iso ff 180.00 scf sf
4635 6030 m
gs 1 -1 sc (ES 5) col0 sh gr
$F2psEnd
rs
#FIG 3.2
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
1305 90 3915 90 3915 1170 1305 1170 1305 90
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
1980 1215 1035 3420
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
225 3465 1800 3465 1800 4275 225 4275 225 3465
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
630 4275 405 6210
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
0 6300 1845 6300 1845 7605 0 7605 0 6300
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
990 4275 990 5625
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
720 5670 1260 5670 1260 5985 720 5985 720 5670
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
1395 4275 1665 5580
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
1440 5670 2025 5670 2025 5985 1440 5985 1440 5670
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
3195 1215 4095 3375
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
3645 3375 4590 3375 4590 3780 3645 3780 3645 3375
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
3915 3780 3420 5670
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
3060 5760 3690 5760 3690 6120 3060 6120 3060 5760
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
0 0 1.00 60.00 120.00
4275 3780 4815 5670
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
4545 5760 5085 5760 5085 6120 4545 6120 4545 5760
4 0 0 50 0 0 12 0.0000 4 135 630 1485 360 Stream :\001
4 0 0 50 0 0 12 0.0000 4 180 2250 1485 585 - b_pace_control, b_seekable\001
4 0 0 50 0 0 12 0.0000 4 180 1065 1485 810 - i_size, i_tell\001
4 0 0 50 0 0 12 0.0000 4 135 675 1485 1035 - control\001
4 0 0 50 0 0 12 0.0000 4 180 855 360 3690 Program 1 :\001
4 0 0 50 0 0 12 0.0000 4 180 1080 360 3915 - synchro info\001
4 0 0 50 0 0 12 0.0000 4 150 1260 360 4140 - p_vout, p_aout\001
4 0 0 50 0 0 12 0.0000 4 135 450 90 6525 ES 1 :\001
4 0 0 50 0 0 12 0.0000 4 165 1635 90 6750 - audio, video or SPU\001
4 0 0 50 0 0 12 0.0000 4 135 345 90 6975 - ID\001
4 0 0 50 0 0 12 0.0000 4 180 615 90 7200 - i_type\001
4 0 0 50 0 0 12 0.0000 4 180 1275 90 7425 - p_decoder_fifo\001
4 0 0 50 0 0 12 0.0000 4 135 360 810 5895 ES 2\001
4 0 0 50 0 0 12 0.0000 4 135 360 1575 5895 ES 3\001
4 0 0 50 0 0 12 0.0000 4 180 765 3735 3645 Program 2\001
4 0 0 50 0 0 12 0.0000 4 135 360 3195 6030 ES 4\001
4 0 0 50 0 0 12 0.0000 4 135 360 4635 6030 ES 5\001
%!PS-Adobe-2.0 EPSF-2.0
%%Title: ts.eps
%%Creator: fig2dev Version 3.2 Patchlevel 3a
%%CreationDate: Fri May 4 16:43:24 2001
%%For: cmassiot@salomon (Christophe Massiot,,,)
%%BoundingBox: 0 0 422 181
%%Magnification: 1.0000
%%EndComments
/$F2psDict 200 dict def
$F2psDict begin
$F2psDict /mtrx matrix put
/col-1 {0 setgray} bind def
/col0 {0.000 0.000 0.000 srgb} bind def
/col1 {0.000 0.000 1.000 srgb} bind def
/col2 {0.000 1.000 0.000 srgb} bind def
/col3 {0.000 1.000 1.000 srgb} bind def
/col4 {1.000 0.000 0.000 srgb} bind def
/col5 {1.000 0.000 1.000 srgb} bind def
/col6 {1.000 1.000 0.000 srgb} bind def
/col7 {1.000 1.000 1.000 srgb} bind def
/col8 {0.000 0.000 0.560 srgb} bind def
/col9 {0.000 0.000 0.690 srgb} bind def
/col10 {0.000 0.000 0.820 srgb} bind def
/col11 {0.530 0.810 1.000 srgb} bind def
/col12 {0.000 0.560 0.000 srgb} bind def
/col13 {0.000 0.690 0.000 srgb} bind def
/col14 {0.000 0.820 0.000 srgb} bind def
/col15 {0.000 0.560 0.560 srgb} bind def
/col16 {0.000 0.690 0.690 srgb} bind def
/col17 {0.000 0.820 0.820 srgb} bind def
/col18 {0.560 0.000 0.000 srgb} bind def
/col19 {0.690 0.000 0.000 srgb} bind def
/col20 {0.820 0.000 0.000 srgb} bind def
/col21 {0.560 0.000 0.560 srgb} bind def
/col22 {0.690 0.000 0.690 srgb} bind def
/col23 {0.820 0.000 0.820 srgb} bind def
/col24 {0.500 0.190 0.000 srgb} bind def
/col25 {0.630 0.250 0.000 srgb} bind def
/col26 {0.750 0.380 0.000 srgb} bind def
/col27 {1.000 0.500 0.500 srgb} bind def
/col28 {1.000 0.630 0.630 srgb} bind def
/col29 {1.000 0.750 0.750 srgb} bind def
/col30 {1.000 0.880 0.880 srgb} bind def
/col31 {1.000 0.840 0.000 srgb} bind def
end
save
newpath 0 181 moveto 0 0 lineto 422 0 lineto 422 181 lineto closepath clip newpath
-27.0 188.0 translate
1 -1 scale
/cp {closepath} bind def
/ef {eofill} bind def
/gr {grestore} bind def
/gs {gsave} bind def
/sa {save} bind def
/rs {restore} bind def
/l {lineto} bind def
/m {moveto} bind def
/rm {rmoveto} bind def
/n {newpath} bind def
/s {stroke} bind def
/sh {show} bind def
/slc {setlinecap} bind def
/slj {setlinejoin} bind def
/slw {setlinewidth} bind def
/srgb {setrgbcolor} bind def
/rot {rotate} bind def
/sc {scale} bind def
/sd {setdash} bind def
/ff {findfont} bind def
/sf {setfont} bind def
/scf {scalefont} bind def
/sw {stringwidth} bind def
/tr {translate} bind def
/tnt {dup dup currentrgbcolor
4 -2 roll dup 1 exch sub 3 -1 roll mul add
4 -2 roll dup 1 exch sub 3 -1 roll mul add
4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
bind def
/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
4 -2 roll mul srgb} bind def
/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
/$F2psEnd {$F2psEnteredState restore end} def
$F2psBegin
%%Page: 1 1
10 setmiterlimit
0.06299 0.06299 sc
% Polyline
7.500 slw
n 765 405 m 1665 405 l 1665 900 l 765 900 l
cp gs col7 0.95 shd ef gr gs col0 s gr
% Polyline
n 1665 405 m 2655 405 l 2655 900 l 1665 900 l
cp gs col7 0.90 shd ef gr gs col0 s gr
% Polyline
gs clippath
2685 930 m 2625 930 l 2625 1081 l 2655 961 l 2685 1081 l cp
eoclip
n 2655 1395 m
2655 945 l gs col0 s gr gr
% arrowhead
n 2685 1081 m 2655 961 l 2625 1081 l 2685 1081 l cp gs 0.00 setgray ef gr col0 s
% Polyline
n 2655 405 m 4500 405 l 4500 900 l 2655 900 l
cp gs col0 s gr
% Polyline
n 4500 405 m 4680 405 l 4680 900 l 4500 900 l
cp gs col7 0.35 shd ef gr gs col0 s gr
% Polyline
gs clippath
660 930 m 600 930 l 600 1081 l 630 961 l 660 1081 l cp
eoclip
n 630 1350 m
630 945 l gs col0 s gr gr
% arrowhead
n 660 1081 m 630 961 l 600 1081 l 660 1081 l cp gs 0.00 setgray ef gr col0 s
% Polyline
gs clippath
4530 930 m 4470 930 l 4470 1081 l 4500 961 l 4530 1081 l cp
eoclip
n 4500 1395 m
4500 945 l gs col0 s gr gr
% arrowhead
n 4530 1081 m 4500 961 l 4470 1081 l 4530 1081 l cp gs 0.00 setgray ef gr col0 s
% Polyline
gs clippath
4710 930 m 4650 930 l 4650 1081 l 4680 961 l 4710 1081 l cp
eoclip
n 4680 1710 m
4680 945 l gs col0 s gr gr
% arrowhead
n 4710 1081 m 4680 961 l 4650 1081 l 4710 1081 l cp gs 0.00 setgray ef gr col0 s
/Times-Roman ff 180.00 scf sf
855 720 m
gs 1 -1 sc (TS header) col0 sh gr
/Times-Roman ff 180.00 scf sf
1710 720 m
gs 1 -1 sc (PES header) col0 sh gr
/Times-Roman ff 180.00 scf sf
2070 1575 m
gs 1 -1 sc (p_payload_start) col0 sh gr
/Times-Roman ff 180.00 scf sf
2700 720 m
gs 1 -1 sc (PES payload \(ES data\)) col0 sh gr
/Times-Roman ff 180.00 scf sf
585 1575 m
gs 1 -1 sc (p_buffer) col0 sh gr
/Times-Roman ff 180.00 scf sf
3420 1575 m
gs 1 -1 sc (p_payload_end) col0 sh gr
/Times-Roman ff 180.00 scf sf
4725 1890 m
gs 1 -1 sc (p_buffer + i_size) dup sw pop neg 0 rm col0 sh gr
% Polyline
n 765 405 m 630 405 l 630 900 l 765 900 l
cp gs col7 0.35 shd ef gr gs col0 s gr
% Polyline
n 5265 405 m 6930 405 l 6930 900 l 5265 900 l
cp gs col0 s gr
/Times-Roman ff 180.00 scf sf
5310 720 m
gs 1 -1 sc (PES payload \(cont'd\)) col0 sh gr
% Polyline
gs clippath
5055 660 m 5055 600 l 4904 600 l 5024 630 l 4904 660 l cp
eoclip
n 4680 630 m
5040 630 l gs col0 s gr gr
% arrowhead
n 4904 660 m 5024 630 l 4904 600 l 4904 660 l cp gs 0.00 setgray ef gr col0 s
% Polyline
n 5265 405 m 5085 405 l 5085 900 l 5265 900 l
cp gs col7 0.95 shd ef gr gs col0 s gr
% Polyline
n 5265 1575 m 5085 1575 l 5085 2070 l 5265 2070 l
cp gs col7 0.95 shd ef gr gs col0 s gr
% Polyline
n 5265 1575 m 6930 1575 l 6930 2070 l 5265 2070 l
cp gs col0 s gr
% Polyline
gs clippath
6810 1545 m 6870 1545 l 6870 1394 l 6840 1514 l 6810 1394 l cp
eoclip
n 6840 900 m
6840 1530 l gs col0 s gr gr
% arrowhead
n 6810 1394 m 6840 1514 l 6870 1394 l 6810 1394 l cp gs 0.00 setgray ef gr col0 s
% Polyline
n 450 135 m 7110 135 l 7110 2565 l 450 2565 l
cp gs col0 s gr
/Times-Roman ff 210.00 scf sf
1845 2340 m
gs 1 -1 sc (First data packet) col0 sh gr
/Times-Roman ff 210.00 scf sf
5040 1170 m
gs 1 -1 sc (Second data packet) col0 sh gr
/Times-Roman ff 180.00 scf sf
5400 1890 m
gs 1 -1 sc (PES payload \(end\)) col0 sh gr
/Times-Roman ff 210.00 scf sf
4590 2340 m
gs 1 -1 sc (Third \(and last\) data packet) col0 sh gr
/Times-Roman ff 210.00 scf sf
3330 2925 m
gs 1 -1 sc (PES packet) col0 sh gr
$F2psEnd
rs
#FIG 3.2
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
6 585 405 4725 1935
6 585 405 4725 1935
2 2 0 1 0 7 50 0 19 0.000 0 0 -1 0 0 5
765 405 1665 405 1665 900 765 900 765 405
2 2 0 1 0 7 50 0 18 0.000 0 0 -1 0 0 5
1665 405 2655 405 2655 900 1665 900 1665 405
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
2655 1395 2655 945
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
2655 405 4500 405 4500 900 2655 900 2655 405
2 2 0 1 0 7 50 0 7 0.000 0 0 -1 0 0 5
4500 405 4680 405 4680 900 4500 900 4500 405
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
630 1350 630 945
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
4500 1395 4500 945
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
4680 1710 4680 945
4 0 0 50 0 0 12 0.0000 4 135 765 855 720 TS header\001
4 0 0 50 0 0 12 0.0000 4 135 885 1710 720 PES header\001
4 0 0 50 0 0 12 0.0000 4 180 1215 2070 1575 p_payload_start\001
4 0 0 50 0 0 12 0.0000 4 180 1755 2700 720 PES payload (ES data)\001
4 0 0 50 0 0 12 0.0000 4 180 630 585 1575 p_buffer\001
4 0 0 50 0 0 12 0.0000 4 180 1125 3420 1575 p_payload_end\001
4 2 0 50 0 0 12 0.0000 4 180 1275 4725 1890 p_buffer + i_size\001
-6
2 2 0 1 0 7 50 0 7 0.000 0 0 -1 0 0 5
765 405 630 405 630 900 765 900 765 405
-6
6 5265 405 6975 900
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
5265 405 6930 405 6930 900 5265 900 5265 405
4 0 0 50 0 0 12 0.0000 4 180 1635 5310 720 PES payload (cont'd)\001
-6
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
4680 630 5040 630
2 2 0 1 0 7 50 0 19 0.000 0 0 -1 0 0 5
5265 405 5085 405 5085 900 5265 900 5265 405
2 2 0 1 0 7 50 0 19 0.000 0 0 -1 0 0 5
5265 1575 5085 1575 5085 2070 5265 2070 5265 1575
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
5265 1575 6930 1575 6930 2070 5265 2070 5265 1575
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
6840 900 6840 1530
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
450 135 7110 135 7110 2565 450 2565 450 135
4 0 0 50 0 0 14 0.0000 4 195 1440 1845 2340 First data packet\001
4 0 0 50 0 0 14 0.0000 4 195 1695 5040 1170 Second data packet\001
4 0 0 50 0 0 12 0.0000 4 180 1425 5400 1890 PES payload (end)\001
4 0 0 50 0 0 14 0.0000 4 195 2370 4590 2340 Third (and last) data packet\001
4 0 0 50 0 0 14 0.0000 4 195 1005 3330 2925 PES packet\001
<chapter> <title> The video output layer </title>
<sect1> <title> Data structures and main loop </title>
<para>
Important data structures are defined in <filename> include/video.h
</filename> and <filename> include/video_output.h</filename>. The main
data structure is <type> picture_t</type>, which describes everything a
video decoder thread needs. Please refer to this file for more
information. Typically, <parameter> p_data </parameter> will be a
pointer to YUV planar picture.
</para>
<para>
Note also the <type> subpicture_t </type> structure. In fact the VLC SPU
decoder only parses the SPU header, and converts the SPU graphical data
to an internal format which can be rendered much faster. So a part of
the "real" SPU decoder lies in
<filename> src/video_output/video_spu.c</filename>.
</para>
<para>
The <type> vout_thread_t </type> structure is much more complex, but
you needn't understand everything. Basically the video output thread
manages a heap of pictures and subpictures (5 by default). Every
picture has a status (displayed, destroyed, empty...) and eventually
a presentation time. The main job of the video output is an infinite
loop to : [this is subject to change in the near future]
</para>
<orderedlist>
<listitem> <para> Find the next picture to display in the heap.
</para> </listitem>
<listitem> <para> Find the current subpicture to display.
</para> </listitem>
<listitem> <para> Render the picture (if the video output plug-in
doesn't support YUV overlay). Rendering will call an optimized
YUV plug-in, which will also do the scaling, add subtitles and
an optional picture information field.
</para> </listitem>
<listitem> <para> Sleep until the specified date.
</para> </listitem>
<listitem> <para> Display the picture (plug-in function). For
outputs which display RGB data, it is often accomplished with
a buffer switching. <parameter> p_vout-&gt;p_buffer </parameter>
is an array of two buffers where the YUV transform takes place,
and p_vout-&gt;i_buffer_index indicates the currently displayed
buffer.
</para> </listitem>
<listitem> <para> Manage events.
</para> </listitem>
</orderedlist>
</sect1>
<sect1> <title> Methods used by video decoders </title>
<para>
The video output exports a bunch of functions so that decoders can send
their decoded data. The most important function is
<function>vout_CreatePicture</function> which allocates the picture
buffer to the size indicated by the video decoder. It then just needs
to feed <type> (void *) </type><parameter> p_picture-&gt;p_data </parameter>
with the decoded data, and call <function> vout_DisplayPicture </function>
and <function> vout_DatePicture </function> upon necessary.
</para>
<itemizedlist>
<listitem> <para> <type> picture_t * </type> <function>
vout_CreatePicture </function>
<parameter> ( vout_thread_t *p_vout, int i_type, int i_width,
int i_height ) </parameter> :
Returns an allocated picture buffer. <parameter> i_type </parameter>
will be for instance <constant> YUV_420_PICTURE</constant>, and
i_width and i_height are in pixels.
</para>
<warning> <para> If no picture is available in the heap,
<function> vout_CreatePicture </function> will return NULL.
</para> </warning>
</listitem>
<listitem> <para> <function> vout_LinkPicture </function>
<parameter> ( vout_thread_t *p_vout, picture_t *p_pic ) </parameter> :
Increases the refcount of the picture, so that it doesn't get
accidently freed while the decoder still needs it. For instance,
an I or P picture can still be needed after displaying to decode
interleaved B pictures.
</para> </listitem>
<listitem> <para> <function> vout_UnlinkPicture </function>
<parameter> ( vout_thread_t *p_vout, picture_t *p_pic ) </parameter> :
Decreases the refcount of the picture. An unlink must be done
for every link previously made.
</para> </listitem>
<listitem> <para> <function> vout_DatePicture </function>
<parameter> ( vout_thread_t *p_vout, picture_t *p_pic ) </parameter> :
Gives the picture a presentation date. You can start working on
a picture before knowing precisely at what time it will be
displayed. For instance to date an I or P picture, you must wait
until you have decoded all previous B pictures (which are
indeed placed after - decoding order != presentation order).
</para> </listitem>
<listitem> <para> <function> vout_DisplayPicture </function>
<parameter> ( vout_thread_t *p_vout, picture_t *p_pic ) </parameter> :
Tells the video output that a picture has been completely decoded
and is ready to be rendered. It can be called before or after
<function> vout_DatePicture</function>.
</para> </listitem>
<listitem> <para> <function> vout_DestroyPicture </function>
<parameter> ( vout_thread_t *p_vout, picture_t *p_pic ) </parameter> :
Marks the picture as empty (useful in case of a stream parsing
error).
</para> </listitem>
<listitem> <para> <type> subpicture_t * </type> <function>
vout_CreateSubPicture </function> <parameter> ( vout_thread_t *p_vout,
int i_type, int i_size ) </parameter> :
Returns an allocated subpicture buffer. <parameter> i_type
</parameter> is <constant> DVD_SUBPICTURE </constant> or
<constant> TEXT_SUBPICTURE</constant>, <parameter> i_size
</parameter> is the length in bytes of the packet.
</para> </listitem>
<listitem> <para> <function> vout_DisplaySubPicture </function>
<parameter> ( vout_thread_t *p_vout, subpicture_t *p_subpic )
</parameter> :
Tells the video output that a subpicture has been completely
decoded. It obsoletes the previous subpicture.
</para> </listitem>
<listitem> <para> <function> vout_DestroySubPicture </function>
<parameter> ( vout_thread_t *p_vout, subpicture_t *p_subpic )
</parameter> :
Marks the subpicture as empty.
</para> </listitem>
</itemizedlist>
</sect1>
<sect1> <title> How to write a video output plug-in </title>
<para>
A video output takes care of the system calls to display the pictures and
manage the output window. Have a look at <filename>
plugins/x11/vout_x11.c</filename>. You must write the following
functions :
</para>
<orderedlist>
<listitem> <para> <type> int </type> <function> vout_Probe </function>
<parameter> ( probedata_t *p_data ) </parameter> :
Returns a score between 0 and 999 to indicate whether it can
run on the architecture. 999 is the best. <parameter> p_data
</parameter> is currently unused.
</para> </listitem>
<listitem> <para> <type> int </type> <function> vout_Create </function>
<parameter> ( vout_thread_t *p_vout ) </parameter> :
Basically, initializes and opens a new window. Returns TRUE if
it failed.
</para> </listitem>
<listitem> <para> <type> int </type> <function> vout_Init </function>
<parameter> ( vout_thread_t *p_vout ) </parameter> :
Creates optional picture buffers (for instance ximages or
xvimages). Returns TRUE if it failed.
</para> </listitem>
<listitem> <para> <function> vout_End </function> <parameter>
( vout_thread_t *p_vout ) </parameter> :
Frees optional picture buffers.
</para> </listitem>
<listitem> <para> <function> vout_Destroy </function> <parameter>
( vout_thread_t *p_vout ) </parameter> :
Unmaps the window and frees all allocated resources.
</para> </listitem>
<listitem> <para> <type> int </type> <function> vout_Manage
</function> <parameter> ( vout_thread_t *p_vout ) </parameter> :
Manages events (including for instance resize events).
</para> </listitem>
<listitem> <para> <function> vout_Display </function> <parameter>
( vout_thread_t *p_vout ) </parameter> :
Displays a previously rendered buffer.
</para> </listitem>
<listitem> <para> <function> vout_SetPalette </function>
<parameter> ( vout_thread_t *p_vout, u16 *red, u16 *green,
u16 *blue, u16 *transp ) </parameter> :
Sets the 8 bpp palette. <parameter> red, green </parameter>
and <parameter> blue </parameter> are arrays of 256 <type>
unsigned shorts</type>.
</para> </listitem>
</orderedlist>
</sect1>
<sect1> <title> How to write a YUV plug-in </title>
<para>
Look at the C source <filename> plugins/yuv/transforms_yuv.c</filename>.
You need to redefine just the same transformations. Basically, it is a
matrix multiply operation. Good luck.
</para>
</sect1>
</chapter>
%
% main.tex: structure of the vlc LaTeX documentation
% (c)1999 VideoLAN
%
\documentclass[a4paper]{report}
%
% Packages and definitions
%
\usepackage{graphicx}
\include{common}
\newcommand{\VideoLAN}{\textit{Video}\textsc{lan}}
%
% Document
%
\begin{document}
% Title page and table of contents
\begin{titlepage}
\VideoLAN project
\begin{center}
\resizebox{\textwidth}{!}{vlc: the \VideoLAN\ client}
\bigskip
a real-time MPEG-2 software decoder and player
\end{center}
\end{titlepage}
\tableofcontents
% General description of the project
\part{General description}
\chapter{The goal}
\chapter{??}
\chapter{vlc: the \VideoLAN\ client}
\chapter{Continuation of the project}
% Project organization
\part{Project organization}
\chapter{Team and communication}
\chapter{Source control}
\chapter{Coding conventions}
\include{threads}
% Code description
\part{Code description}
\end{document}
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment