1 /* 2 * Copyright (c) 2011-2014 - 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 */ 20 21 /** 22 * @file desc_service.h 23 * @ingroup descriptors 24 * @brief Provides the descriptors for the service descriptor 25 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 26 * @author Mauro Carvalho Chehab 27 * @author Andre Roth 28 * 29 * @par Relevant specs 30 * The descriptor described herein is defined at: 31 * - ETSI EN 300 468 V1.11.1 32 * 33 * @par Bug Report 34 * Please submit bug reports and patches to linux-media@vger.kernel.org 35 */ 36 37 #ifndef _DESC_SERVICE_H 38 #define _DESC_SERVICE_H 39 40 #include <libdvbv5/descriptors.h> 41 42 /** 43 * @struct dvb_desc_service 44 * @ingroup descriptors 45 * @brief Structure containing the service descriptor 46 * 47 * @param type descriptor tag 48 * @param length descriptor length 49 * @param next pointer to struct dvb_desc 50 * @param service_type service type 51 * @param name name string 52 * @param name_emph name emphasis string 53 * @param provider provider string 54 * @param provider_emph provider emphasis string 55 * 56 * @details 57 * The emphasis text is the one that uses asterisks. For example, in the text: 58 * "the quick *fox* jumps over the lazy table" the emphasis would be "fox". 59 */ 60 struct dvb_desc_service { 61 uint8_t type; 62 uint8_t length; 63 struct dvb_desc *next; 64 65 uint8_t service_type; 66 char *name; 67 char *name_emph; 68 char *provider; 69 char *provider_emph; 70 } __attribute__((packed)); 71 72 struct dvb_v5_fe_parms; 73 74 #ifdef __cplusplus 75 extern "C" { 76 #endif 77 78 /** 79 * @brief Initializes and parses the service descriptor 80 * @ingroup descriptors 81 * 82 * @param parms struct dvb_v5_fe_parms pointer to the opened device 83 * @param buf buffer containing the descriptor's raw data 84 * @param desc pointer to struct dvb_desc to be allocated and filled 85 * 86 * This function allocates a the descriptor and fills the fields inside 87 * the struct. It also makes sure that all fields will follow the CPU 88 * endianness. Due to that, the content of the buffer may change. 89 * 90 * @return On success, it returns the size of the allocated struct. 91 * A negative value indicates an error. 92 */ 93 int dvb_desc_service_init(struct dvb_v5_fe_parms *parms, 94 const uint8_t *buf, struct dvb_desc *desc); 95 96 /** 97 * @brief Prints the content of the service descriptor 98 * @ingroup descriptors 99 * 100 * @param parms struct dvb_v5_fe_parms pointer to the opened device 101 * @param desc pointer to struct dvb_desc 102 */ 103 void dvb_desc_service_print(struct dvb_v5_fe_parms *parms, 104 const struct dvb_desc *desc); 105 106 /** 107 * @brief Frees all data allocated by the service descriptor 108 * @ingroup descriptors 109 * 110 * @param desc pointer to struct dvb_desc to be freed 111 */ 112 void dvb_desc_service_free(struct dvb_desc *desc); 113 114 #ifdef __cplusplus 115 } 116 #endif 117 118 #endif 119