Make fm report when the radio is muted and tell the user how to unmute it.
[fmtools.git] / fmlib.h
blobb0c7de60a1d25d71b51491cba4c62e1b81eea928
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 bool tuner_is_muted(const struct tuner *);
43 void tuner_set_mute(struct tuner *, bool mute);
45 bool tuner_has_volume_control(const struct tuner *);
46 double tuner_get_volume(const struct tuner *);
47 void tuner_set_volume(struct tuner *, double volume);
49 long long int tuner_get_min_freq(const struct tuner *);
50 long long int tuner_get_max_freq(const struct tuner *);
51 void tuner_set_freq(const struct tuner *, long long int frequency,
52 bool override_range);
54 int tuner_get_signal(const struct tuner *);
55 void tuner_sleep(const struct tuner *, int secs);
56 void tuner_usleep(const struct tuner *, int usecs);
58 #endif /* fmlib.h */