private void TestGetSection() { int hr; short PID = 0x12; // is the PID of a Event Information Table (EIT) byte TID = 0x4e; // is the TID for event_information_section - actual_transport_stream, present/following MPEG2Filter mpeg2Filter = new MPEG2Filter(); mpeg2Filter.bVersionNumber = 1; mpeg2Filter.wFilterSize = 124; // MPEG2_FILTER_VERSION_1_SIZE = Marshal.SizeOf(mpeg2Filter) = 124; hr = mpeg2Data.GetSection(PID, TID, mpeg2Filter, 10 * 1000, out sectionList); if (hr != unchecked ((int)0x80040206)) //MPEG2_E_SECTION_NOT_FOUND { DsError.ThrowExceptionForHR(hr); Debug.Assert((hr == 0) && (sectionList != null), "IMpeg2Data.GetStreamOfSections"); TestISectionList(); Marshal.ReleaseComObject(sectionList); } }
// Tests for IMpeg2Data methods private void TestGetStreamOfSection() { int hr; ManualResetEvent mre = new ManualResetEvent(false); short PID = 0x12; // is the PID of a Event Information Table (EIT) byte TID = 0x4e; // is the TID for event_information_section - actual_transport_stream, present/following //short NID = 1; // 1 is the Network ID of the broadcast selectionned MPEG2Filter mpeg2Filter = new MPEG2Filter(); mpeg2Filter.bVersionNumber = 1; mpeg2Filter.wFilterSize = 124; // MPEG2_FILTER_VERSION_1_SIZE = Marshal.SizeOf(mpeg2Filter) = 124; //mpeg2Filter.fSpecifyTableIdExtension = true; //mpeg2Filter.TableIdExtension = NID; hr = mpeg2Data.GetStreamOfSections(PID, TID, mpeg2Filter, mre.SafeWaitHandle.DangerousGetHandle(), out mpeg2Stream); DsError.ThrowExceptionForHR(hr); Debug.Assert((hr == 0) && (mpeg2Stream != null), "IMpeg2Data.GetStreamOfSections"); TestIMpeg2Stream(); Marshal.ReleaseComObject(mpeg2Stream); }