1 <chapter><title>Porting VLC</title>
3 <sect1> <title> Port steps </title>
6 Basically, porting to a new architecture boils down to follow the
12 <listitem> <para> <emphasis> Building the VLC : </emphasis>
13 That may be the most difficult part, depending on how POSIX
14 the architecture is. You have to produce valid C.
17 <listitem> <para> <emphasis> Having video : </emphasis>
18 If your architecture features an X server, it should be
19 straightforward, though you might have problems with xvideo
20 or xshm. Otherwise you can try to use SDL if it is supported,
21 or end up writing your own video output plugin.
24 <listitem> <para> <emphasis> Having audio : </emphasis>
25 If your architecture features an OSS compatible DSP or ALSA, you
26 can reuse an existing plugin. Otherwise you will have to write
27 your own audio output plugin.
30 <listitem> <para> <emphasis> Accessing DVDs : </emphasis>
31 You are going to need a write access to the DVD device.
32 Every system has specific ioctl() for key negociation with
33 the DVD drive, so we have set up an abstration layer in
34 <filename> plugins/dvd/dvd_ioctl.c</filename>. You might
35 need to add stuff here. Some operating systems won't give
36 you access to the key negociation (MacOS X), so you will
37 have to write a kernel extension or you will only be able to read
38 unencrypted DVDs. Other operating systems might only give
39 you read access to the DVD device if you are root. Your mileage
43 <listitem> <para> <emphasis> Writing a native interface : </emphasis>
44 If your system doesn't support GTK or Qt, you will have to
45 write a native interface plugin (for instance Aqua or Win32).
46 You may also need to rewrite the video output plugin if
47 you're currently using a slow compatibility layer.
50 <listitem> <para> <emphasis> Optimizing : </emphasis>
51 If your architecture features a special set of multimedia
52 instructions (such as MMX) that is not supported by VLC, you
53 may want to write specific optimizations. Heavy calculation
54 parts are : IDCT (see idct plugin), motion compensation
55 (see motion plugin), and YUV (see video output) if you don't
56 use the YUV overlay support of your video board (SDL or
64 <sect1> <title> Building </title>
67 This is probably the most complicated part. If your platform is fully
68 POSIX-compliant (such as GNU/Linux), it should be quick, otherwise
69 expect troubles. Known issues are :
74 <listitem> <para> Finding a compiler : We use <application> gcc
75 </application> on all platforms, and <application> mingw32
76 </application> to cross-compile the win32 port. If you don't you're
77 probably in <emphasis> very big </emphasis> trouble. Good luck.
80 <listitem> <para> Finding <application> GNU make </application> : Our
81 <filename>Makefile</filename> is heavily <application>GNU make
82 </application> specific, so I suggest you install it.
85 <listitem> <para> Running the <filename> configure </filename>
86 script : This is basically a shell script, so if you have a UNIX
87 shell on your platform it shouldn't be a problem. It will probe
88 your system for headers and libraries needed. It needs
89 adequate <filename> config.sub </filename> and <filename>
90 config.guess</filename>, so if your platform is young your
91 provider may have supplied customized versions. Check with it.
94 <listitem> <para> Compiling the VLC binary : This is the most
95 difficult. Type <command> make </command> or <command> gmake
96 </command> and watch the results. It will probably break soon
97 on a parse error. Add the headers missing, fix mistakes. If
98 you cannot make it to also compiles on other platforms, use
99 #ifdef directives. Add tests for functions or libraries in
100 <filename> configure.in </filename> and run <command> autoheader
101 </command> and <command> autoconf</command>. Always prefer
102 tests on <property> #ifdef HAVE_MY_HEADER_T</property>,
103 instead of <property> #ifdef SYS_MYOPERATINGSYSTEM</property>.
104 You may especially experience problems with the network code
105 in <filename> src/input/input.c</filename>.
108 <listitem> <para> Threads : If your system has an exotic thread
109 implementation, you will probably need to fill the wrappers in
110 <filename> include/threads.h </filename> for your system.
111 Currently supported implementations include the POSIX pthreads,
112 the BeOS threads, and the Mach cthreads.
115 <listitem> <para> Linking : You will need special flags to the
116 compiler, to allow symbol exports (otherwise plug-ins won't
117 work). For instance under GNU/Linux you need <parameter>
118 -rdynamic</parameter>.
121 <listitem> <para> Compiling plug-ins : You do not need external
122 plug-ins at first, you can build all you need in (see <filename>
123 Makefile.opts</filename>). In the long run though, it is a
124 good idea to change <parameter> PCFLAGS</parameter> and <parameter>
125 PLCFLAGS</parameter> to allow run-time loading of libraries.
126 You are going to need <application> libdl</application>, or a
127 similar dynamic loader. To add support for an exotic dynamic
128 loader, have a look at <filename> include/modules_core.h
129 </filename>. Currently supported implementations include the
130 UNIX dynamic loader and the BeOS image loader.
133 <listitem> <para> Assembling : If you use specific optimizations
134 (such as MMX), you may have problem assembling files, because
135 the assembler syntax may be different on your platform. Try
136 without it at first. Pay attention to the optimization flags
137 too, you may see a <emphasis>huge</emphasis> difference.
143 VLC should work both on little endian and big endian systems. All
144 load operations should be aligned on the native size of the type, so
145 that it works on exotic processors like Sparc or Alpha. It should
146 work on 64-bit platforms, though it has not been optimized for it.
147 A big boost for them would be to have a WORD_TYPE = u64 in <filename>
148 include/input_ext-dec.h</filename>, but it is currently broken for
153 If you experience run-time problems, see the following appendix and
154 pray for you to have <command> gdb</command>...