libdvbv5  1.10.0
Library to work with Digital TV devices on Linux
mgt.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 - Andre Roth <neolynx@gmail.com>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation version 2
7  * 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 General Public License for more details.
13  *
14  * You should have received a copy of the GNU 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 
39 #ifndef _MGT_H
40 #define _MGT_H
41 
42 #include <stdint.h>
43 #include <unistd.h> /* ssize_t */
44 
45 #include <libdvbv5/atsc_header.h>
46 
52 #define ATSC_TABLE_MGT 0xC7
53 
79  uint16_t type;
80  union {
81  uint16_t bitfield;
82  struct {
83  uint16_t pid:13;
84  uint16_t one:3;
85  } __attribute__((packed));
86  } __attribute__((packed));
87  uint8_t type_version:5;
88  uint8_t one2:3;
89  uint32_t size;
90  union {
91  uint16_t bitfield2;
92  struct {
93  uint16_t desc_length:12;
94  uint16_t one3:4;
95  } __attribute__((packed));
96  } __attribute__((packed));
99 } __attribute__((packed));
100 
124  struct dvb_table_header header;
126  uint16_t tables;
129 } __attribute__((packed));
130 
137 #define atsc_mgt_table_foreach( _table, _mgt ) \
138  for( struct atsc_table_mgt_table *_table = _mgt->table; _table; _table = _table->next ) \
139 
140 struct dvb_v5_fe_parms;
141 
142 #ifdef __cplusplus
143 extern "C" {
144 #endif
145 
162 ssize_t atsc_table_mgt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
163  ssize_t buflen, struct atsc_table_mgt **table);
164 
171 void atsc_table_mgt_free(struct atsc_table_mgt *table);
172 
180 void atsc_table_mgt_print(struct dvb_v5_fe_parms *parms,
181  struct atsc_table_mgt *table);
182 
183 #ifdef __cplusplus
184 }
185 #endif
186 
187 #endif
Header of a MPEG-TS table.
Definition: header.h:93
void atsc_table_mgt_free(struct atsc_table_mgt *table)
Frees all data allocated by the MGT table parser.
uint16_t one
Definition: mgt.h:84
uint32_t size
Definition: mgt.h:89
uint16_t one3
Definition: mgt.h:94
ATSC tables descrition at MGT table.
Definition: mgt.h:78
uint8_t protocol_version
Definition: mgt.h:125
uint16_t type
Definition: mgt.h:79
uint8_t one2
Definition: mgt.h:88
uint16_t bitfield2
Definition: mgt.h:91
uint8_t type_version
Definition: mgt.h:87
struct atsc_table_mgt_table * table
Definition: mgt.h:127
ssize_t atsc_table_mgt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, struct atsc_table_mgt **table)
Initializes and parses MGT table.
uint16_t desc_length
Definition: mgt.h:93
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:118
struct dvb_desc * descriptor
Definition: mgt.h:97
Linked list containing the several descriptors found on a MPEG-TS table.
Definition: descriptors.h:118
struct atsc_table_mgt_table * next
Definition: mgt.h:98
ATSC MGT table.
Definition: mgt.h:123
uint16_t pid
Definition: mgt.h:83
uint16_t bitfield
Definition: mgt.h:81
void atsc_table_mgt_print(struct dvb_v5_fe_parms *parms, struct atsc_table_mgt *table)
Prints the content of the MGT table.
uint16_t tables
Definition: mgt.h:126
struct dvb_desc * descriptor
Definition: mgt.h:128
Provides some common ATSC stuff.