Basically, porting to a new architecture boils沸腾 down to follow the following steps :
1. Building the VLC : That may be the most difficult part, depending on how POSIX the architecture is. You have to produce valid合法正当的 C.
2. Having video : 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.
3. Having audio : 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.
4. Accessing DVDs : 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 plugins/dvd/dvd_ioctl.c. 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.
5. Writing a native interface : 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.
6. Optimizing : 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).
BuildingThis 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 :
· Finding a compiler : We use gcc on all platforms, and mingw32 to cross-compile the win32 port. If you don't you're probably in very big trouble. Good luck.
· Finding GNU make : Our Makefile is heavily GNU make specific, so I suggest you install it.
· Running the configure 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 config.sub and config.guess, so if your platform is young your provider may have supplied customized versions. Check with it.
· Compiling the VLC binary : This is the most difficult. Type make or gmake 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 configure.in and run autoheader and autoconf. Always prefer tests on #ifdef HAVE_MY_HEADER_T, instead of #ifdef SYS_MYOPERATINGSYSTEM. You may especially experience problems with the network code in src/input/input.c.
· Threads : If your system has an exotic thread implementation, you will probably need to fill the wrappers in include/threads.h for your system. Currently supported implementations include the POSIX pthreads, the BeOS threads, and the Mach cthreads.
· 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 -rdynamic.
· Compiling plug-ins : You do not need external plug-ins at first, you can build all you need in (see Makefile.opts). In the long run though, it is a good idea to change PCFLAGS and PLCFLAGS to allow run-time loading of libraries. You are going to need libdl, or a similar dynamic loader. To add support for an exotic dynamic loader, have a look at include/modules_core.h . Currently supported implementations include the UNIX dynamic loader and the BeOS image loader.
· 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 huge difference.
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 include/input_ext-dec.h, but it is currently broken for unknown reasons.
If you experience run-time problems, see the following appendix and pray 请求for you to have gdb...