|
|
Subscribe / Log in / New account

Introducing the XMMS2 Media Player

May 25, 2005

This article was contributed by Anders Gustafsson and Sham Chukoury.

"Developer Release 1" of XMMS2, the next generation of the X Multimedia System (XMMS), has been released. This article describes what is new in XMMS2.

Why bother working on a next generation XMMS while there are various existing and possibly more advanced projects already in progress, some which are ready for production use? Because XMMS is just too damn popular to be allowed to die, of course! But seriously, while the field of 'audio playback' in general is something of an old beaten path, there is still much room for improvement.

Constant progress is happening in the field of digital audio playback, including: new compression/encoding schemes, better and more flexible encapsulation and container formats, more efficient encoders and decoders, better ways of managing collections of music files, new ways of letting users interact with their music and so on. XMMS2 jumps into the mix with the goal of trying to provide an improved music listening experience for users.

The XMMS2 project started in late 2002 as an idea to make a "kick-ass music player", and has eventually evolved into the next generation XMMS. The need for an XMMS replacement had been evident for years: the XMMS codebase and framework weren't exactly well-designed from the beginning. Lately, active development of XMMS has mostly stopped, this can be attributed to the lack of active developers, and a broken codebase. Adding new features to XMMS is difficult. Some of the most-wanted features would be nearly impossible to add. Some parts of XMMS are beyond patching, a re-design of the framework is needed.

Developers of another fork of XMMS, BMP, the "Beep media player", comment on XMMS:

The XMMS code we inherited is old and messy. In more specific terms, it is poorly structured, poorly documented and littered with duplications. It is difficult to modify or extend one component of XMMS without breaking another. We spent most of our time fixing problems that were introduced after seemingly innocent modifications.

The XMMS2 team is committed to producing a better music player, while diligently maintaining a robust and flexible design. The goal is to make the system easy for developers to maintain and integrate with. In terms of the listening experience, XMMS2 makes it possible for anyone to easily manage their music collection and to interact with it in a flexible manner.

A Client/Server Model

XMMS2 runs the core player and user interface(s) as separate processes. The core player acts as a server to which user interfaces can connect. The interprocess communication is carried out over a Unix socket or a tcp connection, but all of the details are hidden from the client in a high-level client library.

The library also has bindings for Python and Ruby, simplifying the creation of clients. Putting the user interface in a separate process provides the opportunity to offer some very nice features. It allows any number of clients (user interfaces) to be connected simultaneously.

When you are sitting on your sofa with your laptop, you can just ssh to your desktop where XMMS2 is playing, and use the text interface to change songs, much like using xmms-shell for XMMS, but XMMS2 is designed for this from the ground up, and all clients are first-class citizens having full access to all of the available features.

Support for multiple clients also means that you don't have to keep a client connected - you may start the player, load a nice playlist and start playing it, and disconnect your client without killing the core player. This flexibility makes XMMS2 well suited for a headless system, and allows it to be controlled from a web browser.

The client-server model allows XMMS2 to be completely desktop environment agnostic. It is possible for one user to run the core player with a client that integrates tightly with a KDE-desktop, while another user runs it a with client that just sits in his/her Gnome panel. At the moment, there are no finished and stable GUI clients, but the plan is to write a small skinnable client that isn't bound to either KDE or Gnome. This will be shipped with XMMS2 as the default GUI client. The XMMS2 team also hopes that third-party clients which are more tightly integrated with individual desktop environments will be independently developed.

If you are familiar with XMMS, you know that its plugin system allows plugins of type "General", which are used to provide functions such as controlling the player using an IR remote control (xmms-lirc), running specific commands when a new song is played (song_change) and starting playback at a specific time (xmms-alarm). In XMMS2 all of these functions can be implemented as special clients.

This increases the stability of the core player, as the core player will continue to work fine even if one of the clients crashes. This design also speeds the development of such functions up in two ways, the client doesn't need to be unloaded and loaded from the server to test each change, and the server will keep running even if the client has crashed.

More importantly, the client functions can be written in a scripting language such as Python or Ruby. Visualization works exactly the same way - a visualization client requests visualization data, and processes it to produce fancy real-time visual graphics. Currently, only frequency information is available, wave data will probably be added in next release.

The Medialib

Displaying just the filename or URL of an audio stream in the playlist isn't very attractive, metadata such as the artist's name and the song title should also be shown. This media information is generally available inside the file (or stream) itself, like the ID3 tag in an mp3 file, and must be parsed. This parsing takes some time, and if it had to be done every time a song was added to the playlist, it would take a noticeable amount of time to add an album to the playlist. To solve this problem, the media info is cached in a database, named the 'medialib'. When a song is added to the playlist, the medialib is first queried, if the song has been seen before, the media info will instantly be available and the operation of adding songs to the playlist will be much faster.

This also has a very nice side effect: all of the mediainfo from the songs seen by XMMS2 will be stored in a database. This makes it possible to perform queries to find songs that have certain properties. For example, finding all songs by a certain artist or of a particular genre. This is so useful that a command was added to import music metadata straight into the medialib. The medialib is implemented as a standard SQL database using SQLite.

The medialib can be queried using SQL, and the possibilities are only limited by one's imagination. Examples are: "list all unique artists", "all artists with more than one hour total playtime", "10 random songs from artists beginning with 'a'", "100 random songs which are longer than 2 minutes and have the genre 'electronic'", and "select one song from each year between 1980 and 2003".

If logging is enabled, which it is by default, an entry is written to a log-table in the database every time a song is played. By using this table, even more complex queries can be made: "10 random songs that weren't played last week", "20 hangover-songs (that have been played Saturdays 10:00-14:00)". The power of querying the medialib would be apparent when XMMS2 is coupled with a client that abstracts away the SQL queries in a simple, but effective manner. No such client exists today, but the potential is great.

