GNOME Bugzilla – Bug 168735
Make v4l radio use normal (gstreamer) backend
Last modified: 2018-05-24 10:42:18 UTC
I hope there will be support for video4linux radio in gstreamer http://bugzilla.gnome.org/show_bug.cgi?id=168728 So it would be nice to make rhythmbox support radio. Some design moments are not clear for me: 1. Should I create a new source like iradio? 2. Should I add new uri like v4lradio:// ? 3. Any other ideas on this feature?
Created attachment 38209 [details] tar.gz with patch and additional sources First version :)
Hi, I haven't really had time to look at your patch, and without v4l hardware, I'll probably have a hard time testing it :(... Does it play anything yet, or is it just for testing? It seems you have to manually specify a frequency to add a v4l radio, any idea if it would be possible to autodetect radio frequencies, and even better, get their name from RDS ? (just a question, don't go like crazy coding that ;) The v4l-iradio source seems like a lot of code, does it have lot of common with the standard iradio source, or is there really few code that can be shared?
It works perfectly for me, really, it's ready for usage. Moreover, it's disabled by default, so there should not be any problem. There is nothing strange that there is much common code - the iradio code was a good template. But in the future they can grow in different directions. For example, v4lradio station has attributes like stereo/mono, signal level and so on. The autodetect is also needed. Probably they genre column is not so needed for v4lradio. So, the sources are really completely different. About autodetect. It possible to implement such feature. Hardware and v4l interface has ways to detect signal strength. The implementation of such things in gstreamer and rhythmbox is also possible, but there should be a code to start with :) Also, it's possible to get station list somewhere and use it.
Created attachment 47676 [details] Tar.gz with patch and new files. This is updated patch, it applies cleanly to CVS. There was suggestion to use HAL to detect radio devices, but it've meet a number of problems. First of all, v4l support was in hal 0.4 and magically disappear in 0.5, I've created a bug about it https://bugs.freedesktop.org/show_bug.cgi?id=3527 But even with 0.4 it's impossible to use hal, since it detects only video devices, not radio. So I've choosen to check radio presence with another way - I just check for /sys/class/video4linux/radio0 presense. It should work perfectly on recent kernel systems.
*** Bug 300070 has been marked as a duplicate of this bug. ***
It seems relatively sane, although it does really point out some core changes we should make, in particualr the player mode stuff is something a lot of people are hitting. This looking at /radio0 seems a bit unclean; I guess it's going to be unusual for a machine to have more than one radio, but besides that I'm also a bit worried about depending on sysfs layout and such (what if they change it to start with 1 or have a different prefix?). Really as Christophe said we need to get the support in HAL again. You need to fix the copyright; add your name to e.g. iradio/rb-new-v4lstation.[ch] since you made changes. Although, is it really necessary? Let's remove the Genre thing if it's not being used. Can you post some screenshots of how the UI works? I know nothing about v4l. Can you explain what this patch is for? --- rhythmbox/rhythmdb/rhythmdb.c 2005-06-11 19:12:26.000000000 +0400 +++ rhythmbox.new/rhythmdb/rhythmdb.c 2005-06-12 23:25:05.000000000 +0400 @@ -1491,9 +1491,14 @@ rhythmdb_execute_stat (RhythmDB *db, con { GnomeVFSResult vfsresult = GNOME_VFS_OK; char *unescaped; - + vfsresult = GNOME_VFS_ERROR_GENERIC; - event->real_uri = rb_uri_resolve_symlink (uri); + + if (!rb_uri_is_v4lradio (uri)) + event->real_uri = rb_uri_resolve_symlink (uri); + else + event->real_uri = g_strdup ("/dev/radio0"); + if (!event->real_uri) goto error; event->vfsinfo = gnome_vfs_file_info_new (); I think this might not be necessary anymore; can you try removing it with the latest CVS? I would like to get some core changes in to support custom pipelines for different sources (this will replace your patches to player.c); after we do that and address the above issues I think this work is good to go in.
Nickolay, any chance to update your patch against the current CVS? Does HAL recognise v4l radios now?
As I understood, hal question is still open. I'll try to look closer and update the patch soon.
Switch component to "Internet Radio"
Why "Internet Radio"? It's radio without internet.
Created attachment 59703 [details] Updated patch This patch is not functional since gstreamer support is broken and rhythmbox uses gstreamer in rather restrictive way. I am attaching it just to keep the work
Rather than doing a copy-and-paste of rb-iradio-source.c, it would probably be better to derive from it. You can change the "entry_type" property, and override impl_show_popup and impl_get_ui_actions - however we need to make the entry-view popup configurable. From the gstreamer side, all we really need is a v4lradiosrc element that accepts v4lradio:// URIs. Do you know what element we are supposed to use with 0.10? possible the base v4lsrc element?
Created attachment 88534 [details] [review] rhythmbox-fmradio.patch Attached is a patch that adds the fmradio plugin I've been working on. This is new work, rather than building on top of Nickolay's patches. The plugin is not passing the audio through the GStreamer pipeline. Instead it hooks up a source that outputs silence. You'll need to adjust your mixer settings to pass through the audio with the right volume. It uses the V4L2 tuner interface, so should work with current kernels (I've tested with my DSB-R100 using 2.6.20). It'd need more work to support the V4L1 interface found in older kernels (should be possible to pick the right interface at runtime).
Be aware that there is a v4l2src plugin in GStreamer CVS (--good)
Good progress, thanks :) The biggest reason for gstreamer is that many common tv-tuner cards doesn't stream audio through cable to line-in, they use DMA through PCI. Card is visible as another alsa device and there should be an application to stream sound from one alsa device to another. So user have to run sox anyhow. About v4l2src it would be nice to build pipeline with it automatically since rhythmbox uses uris :(
Christian: the existing Video4Linux2 GStreamer plugin is not usable with my card. In general, V4L2 radio devices do not provide any audio or video through the device -- just a tuner input and one or more controls (mute on most, volume on some). Often they don't support enough ioctls to properly introspect all these features either ... The v4l2src element just segfaults if I try to instantiate it with the radio device (e.g. "gst-launch-0.10 v4l2src device=/dev/radio0"). Nickolay: we could probably change my patch to hook up an alsasrc for the appropriate sound card rather than feeding silence to GStreamer. This'd handle your use case, and should work for cases like my DSB-R100 too. We'd need a proper config dialog for it though ... It'd also allow the volume control and visualisations in Rhythmbox to work with radio too, which would be good.
That would be nice. About v4lsrc it's certainly not usable for radio. In gstreamer there was v4lradio container so you was able to use v4lradio frequency=8700 (gconfaudiosrc) ! gconfaudiosink but unfortunately it wasn't ported during gstreamer update :(
Is there any further action that needs to be taken before my patch is considered? Does the approach taken by my branch seem acceptable? If not, are there any suggestions for changes/improvements?
Sorry, I somehow got the impression this was still a work in progress last time I looked at it. I haven't had a terribly close look, but it looks OK to me.
Sorry for taking so long to commit this, I'd missed it amongst the bugmail. I've committed the patch to svn with the addition of the appropriate keys to the gconf schema. I'm leaving the bug open, but re-titled, in the hope that we can adapt it to sue the normal playback mechanisms in the future.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/rhythmbox/issues/56.