Rewrite to use video4linux2 API.
[fmtools.git] / fmlib.h
blob068feec3a798fde60fd004cc72b8e7ebe107abf1
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 double tuner_get_volume(const struct tuner *);
45 void tuner_set_volume(struct tuner *, double volume);
47 long long int tuner_get_min_freq(const struct tuner *);
48 long long int tuner_get_max_freq(const struct tuner *);
49 void tuner_set_freq(const struct tuner *, long long int frequency,
50 bool override_range);
52 int tuner_get_signal(const struct tuner *);
53 void tuner_sleep(const struct tuner *, int secs);
54 void tuner_usleep(const struct tuner *, int usecs);
56 #endif /* fmlib.h */