FM Radio in Rhythmbox – The Code
Previously, I posted about the FM radio plugin I was working on. I just posted the code to bug 168735. A few notes about the implementation:
- The code only supports Video4Linux 2 radio tuners (since that’s the interface my device supports, and the V4L1 compatibility layer doesn’t work for it). It should be possible to port it support both protocols if someone is interested.
- It does not pass the audio through the GStreamer pipeline. Instead, you need to configure your mixer settings to pass the audio through (e.g. unmute the Line-in source and set the volume appropriately). It plugs in a GStreamer source that generates silence to work with the rest of the Rhythmbox infrastructure. This does mean that the volume control and visualisations won’t work
- No properties dialog yet. If you want to set titles on the stations,
you’ll need to edit
rhythmdb.xml
directly at the moment. - The code assumes that the radio device is
/dev/radio0
.
Other than that, it all works quite well (I've been using it for the last few weeks).
Development
I developed this plugin in Bazaar using Jelmer's bzr-svn plugin. It produces a repeatable import, so I should be able to cross merge with anyone else producing branches with it.
It is also possible to use bzr-svn to merge Bazaar branches back into the original Subversion repository through the use of a lightweight checkout.
For anyone wanting to play with my Bazaar branch, it is published in Launchpad and can be grabbed with the following command:
bzr branch lp:~jamesh/rhythmbox/fmradio rhythmbox
Comments:
dave -
Does this (and the other projects based on v4l) give you access to the radio stations broadcast alongside television channels via DVB-T or DVB-S (Freeview and Freesat in the UK)?
bronxoni -
Please *DO NOT* develop the V4L1 support. The reason is simple: V4L1 is deprecated and getting seriously outdated. The problem is that some people are still developing new drivers using V4L1, which is harder and worse to work with. They will never stop that idiocy before V4L1 support starts seriously get dropped from all the applications.
James Henstridge -
dave: I have no idea. I don't have a DVB-T tuner card in my desktop (the DSB-R100 only does FM radio).
bronxoni: I have no immediate plans to implement V4L1 support -- I am merely pointing out that it wouldn't be too difficult to support both APIs transparently. I wrote my plugin to the V4L2 API because that's the interface my hardware supports on Ubuntu Feisty.