-
Notifications
You must be signed in to change notification settings - Fork 7
/
atscpsipparser.cs
729 lines (588 loc) · 18.3 KB
/
atscpsipparser.cs
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
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
#region license
/*
DirectShowLib - Provide access to DirectShow interfaces via .NET
Copyright (C) 2007
http://sourceforge.net/projects/directshownet/
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#endregion
using System;
using System.Runtime.InteropServices;
namespace DirectShowLib.BDA
{
#region Declarations
#if ALLOW_UNTESTED_INTERFACES
/// <summary>
/// From ATSC_ETM_LOCATION_*
/// </summary>
public enum AtscEtmLocation
{
NotPresent = 0x00,
InPtcForPsip = 0x01,
InPtcForEvent = 0x02,
Reserved = 0x03,
}
#endif
#endregion
#region Interfaces
#if ALLOW_UNTESTED_INTERFACES
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("B2C98995-5EB2-4fb1-B406-F3E8E2026A9A"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IAtscPsipParser
{
[PreserveSig]
int Initialize([In] IMpeg2Data punkMpeg2Data);
[PreserveSig]
int GetPAT([Out] out IPAT ppPAT);
[PreserveSig]
int GetCAT(
[In] int dwTimeout,
[Out] out ICAT ppCAT
);
[PreserveSig]
int GetPMT(
[In] short pid,
[In] IntPtr pwProgramNumber,
[Out] out IPMT ppPMT
);
[PreserveSig]
int GetTSDT([Out] out ITSDT ppTSDT);
[PreserveSig]
int GetMGT([Out] out IATSC_MGT ppMGT);
[PreserveSig]
int GetVCT(
[In] byte tableId,
[In, MarshalAs(UnmanagedType.Bool)] bool fGetNextTable,
[Out] out IATSC_VCT ppVCT
);
[PreserveSig]
int GetEIT(
[In] short pid,
[In] IntPtr pwSourceId,
[In] int dwTimeout,
[Out] out IATSC_EIT ppEIT
);
[PreserveSig]
int GetETT(
[In] short pid,
[In] IntPtr wSourceId,
[In] IntPtr pwEventId,
[Out] out IATSC_ETT ppETT
);
[PreserveSig]
int GetSTT([Out] out IATSC_STT ppSTT);
[PreserveSig]
int GetEAS(
[In] short pid,
[Out] out ISCTE_EAS ppEAS
);
}
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("8877dabd-c137-4073-97e3-779407a5d87a"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IATSC_MGT
{
[PreserveSig]
int Initialize(
[In] ISectionList pSectionList,
[In] IMpeg2Data pMPEGData
);
[PreserveSig]
int GetVersionNumber([Out] out byte pbVal);
[PreserveSig]
int GetProtocolVersion([Out] out byte pbVal);
[PreserveSig]
int GetCountOfRecords([Out] out int pdwVal);
[PreserveSig]
int GetRecordType(
[In] int dwRecordIndex,
[Out] out short pwVal
);
[PreserveSig]
int GetRecordTypePid(
[In] int dwRecordIndex,
[Out] out short ppidVal
);
[PreserveSig]
int GetRecordVersionNumber(
[In] int dwRecordIndex,
[Out] out byte pbVal
);
[PreserveSig]
int GetRecordCountOfDescriptors(
[In] int dwRecordIndex,
[Out] out int pdwVal
);
[PreserveSig]
int GetRecordDescriptorByIndex(
[In] int dwRecordIndex,
[In] int dwIndex,
[Out] out IGenericDescriptor ppDescriptor
);
[PreserveSig]
int GetRecordDescriptorByTag(
[In] int dwRecordIndex,
[In] byte bTag,
[In, Out] DsInt pdwCookie,
[Out] out IGenericDescriptor ppDescriptor
);
[PreserveSig]
int GetCountOfTableDescriptors([In, Out] ref int pdwVal);
[PreserveSig]
int GetTableDescriptorByIndex(
[In] int dwIndex,
[Out] out IGenericDescriptor ppDescriptor
);
[PreserveSig]
int GetTableDescriptorByTag(
[In] byte bTag,
[In] IntPtr pdwCookie,
[Out] out IGenericDescriptor ppDescriptor
);
}
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("26879a18-32f9-46c6-91f0-fb6479270e8c"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IATSC_VCT
{
[PreserveSig]
int Initialize(
[In] ISectionList pSectionList,
[In] IMpeg2Data pMPEGData
);
[PreserveSig]
int GetVersionNumber([Out] out byte pbVal);
[PreserveSig]
int GetTransportStreamId([Out] out short pwVal);
[PreserveSig]
int GetProtocolVersion([Out] out byte pbVal);
[PreserveSig]
int GetCountOfRecords([Out] out int pdwVal);
[PreserveSig]
int GetRecordName(
[In] int dwRecordIndex,
[Out, MarshalAs(UnmanagedType.LPWStr)] out string pwsName);
[PreserveSig]
int GetRecordMajorChannelNumber(
[In] int dwRecordIndex,
[Out] out short pwVal
);
[PreserveSig]
int GetRecordMinorChannelNumber(
[In] int dwRecordIndex,
[Out] out short pwVal
);
[PreserveSig]
int GetRecordModulationMode(
[In] int dwRecordIndex,
[Out] out byte pbVal
);
[PreserveSig]
int GetRecordCarrierFrequency(
[In] int dwRecordIndex,
[Out] out int pdwVal
);
[PreserveSig]
int GetRecordTransportStreamId(
[In] int dwRecordIndex,
[Out] out short pwVal
);
[PreserveSig]
int GetRecordProgramNumber(
[In] int dwRecordIndex,
[Out] out short pwVal
);
[PreserveSig]
int GetRecordEtmLocation(
[In] int dwRecordIndex,
[Out] out byte pbVal
);
[PreserveSig]
int GetRecordIsAccessControlledBitSet(
[In] int dwRecordIndex,
[Out, MarshalAs(UnmanagedType.Bool)] out bool pfVal
);
[PreserveSig]
int GetRecordIsHiddenBitSet(
[In] int dwRecordIndex,
[Out, MarshalAs(UnmanagedType.Bool)] out bool pfVal
);
[PreserveSig]
int GetRecordIsPathSelectBitSet(
[In] int dwRecordIndex,
[Out, MarshalAs(UnmanagedType.Bool)] out bool pfVal
);
[PreserveSig]
int GetRecordIsOutOfBandBitSet(
[In] int dwRecordIndex,
[Out, MarshalAs(UnmanagedType.Bool)] out bool pfVal
);
[PreserveSig]
int GetRecordIsHideGuideBitSet(
[In] int dwRecordIndex,
[Out, MarshalAs(UnmanagedType.Bool)] out bool pfVal
);
[PreserveSig]
int GetRecordServiceType(
[In] int dwRecordIndex,
[Out] out byte pbVal
);
[PreserveSig]
int GetRecordSourceId(
[In] int dwRecordIndex,
[Out] out short pwVal
);
[PreserveSig]
int GetRecordCountOfDescriptors(
[In] int dwRecordIndex,
[Out] out int pdwVal
);
[PreserveSig]
int GetRecordDescriptorByIndex(
[In] int dwRecordIndex,
[In] int dwIndex,
[Out] out IGenericDescriptor ppDescriptor
);
[PreserveSig]
int GetRecordDescriptorByTag(
[In] int dwRecordIndex,
[In] byte bTag,
[In, Out] DsInt pdwCookie,
[Out] out IGenericDescriptor ppDescriptor
);
[PreserveSig]
int GetCountOfTableDescriptors([In, Out] ref int pdwVal);
[PreserveSig]
int GetTableDescriptorByIndex(
[In] int dwIndex,
[Out] out IGenericDescriptor ppDescriptor
);
[PreserveSig]
int GetTableDescriptorByTag(
[In] byte bTag,
[In] IntPtr pdwCookie,
[Out] out IGenericDescriptor ppDescriptor
);
}
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("d7c212d7-76a2-4b4b-aa56-846879a80096"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IATSC_EIT
{
[PreserveSig]
int Initialize(
[In] ISectionList pSectionList,
[In] IMpeg2Data pMPEGData
);
[PreserveSig]
int GetVersionNumber([Out] out byte pbVal);
[PreserveSig]
int GetSourceId([Out] out short pwVal);
[PreserveSig]
int GetProtocolVersion([Out] out byte pbVal);
[PreserveSig]
int GetCountOfRecords([Out] out int pdwVal);
[PreserveSig]
int GetRecordEventId(
[In] int dwRecordIndex,
[Out] out short pwVal
);
[PreserveSig]
int GetRecordStartTime(
[In] int dwRecordIndex,
[Out] out MpegDateAndTime pmdtVal
);
[PreserveSig]
int GetRecordEtmLocation(
[In] int dwRecordIndex,
[Out] out byte pbVal
);
[PreserveSig]
int GetRecordDuration(
[In] int dwRecordIndex,
[Out] out MpegDuration pmdVal
);
[PreserveSig]
int GetRecordTitleText(
[In] int dwRecordIndex,
[Out] out int pdwLength,
[Out] out IntPtr ppText
);
[PreserveSig]
int GetRecordCountOfDescriptors(
[In] int dwRecordIndex,
[Out] out int pdwVal
);
[PreserveSig]
int GetRecordDescriptorByIndex(
[In] int dwRecordIndex,
[In] int dwIndex,
[Out] out IGenericDescriptor ppDescriptor
);
[PreserveSig]
int GetRecordDescriptorByTag(
[In] int dwRecordIndex,
[In] byte bTag,
[In, Out] DsInt pdwCookie,
[Out] out IGenericDescriptor ppDescriptor
);
}
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("5a142cc9-b8cf-4a86-a040-e9cadf3ef3e7"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IATSC_ETT
{
[PreserveSig]
int Initialize(
[In] ISectionList pSectionList,
[In] IMpeg2Data pMPEGData
);
[PreserveSig]
int GetVersionNumber([Out] out byte pbVal);
[PreserveSig]
int GetProtocolVersion([Out] out byte pbVal);
[PreserveSig]
int GetEtmId([Out] out int pdwVal);
int GetExtendedMessageText(
[Out] out int pdwLength,
[Out] out IntPtr ppText
);
}
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("6bf42423-217d-4d6f-81e1-3a7b360ec896"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IATSC_STT
{
[PreserveSig]
int Initialize(
[In] ISectionList pSectionList,
[In] IMpeg2Data pMPEGData
);
[PreserveSig]
int GetProtocolVersion([Out] out byte pbVal);
[PreserveSig]
int GetSystemTime([Out] out MpegDateAndTime pmdtSystemTime);
[PreserveSig]
int GetGpsUtcOffset([Out] out byte pbVal);
[PreserveSig]
int GetDaylightSavings([Out] out short pwVal);
[PreserveSig]
int GetCountOfTableDescriptors([Out] out int pdwVal);
[PreserveSig]
int GetTableDescriptorByIndex(
[In] int dwIndex,
[Out] out IGenericDescriptor ppDescriptor
);
[PreserveSig]
int GetTableDescriptorByTag(
[In] byte bTag,
[In] IntPtr pdwCookie,
[Out] out IGenericDescriptor ppDescriptor
);
}
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("1FF544D6-161D-4fae-9FAA-4F9F492AE999"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ISCTE_EAS
{
[PreserveSig]
int Initialize(
[In] ISectionList pSectionList,
[In] IMpeg2Data pMPEGData
);
[PreserveSig]
int GetVersionNumber([Out] out byte pbVal);
[PreserveSig]
int GetSequencyNumber([Out] out byte pbVal);
[PreserveSig]
int GetProtocolVersion([Out] out byte pbVal);
[PreserveSig]
int GetEASEventID([Out] out short pwVal);
[PreserveSig]
int GetOriginatorCode([Out] out byte pbVal);
[PreserveSig]
int GetEASEventCodeLen([Out] out byte pbVal);
[PreserveSig]
int GetEASEventCode([Out] out byte pbVal);
[PreserveSig]
int GetRawNatureOfActivationTextLen([Out] out byte pbVal);
[PreserveSig]
int GetRawNatureOfActivationText([Out] out byte pbVal);
[PreserveSig]
int GetNatureOfActivationText(
[In, MarshalAs(UnmanagedType.BStr)] string bstrIS0639code,
[Out, MarshalAs(UnmanagedType.BStr)] out string pbstrString
);
[PreserveSig]
int GetTimeRemaining([Out] out byte pbVal);
[PreserveSig]
int GetStartTime([Out] out int pdwVal);
[PreserveSig]
int GetDuration([Out] out short pwVal);
[PreserveSig]
int GetAlertPriority([Out] out byte pbVal);
[PreserveSig]
int GetDetailsOOBSourceID([Out] out short pwVal);
[PreserveSig]
int GetDetailsMajor([Out] out short pwVal);
[PreserveSig]
int GetDetailsMinor([Out] out short pwVal);
[PreserveSig]
int GetDetailsAudioOOBSourceID([Out] out short pwVal);
[PreserveSig]
int GetAlertText(
[In, MarshalAs(UnmanagedType.BStr)] string bstrIS0639code,
[Out, MarshalAs(UnmanagedType.BStr)] out string pbstrString
);
[PreserveSig]
int GetRawAlertTextLen([Out] out short pwVal);
[PreserveSig]
int GetRawAlertText([Out] out byte pbVal);
[PreserveSig]
int GetLocationCount([Out] out byte pbVal);
[PreserveSig]
int GetLocationCodes(
[In] byte bIndex,
[Out] out byte pbState,
[Out] out byte pbCountySubdivision,
[Out] out short pwCounty
);
[PreserveSig]
int GetExceptionCount([Out] out byte pbVal);
[PreserveSig]
int GetExceptionService(
[In] byte bIndex,
[Out] out byte pbIBRef,
[Out] out byte pwFirst,
[Out] out short pwSecond
);
[PreserveSig]
int GetCountOfTableDescriptors([Out] out int pdwVal);
[PreserveSig]
int GetTableDescriptorByIndex(
[In] int dwIndex,
[Out] out IGenericDescriptor ppDescriptor
);
[PreserveSig]
int GetTableDescriptorByTag(
[In] byte bTag,
[In] IntPtr pdwCookie,
[Out] out IGenericDescriptor ppDescriptor
);
}
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("FF76E60C-0283-43ea-BA32-B422238547EE"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IAtscContentAdvisoryDescriptor
{
[PreserveSig]
int GetTag([Out] out byte pbVal);
[PreserveSig]
int GetLength([Out] out byte pbVal);
[PreserveSig]
int GetRatingRegionCount([Out] out byte pbVal);
[PreserveSig]
int GetRecordRatingRegion(
[In] byte bIndex,
[Out] out byte pbVal
);
[PreserveSig]
int GetRecordRatedDimensions(
[In] byte bIndex,
[Out] out byte pbVal
);
[PreserveSig]
int GetRecordRatingDimension(
[In] byte bIndexOuter,
[In] byte bIndexInner,
[Out] out byte pbVal
);
[PreserveSig]
int GetRecordRatingValue(
[In] byte bIndexOuter,
[In] byte bIndexInner,
[Out] out byte pbVal
);
[PreserveSig]
int GetRecordRatingDescriptionText(
[In] byte bIndex,
[Out] out byte pbLength,
[Out] out IntPtr ppText
);
}
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("40834007-6834-46f0-BD45-D5F6A6BE258C"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ICaptionServiceDescriptor
{
[PreserveSig]
int GetNumberOfServices([Out] out byte pbVal);
[PreserveSig]
int GetLanguageCode(
[In] byte bIndex,
[Out] out int LangCode // probably a byte[3]
);
[PreserveSig]
int GetCaptionServiceNumber(
[In] byte bIndex,
[Out] out byte pbVal
);
[PreserveSig]
int GetCCType(
[In] byte bIndex,
[Out] out byte pbVal
);
[PreserveSig]
int GetEasyReader(
[In] byte bIndex,
[Out] out byte pbVal
);
[PreserveSig]
int GetWideAspectRatio(
[In] byte bIndex,
[Out] out byte pbVal
);
}
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("58C3C827-9D91-4215-BFF3-820A49F0904C"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IServiceLocationDescriptor
{
[PreserveSig]
int GetPCR_PID(
out short pwVal
);
[PreserveSig]
int GetNumberOfElements(
out byte pbVal
);
[PreserveSig]
int GetElementStreamType(
byte bIndex,
out byte pbVal
);
[PreserveSig]
int GetElementPID(
byte bIndex,
out short pwVal
);
[PreserveSig]
int GetElementLanguageCode(
byte bIndex,
[MarshalAs(UnmanagedType.LPArray, SizeConst=3)] out byte[] LangCode
);
};
#endif
#endregion
}