• 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 #include <libdvbv5/desc_terrestrial_delivery.h>
24 #include <libdvbv5/dvb-fe.h>
25 
26 #if __GNUC__ >= 9
27 #pragma GCC diagnostic ignored "-Waddress-of-packed-member"
28 #endif
29 
dvb_desc_terrestrial_delivery_init(struct dvb_v5_fe_parms * parms,const uint8_t * buf,struct dvb_desc * desc)30 int dvb_desc_terrestrial_delivery_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, struct dvb_desc *desc)
31 {
32 	struct dvb_desc_terrestrial_delivery *tdel = (struct dvb_desc_terrestrial_delivery *) desc;
33 	/* copy from .length */
34 	memcpy(((uint8_t *) tdel ) + sizeof(tdel->type) + sizeof(tdel->next) + sizeof(tdel->length),
35 			buf,
36 			tdel->length);
37 	bswap32(tdel->centre_frequency);
38 	bswap32(tdel->reserved_future_use2);
39 	return 0;
40 }
41 
dvb_desc_terrestrial_delivery_print(struct dvb_v5_fe_parms * parms,const struct dvb_desc * desc)42 void dvb_desc_terrestrial_delivery_print(struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc)
43 {
44 	const struct dvb_desc_terrestrial_delivery *tdel = (const struct dvb_desc_terrestrial_delivery *) desc;
45 	dvb_loginfo("|           length                %d", tdel->length);
46 	dvb_loginfo("|           centre frequency      %d", tdel->centre_frequency * 10);
47 	dvb_loginfo("|           mpe_fec_indicator     %d", tdel->mpe_fec_indicator);
48 	dvb_loginfo("|           time_slice_indicator  %d", tdel->time_slice_indicator);
49 	dvb_loginfo("|           priority              %d", tdel->priority);
50 	dvb_loginfo("|           bandwidth             %d", tdel->bandwidth);
51 	dvb_loginfo("|           code_rate_hp_stream   %d", tdel->code_rate_hp_stream);
52 	dvb_loginfo("|           hierarchy_information %d", tdel->hierarchy_information);
53 	dvb_loginfo("|           constellation         %d", tdel->constellation);
54 	dvb_loginfo("|           other_frequency_flag  %d", tdel->other_frequency_flag);
55 	dvb_loginfo("|           transmission_mode     %d", tdel->transmission_mode);
56 	dvb_loginfo("|           guard_interval        %d", tdel->guard_interval);
57 	dvb_loginfo("|           code_rate_lp_stream   %d", tdel->code_rate_lp_stream);
58 }
59 
60 const unsigned dvbt_bw[] = {
61 	[0] = 8000000,
62 	[1] = 7000000,
63 	[2] = 6000000,
64 	[3] = 5000000,
65 	[4 ...7] = 0,		/* Reserved */
66 };
67 const unsigned dvbt_modulation[] = {
68 	[0] = QPSK,
69 	[1] = QAM_16,
70 	[2] = QAM_64,
71 	[3] = QAM_AUTO	/* Reserved */
72 };
73 const unsigned dvbt_hierarchy[] = {
74 	[0] = HIERARCHY_NONE,
75 	[1] = HIERARCHY_1,
76 	[2] = HIERARCHY_2,
77 	[3] = HIERARCHY_4,
78 };
79 const unsigned dvbt_code_rate[] = {
80 	[0] = FEC_1_2,
81 	[1] = FEC_2_3,
82 	[2] = FEC_3_4,
83 	[3] = FEC_5_6,
84 	[4] = FEC_7_8,
85 	[5 ...7] = FEC_AUTO,	/* Reserved */
86 };
87 const uint32_t dvbt_interval[] = {
88 	[0] = GUARD_INTERVAL_1_32,
89 	[1] = GUARD_INTERVAL_1_16,
90 	[2] = GUARD_INTERVAL_1_8,
91 	[3] = GUARD_INTERVAL_1_4,
92 };
93 const unsigned dvbt_transmission_mode[] = {
94 	[0] = TRANSMISSION_MODE_2K,
95 	[1] = TRANSMISSION_MODE_8K,
96 	[2] = TRANSMISSION_MODE_4K,
97 	[3] = TRANSMISSION_MODE_AUTO,	/* Reserved */
98 };
99