2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 2 of the License, or
5
* (at your option) any later version.
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU Library General Public License for more details.
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software
14
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
#include <sys/ioctl.h>
33
* These functions handle the radio device
36
int radio_init(char *device, DriverType driver)
53
dev = v4l1_radio_dev_new();
54
rv = dev->init (dev, device);
56
fprintf(stderr, "Initializing v4l1 failed\n");
59
if (driver != DRIVER_ANY)
66
dev = v4l2_radio_dev_new();
67
rv = dev->init (dev, device);
69
fprintf(stderr, "Initializing v4l2 failed\n");
72
if (driver != DRIVER_ANY)
85
int radio_is_init(void)
87
if (dev) return dev->is_init (dev);
95
if (dev) dev->finalize (dev);
98
void radio_set_freq(float frequency)
100
if (dev) dev->set_freq (dev, frequency);
103
void radio_unmute(void)
105
if (dev) dev->mute (dev, 0);
108
void radio_mute(void)
110
if (dev) dev->mute (dev, 1);
113
int radio_get_stereo(void)
115
if (dev) return dev->get_stereo (dev);
119
int radio_get_signal(void)
121
if (dev) return dev->get_signal (dev);
125
int radio_check_station(float freq)
131
signal = radio_get_signal();
136
if ((a + b + signal > 8) && (fabsf(freq - last) > 0.25f)) {