1 /* 2 * Copyright (c) 2013-2014 - Mauro Carvalho Chehab <mchehab@kernel.org> 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 * Described on ARIB STD-B10 as Terrestrial delivery system descriptor 19 */ 20 21 /** 22 * @file desc_isdbt_delivery.h 23 * @ingroup descriptors 24 * @brief Provides the descriptors for the ISDB-T terrestrial delivery system 25 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 26 * @author Mauro Carvalho Chehab 27 * 28 * @par Relevant specs 29 * The descriptor described herein is defined at: 30 * - ARIB STD-B10 31 * 32 * @par Bug Report 33 * Please submit bug reports and patches to linux-media@vger.kernel.org 34 */ 35 36 #ifndef _ISDBT_DELIVERY_H 37 #define _ISDBT_DELIVERY_H 38 39 #include <libdvbv5/descriptors.h> 40 41 /** 42 * @struct isdbt_desc_terrestrial_delivery_system 43 * @ingroup descriptors 44 * @brief Struct containing the ISDB-T terrestrial delivery system 45 * 46 * @param type descriptor tag 47 * @param length descriptor length 48 * @param next pointer to struct dvb_desc 49 * @param area_code area code. The area code definition varies from 50 * Country to Country. 51 * @param guard_interval guard interval 52 * @param transmission_mode transmission mode 53 * @param frequency vector with center frequencies 54 * @param num_freqs number of frequencies at the 55 * isdbt_desc_terrestrial_delivery_system::frequency vector 56 */ 57 struct isdbt_desc_terrestrial_delivery_system { 58 uint8_t type; 59 uint8_t length; 60 struct dvb_desc *next; 61 62 uint32_t *frequency; 63 unsigned num_freqs; 64 65 union { 66 uint16_t bitfield; 67 struct { 68 uint16_t transmission_mode:2; 69 uint16_t guard_interval:2; 70 uint16_t area_code:12; 71 } __attribute__((packed)); 72 } __attribute__((packed)); 73 } __attribute__((packed)); 74 75 struct dvb_v5_fe_parms; 76 77 #ifdef __cplusplus 78 extern "C" { 79 #endif 80 81 /** 82 * @brief Initializes and parses the ISDB-T terrestrial delivery system 83 * descriptor 84 * @ingroup descriptors 85 * 86 * @param parms struct dvb_v5_fe_parms pointer to the opened device 87 * @param buf buffer containing the descriptor's raw data 88 * @param desc pointer to struct dvb_desc to be allocated and filled 89 * 90 * This function allocates a the descriptor and fills the fields inside 91 * the struct. It also makes sure that all fields will follow the CPU 92 * endianness. Due to that, the content of the buffer may change. 93 * 94 * @return On success, it returns the size of the allocated struct. 95 * A negative value indicates an error. 96 */ 97 int isdbt_desc_delivery_init(struct dvb_v5_fe_parms *parms, 98 const uint8_t *buf, struct dvb_desc *desc); 99 100 /** 101 * @brief Prints the content of the ISDB-T terrestrial delivery system 102 * descriptor 103 * @ingroup descriptors 104 * 105 * @param parms struct dvb_v5_fe_parms pointer to the opened device 106 * @param desc pointer to struct dvb_desc 107 */ 108 void isdbt_desc_delivery_print(struct dvb_v5_fe_parms *parms, 109 const struct dvb_desc *desc); 110 111 /** 112 * @brief Frees all data allocated by the ISDB-T terrestrial delivery system 113 * descriptor 114 * @ingroup descriptors 115 * 116 * @param desc pointer to struct dvb_desc to be freed 117 */ 118 void isdbt_desc_delivery_free(struct dvb_desc *desc); 119 120 /** 121 * Converts an ISDB-T Interval code into a string 122 */ 123 extern const uint32_t isdbt_interval[]; 124 125 /** 126 * Converts an ISDB-T mode into a string 127 */ 128 extern const uint32_t isdbt_mode[]; 129 130 #ifdef __cplusplus 131 } 132 #endif 133 134 #endif 135