aboutsummaryrefslogtreecommitdiffstats
path: root/lib/include/libdvbv5/pmt.h
blob: 150b45a0f568ec7128dc75df71ee2acbac5b44f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
 * Copyright (c) 2011-2012 - Mauro Carvalho Chehab
 * Copyright (c) 2012 - Andre Roth <neolynx@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation version 2
 * of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 *
 */

#ifndef _PMT_H
#define _PMT_H

#include <stdint.h>
#include <unistd.h> /* ssize_t */

#include <libdvbv5/header.h>

#define DVB_TABLE_PMT      0x02

enum dvb_streams {
	stream_reserved0	= 0x00, // ITU-T | ISO/IEC Reserved
	stream_video		= 0x01, // ISO/IEC 11172 Video
	stream_video_h262	= 0x02, // ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream
	stream_audio		= 0x03, // ISO/IEC 11172 Audio
	stream_audio_13818_3	= 0x04, // ISO/IEC 13818-3 Audio
	stream_private_sections	= 0x05, // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections
	stream_private_data	= 0x06, // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data
	stream_mheg		= 0x07, // ISO/IEC 13522 MHEG
	stream_h222		= 0x08, // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A DSM-CC
	stream_h222_1		= 0x09, // ITU-T Rec. H.222.1
	stream_13818_6_A	= 0x0A, // ISO/IEC 13818-6 type A
	stream_13818_6_B	= 0x0B, // ISO/IEC 13818-6 type B
	stream_13818_6_C	= 0x0C, // ISO/IEC 13818-6 type C
	stream_13818_6_D	= 0x0D, // ISO/IEC 13818-6 type D
	stream_h222_aux		= 0x0E, // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary
	stream_audio_adts	= 0x0F, // ISO/IEC 13818-7 Audio with ADTS transport syntax
	stream_video_14496_2	= 0x10, // ISO/IEC 14496-2 Visual
	stream_audio_latm	= 0x11, // ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1
	stream_14496_1_pes	= 0x12, // ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets
	stream_14496_1_iso	= 0x13, // ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections.
	stream_download		= 0x14, // ISO/IEC 13818-6 Synchronized Download Protocol
	stream_reserved		= 0x15, // - 0x7F, ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved
	stream_private		= 0x80  // - 0xFF, User Private
};

extern const char *pmt_stream_name[];

struct dvb_table_pmt_stream {
	uint8_t type;
	union {
		uint16_t bitfield;
		struct {
			uint16_t elementary_pid:13;
			uint16_t reserved:3;
		} __attribute__((packed));
	} __attribute__((packed));
	union {
		uint16_t bitfield2;
		struct {
			uint16_t desc_length:10;
			uint16_t zero:2;
			uint16_t reserved2:4;
		} __attribute__((packed));
	} __attribute__((packed));
	struct dvb_desc *descriptor;
	struct dvb_table_pmt_stream *next;
} __attribute__((packed));

struct dvb_table_pmt {
	struct dvb_table_header header;
	union {
		uint16_t bitfield;
		struct {
			uint16_t pcr_pid:13;
			uint16_t reserved2:3;
		} __attribute__((packed));
	} __attribute__((packed));

	union {
		uint16_t bitfield2;
		struct {
			uint16_t desc_length:10;
			uint16_t zero3:2;
			uint16_t reserved3:4;
		} __attribute__((packed));
	} __attribute__((packed));
	struct dvb_desc *descriptor;
	struct dvb_table_pmt_stream *stream;
} __attribute__((packed));

#define dvb_pmt_field_first header
#define dvb_pmt_field_last descriptor

#define dvb_pmt_stream_foreach(_stream, _pmt) \
  for (struct dvb_table_pmt_stream *_stream = _pmt->stream; _stream; _stream = _stream->next) \

struct dvb_v5_fe_parms;

#ifdef __cplusplus
extern "C" {
#endif

ssize_t dvb_table_pmt_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, struct dvb_table_pmt **table);
void dvb_table_pmt_free(struct dvb_table_pmt *pmt);
void dvb_table_pmt_print(struct dvb_v5_fe_parms *parms, const struct dvb_table_pmt *pmt);

#ifdef __cplusplus
}
#endif

#endif

Privacy Policy