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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
|
/////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Module Name:
//
// Mpeg2Structs.idl
//
// Abstract:
//
// Definitions for the common structures used in Mpeg2Data
//
// Notes:
//
// This IDL file is not built independently, but is included and built
// in the master IDL file Mpeg2Data.idl
//
/////////////////////////////////////////////////////////////////////////////
// Include Files
#include "Mpeg2Bits.h"
//
// Basic Type Aliases
//
typedef WORD PID;
typedef BYTE TID;
typedef UINT ClientKey;
//
// MPEG-2 Current/Next bit field
//
typedef enum
{
MPEG_SECTION_IS_NEXT = 0,
MPEG_SECTION_IS_CURRENT = 1
} MPEG_CURRENT_NEXT_BIT;
//
// MPEG-2 TID Extension structure
//
typedef struct
{
WORD wTidExt;
WORD wCount;
} TID_EXTENSION, *PTID_EXTENSION;
//
// MPEG-2 packet "small" header structure
//
typedef struct
{
TID TableId;
union
{
MPEG_HEADER_BITS_MIDL S;
WORD W;
} Header;
BYTE SectionData[1]; // Array size is Header.S.SectionLength
} SECTION, *PSECTION;
//
// MPEG-2 packet "long" header structure
//
typedef struct
{
TID TableId;
union
{
MPEG_HEADER_BITS_MIDL S;
WORD W;
} Header;
WORD TableIdExtension;
union
{
MPEG_HEADER_VERSION_BITS_MIDL S;
BYTE B;
} Version;
BYTE SectionNumber;
BYTE LastSectionNumber;
BYTE RemainingData[1]; // Array size is Header.S.SectionLength - 5
} LONG_SECTION, *PLONG_SECTION;
//
// DSM-CC packet header structure
//
typedef struct
{
TID TableId;
union
{
MPEG_HEADER_BITS_MIDL S;
WORD W;
} Header;
WORD TableIdExtension;
union
{
MPEG_HEADER_VERSION_BITS_MIDL S;
BYTE B;
} Version;
BYTE SectionNumber;
BYTE LastSectionNumber;
BYTE ProtocolDiscriminator;
BYTE DsmccType;
WORD MessageId;
DWORD TransactionId;
BYTE Reserved;
BYTE AdaptationLength;
WORD MessageLength;
BYTE RemainingData[1];
} DSMCC_SECTION, *PDSMCC_SECTION;
//
// MPEG-2 request/response packets structures
//
typedef struct
{
DWORD dwLength;
PSECTION pSection;
} MPEG_RQST_PACKET, *PMPEG_RQST_PACKET;
typedef struct
{
WORD wPacketCount;
PMPEG_RQST_PACKET PacketList[1]; // Array size is wPacketCount;
} MPEG_PACKET_LIST, *PMPEG_PACKET_LIST;
//
// DSM-CC request filter options
//
typedef struct
{
BOOL fSpecifyProtocol; // If true, Protocol should be set to desired value
BYTE Protocol;
BOOL fSpecifyType; // If true, Type should be set to desired value
BYTE Type;
BOOL fSpecifyMessageId; // If true, MessageId should be set to desired value
WORD MessageId;
BOOL fSpecifyTransactionId; // If true, TransactionId (or DownloadId for DDB msgs) should be set to desired value
BOOL fUseTrxIdMessageIdMask; // If false, TransactionId is filtered as is.
// If true, TransactionId is masked to look
// for any version of message with associated
// message identifier. See DVB - Data
// Broadcasting Guidlines 4.6.5. (Assignment
// and use of transactionId values).
DWORD TransactionId;
BOOL fSpecifyModuleVersion; // If true, ModuleVersion should be set to the desired value
BYTE ModuleVersion;
BOOL fSpecifyBlockNumber; // If true, BlockNumber should be set to desired value
WORD BlockNumber;
BOOL fGetModuleCall; // If true, NumberOfBlocksInModule should be set
WORD NumberOfBlocksInModule;
} DSMCC_FILTER_OPTIONS;
// 45 BYTES
//
// ATSC request filter options
//
typedef struct
{
BOOL fSpecifyEtmId; // If true, EtmId should be set to desired value
DWORD EtmId;
} ATSC_FILTER_OPTIONS;
// 8 BYTES
//
// MPEG-2 request filter structure
//
typedef struct
{
BYTE bVersionNumber; // Must be set to 1 or more to match filter definition
WORD wFilterSize; // Size of total filter structure. Version 1 filter is 73 bytes.
BOOL fUseRawFilteringBits; // If true, Filter and Mask fields should be set to desired value, all other
// fields with be ignored.
BYTE Filter[16]; // Bits with values to compare against for a match.
BYTE Mask[16]; // Bits set to 0 are bits that are compared to those in the filter, those
// bits set to 1 are ignored.
BOOL fSpecifyTableIdExtension; // If true, TableIdExtension should be set to desired value (false = don't care)
WORD TableIdExtension;
BOOL fSpecifyVersion; // If true, Version should be set to desired value (false = don't care)
BYTE Version;
BOOL fSpecifySectionNumber; // If true, SectionNumber should be set to desired value (false = don't care)
BYTE SectionNumber;
BOOL fSpecifyCurrentNext; // If true, fNext should be set to desired value (false = don't care)
BOOL fNext; // If true, next table is queried. Else, current
BOOL fSpecifyDsmccOptions; // If true, Dsmcc should be set with desired filter options
DSMCC_FILTER_OPTIONS Dsmcc;
BOOL fSpecifyAtscOptions; // If true, Atsc should be set with desired filter options
ATSC_FILTER_OPTIONS Atsc;
} MPEG2_FILTER, *PMPEG2_FILTER;
// 124 BYTES
cpp_quote("#define MPEG2_FILTER_VERSION_1_SIZE 124")
//
// Mpeg-2 Stream buffer structure
//
typedef struct
{
HRESULT hr;
DWORD dwDataBufferSize;
DWORD dwSizeOfDataRead;
BYTE * pDataBuffer;
} MPEG_STREAM_BUFFER, *PMPEG_STREAM_BUFFER;
//
// MPEG-2 Time and Date structures
//
typedef struct
{
BYTE Hours; // Legal Range: 0 to 23
BYTE Minutes; // Legal Range: 0 to 59
BYTE Seconds; // Legal Range: 0 to 59
} MPEG_TIME;
typedef MPEG_TIME MPEG_DURATION;
typedef struct
{
BYTE Date; // Legal Range: 1 to 31
BYTE Month; // Legal Range: 1 to 12
WORD Year; // Legal Range: 1900 to 2100
} MPEG_DATE;
typedef struct
{
MPEG_DATE D;
MPEG_TIME T;
} MPEG_DATE_AND_TIME;
//
// MPEG-2 API Context structures
//
typedef enum
{
MPEG_CONTEXT_BCS_DEMUX,
MPEG_CONTEXT_WINSOCK
} MPEG_CONTEXT_TYPE;
typedef struct
{
DWORD AVMGraphId;
} MPEG_BCS_DEMUX;
typedef struct
{
DWORD AVMGraphId;
} MPEG_WINSOCK;
typedef struct
{
MPEG_CONTEXT_TYPE Type;
union
{
MPEG_BCS_DEMUX Demux;
MPEG_WINSOCK Winsock;
} U;
} MPEG_CONTEXT, *PMPEG_CONTEXT;
//
// MPEG-2 Service Request and Responses
//
typedef enum
{
MPEG_RQST_UNKNOWN = 0,
MPEG_RQST_GET_SECTION,
MPEG_RQST_GET_SECTION_ASYNC,
MPEG_RQST_GET_TABLE,
MPEG_RQST_GET_TABLE_ASYNC,
MPEG_RQST_GET_SECTIONS_STREAM,
MPEG_RQST_GET_PES_STREAM,
MPEG_RQST_GET_TS_STREAM,
MPEG_RQST_START_MPE_STREAM,
} MPEG_REQUEST_TYPE;
typedef struct
{
MPEG_REQUEST_TYPE Type;
MPEG_CONTEXT Context;
PID Pid;
TID TableId;
MPEG2_FILTER Filter;
DWORD Flags;
} MPEG_SERVICE_REQUEST, *PMPEG_SERVICE_REQUEST;
typedef struct
{
DWORD IPAddress;
WORD Port;
} MPEG_SERVICE_RESPONSE, *PMPEG_SERVICE_RESPONSE;
//
// DSM-CC & MPE Query Results
//
typedef struct _DSMCC_ELEMENT
{
PID pid;
BYTE bComponentTag;
DWORD dwCarouselId;
DWORD dwTransactionId;
struct _DSMCC_ELEMENT * pNext;
} DSMCC_ELEMENT, *PDSMCC_ELEMENT;
typedef struct _MPE_ELEMENT
{
PID pid;
BYTE bComponentTag;
struct _MPE_ELEMENT * pNext;
} MPE_ELEMENT, *PMPE_ELEMENT;
//
// MPEG-2 Stream Filtering Structure
//
typedef struct _MPEG_STREAM_FILTER
{
WORD wPidValue; // PID value
DWORD dwFilterSize; // size of filter in bits
BOOL fCrcEnabled; // enable/disable CRC check
BYTE rgchFilter[16]; // filter data
BYTE rgchMask[16]; // filter mask
} MPEG_STREAM_FILTER;
|