| 1 |
/* |
| 2 |
* Copyright (c) 2011-2014 - Mauro Carvalho Chehab |
| 3 |
* Copyright (c) 2012 - Andre Roth <[email protected]> |
| 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_event_short.h |
| 23 |
* @ingroup descriptors |
| 24 |
* @brief Provides the descriptors for the short event 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 [email protected] |
| 35 |
*/ |
| 36 |
|
| 37 |
#ifndef _DESC_EVENT_SHORT_H |
| 38 |
#define _DESC_EVENT_SHORT_H |
| 39 |
|
| 40 |
#include <libdvbv5/descriptors.h> |
| 41 |
|
| 42 |
/** |
| 43 |
* @struct dvb_desc_event_short |
| 44 |
* @ingroup descriptors |
| 45 |
* @brief Structure containing the short event descriptor |
| 46 |
* |
| 47 |
* @param type descriptor tag |
| 48 |
* @param length descriptor length |
| 49 |
* @param next pointer to struct dvb_desc |
| 50 |
* @param language ISO 639 language code |
| 51 |
* @param name event name string |
| 52 |
* @param name_emph event name emphasis string |
| 53 |
* @param text event text string |
| 54 |
* @param text_emph event text 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_event_short { |
| 61 |
uint8_t type; |
| 62 |
uint8_t length; |
| 63 |
struct dvb_desc *next; |
| 64 |
|
| 65 |
unsigned char language[4]; |
| 66 |
char *name; |
| 67 |
char *name_emph; |
| 68 |
char *text; |
| 69 |
char *text_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 short event 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_event_short_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 short event 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_event_short_print(struct dvb_v5_fe_parms *parms, |
| 104 |
const struct dvb_desc *desc); |
| 105 |
|
| 106 |
/** |
| 107 |
* @brief Frees all data allocated by the short event descriptor |
| 108 |
* @ingroup descriptors |
| 109 |
* |
| 110 |
* @param desc pointer to struct dvb_desc to be freed |
| 111 |
*/ |
| 112 |
void dvb_desc_event_short_free(struct dvb_desc *desc); |
| 113 |
|
| 114 |
#ifdef __cplusplus |
| 115 |
} |
| 116 |
#endif |
| 117 |
|
| 118 |
#endif |