Transport Plugins

One of the problems with XMMS is that each input plugin is responsible for reading data from files or streams. This means that every input plugin wanting to be able to load a file over HTTP must implement its own HTTP code.

In XMMS2 the "input" plugins are split into "transport" and "decoder". Thus, if an HTTP transport plugin is installed, all supported file types can be loaded over HTTP.

Summary

While it is far from being able to replace XMMS as the de-facto standard music player on linux desktops, "Developer Release 1" of XMMS2 shows that the potential is there. Hopefully, the development of interfaces will be accelerated now that a public release has been made. All developers are encouraged to take a look at it, and take a plunge into the code to help make it the music player.

For more information have a look at the XMMS2 Wiki and join #xmms2 on freenode.

Index entries for this article
GuestArticlesWaldenborg, Anders


to post comments

Introducing the XMMS2 Media Player

Posted May 26, 2005 7:56 UTC (Thu) by hensema (guest, #980) [Link] (3 responses)

If you want all features mentionned in the article, but NOW, then install amarok. It is very, very nice.

Introducing the XMMS2 Media Player

Posted May 26, 2005 23:21 UTC (Thu) by bk (guest, #25617) [Link]

amaroK *is* very nice. I don't know whether it has all the planned features of XMMS2 currently, but it's by far the best audio player for the Linux desktop.

Introducing the XMMS2 Media Player

Posted May 27, 2005 16:17 UTC (Fri) by Felix.Braun (guest, #3032) [Link] (1 responses)

This is not true. Unlike XMMS2 amaroK is not platform agnostic. On the contrary, at the first glance it seems to be very tightly integrated into the KDE environment (integration into K3B and DCOP access are some of the key features mentioned on amaroK's web site). I really like the separation between music server and GUI frontend in XMMS2's design.

I have to admit that my quick glance over amaroK's features may not have discovered all it's advantages. And I'm certain that it is a very capable piece of software. But considering the combined footprint of QT and KDElibs using amaroK is not at option for me at the moment.

Introducing the XMMS2 Media Player

Posted May 28, 2005 1:02 UTC (Sat) by tru (guest, #30161) [Link]

That's right. Core XMMS2 depends on GLib and SQLite, but then you probably want to play some music, so add vorbis and mad libs to it. That's all you need. We have really made an effort to keep the dependencys down. XMMS2 should be as big component in a headless installation as on the desktop.

Introducing the XMMS2 Media Player

Posted May 26, 2005 18:40 UTC (Thu) by mp (subscriber, #5615) [Link] (1 responses)

One very specific question. Is the architecture flexible enough to easily support integrating IMMS or equivalent automatic scoring system?

Introducing the XMMS2 Media Player

Posted May 26, 2005 21:45 UTC (Thu) by tru (guest, #30161) [Link]

The medialib in XMMS2 already has automatic scoring:

sqlite> select artist,song,playsum from topsongs order by playsum desc limit 10;
Iris|Danger is the Shame|146
Iris|Lose in Wanting|99
Iris|Saving Time|99
Iris|Endless|99

Introducing the XMMS2 Media Player

Posted May 26, 2005 19:17 UTC (Thu) by bronson (subscriber, #4806) [Link] (3 responses)

XMMS2 has been factored into download components, decode components, play components... Sounds a bit like an audio-only gstreamer doesn't it? Why not use it? It is a really nice lib even though Rhythmbox and Muine both stink.

> rhythmbox stinks

Posted May 26, 2005 21:50 UTC (Thu) by brettlevin (guest, #29117) [Link]

I've heard this from a few people. Care to elaborate?

My experience: the version that comes with Ubuntu 5.04 crashes trying to import the dir where my iTunes collection lives. Otherwise it seems like a reasonable basic iTunes clone.

Introducing the XMMS2 Media Player

Posted May 26, 2005 21:50 UTC (Thu) by tru (guest, #30161) [Link] (1 responses)

We considered gstreamer as our playing framework, but it was rejected for several reasons.

The biggest reason was proabably our diffrent design goals. We wanted a small, agile *MUSIC* player while gstreamer aims to be general *MULTIMEDIA* playing framework.

Introducing the XMMS2 Media Player

Posted May 27, 2005 0:58 UTC (Fri) by njhurst (guest, #6022) [Link]

Can you expand on what this means? To me it seems that greater results would come from you spending your time making a really good client for gstreamer, and solving those few problems that make gstreamer currently unsuitable. Otherwise I suspect history will pass you by and stay with gstreamer. I feel personally that the moment I have a good general purpose player like totem, with the music selection options of xmms, it will be game over for any other client.

Introducing the XMMS2 Media Player

Posted May 29, 2005 12:15 UTC (Sun) by shapr (subscriber, #9077) [Link] (1 responses)

Doesn't mpd already do all of this?
Anyway, mpd was designed for a dedicated music box and is the only music player I've found that does not skip when my system is fully loaded.
  • runs on a p75
  • communicates via tcp/ip
  • tcp/ip means many front-ends: php, shell, gnome, Qt, GNUstep, windowmaker, curses, etc
  • handles flac, ogg, mp3
  • keeps all the metadata in a database
  • has audioscrobbler support
See the mpd features page for the full list.
So, why should I use xmms2 instead? What have I not noticed?

Introducing the XMMS2 Media Player

Posted May 29, 2005 12:36 UTC (Sun) by daniel_svensson (guest, #28746) [Link]

http://wiki.xmms2.xmms.se/index.php/XMMS2_vs_MPD


Copyright © 2005, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds