Better support radios that do not have volume control.
[fmtools.git] / fmlib.h
blob9a6547462a677b76b8b5892857e3bb34a0a1cec4
1 /* fmlib.c - simple V4L2 compatible tuner for radio cards
3 Copyright (C) 2009 Ben Pfaff <blp@cs.stanford.edu>
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2 of the License, or (at your option)
8 any later version.
10 This program is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
15 You should have received a copy of the GNU General Public License along with
16 this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef FMLIB_H
20 #define FMLIB_H 1
22 #include <linux/videodev2.h>
23 #include <stdint.h>
24 #include <stdbool.h>
26 struct tuner {
27 int fd;
28 int index;
29 struct v4l2_queryctrl volume_ctrl;
30 struct v4l2_tuner tuner;
31 struct tuner_test *test;
34 extern char *program_name;
36 void fatal(int error, const char *msg, ...)
37 __attribute__((noreturn, format(printf, 2, 3)));
39 void tuner_open(struct tuner *, const char *device, int index);
40 void tuner_close(struct tuner *);
42 void tuner_set_mute(struct tuner *, bool mute);
44 bool tuner_has_volume_control(const struct tuner *);
45 double tuner_get_volume(const struct tuner *);
46 void tuner_set_volume(struct tuner *, double volume);
48 long long int tuner_get_min_freq(const struct tuner *);
49 long long int tuner_get_max_freq(const struct tuner *);
50 void tuner_set_freq(const struct tuner *, long long int frequency,
51 bool override_range);
53 int tuner_get_signal(const struct tuner *);
54 void tuner_sleep(const struct tuner *, int secs);
55 void tuner_usleep(const struct tuner *, int usecs);
57 #endif /* fmlib.h */