• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2011-2012 - Mauro Carvalho Chehab
3  * Copyright (c) 2012 - Andre Roth <neolynx@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation version 2.1 of the License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18  *
19  * Based on ETSI EN 300 468 V1.11.1 (2010-04)
20  *
21  */
22 
23 /**
24  * @file desc_terrestrial_delivery.h
25  * @ingroup descriptors
26  * @brief Provides the descriptors for the DVB-T terrestrial delivery system descriptor
27  * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1)
28  * @author Mauro Carvalho Chehab
29  * @author Andre Roth
30  *
31  * @par Relevant specs
32  * The descriptor described herein is defined at:
33  * - ETSI EN 300 468 V1.11.1
34  *
35  * @par Bug Report
36  * Please submit bug reports and patches to linux-media@vger.kernel.org
37  */
38 
39 #ifndef _TERRESTRIAL_DELIVERY_H
40 #define _TERRESTRIAL_DELIVERY_H
41 
42 #include <libdvbv5/descriptors.h>
43 
44 /**
45  * @struct dvb_desc_terrestrial_delivery
46  * @ingroup descriptors
47  * @brief Structure containing the DVB-T terrestrial delivery system descriptor
48  *
49  * @param type			descriptor tag
50  * @param length		descriptor length
51  * @param next			pointer to struct dvb_desc
52  * @param centre_frequency	centre frequency, multiplied by 10 Hz
53  * @param bandwidth		bandwidth
54  * @param priority		priority (0 = LP, 1 = HP)
55  * @param time_slice_indicator	time slicing indicator
56  * @param mpe_fec_indicator	mpe fec indicator. If 1, MPE-FEC is not used.
57  * @param constellation		constellation
58  * @param hierarchy_information	hierarchy information
59  * @param code_rate_hp_stream	code rate hp stream
60  * @param code_rate_lp_stream	code rate lp stream
61  * @param guard_interval	guard interval
62  * @param transmission_mode	transmission mode
63  * @param other_frequency_flag	other frequency flag
64  */
65 struct dvb_desc_terrestrial_delivery {
66 	uint8_t type;
67 	uint8_t length;
68 	struct dvb_desc *next;
69 
70 	uint32_t centre_frequency;
71 	uint8_t reserved_future_use1:2;
72 	uint8_t mpe_fec_indicator:1;
73 	uint8_t time_slice_indicator:1;
74 	uint8_t priority:1;
75 	uint8_t bandwidth:3;
76 	uint8_t code_rate_hp_stream:3;
77 	uint8_t hierarchy_information:3;
78 	uint8_t constellation:2;
79 	uint8_t other_frequency_flag:1;
80 	uint8_t transmission_mode:2;
81 	uint8_t guard_interval:2;
82 	uint8_t code_rate_lp_stream:3;
83 	uint32_t reserved_future_use2;
84 } __attribute__((packed));
85 
86 struct dvb_v5_fe_parms;
87 
88 #ifdef __cplusplus
89 extern "C" {
90 #endif
91 
92 /**
93  * @brief Initializes and parses the DVB-T terrestrial delivery system descriptor
94  *
95  * @param parms	struct dvb_v5_fe_parms pointer to the opened device
96  * @param buf	buffer containing the descriptor's raw data
97  * @param desc	pointer to struct dvb_desc to be allocated and filled
98  *
99  * This function initializes and makes sure that all fields will follow the CPU
100  * endianness. Due to that, the content of the buffer may change.
101  *
102  * Currently, no memory is allocated internally.
103  *
104  * @return On success, it returns the size of the allocated struct.
105  *	   A negative value indicates an error.
106  */
107 int dvb_desc_terrestrial_delivery_init(struct dvb_v5_fe_parms *parms,
108 				       const uint8_t *buf,
109 				       struct dvb_desc *desc);
110 
111 /**
112  * @brief Prints the content of the DVB-T terrestrial delivery system descriptor
113  * @ingroup descriptors
114  *
115  * @param parms	struct dvb_v5_fe_parms pointer to the opened device
116  * @param desc	pointer to struct dvb_desc
117  */
118 void dvb_desc_terrestrial_delivery_print(struct dvb_v5_fe_parms *parms,
119 					 const struct dvb_desc *desc);
120 
121 /**
122  * @brief converts from internal representation into bandwidth in Hz
123  */
124 extern const unsigned dvbt_bw[];
125 
126 /**
127  * @brief converts from the descriptor's modulation into enum fe_modulation,
128  *	  as defined by DVBv5 API.
129  */
130 extern const unsigned dvbt_modulation[];
131 
132 /**
133  * @brief converts from the descriptor's hierarchy into enum fe_hierarchy,
134  *	  as defined by DVBv5 API.
135  */
136 extern const unsigned dvbt_hierarchy[];
137 
138 /**
139  * @brief converts from the descriptor's FEC into enum fe_code_rate,
140  *	  as defined by DVBv5 API.
141  */
142 extern const unsigned dvbt_code_rate[];
143 
144 /**
145  * @brief converts from internal representation into enum fe_guard_interval,
146  * as defined at DVBv5 API.
147  */
148 extern const uint32_t dvbt_interval[];
149 
150 /**
151  * @brief converts from the descriptor's transmission mode into
152  *	  enum fe_transmit_mode, as defined by DVBv5 API.
153  */
154 extern const unsigned dvbt_transmission_mode[];
155 
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 #endif
161