libdvbv5 1.24.1 Library to work with Digital TV devices on Linux

mpeg_ts.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013-2014 - 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
20#ifndef _MPEG_TS_H
21#define _MPEG_TS_H
22
39#include <stdint.h>
40#include <unistd.h> /* ssize_t */
41
50#define DVB_MPEG_TS 0x47
51#define DVB_MPEG_TS_PACKET_SIZE 188
52
70 struct dvb_mpeg_ts_adaption {
71 uint8_t length;
72 struct {
73 uint8_t extension:1;
74 uint8_t private_data:1;
75 uint8_t splicing_point:1;
76 uint8_t OPCR:1;
77 uint8_t PCR:1;
78 uint8_t priority:1;
79 uint8_t random_access:1;
80 uint8_t discontinued:1;
81 } __attribute__((packed));
82 uint8_t data[];
83} __attribute__((packed));
84
101 struct dvb_mpeg_ts {
102 uint8_t sync_byte;
103 union {
104 uint16_t bitfield;
105 struct {
106 uint16_t pid:13;
107 uint16_t priority:1;
108 uint16_t payload_start:1;
109 uint16_t tei:1;
110 } __attribute__((packed));
111 } __attribute__((packed));
112 struct {
113 uint8_t continuity_counter:4;
114 uint8_t payload:1;
115 uint8_t adaptation_field:1;
116 uint8_t scrambling:2;
117 } __attribute__((packed));
118 struct dvb_mpeg_ts_adaption adaption[];
119} __attribute__((packed));
120
121 struct dvb_v5_fe_parms;
122
123#ifdef __cplusplus
124 extern "C" {
125#endif
126
143ssize_t dvb_mpeg_ts_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen,
144 uint8_t *table, ssize_t *table_length);
145
155 void dvb_mpeg_ts_free(struct dvb_mpeg_ts *ts);
156
166 void dvb_mpeg_ts_print(struct dvb_v5_fe_parms *parms, struct dvb_mpeg_ts *ts);
167
168#ifdef __cplusplus
169}
170#endif
171
172#endif
dvb_mpeg_ts_print
void dvb_mpeg_ts_print(struct dvb_v5_fe_parms *parms, struct dvb_mpeg_ts *ts)
Print details of struct dvb_mpeg_ts.
dvb_mpeg_ts_free
void dvb_mpeg_ts_free(struct dvb_mpeg_ts *ts)
Deallocate memory associated with a struct dvb_mpeg_ts.
dvb_mpeg_ts_init
ssize_t dvb_mpeg_ts_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, uint8_t *table, ssize_t *table_length)
Initialize a struct dvb_mpeg_ts from buffer.
dvb_mpeg_ts_adaption
MPEG TS header adaption field.
Definition: mpeg_ts.h:70
dvb_mpeg_ts_adaption::extension
uint8_t extension
Definition: mpeg_ts.h:73
dvb_mpeg_ts_adaption::data
uint8_t data[]
Definition: mpeg_ts.h:82
dvb_mpeg_ts_adaption::random_access
uint8_t random_access
Definition: mpeg_ts.h:79
dvb_mpeg_ts_adaption::private_data
uint8_t private_data
Definition: mpeg_ts.h:74
dvb_mpeg_ts_adaption::splicing_point
uint8_t splicing_point
Definition: mpeg_ts.h:75
dvb_mpeg_ts_adaption::OPCR
uint8_t OPCR
Definition: mpeg_ts.h:76
dvb_mpeg_ts_adaption::PCR
uint8_t PCR
Definition: mpeg_ts.h:77
dvb_mpeg_ts_adaption::priority
uint8_t priority
Definition: mpeg_ts.h:78
dvb_mpeg_ts_adaption::discontinued
uint8_t discontinued
Definition: mpeg_ts.h:80
dvb_mpeg_ts_adaption::length
uint8_t length
Definition: mpeg_ts.h:71
dvb_mpeg_ts
MPEG TS header.
Definition: mpeg_ts.h:101
dvb_mpeg_ts::bitfield
uint16_t bitfield
Definition: mpeg_ts.h:104
dvb_mpeg_ts::continuity_counter
uint8_t continuity_counter
Definition: mpeg_ts.h:113
dvb_mpeg_ts::priority
uint16_t priority
Definition: mpeg_ts.h:107
dvb_mpeg_ts::payload
uint8_t payload
Definition: mpeg_ts.h:114
dvb_mpeg_ts::scrambling
uint8_t scrambling
Definition: mpeg_ts.h:116
dvb_mpeg_ts::adaption
struct dvb_mpeg_ts_adaption adaption[]
Definition: mpeg_ts.h:118
dvb_mpeg_ts::payload_start
uint16_t payload_start
Definition: mpeg_ts.h:108
dvb_mpeg_ts::tei
uint16_t tei
Definition: mpeg_ts.h:109
dvb_mpeg_ts::adaptation_field
uint8_t adaptation_field
Definition: mpeg_ts.h:115
dvb_mpeg_ts::sync_byte
uint8_t sync_byte
Definition: mpeg_ts.h:102
dvb_mpeg_ts::pid
uint16_t pid
Definition: mpeg_ts.h:106
dvb_v5_fe_parms
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:117