GNOME Bugzilla – Bug 640118
v4l2: add element to control radio devices
Last modified: 2011-03-27 19:47:14 UTC
Created attachment 178899 [details]
Patch adding v4l2radio element code
GStreamer plugins lack an element which provides control over v4l2 radio devices as there's no separate element for it and v4l2src element couldn't be used due to several limitations of radio V4L2 devices against video V4L2 devices.
Last year I wrote separate radiotuner GStreamer plugin (http://sourceforge.net/projects/gstradiotuner/) and during discussion in the mailing-list several developers suggested me not to include the plugin separately (to -bad package, obviously) but to try to merge it with existing video4linux2 plugin range (which consists of v4l2src and v4l2sink). I worked at it and I actually managed to use most of the low-level calls from already existing code. With some additional radiodevice-specific code I wrote the new v4l2radio element to close the gap in this part of functionality.
Attached patch includes code to video4linux2 plugin and adds v4l2radio element. The element itself implements GstTuner, GstURIHandler, GstPropertyProbe and GstImplementsInterface interfaces as completely as it's possible.
In terms of GstTuner interface, v4l2radio element has single channel (according to the official V4L2 API radio devices can contain exactly one channel) and supports changing frequency, sending certain signals and receiving signal strength. List of norms is NULL as norms aren't supported for radio.
As for GstURIHandler, the element supports 'radio' protocol. I decided to implement it very similar to MPlayer example, i.e. the format is "radio://"+ <frequency in MHz>.
Also, device and frequency can be set using certain properties.
I hope the patch is useful and would enhance GStreamer's functionality.
Could someone please review the patch? Is it possible to merge it? Thanks a lot in advance
Created attachment 184326 [details] [review]
Updated version of the patch against most modern git master in git format-patch format
Created attachment 184327 [details] [review]
Alternative version of patch
Here's an alternative version with all the functions in v4l2radio_calls.* files moved to gstv4l2radio.c.
Thanks for the update, I've pushed the second patch now with tiny changes (use static debug category, remove some trailing whitespaces, move ARG_* enum to top of file):
Author: Alexey Chernov <email@example.com>
Date: Sun Mar 27 01:19:58 2011 +0300
v4l2: new v4l2radio element to control analog radio devices
Haven't tested it myself though, but at least it seems to error out fine :)
Thanks you very much, Tim!
I've tested it with the real device quite thoroughly, also have a test source code. It's depends on Qt, but maybe it will be useful for someone so I'll attach it here.
Created attachment 184383 [details]
Test source to test v4l2radio element