Linux development

From Official Kodi Wiki
Jump to navigation Jump to search

NOTE! This article documents a current event. Information may change rapidly as the event progresses.

Currently, a few developers on Team-XBMC have begun the porting of XBMC to Linux (and OpenGL using the SDL toolkit). The goal is for this to become a full port of XBMC with all the features and functions that are available on the Xbox version of XBMC (with the exception of Xbox exclusive functionality as Trainers, launching Xbox Games, and such). This is a huge task which is why we are now making this public request, seeking C/C++ programmers to volunteer in assisting us with this Linux porting development project. Whether you have contributed to The XBMC Project in the past or not, please consider doing so now. Those of you who are completely unfamiliar with XBMC can get a good overview of what XBMC offers for its end-users by reading through the XBMC article on wikipedia.org

Note to XBMC end-users! Please understand that this Linux port project is not yet mature enough for you as an end-user to play with, no media can even be played back yet. We can not yet give you an ETA as to when it will be useful for end-users. Respect that we can not accept any bug-reports or feature/function-requests for this Linux port yet. If you as end-users have any questions or need to get something of your chest about this then please direct that towards the existing XBMC Linux port end-user discussion topic-thread in our community-forum

What is XBMC and why port it to Linux?

For the developers who does not know this; XBMC (short for XBox Media Center, not to be confused with Microsoft's Windows Media Center Extender for the Xbox) is an award-winning free and open source media player, originally designed to run on the Xbox game-console. The GPL/LGPL licensed source code basically consist of a GUI framework that has been written from scratch by Team-XBMC, this GUI acts as a front-end control interface for several audio/video players designed for specific purposes (and those are loaded when needed as DLLs), the GUI is also the user interface to all of XBMC multimedia handling functions such as databases and sorting, etc.. The XBMC Project, (who's members maintain XBMC source code), is a non-profit open source hobby project that is developed by volunteers in their spare-time without any monetary gain. The team of developers working on XBMC have always encouraged anyone to submit your own source code patches for new features or functions, improve on existing ones, or fix bugs.

The difference this time is that we are not asking for new features/functions, what we are asking is for the existing code to be ported so it will compile and run under a Linux operating-system (with the same features/functions that are already available on the Xbox version of XBMC). The main reasons for porting XBMC to Linux are non-technical, (so it is not that the Xbox hardware is too slow or to old for the XBMC GUI or its existing features/functions), the real reasons are that we want XBMC to get a larger end-user and developer-base, because the more people who use XBMC and help maintain the code (and skins) the longer the project will grow and stay alive. The main reason from an end-user point of view is that the Xbox can not playback native high-definition video (at 720p and 1080i/1080p), especially not if the video is encoded with a H.264 or VC-1 codec. Nevertheless, note that we will still keep the old Xbox as the reference platform for standard-definition resolution video for some time (possibly a few more years), which means that the same GUI (and skins) that runs smooth under Linux on a relatively new computer must also run just as smooth on the old Xbox hardware (or a old computer that closly matches the Xbox hardware, at 733Mhz Intel Pentium III CPU and only 64MB shared memory).

Skill requirements and where to start

Proficient in C/C++ programming language, and though not required knowledge of DirectX, Direct3D, OpenGL and/or multimedia programming is a plus, as well as prior cross-platform or porting development experience. You do not need to have access to an Xbox game-console or any special tools/softwares in order to take part - XBMC development is well underway on Linux (Ubuntu 7.04).

Where do I start (Linux)?

The recommended Linux development platform is currently Ubuntu 7.04 (Feisty Fawn). There is a Kdevelop project file available in our SVN (Subversion revision control system). After you done a SVN checkout, follow the install guide in the SVN (README.linux) to setup the required packages and so on. Team-XBMC developers think that the best thing to start with is just to take a look through the source code and try to understand how it all fits together. Test things out, find what works and what does not, then try and track down why.

Hardware requirements

Can non-Linux developers also help?

XBMC can also be compiled for Win32 (Microsoft Windows) operating-systems with Microsoft Visual Studio .NET 2003 (7.1) or higher, so even though Team-XBMC will be concentrating on the Linux port of XBMC, it will not hurt if some people who prefer and feel comfortable with Microsoft Visual Studio as a developement platform also volunteer to help with getting the Win32 port of XBMC up to par with the Linux and Xbox versions, this as a preperation for possible future cross-platform versions of XBMC.

Other tools and resources

Though any other tools or resources are not required they can possible help make in development.

Development Tools

  • Valgrind (for Linux) - a free Linux programming tool for memory debugging, memory leak detection, and profiling.
  • Sysprof (for Linux) - a free System-wide Linux Profiler for tracking CPU usage
  • HLSL2GLSL - library and tool that converts HLSL (High Level Shader Language) shaders to GLSL (OpenGL Shading Language)
  • PowerTOP - utility by Intel for detecting what Linux programs and kernel tunables are resulting in the most power consumption.
  • Dependency walker (for Microsoft Windows) - a free program used to list the imported and exported functions of a portable executable file.

