libdvbv5  1.8.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
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 
21 #ifndef _MPEG_TS_H
22 #define _MPEG_TS_H
23 
40 #include <stdint.h>
41 #include <unistd.h> /* ssize_t */
42 
51 #define DVB_MPEG_TS 0x47
52 #define DVB_MPEG_TS_PACKET_SIZE 188
53 
72  uint8_t length;
73  struct {
74  uint8_t extension:1;
75  uint8_t private_data:1;
76  uint8_t splicing_point:1;
77  uint8_t OPCR:1;
78  uint8_t PCR:1;
79  uint8_t priority:1;
80  uint8_t random_access:1;
81  uint8_t discontinued:1;
82  } __attribute__((packed));
83  uint8_t data[];
84 } __attribute__((packed));
85 
102 struct dvb_mpeg_ts {
103  uint8_t sync_byte;
104  union {
105  uint16_t bitfield;
106  struct {
107  uint16_t pid:13;
108  uint16_t priority:1;
109  uint16_t payload_start:1;
110  uint16_t tei:1;
111  } __attribute__((packed));
112  } __attribute__((packed));
113  struct {
115  uint8_t payload:1;
116  uint8_t adaptation_field:1;
117  uint8_t scrambling:2;
118  } __attribute__((packed));
120 } __attribute__((packed));
121 
122 struct dvb_v5_fe_parms;
123 
124 #ifdef __cplusplus
125 extern "C" {
126 #endif
127 
144 ssize_t dvb_mpeg_ts_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen,
145  uint8_t *table, ssize_t *table_length);
146 
156 void dvb_mpeg_ts_free(struct dvb_mpeg_ts *ts);
157 
167 void dvb_mpeg_ts_print(struct dvb_v5_fe_parms *parms, struct dvb_mpeg_ts *ts);
168 
169 #ifdef __cplusplus
170 }
171 #endif
172 
173 #endif
uint16_t tei
Definition: mpeg_ts.h:110
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:81
uint8_t scrambling
Definition: mpeg_ts.h:117
MPEG TS header.
Definition: mpeg_ts.h:102
uint16_t payload_start
Definition: mpeg_ts.h:109
uint16_t priority
Definition: mpeg_ts.h:108
struct dvb_mpeg_ts_adaption adaption[]
Definition: mpeg_ts.h:119
uint8_t sync_byte
Definition: mpeg_ts.h:103
uint8_t data[]
Definition: mpeg_ts.h:83
MPEG TS header adaption field.
Definition: mpeg_ts.h:71
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:118
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:114
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:116
uint8_t extension
Definition: mpeg_ts.h:74
uint8_t priority
Definition: mpeg_ts.h:79
uint8_t payload
Definition: mpeg_ts.h:115
uint8_t private_data
Definition: mpeg_ts.h:75
uint8_t splicing_point
Definition: mpeg_ts.h:76
uint8_t random_access
Definition: mpeg_ts.h:80
uint16_t bitfield
Definition: mpeg_ts.h:105
uint16_t pid
Definition: mpeg_ts.h:107