libdvbv5: lib/include/libdvbv5/mpeg_es.h Source File

libdvbv5 1.32.0 Library to work with Digital TV devices on Linux

mpeg_es.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_ES_H
21#define _MPEG_ES_H
22
39
40#include <stdint.h>
41#include <unistd.h> /* ssize_t */
42
63#define DVB_MPEG_ES_PIC_START 0x00
64#define DVB_MPEG_ES_USER_DATA 0xb2
65#define DVB_MPEG_ES_SEQ_START 0xb3
66#define DVB_MPEG_ES_SEQ_EXT 0xb5
67#define DVB_MPEG_ES_GOP 0xb8
68#define DVB_MPEG_ES_SLICES 0x01 ... 0xaf
69
88 struct dvb_mpeg_es_seq_start {
89 union {
90 uint32_t bitfield;
91 struct {
92 uint32_t type:8;
93 uint32_t sync:24;
94 } __attribute__((packed));
95 } __attribute__((packed));
96 union {
97 uint32_t bitfield2;
98 struct {
99 uint32_t framerate:4;
100 uint32_t aspect:4;
101 uint32_t height:12;
102 uint32_t width:12;
103 } __attribute__((packed));
104 } __attribute__((packed));
105 union {
106 uint32_t bitfield3;
107 struct {
108 uint32_t qm_nonintra:1;
109 uint32_t qm_intra:1;
110 uint32_t constrained:1;
111 uint32_t vbv:10; // Size of video buffer verifier = 16*1024*vbv buf size
112 uint32_t one:1;
113 uint32_t bitrate:18;
114 } __attribute__((packed));
115 } __attribute__((packed));
116} __attribute__((packed));
117
130 struct dvb_mpeg_es_pic_start {
131 union {
132 uint32_t bitfield;
133 struct {
134 uint32_t type:8;
135 uint32_t sync:24;
136 } __attribute__((packed));
137 } __attribute__((packed));
138 union {
139 uint32_t bitfield2;
140 struct {
141 uint32_t dummy:3;
142 uint32_t vbv_delay:16;
143 uint32_t coding_type:3;
144 uint32_t temporal_ref:10;
145 } __attribute__((packed));
146 } __attribute__((packed));
147} __attribute__((packed));
148
165 enum dvb_mpeg_es_frame_t
166{
167 DVB_MPEG_ES_FRAME_UNKNOWN,
168 DVB_MPEG_ES_FRAME_I,
169 DVB_MPEG_ES_FRAME_P,
170 DVB_MPEG_ES_FRAME_B,
171 DVB_MPEG_ES_FRAME_D
172};
173
178extern const char *dvb_mpeg_es_frame_names[5];
179
180struct dvb_v5_fe_parms;
181
182#ifdef __cplusplus
183extern "C" {
184#endif
185
200 int dvb_mpeg_es_seq_start_init (const uint8_t *buf, ssize_t buflen,
201 struct dvb_mpeg_es_seq_start *seq_start);
202
212 void dvb_mpeg_es_seq_start_print(struct dvb_v5_fe_parms *parms,
213 struct dvb_mpeg_es_seq_start *seq_start);
214
229 int dvb_mpeg_es_pic_start_init (const uint8_t *buf, ssize_t buflen,
230 struct dvb_mpeg_es_pic_start *pic_start);
231
241 void dvb_mpeg_es_pic_start_print(struct dvb_v5_fe_parms *parms,
242 struct dvb_mpeg_es_pic_start *pic_start);
243
244#ifdef __cplusplus
245}
246#endif
247
248#endif
dvb_mpeg_es_seq_start_print
void dvb_mpeg_es_seq_start_print(struct dvb_v5_fe_parms *parms, struct dvb_mpeg_es_seq_start *seq_start)
Print details of struct dvb_mpeg_es_seq_start.
dvb_mpeg_es_seq_start_init
int dvb_mpeg_es_seq_start_init(const uint8_t *buf, ssize_t buflen, struct dvb_mpeg_es_seq_start *seq_start)
Initialize a struct dvb_mpeg_es_seq_start from buffer.
dvb_mpeg_es_frame_t
dvb_mpeg_es_frame_t
MPEG frame types.
Definition mpeg_es.h:166
dvb_mpeg_es_frame_names
const char * dvb_mpeg_es_frame_names[5]
Vector that translates from enum dvb_mpeg_es_frame_t to string.
dvb_mpeg_es_pic_start_init
int dvb_mpeg_es_pic_start_init(const uint8_t *buf, ssize_t buflen, struct dvb_mpeg_es_pic_start *pic_start)
Initialize a struct dvb_mpeg_es_pic_start from buffer.
dvb_mpeg_es_pic_start_print
void dvb_mpeg_es_pic_start_print(struct dvb_v5_fe_parms *parms, struct dvb_mpeg_es_pic_start *pic_start)
Print details of struct dvb_mpeg_es_pic_start.
DVB_MPEG_ES_FRAME_P
@ DVB_MPEG_ES_FRAME_P
P frame.
Definition mpeg_es.h:169
DVB_MPEG_ES_FRAME_B
@ DVB_MPEG_ES_FRAME_B
B frame.
Definition mpeg_es.h:170
DVB_MPEG_ES_FRAME_UNKNOWN
@ DVB_MPEG_ES_FRAME_UNKNOWN
Unknown frame.
Definition mpeg_es.h:167
DVB_MPEG_ES_FRAME_I
@ DVB_MPEG_ES_FRAME_I
I frame.
Definition mpeg_es.h:168
DVB_MPEG_ES_FRAME_D
@ DVB_MPEG_ES_FRAME_D
D frame.
Definition mpeg_es.h:171
dvb_mpeg_es_pic_start
MPEG ES Picture start header.
Definition mpeg_es.h:130
dvb_mpeg_es_pic_start::temporal_ref
uint32_t temporal_ref
Definition mpeg_es.h:144
dvb_mpeg_es_pic_start::bitfield2
uint32_t bitfield2
Definition mpeg_es.h:139
dvb_mpeg_es_pic_start::sync
uint32_t sync
Definition mpeg_es.h:135
dvb_mpeg_es_pic_start::dummy
uint32_t dummy
Definition mpeg_es.h:141
dvb_mpeg_es_pic_start::type
uint32_t type
Definition mpeg_es.h:134
dvb_mpeg_es_pic_start::bitfield
uint32_t bitfield
Definition mpeg_es.h:132
dvb_mpeg_es_pic_start::vbv_delay
uint32_t vbv_delay
Definition mpeg_es.h:142
dvb_mpeg_es_pic_start::coding_type
uint32_t coding_type
Definition mpeg_es.h:143
dvb_mpeg_es_seq_start
MPEG ES Sequence header.
Definition mpeg_es.h:88
dvb_mpeg_es_seq_start::aspect
uint32_t aspect
Definition mpeg_es.h:100
dvb_mpeg_es_seq_start::qm_nonintra
uint32_t qm_nonintra
Definition mpeg_es.h:108
dvb_mpeg_es_seq_start::bitfield3
uint32_t bitfield3
Definition mpeg_es.h:106
dvb_mpeg_es_seq_start::height
uint32_t height
Definition mpeg_es.h:101
dvb_mpeg_es_seq_start::constrained
uint32_t constrained
Definition mpeg_es.h:110
dvb_mpeg_es_seq_start::framerate
uint32_t framerate
Definition mpeg_es.h:99
dvb_mpeg_es_seq_start::bitfield
uint32_t bitfield
Definition mpeg_es.h:90
dvb_mpeg_es_seq_start::one
uint32_t one
Definition mpeg_es.h:112
dvb_mpeg_es_seq_start::bitrate
uint32_t bitrate
Definition mpeg_es.h:113
dvb_mpeg_es_seq_start::width
uint32_t width
Definition mpeg_es.h:102
dvb_mpeg_es_seq_start::qm_intra
uint32_t qm_intra
Definition mpeg_es.h:109
dvb_mpeg_es_seq_start::bitfield2
uint32_t bitfield2
Definition mpeg_es.h:97
dvb_mpeg_es_seq_start::type
uint32_t type
Definition mpeg_es.h:92
dvb_mpeg_es_seq_start::vbv
uint32_t vbv
Definition mpeg_es.h:111
dvb_mpeg_es_seq_start::sync
uint32_t sync
Definition mpeg_es.h:93
dvb_v5_fe_parms
Keeps data needed to handle the DVB frontend.
Definition dvb-fe.h:117