libdvbv5  1.6.3
Library to work with Digital TV devices on Linux
mpeg_pes.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_PES_H
22 #define _MPEG_PES_H
23 
41 #include <stdint.h>
42 #include <unistd.h> /* ssize_t */
43 
44 
81 #define DVB_MPEG_PES 0x00001
82 
83 #define DVB_MPEG_PES_AUDIO 0xc0 ... 0xcf
84 #define DVB_MPEG_PES_VIDEO 0xe0 ... 0xef
85 
86 #define DVB_MPEG_STREAM_MAP 0xBC
87 #define DVB_MPEG_STREAM_PADDING 0xBE
88 #define DVB_MPEG_STREAM_PRIVATE_2 0x5F
89 #define DVB_MPEG_STREAM_ECM 0x70
90 #define DVB_MPEG_STREAM_EMM 0x71
91 #define DVB_MPEG_STREAM_DIRECTORY 0xFF
92 #define DVB_MPEG_STREAM_DSMCC 0x7A
93 #define DVB_MPEG_STREAM_H222E 0xF8
94 
109 struct ts_t {
110  uint8_t one:1;
111  uint8_t bits30:3;
112  uint8_t tag:4;
113 
114  union {
115  uint16_t bitfield;
116  struct {
117  uint16_t one1:1;
118  uint16_t bits15:15;
119  } __attribute__((packed));
120  } __attribute__((packed));
121 
122  union {
123  uint16_t bitfield2;
124  struct {
125  uint16_t one2:1;
126  uint16_t bits00:15;
127  } __attribute__((packed));
128  } __attribute__((packed));
129 } __attribute__((packed));
130 
154  union {
155  uint16_t bitfield;
156  struct {
157  uint16_t PES_extension:1;
158  uint16_t PES_CRC:1;
160  uint16_t DSM_trick_mode:1;
161  uint16_t ES_rate:1;
162  uint16_t ESCR:1;
163  uint16_t PTS_DTS:2;
164  uint16_t original_or_copy:1;
165  uint16_t copyright:1;
167  uint16_t PES_priority:1;
169  uint16_t two:2;
170  } __attribute__((packed));
171  } __attribute__((packed));
172  uint8_t length;
173  uint64_t pts;
174  uint64_t dts;
175 } __attribute__((packed));
176 
187 struct dvb_mpeg_pes {
188  union {
189  uint32_t bitfield;
190  struct {
191  uint32_t stream_id:8;
192  uint32_t sync:24;
193  } __attribute__((packed));
194  } __attribute__((packed));
195  uint16_t length;
197 } __attribute__((packed));
198 
199 struct dvb_v5_fe_parms;
200 
201 #ifdef __cplusplus
202 extern "C" {
203 #endif
204 
220 ssize_t dvb_mpeg_pes_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen,
221  uint8_t *table);
222 
232 void dvb_mpeg_pes_free(struct dvb_mpeg_pes *pes);
233 
243 void dvb_mpeg_pes_print (struct dvb_v5_fe_parms *parms, struct dvb_mpeg_pes *pes);
244 
245 #ifdef __cplusplus
246 }
247 #endif
248 
249 #endif
uint16_t one2
Definition: mpeg_pes.h:125
struct dvb_mpeg_pes_optional optional[]
Definition: mpeg_pes.h:196
uint16_t bits00
Definition: mpeg_pes.h:126
uint16_t bitfield2
Definition: mpeg_pes.h:123
uint16_t length
Definition: mpeg_pes.h:195
uint16_t PES_scrambling_control
Definition: mpeg_pes.h:168
uint32_t bitfield
Definition: mpeg_pes.h:189
uint32_t sync
Definition: mpeg_pes.h:192
uint16_t one1
Definition: mpeg_pes.h:117
void dvb_mpeg_pes_free(struct dvb_mpeg_pes *pes)
Deallocate memory associated with a struct dvb_mpeg_pes.
uint8_t bits30
Definition: mpeg_pes.h:111
MPEG PES timestamp structure, used for dts and pts.
Definition: mpeg_pes.h:109
uint16_t bits15
Definition: mpeg_pes.h:118
uint8_t tag
Definition: mpeg_pes.h:112
uint8_t one
Definition: mpeg_pes.h:110
uint32_t stream_id
Definition: mpeg_pes.h:191
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:118
uint16_t bitfield
Definition: mpeg_pes.h:115
uint16_t original_or_copy
Definition: mpeg_pes.h:164
uint16_t PES_priority
Definition: mpeg_pes.h:167
MPEG PES optional header.
Definition: mpeg_pes.h:153
uint16_t additional_copy_info
Definition: mpeg_pes.h:159
MPEG PES data structure.
Definition: mpeg_pes.h:187
uint16_t PES_extension
Definition: mpeg_pes.h:157
ssize_t dvb_mpeg_pes_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, uint8_t *table)
Initialize a struct dvb_mpeg_pes from buffer.
void dvb_mpeg_pes_print(struct dvb_v5_fe_parms *parms, struct dvb_mpeg_pes *pes)
Print details of struct dvb_mpeg_pes.
uint16_t data_alignment_indicator
Definition: mpeg_pes.h:166
uint16_t DSM_trick_mode
Definition: mpeg_pes.h:160