Development Resources

Third-party libraries

This is a list of third-party cross-platform libraries that you may or may not want to use in the porting process, you decide:

  • Anti-Grain Geometry - A High Quality Rendering Engine (High Fidelity 2D Graphics Renderer) for C++ (GPL licenced)
  • CMIL (Common Media Input Layer) C++ OO framework designed to improve the state of cross-platform input handling
    • CMIL is (or will be soon) compatible with both SDL and DirectX (GPL licenced)
  • VControl - a flexible library for unifying keyboard and joystick input.
  • libmousetrap (The Mousetrap Library) - C library for SDL (LGPL licenced), also see Pymousetrap
  • Xbox 360 controller on Linux - experimental device driver for Xbox360 Wireless/Wired controller on Linux computers.
  • Lirc (or alternative library implementation) for IR/IrDA (infrared) remote controls support under Linux
    • Possible also add Wlirc for IR/IrDA (infrared) remote support under Win32 for consistency.
  • SDL_net - a simple cross-platform network library
  • SDL_buffer - a SDL extention library that is useful when you have to resize an image multiple times.
  • SDL_Resize - basic image resizing library, high quality output suited for prerendering images.
  • SDL_Config - Library designed for reading and writing configuration (.ini) files in an easy, cross-platform way.
  • navfs - Hard drive abstraction layer C library, allowing easy directory navigation.
  • SDL_bgrab - SDL convertion of libbgrab (a framegrabber lib from the same author).

Technical summary of XBMC

The basics

The XBMC code structure uses a fairly modular design (with libraries and DLLs), and we think that there are enough modules/libraries to keep a wide skill-level range of developers busy for a while in the porting of them all. So please, take a look at the source code, then with the help of our To-Do list (see futher down in this article) assess where the porting stage is today and think about where and how you can try to help out. Note that we are not planning on completly abandoning the Xbox hardware any time soon - XBMC will be a cross-platform software application, using the same code on multiple hardware platforms, (the 'old' Xbox still have a good amount of years to live we hope).

Detailed technical information

For more details please visit the Development Notes section of this manual.

The XBMC source code

The XBMC source code is in our SVN repository on sourceforge.net. Full instructions for compiling/builing XBMC under Linux is available here:

Linux porting

The Linux port plan

Disclaimer: The XBMC Linux port of course excludes all Xbox exclusive functionality (like for example Trainers, launching Xbox Games, and such):

