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