1 /* 2 * Copyright (c) 2020 - 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 */ 19 20 #ifndef _DESC_REGISTRATION_ID_H 21 #define _DESC_REGISTRATION_ID_H 22 23 #include <libdvbv5/descriptors.h> 24 /** 25 * @file desc_registration_id.h 26 * @ingroup descriptors 27 * @brief Provides the descriptors for the registration descriptor. 28 * This descriptor provides the format information for an 29 * Elementary Stream. 30 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 31 * @author Mauro Carvalho Chehab 32 * 33 * @par Relevant specs 34 * The descriptor described herein is defined at: 35 * - ISO/IEC 13818-1 36 * 37 * @par Bug Report 38 * Please submit bug reports and patches to linux-media@vger.kernel.org 39 */ 40 41 /** 42 * @struct dvb_desc_registration 43 * @ingroup descriptors 44 * @brief Struct containing the frequency list descriptor 45 * 46 * @param type descriptor tag 47 * @param length descriptor length 48 * @param format_identifier 32-bit value obtained from ISO/IEC JTC 1/SC 29 49 * which describes the format of the ES 50 * The length of the vector is given by: 51 * length - 4. 52 */ 53 struct dvb_desc_registration { 54 uint8_t type; 55 uint8_t length; 56 struct dvb_desc *next; 57 58 uint8_t format_identifier[4]; 59 uint8_t *additional_identification_info; 60 } __attribute__((packed)); 61 62 struct dvb_v5_fe_parms; 63 64 #ifdef __cplusplus 65 extern "C" { 66 #endif 67 68 /** 69 * @brief Initializes and parses the registration descriptor 70 * @ingroup descriptors 71 * 72 * @param parms struct dvb_v5_fe_parms pointer to the opened device 73 * @param buf buffer containing the descriptor's raw data 74 * @param desc pointer to struct dvb_desc to be allocated and filled 75 * 76 * This function initializes and makes sure that all fields will follow the CPU 77 * endianness. Due to that, the content of the buffer may change. 78 * 79 * Currently, no memory is allocated internally. 80 * 81 * @return On success, it returns the size of the allocated struct. 82 * A negative value indicates an error. 83 */ 84 int dvb_desc_registration_init(struct dvb_v5_fe_parms *parms, 85 const uint8_t *buf, struct dvb_desc *desc); 86 87 /** 88 * @brief Prints the content of the registration descriptor 89 * @ingroup descriptors 90 * 91 * @param parms struct dvb_v5_fe_parms pointer to the opened device 92 * @param desc pointer to struct dvb_desc 93 */ 94 void dvb_desc_registration_print(struct dvb_v5_fe_parms *parms, 95 const struct dvb_desc *desc); 96 97 /** 98 * @brief Frees all data allocated by the registration descriptor 99 * @ingroup descriptors 100 * 101 * @param desc pointer to struct dvb_desc to be freed 102 */ 103 void dvb_desc_registration_free(struct dvb_desc *desc); 104 105 #ifdef __cplusplus 106 } 107 #endif 108 109 #endif 110