What has already been done

  • Kdevelop] project file available in SVN
    • Linux development and debug environment
  • Code fully compiles on Ubuntu 7.04
  • GUI implementation of SDL
    • OpenGL/SDL - using the GPU, working but relies on an accelerated OpenGL version
    • SDL using 2D blitting, working but relies on computer CPU, not recommended (XBMC requires 24bpp to run, so if your graphic card doesn't have 3D accel for 24bpp -as i810 ones- then you have to compile using the option 'make sdl_2d')
  • Picture viewing working (including slideshow and it's effects)
  • SMB network shares
  • PAPlayer and its audio decoder DLL codecs - in progress

To-Do

This is a To-Do list of thing that still need to be done, you are more than welcome to help out with any of these tasks:

Major To-Do tasks with high priority

  • [MAJOR - HIGH PRIORITY] PAPlayer porting to Linux (port DLLs to SO, support ALSA) - in progress
  • [MAJOR - HIGH PRIORITY] MPlayer porting to Linux
  • [MAJOR - HIGH PRIORITY] DVDPlayer porting to Linux
  • [MAJOR - HIGH PRIORITY] Pixel Shader video renderer(s) (possibly also hardware overlay via Xv)
  • [MAJOR - HIGH PRIORITY] Python interpreter (and python scripts/libraries] - in early stages
  • [MAJOR - HIGH PRIORITY] CD-ROM/DVD-ROM support (ripping, ISO 9660, UDF, etc.) - possibly via libcdio

Major To-Do tasks with medium priority

  • [MAJOR - MEDIUM PRIORITY] WMA aduio decoder codecs for PAPlayer (port from FFmpeg?)
  • [MAJOR - MEDIUM PRIORITY] Development of a platform-independent wrapper interface to SDL / DirectX / OpenGL / graphic backend interfaces, particularly with respect to how this interface should be exported to visualisations (.vis) and screensavers (.xscr), etc.
  • [MAJOR - MEDIUM PRIORITY] Development of a platform-independent wrapper interface to SDL / DirectX / ALSA /OSS / OpenAL audio backend interfaces.
  • [MAJOR - MEDIUM PRIORITY] Network: Servers (FTP, Web, UPnP), Clients (FTP, UPnP, Time), Network settings
  • [MAJOR - MEDIUM PRIORITY] Support USB disks dynamically (meaning, inserted/removed after boot)
  • [MAJOR - MEDIUM PRIORITY] Port milkdrop and possibly other XBMC visualizations to also support OpenGL
  • [MAJOR - MEDIUM PRIORITY] Screen savers. Possibly use GNOME or other open source ones, (OpenGL).

Major To-Do tasks with low priority

Minor To-Do Tasks with high priority

  • [MINOR - HIGH PRIORITY] Fix hacks which might not work on some platforms (improve cross-platform code)

Minor To-Do Tasks with medium priority

  • [MINOR - MEDIUM PRIORITY] Lirc or alternative implementation for IR/IrDA (infrared) remote support under Linux
    • Also add Wlirc for IR/IrDA (infrared) remote support under Win32 for consistency.
    • Though probably not possible, it would be great if could be added via SDL for platform-independence.

Cleanup To-Do Tasks

  • [CLEANUP - ALWAYS AN ONGOING PROCESS] Document all of the current/existing code (DocBook, rst, or doxygen, preferably the latter)
  • [CLEANUP - ALWAYS AN ONGOING PROCESS] Valgrid debugging under Linux (and back-port any fixes to the Xbox and Win32 code)

XBMC programming and code formatting convention guidelines

Note! More specifica to come based on ongoing discussions, see Proposed code formatting conventions for XBMC

General guide-lines

  • Code documentation (DocBook, rst, or doxygen for the code documentation steps, preferably the latter, doxygen)
  • Self-containment - XBMC should be as little dependent as possible on operating-system and third-party services/deamons/libraries
    • XBMC should for example contain all file-system and network-client (like samba) support built-into the XBMC package
  • Modular design - independent modules made up by localized/isolated code libraries without dependencies
    • XBMC should still compile and run if a non-essencial module/library is disabled or removed
  • Aim for the GUI/interface to run smoothly on a low spec computer (less than 1Ghz)
    • 3D graphic controller (GPU) will always be required hardware for XBMC so try to utilize the GPU as much as possible
  • Avoid harddisk trashing (excess read/write/erase cycles), so no harddrive paging, (utilize RAM memory intead).
    • End-users will be running XBMC and the operating-system on Solid-State memory as a Live CD (LiveDistro) of a USB-key
  • Fast load and boot times for end-user perception (other thing can still run/start in the background without the user knowledge)
    • 15-seconds or less from when the end user press the power-button on the computer till he/she can browse the GUI

User-friendliness is next to godlyness

One of Team-XBMC major ongoing goal have always been to make XBMC and its user interface even more intuitive and user-friendly for its end-users, based on the KISS (Keep It Simple Stupid) philosophy. We think that usability is very important for media players like XBMC. Many user interface decisions are being made by developers who often have little experience in user interface design, in order to improve this, we try to listen to XBMC's end-users fro how XBMC is actually being used and how we can improve the user experience. We also aim to do regular overhauls, improving existing features/functions, and scrapping outdated code and features/functions (as "to much stuff" can also be a bad thing).

XBMC as a whole must...

  • Be easy to install, set up, and maintain, (so that the end-users do not get fed up with it and quit).
  • Have an user interface simple and intuitive enough so that less geek-savvy people are not intimidated by it.
  • Be able to play audio and video files that have been compressed using divx, xvid, etc. directly out-of-the-box
  • Be able to and organize audio and video files in an easy and user-friendly way.
  • Use standards and be consistant, (the music section can for example not use complly different controls from the video section)
  • Preform actions in the GUI with as few 'clicks' as possible
  • Require little to none non-GUI configuration (and all such non-GUI config should be via AdvancedSettings.xml)
    • There is still a little work to be done here, for example RSS-feeds settings need to moved to the GUI
  • Look nice.

Mentors

Mentors are developers from Team-XBMC and members of The XBMC Project that have volunteered to assist and mentor non-official XBMC developers in any non-trivial way they can, helping you by checking, commenting and committing your code patches to our SVN source code tree. These mentors have chosen an area they prefer to specialize in, usually this is an area in which they feel they have most interest, knowledge, and expertise in. Initial patches are welcome, and can and will be merged by the team. If you wish to join the team in an official capacity, please let us know.

Linux port mentors:

  • Yuvalt: Everything Linux
  • Vulkanr: Everything Linux
  • Elupus: DllLoader, Mplayer and DVDPlayer
  • Spiff: Anything other than DllLoader/MPlayer/DVDPlayer internals.
  • JMarshall: Anything GUI related, Music Library, Video Library, PAPlayer, etc.


Note! If you are a C/C++ porting guru/expert and like volunteer as a 'third-party developer mentor' then please let us know.

Contact methods

These are developers forums for XBMC development, (programmers/coders only!).
Respect, these are not for posting feature-requests or end-user support requests!