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

libdvbv5 1.28.1 Library to work with Digital TV devices on Linux

pat.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2012 - 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
39#ifndef _PAT_H
40#define _PAT_H
41
42#include <stdint.h>
43#include <unistd.h> /* ssize_t */
44
45#include <libdvbv5/header.h>
46
55#define DVB_TABLE_PAT 0x00
56#define DVB_TABLE_PAT_PID 0x0000
57
77 struct dvb_table_pat_program {
78 uint16_t service_id;
79 union {
80 uint16_t bitfield;
81 struct {
82 uint16_t pid:13;
83 uint8_t reserved:3;
84 } __attribute__((packed));
85 } __attribute__((packed));
86 struct dvb_table_pat_program *next;
87} __attribute__((packed));
88
108 struct dvb_table_pat {
109 struct dvb_table_header header;
110 uint16_t programs;
111 struct dvb_table_pat_program *program;
112} __attribute__((packed));
113
121#define dvb_pat_program_foreach(_pgm, _pat) \
122 if (_pat && _pat->program) \
123 for (struct dvb_table_pat_program *_pgm = _pat->program; _pgm; _pgm = _pgm->next) \
124
125struct dvb_v5_fe_parms;
126
127#ifdef __cplusplus
128extern "C" {
129#endif
130
147ssize_t dvb_table_pat_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
148 ssize_t buflen, struct dvb_table_pat **table);
149
156 void dvb_table_pat_free(struct dvb_table_pat *table);
157
165 void dvb_table_pat_print(struct dvb_v5_fe_parms *parms,
166 struct dvb_table_pat *table);
167
168#ifdef __cplusplus
169}
170#endif
171
172#endif
dvb_table_pat_init
ssize_t dvb_table_pat_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, struct dvb_table_pat **table)
Initializes and parses PAT table.
dvb_table_pat_free
void dvb_table_pat_free(struct dvb_table_pat *table)
Frees all data allocated by the PAT table parser.
dvb_table_pat_print
void dvb_table_pat_print(struct dvb_v5_fe_parms *parms, struct dvb_table_pat *table)
Prints the content of the PAT table.
header.h
Provides the MPEG TS table headers.
dvb_table_header
Header of a MPEG-TS table.
Definition header.h:103
dvb_table_pat_program
MPEG-TS PAT program table.
Definition pat.h:77
dvb_table_pat_program::service_id
uint16_t service_id
Definition pat.h:78
dvb_table_pat_program::pid
uint16_t pid
Definition pat.h:82
dvb_table_pat_program::next
struct dvb_table_pat_program * next
Definition pat.h:86
dvb_table_pat_program::bitfield
uint16_t bitfield
Definition pat.h:80
dvb_table_pat_program::reserved
uint8_t reserved
Definition pat.h:83
dvb_table_pat
MPEG-TS PAT table.
Definition pat.h:108
dvb_table_pat::program
struct dvb_table_pat_program * program
Definition pat.h:111
dvb_table_pat::programs
uint16_t programs
Definition pat.h:110
dvb_table_pat::header
struct dvb_table_header header
Definition pat.h:109
dvb_v5_fe_parms
Keeps data needed to handle the DVB frontend.
Definition dvb-fe.h:117