libdvbv5  1.11.0
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 
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 {
114  uint8_t payload:1;
115  uint8_t adaptation_field:1;
116  uint8_t scrambling:2;
117  } __attribute__((packed));
119 } __attribute__((packed));
120 
121 struct dvb_v5_fe_parms;
122 
123 #ifdef __cplusplus
124 extern "C" {
125 #endif
126 
143 ssize_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
uint16_t tei
Definition: mpeg_ts.h:109
void dvb_mpeg_ts_print(struct dvb_v5_fe_parms *parms, struct dvb_mpeg_ts *ts)
Print details of struct dvb_mpeg_ts.
uint8_t discontinued
Definition: mpeg_ts.h:80
uint8_t scrambling
Definition: mpeg_ts.h:116
MPEG TS header.
Definition: mpeg_ts.h:101
uint16_t payload_start
Definition: mpeg_ts.h:108
uint16_t priority
Definition: mpeg_ts.h:107
struct dvb_mpeg_ts_adaption adaption[]
Definition: mpeg_ts.h:118
uint8_t sync_byte
Definition: mpeg_ts.h:102
uint8_t data[]
Definition: mpeg_ts.h:82
MPEG TS header adaption field.
Definition: mpeg_ts.h:70
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:117
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.
uint8_t continuity_counter
Definition: mpeg_ts.h:113
void dvb_mpeg_ts_free(struct dvb_mpeg_ts *ts)
Deallocate memory associated with a struct dvb_mpeg_ts.
uint8_t adaptation_field
Definition: mpeg_ts.h:115
uint8_t extension
Definition: mpeg_ts.h:73
uint8_t priority
Definition: mpeg_ts.h:78
uint8_t payload
Definition: mpeg_ts.h:114
uint8_t private_data
Definition: mpeg_ts.h:74
uint8_t splicing_point
Definition: mpeg_ts.h:75
uint8_t random_access
Definition: mpeg_ts.h:79
uint16_t bitfield
Definition: mpeg_ts.h:104
uint16_t pid
Definition: mpeg_ts.h:106