Wasabi ExpressPlay SDK for Embedded Systems
1.10
Main Page
Modules
Data Structures
Files
File List
Globals
Client
ThirdParty
Ts2
Source
Ts2Tables.h
Go to the documentation of this file.
1
/*****************************************************************
2
|
3
| MPEG2 Transport Stream - Tables
4
|
5
| $Id: Ts2Tables.h 296 2014-06-25 11:20:09Z jebaseelir $
6
| Original author: Julien Boeuf
7
|
8
| This software is provided to you pursuant to your agreement
9
| with Intertrust Technologies Corporation ("Intertrust").
10
| This software may be used only in accordance with the terms
11
| of the agreement.
12
|
13
| Copyright (c) 2005-2014 by Intertrust. All rights reserved.
14
|
15
****************************************************************/
16
17
#ifndef _TS2_TABLES_H_
18
#define _TS2_TABLES_H_
19
20
/*----------------------------------------------------------------------
21
| includes
22
+---------------------------------------------------------------------*/
23
#include "Atomix.h"
24
#include "
Ts2Packet.h
"
25
#include "
Ts2Utils.h
"
26
27
/*----------------------------------------------------------------------
28
| constants
29
+---------------------------------------------------------------------*/
30
#define TS2_PAT_PID 0
31
#define TS2_CAT_PID 1
32
33
#define TS2_PAT_TABLE_ID 0x00
34
#define TS2_CAT_TABLE_ID 0x01
35
#define TS2_PMT_TABLE_ID 0x02
36
37
#define TS2_SECTION_CRC_SIZE 4
38
#define TS2_SECTION_LONG_HEADER_SIZE 8
39
#define TS2_SECTION_SHORT_HEADER_SIZE 3
40
41
/*----------------------------------------------------------------------
42
| types
43
+---------------------------------------------------------------------*/
44
typedef
struct
TS2_Table
TS2_Table
;
45
typedef
struct
{
46
ATX_UInt8
table_id
;
47
ATX_UInt8
section_syntax_indicator
;
48
ATX_UInt8
private_indicator
;
/* constant in all tables other than Private tables */
49
ATX_UInt16
section_length
;
50
ATX_UInt32
specific
;
/* data specific to the table type */
51
ATX_UInt8
section_number
;
52
ATX_UInt8
last_section_number
;
53
}
TS2_SectionHeader
;
54
55
typedef
struct
{
56
TS2_SectionHeader
header
;
57
ATX_Byte*
payload
;
/* to be used in ParseSection */
58
ATX_Byte*
buffer
;
/* contains the whole section (with header and crc) */
59
ATX_Size
bytes_read
;
60
}
TS2_Section
;
61
62
typedef
enum
{
63
TS2_CRC_NONE
= 0,
64
TS2_CRC_OK
,
65
TS2_CRC_FAILED
66
}
TS2_Crc_Status
;
67
68
struct
TS2_Table
{
69
/* public */
70
ATX_Boolean
is_complete
;
71
TS2_Crc_Status
crc_status
;
72
ATX_Result (*
UpdateSectionBuffer
)(
TS2_Table
*
self
);
/* only support 1 section for now */
73
74
/* internal */
75
ATX_Result (*
CheckTableId
)(ATX_UInt8 table_id);
76
ATX_Result (*
ParseSection
)(
TS2_Table
*
self
);
77
void (*
Destruct
)(
TS2_Table
*
self
);
78
TS2_Section
section
;
79
};
80
81
typedef
struct
{
82
ATX_UInt16
program_number
;
83
ATX_UInt16
pid
;
84
}
TS2_PAT_Entry
;
85
86
typedef
struct
{
87
TS2_Table
base
;
88
ATX_List*
programs_to_pids
;
89
}
TS2_PAT
;
90
91
typedef
struct
{
92
TS2_Table
base
;
93
ATX_UInt16
pcr_pid
;
94
ATX_UInt16
program_info_length
;
95
ATX_List*
program_info_descs
;
/* List of TS2_Descriptor */
96
ATX_List*
elementary_streams
;
/* List of TS2_ElementaryStream */
97
}
TS2_PMT
;
98
99
typedef
struct
{
100
TS2_Table
base
;
101
ATX_List*
descriptors
;
102
}
TS2_CAT
;
103
104
typedef
struct
{
105
TS2_Table
base
;
106
}
TS2_PrivateTable
;
107
108
#ifdef __cplusplus
109
extern
"C"
{
110
#endif
111
112
/*----------------------------------------------------------------------
113
| TS2_Section methods
114
+---------------------------------------------------------------------*/
115
ATX_Size
116
TS2_Section_GetPayloadSize
(
TS2_Section
* section);
117
118
ATX_Result
119
TS2_SectionHeader_Serialize
(
TS2_SectionHeader
* header,
120
ATX_Byte* buffer);
121
122
/*----------------------------------------------------------------------
123
| TS2_Table methods
124
+---------------------------------------------------------------------*/
125
ATX_Result
126
TS2_Table_AddData
(
TS2_Table
*
self
,
127
const
ATX_Byte* data,
128
ATX_Size data_size,
129
ATX_Boolean payload_unit_start);
130
134
TS2_EXPORT
ATX_Result
135
TS2_Table_AddPacket
(
TS2_Table
*
self
,
136
const
TS2_Packet
* packet);
137
138
ATX_Result
139
TS2_Table_SerializeToPackets
(
TS2_Table
*
self
,
140
ATX_UInt16 pid,
141
ATX_DataBuffer* packets,
142
ATX_UInt32* continuity_counter);
143
144
ATX_Result
145
TS2_Table_UpdateSectionBuffer
(
TS2_Table
*
self
);
146
147
ATX_Boolean
148
TS2_Table_IsEqual
(
TS2_Table
*
self
,
149
TS2_Table
* other);
150
151
TS2_EXPORT
void
152
TS2_Table_Destruct
(
TS2_Table
*
self
);
153
154
/*----------------------------------------------------------------------
155
| TS2_PAT methods
156
+---------------------------------------------------------------------*/
157
TS2_EXPORT
ATX_Result
158
TS2_PAT_Construct
(
TS2_PAT
*
self
);
159
160
TS2_EXPORT
ATX_Result
161
TS2_PAT_GetFirstPMTPid
(
const
TS2_PAT
*
self
,
162
ATX_UInt16* pmt_pid);
163
164
/*----------------------------------------------------------------------
165
| TS2_PMT methods
166
+---------------------------------------------------------------------*/
167
TS2_EXPORT
ATX_Result
168
TS2_PMT_Construct
(
TS2_PMT
*
self
);
169
170
ATX_Result
171
TS2_PMT_RemoveCADescriptors
(
TS2_PMT
*
self
);
172
173
/*----------------------------------------------------------------------
174
| TS2_CAT methods
175
+---------------------------------------------------------------------*/
176
TS2_EXPORT
ATX_Result
177
TS2_CAT_Construct
(
TS2_CAT
*
self
);
178
179
/*----------------------------------------------------------------------
180
| helpers
181
+---------------------------------------------------------------------*/
182
#define TS2_SectionHeader_GetSize(h) \
183
(h)->section_syntax_indicator? \
184
TS2_SECTION_LONG_HEADER_SIZE: \
185
TS2_SECTION_SHORT_HEADER_SIZE
186
187
#ifdef __cplusplus
188
}
189
#endif
190
191
#endif
/* _TS2_TABLES_H_ */