libdvbv5: lib/include/libdvbv5/mgt.h Source File

libdvbv5 1.26.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 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
38#ifndef _MGT_H
39#define _MGT_H
40
41#include <stdint.h>
42#include <unistd.h> /* ssize_t */
43
44#include <libdvbv5/atsc_header.h>
45
51#define ATSC_TABLE_MGT 0xC7
52
77 struct atsc_table_mgt_table {
78 uint16_t type;
79 union {
80 uint16_t bitfield;
81 struct {
82 uint16_t pid:13;
83 uint16_t one:3;
84 } __attribute__((packed));
85 } __attribute__((packed));
86 uint8_t type_version:5;
87 uint8_t one2:3;
88 uint32_t size;
89 union {
90 uint16_t bitfield2;
91 struct {
92 uint16_t desc_length:12;
93 uint16_t one3:4;
94 } __attribute__((packed));
95 } __attribute__((packed));
96 struct dvb_desc *descriptor;
97 struct atsc_table_mgt_table *next;
98} __attribute__((packed));
99
122 struct atsc_table_mgt {
123 struct dvb_table_header header;
124 uint8_t protocol_version;
125 uint16_t tables;
126 struct atsc_table_mgt_table *table;
127 struct dvb_desc *descriptor;
128} __attribute__((packed));
129
136#define atsc_mgt_table_foreach( _table, _mgt ) \
137 if (_mgt && _mgt->_table) \
138 for( struct atsc_table_mgt_table *_table = _mgt->table; _table; _table = _table->next ) \
139
140struct dvb_v5_fe_parms;
141
142#ifdef __cplusplus
143extern "C" {
144#endif
145
162ssize_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
atsc_header.h
Provides some common ATSC stuff.
atsc_table_mgt_free
void atsc_table_mgt_free(struct atsc_table_mgt *table)
Frees all data allocated by the MGT table parser.
atsc_table_mgt_init
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.
atsc_table_mgt_print
void atsc_table_mgt_print(struct dvb_v5_fe_parms *parms, struct atsc_table_mgt *table)
Prints the content of the MGT table.
atsc_table_mgt_table
ATSC tables descrition at MGT table.
Definition mgt.h:77
atsc_table_mgt_table::bitfield
uint16_t bitfield
Definition mgt.h:80
atsc_table_mgt_table::descriptor
struct dvb_desc * descriptor
Definition mgt.h:96
atsc_table_mgt_table::next
struct atsc_table_mgt_table * next
Definition mgt.h:97
atsc_table_mgt_table::size
uint32_t size
Definition mgt.h:88
atsc_table_mgt_table::one2
uint8_t one2
Definition mgt.h:87
atsc_table_mgt_table::type
uint16_t type
Definition mgt.h:78
atsc_table_mgt_table::type_version
uint8_t type_version
Definition mgt.h:86
atsc_table_mgt_table::desc_length
uint16_t desc_length
Definition mgt.h:92
atsc_table_mgt_table::one
uint16_t one
Definition mgt.h:83
atsc_table_mgt_table::one3
uint16_t one3
Definition mgt.h:93
atsc_table_mgt_table::bitfield2
uint16_t bitfield2
Definition mgt.h:90
atsc_table_mgt_table::pid
uint16_t pid
Definition mgt.h:82
atsc_table_mgt
ATSC MGT table.
Definition mgt.h:122
atsc_table_mgt::descriptor
struct dvb_desc * descriptor
Definition mgt.h:127
atsc_table_mgt::table
struct atsc_table_mgt_table * table
Definition mgt.h:126
atsc_table_mgt::protocol_version
uint8_t protocol_version
Definition mgt.h:124
atsc_table_mgt::tables
uint16_t tables
Definition mgt.h:125
atsc_table_mgt::header
struct dvb_table_header header
Definition mgt.h:123
dvb_desc
Linked list containing the several descriptors found on a MPEG-TS table.
Definition descriptors.h:117
dvb_table_header
Header of a MPEG-TS table.
Definition header.h:103
dvb_v5_fe_parms
Keeps data needed to handle the DVB frontend.
Definition dvb-fe.h:117