Tuesday, May 20, 2008

Ogg Support on Canola2

With Canola2 beta9 finally out, people have asked about the ogg support for Canola. Well, let me first try to clarify things a bit: ogg support actually has not much to do with Canola itself, but more with lightmediascanner.

In our architecture, the component responsible for scanning the media, amongst other things, is canola deamon (canolad for short). Canola daemon is Free software, released under the GPL license since its very first version. You can get the source with a simple apt-get source command.

When the user marks a folder as "scannable" on the "Media Folder" section in canola settings, it will call canola daemon to add that folder to the list of folders it will have to scan. Canolad then invokes ligthmediascanner (lms for short) which will scan for media on those folders.

LMS makes use of a very clever plugin architecture implementation, where each plugin is responsible for gathering metadata from that specific type of file it was developed for. So far there are implementations for asf, flac, id3, jpeg, m3u, mp4, ogg, pls, png and rm files. Dummy implementations for audio and video files will index files of given file extensions.

The ogg plugin was making use of libvorbis, which provides the reference implementation for the standard, but it was not being installed by Tuomas' packages. At this moment I sent him an email asking if it would be possible to have the package installed on the device. He then said it was perfectly feasible, but not advisable, as the implementation makes heavily use of floating point operations. Everybody knows how floating point operations perform on our target platform. And it doesn't really fit our purposes.

Tuomas suggested that LMS ogg plugin should make use of libvorbisidec, also known as Tremor, which was specially implemented taking into account those performance problems of floating point operations on embedded devices. It provides a fixed-point implementation for the Vorbis decoder.

At first glance, I thought it would be a really trivial task. With a few modifications in the configure.ac file, the ogg plugin would link against libvorbisidec and everything should just work! And of course I was so very wrong... I first spotted some severe bugs in the lms ogg plugin which were causing segfaults. Having those fixed was the easiest part.

The most difficult thing was to find out after some time digging that libvorbis and libvorbisidec implementations are not compatible at all. Only after that I could be able to end up with the final solution for the problem. You can now build lightmediascanner with ogg support using either the regular vorbis or tremor implementations.

With LMS now being able to scan and index ogg files, I came back to Tuomas and provided the patch that creates ogg-support-lightmediascanner meta package, which will install both ogg-support and lms ogg plugin as dependencies.

No change in the canola side was needed, since the whole work of decoding and playing ogg files was already being done by ogg-support packages provided by Tuomas. Big kudos to Tuomas and his hard work and as well to Gustavo for reviewing and pushing my patches for LMS to mainstream.

ogg-support-lightmediascanner.installInstall it now and enjoy!


Anonymous said...

You have no idea how happy this makes me. I've been waiting for something like this since the 770 first came out.

You guys couldn't have given me a better birthday gift :)

Kevin T. Neely said...

Ogg suport already worked for me in Canola beta 8. Not sure how I accomplished that, but I am guessing some install from maemo.org.

Tried to update to beta 9, but that failed due to a number of lib deendencies for python-edje. Also, this ogg support failed for want of a number of dependencies, including gstreamer. I am a bit lost, running latest OS2008

Bill Bardon said...

Thank you! I never could get ogg working in beta 8. I started from a reflashed OS2008 on n800 and installed your package followed by Canola Beta 9, and it's working smoothly now.

Serge said...

> Everybody knows how floating point operations perform on our target platform. And it doesn't really fit our purposes.

Actually floating point unit is quite fast in N8x0 (looking at the specs). Properly optimized floating point code should be much faster than fixed point version.

linuxeux said...

Canaola2 Beta 9 still can't scan and include ogg file in "My Music". I have a n810 and I run the lastest flash image. Any idea ?

Anonymous said...

I tried to get this to work with a 770 running the 2006. Canola2 starts and works fine.

I tried the '1 click link', but it did not work. So, I did it by hand, adding your repository. This does not work, because your binaries are built against a newer version of libc6 and other packages. In other words, is there only a version for os2008? Or is something broken on my 770?

Is there anyway you could build a version for the 770?

Minder said...

Something's wrong - application manager can't pull missing package - lightmediascanner0-ogg (>=0.1.9). I checked Tuomas' repo - there's no such package :\