]> git.sesse.net Git - vlc/blob - modules/access/dtv/dtv.h
DTV: do not assume __linux__ == HAVE_LINUX_DVB
[vlc] / modules / access / dtv / dtv.h
1 /**
2  * @file dtv.h
3  * @brief Digital TV module common header
4  */
5 /*****************************************************************************
6  * Copyright © 2011 Rémi Denis-Courmont
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21  *****************************************************************************/
22
23 #ifndef VLC_DTV_H
24 # define VLC_DTV_H 1
25 # ifdef __cplusplus
26 extern "C" {
27 # endif
28
29 enum {
30     ATSC   = 0x00000001,
31     CQAM   = 0x00000002,
32
33     DVB_C  = 0x00000010,
34     DVB_C2 = 0x00000020,
35     DVB_S  = 0x00000040,
36     DVB_S2 = 0x00000080,
37     DVB_T  = 0x00000100,
38     DVB_T2 = 0x00000200,
39
40     ISDB_C = 0x00001000,
41     ISDB_S = 0x00002000,
42     ISDB_T = 0x00004000,
43 };
44
45 typedef struct dvb_device dvb_device_t;
46
47 dvb_device_t *dvb_open (vlc_object_t *obj);
48 void dvb_close (dvb_device_t *);
49 ssize_t dvb_read (dvb_device_t *, void *, size_t);
50
51 int dvb_add_pid (dvb_device_t *, uint16_t);
52 void dvb_remove_pid (dvb_device_t *, uint16_t);
53
54 unsigned dvb_enum_systems (dvb_device_t *);
55 float dvb_get_signal_strength (dvb_device_t *);
56 float dvb_get_snr (dvb_device_t *);
57
58 #ifdef HAVE_DVBPSI
59 struct dvbpsi_pmt_s;
60 void dvb_set_ca_pmt (dvb_device_t *, struct dvbpsi_pmt_s *);
61 #endif
62
63 int dvb_set_inversion (dvb_device_t *, int);
64 int dvb_tune (dvb_device_t *);
65
66 #define VLC_FEC(a,b)   (((a) << 16u) | (b))
67 #define VLC_FEC_AUTO   0xFFFFFFFF
68 #define VLC_GUARD(a,b) (((a) << 16u) | (b))
69 #define VLC_GUARD_AUTO 0xFFFFFFFF
70
71 /* DVB-C */
72 int dvb_set_dvbc (dvb_device_t *, uint32_t freq, const char *mod,
73                   uint32_t srate, uint32_t fec);
74
75 /* DVB-S */
76 int dvb_set_dvbs (dvb_device_t *, uint64_t freq, uint32_t srate, uint32_t fec);
77 int dvb_set_dvbs2 (dvb_device_t *, uint64_t freq, const char *mod,
78                    uint32_t srate, uint32_t fec, int pilot, int rolloff);
79 int dvb_set_sec (dvb_device_t *, uint64_t freq, char pol,
80                  uint32_t lowf, uint32_t highf, uint32_t switchf);
81
82 /* DVB-T */
83 int dvb_set_dvbt (dvb_device_t *, uint32_t freq, const char *mod,
84                   uint32_t fec_hp, uint32_t fec_lp, uint32_t bandwidth,
85                   int transmission, uint32_t guard, int hierarchy);
86 int dvb_set_dvbt2 (dvb_device_t *, uint32_t freq, const char *mod,
87                    uint32_t fec, uint32_t bandwidth,
88                    int transmission, uint32_t guard, uint32_t plp);
89
90 /* ATSC */
91 int dvb_set_atsc (dvb_device_t *, uint32_t freq, const char *mod);
92 int dvb_set_cqam (dvb_device_t *, uint32_t freq, const char *mod);
93
94 /* ISDB-C */
95 int dvb_set_isdbc (dvb_device_t *, uint32_t freq, const char *mod,
96                    uint32_t srate, uint32_t fec);
97
98 /* ISDB-S */
99 /* TODO: modulation? */
100 int dvb_set_isdbs (dvb_device_t *, uint64_t freq, uint16_t ts_id);
101
102 /* ISDB-T */
103 typedef struct isdbt_layer
104 {
105     const char *modulation;
106     uint32_t code_rate;
107     uint8_t segment_count;
108     uint8_t time_interleaving;
109 } isdbt_layer_t;
110
111 int dvb_set_isdbt (dvb_device_t *, uint32_t freq, uint32_t bandwith,
112                    int transmission, uint32_t guard, const isdbt_layer_t[3]);
113
114 typedef struct isdbt_sound
115 {
116     uint8_t subchannel_id;
117     uint8_t segment_index;
118     uint8_t segment_count;
119 } isdbt_sound_t;
120
121 # ifdef __cplusplus
122 }
123 # endif
124 #endif