Debian Codegraph @

lib/include/libdvbv5/dvb-v5-std.h

raw
1 /*
2 * Copyright (c) 2011-2014 - Mauro Carvalho Chehab
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation version 2.1 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
17 *
18 * Per-delivery system properties defined at libdvbv5 scope, following
19 * the same model as defined at the Linux DVB media specs:
20 * http://linuxtv.org/downloads/v4l-dvb-apis/FE_GET_SET_PROPERTY.html
21 */
22 #ifndef _DVB_V5_STD_H
23 #define _DVB_V5_STD_H
24
25 #include <stddef.h>
26 #include "dvb-frontend.h"
27
28 /**
29 * @file dvb-v5-std.h
30 * @ingroup frontend
31 * @brief Provides libdvbv5 defined properties for the frontend.
32 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1)
33 * @author Mauro Carvalho Chehab
34 *
35 * @par Bug Report
36 * Please submit bug reports and patches to [email protected]
37 */
38
39 /*
40 * User DTV codes, for internal usage. There are two sets of
41 * properties. One for DTV properties and another one for statistics
42 */
43
44 /*
45 * First set: DTV properties that don't belong to Kernelspace
46 *
47 * Those properties contain data that comes from the MPEG-TS
48 * tables, like audio/video/other PIDs, and satellite config
49 */
50
51 /**
52 * @def DTV_USER_COMMAND_START
53 * @brief Start number for libdvbv5 user commands
54 * @ingroup frontend
55 * @def DTV_POLARIZATION
56 * @brief Satellite polarization (for Satellite delivery systems)
57 * @ingroup frontend
58 * @def DTV_AUDIO_PID
59 * @brief Audio PID
60 * @ingroup frontend
61 * @def DTV_VIDEO_PID
62 * @brief Video PID
63 * @ingroup frontend
64 * @def DTV_SERVICE_ID
65 * @brief MPEG TS service ID
66 * @ingroup frontend
67 * @def DTV_CH_NAME
68 * @brief Digital TV service name
69 * @ingroup frontend
70 * @def DTV_VCHANNEL
71 * @brief Digital TV channel number. May contain symbols
72 * @ingroup frontend
73 * @def DTV_SAT_NUMBER
74 * @brief Number of the satellite (used on multi-dish Satellite systems)
75 * @ingroup frontend
76 * @def DTV_DISEQC_WAIT
77 * @brief Extra time needed to wait for DiSeqC to complete, in ms.
78 * The minimal wait time is 15 ms. The time here will be
79 * added to the minimal time.
80 * @ingroup frontend
81 * @def DTV_DISEQC_LNB
82 * @brief LNBf name
83 * @ingroup frontend
84 * @def DTV_FREQ_BPF
85 * @brief SCR/Unicable band-pass filter frequency in kHz
86 * @ingroup frontend
87 * @def DTV_PLS_CODE
88 * @brief DVB-T2 PLS code. Not used internally. It is needed
89 * only for file conversion.
90 * @ingroup frontend
91 * @def DTV_PLS_MODE
92 * @brief DVB-T2 PLS mode. Not used internally. It is needed
93 * only for file conversion.
94 * @ingroup frontend
95 * @def DTV_COUNTRY_CODE
96 * @brief Country variant of international delivery system standard.
97 in ISO 3166-1 two letter code.
98 * @ingroup frontend
99 * @def DTV_MAX_USER_COMMAND
100 * @brief Last user command
101 * @ingroup frontend
102 * @def DTV_USER_NAME_SIZE
103 * @brief Number of user commands
104 * @ingroup frontend
105 */
106
107 #define DTV_USER_COMMAND_START 256
108
109 #define DTV_POLARIZATION (DTV_USER_COMMAND_START + 0)
110 #define DTV_VIDEO_PID (DTV_USER_COMMAND_START + 1)
111 #define DTV_AUDIO_PID (DTV_USER_COMMAND_START + 2)
112 #define DTV_SERVICE_ID (DTV_USER_COMMAND_START + 3)
113 #define DTV_CH_NAME (DTV_USER_COMMAND_START + 4)
114 #define DTV_VCHANNEL (DTV_USER_COMMAND_START + 5)
115 #define DTV_SAT_NUMBER (DTV_USER_COMMAND_START + 6)
116 #define DTV_DISEQC_WAIT (DTV_USER_COMMAND_START + 7)
117 #define DTV_DISEQC_LNB (DTV_USER_COMMAND_START + 8)
118 #define DTV_FREQ_BPF (DTV_USER_COMMAND_START + 9)
119 #define DTV_PLS_CODE (DTV_USER_COMMAND_START + 10)
120 #define DTV_PLS_MODE (DTV_USER_COMMAND_START + 11)
121 #define DTV_COUNTRY_CODE (DTV_USER_COMMAND_START + 12)
122
123 #define DTV_MAX_USER_COMMAND DTV_COUNTRY_CODE
124
125 #define DTV_USER_NAME_SIZE (1 + DTV_MAX_USER_COMMAND - DTV_USER_COMMAND_START)
126
127 /**
128 * @enum dvb_sat_polarization
129 * @brief Polarization types for Satellite systems
130 * @ingroup satellite
131 *
132 * @param POLARIZATION_OFF Polarization disabled/unused.
133 * @param POLARIZATION_H Horizontal polarization
134 * @param POLARIZATION_V Vertical polarization
135 * @param POLARIZATION_L Left circular polarization (C-band)
136 * @param POLARIZATION_R Right circular polarization (C-band)
137 */
138 enum dvb_sat_polarization {
139 POLARIZATION_OFF = 0,
140 POLARIZATION_H = 1,
141 POLARIZATION_V = 2,
142 POLARIZATION_L = 3,
143 POLARIZATION_R = 4,
144 };
145
146 /*
147 * Second set: DTV statistics
148 *
149 * Those properties contain statistics measurements that aren't
150 * either provided by the Kernel via property cmd/value pair,
151 * like status (with has its own ioctl), or that are derivated
152 * measures from two or more Kernel reported stats.
153 */
154
155 /**
156 * @def DTV_STAT_COMMAND_START
157 * @brief Start number for libdvbv5 statistics commands
158 * @ingroup frontend
159 * @def DTV_STATUS
160 * @brief Lock status of a DTV frontend. This actually comes from
161 * the Kernel, but it uses a separate ioctl.
162 * @ingroup frontend
163 * @def DTV_BER
164 * @brief Bit Error Rate. This is a parameter that it is
165 * derivated from two counters at the Kernel side
166 * @ingroup frontend
167 * @def DTV_PER
168 * @brief Packet Error Rate. This is a parameter that it is
169 * derivated from two counters at the Kernel side
170 * @ingroup frontend
171 * @def DTV_QUALITY
172 * @brief A quality indicator that represents if a locked
173 * channel provides a good, OK or poor signal. This is
174 * estimated considering the error rates, signal strengh
175 * and/or S/N ratio of the carrier.
176 * @ingroup frontend
177 * @def DTV_PRE_BER
178 * @brief Bit Error Rate before Viterbi. This is the error rate
179 * before applying the Forward Error Correction. This is
180 * a parameter that it is derivated from two counters
181 * at the Kernel side.
182 * @ingroup frontend
183 * @def DTV_MAX_STAT_COMMAND
184 * @brief Last statistics command
185 * @ingroup frontend
186 * @def DTV_STAT_NAME_SIZE
187 * @brief Number of statistics commands
188 * @ingroup frontend
189 * @def DTV_NUM_KERNEL_STATS
190 * @brief Number of statistics commands provided by the Kernel
191 * @ingroup frontend
192 * @def DTV_NUM_STATS_PROPS
193 * @brief Total number of statistics commands
194 * @ingroup frontend
195 */
196
197 #define DTV_STAT_COMMAND_START 512
198
199 #define DTV_STATUS (DTV_STAT_COMMAND_START + 0)
200 #define DTV_BER (DTV_STAT_COMMAND_START + 1)
201 #define DTV_PER (DTV_STAT_COMMAND_START + 2)
202 #define DTV_QUALITY (DTV_STAT_COMMAND_START + 3)
203 #define DTV_PRE_BER (DTV_STAT_COMMAND_START + 4)
204
205 #define DTV_MAX_STAT_COMMAND DTV_PRE_BER
206
207 #define DTV_STAT_NAME_SIZE (1 + DTV_MAX_STAT_COMMAND - DTV_STAT_COMMAND_START)
208
209 /* There are currently 8 stats provided on Kernelspace */
210 #define DTV_NUM_KERNEL_STATS 8
211
212 #define DTV_NUM_STATS_PROPS (DTV_NUM_KERNEL_STATS + DTV_STAT_NAME_SIZE)
213
214 /**
215 * @enum dvb_quality
216 * @brief Provides an estimation about the user's experience
217 * while watching to a given MPEG stream
218 * @ingroup frontend
219 *
220 * @param DVB_QUAL_UNKNOWN Quality could not be estimated, as the Kernel driver
221 * doesn't provide enough statistics
222 *
223 * @param DVB_QUAL_POOR The signal reception is poor. Signal loss or packets
224 * can be lost too frequently.
225 * @param DVB_QUAL_OK The signal reception is ok. Eventual artifacts could
226 * be expected, but it should work.
227 * @param DVB_QUAL_GOOD The signal is good, and not many errors are happening.
228 * The user should have a good experience watching the
229 * stream.
230 */
231 enum dvb_quality {
232 DVB_QUAL_UNKNOWN = 0,
233 DVB_QUAL_POOR,
234 DVB_QUAL_OK,
235 DVB_QUAL_GOOD,
236 };
237
238 #ifndef _DOXYGEN
239
240 /*
241 * Some tables to translate from value to string
242 *
243 * These tables are raw ways to translate from some DTV values into strings.
244 * Please use the API-provided function dvb_cmd_name() and dvb_dvb_attr_names(),
245 * instead of using the tables directly.
246 */
247
248 extern const unsigned int sys_dvbt_props[];
249 extern const unsigned int sys_dvbt2_props[];
250 extern const unsigned int sys_isdbt_props[];
251 extern const unsigned int sys_atsc_props[];
252 extern const unsigned int sys_atscmh_props[];
253 extern const unsigned int sys_dvbc_annex_ac_props[];
254 extern const unsigned int sys_dvbc_annex_b_props[];
255 extern const unsigned int sys_dvbs_props[];
256 extern const unsigned int sys_dvbs2_props[];
257 extern const unsigned int sys_turbo_props[];
258 extern const unsigned int sys_isdbs_props[];
259 extern const unsigned int *dvb_v5_delivery_system[];
260 extern const char *dvb_sat_pol_name[6];
261 extern const char *dvb_user_name[DTV_USER_NAME_SIZE + 1];
262 extern const char *dvb_stat_name[DTV_STAT_NAME_SIZE + 1];
263 extern const void *dvb_user_attr_names[];
264
265 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
266
267 #endif