/// <summary> /// Returns a section list for the entire specified table. Caller must dispose the resulting ISectionList /// </summary> /// <param name="PID">program ID</param> /// <param name="TID">table ID</param> /// <returns>returns the section list neccesary to read the whole table</returns> private ISectionList GetTableSectionList(short PID, byte TID) { ISectionList sectionList = null; int hr = mpeg2Data.GetTable(PID, TID, null, Parser.Timeout, out sectionList); DsError.ThrowExceptionForHR(hr); return(sectionList); }
public static PSISection[] GetPSITable(int pid, int tableId, IMpeg2Data mpeg2Data) { ArrayList al = new ArrayList(); ISectionList ppSectionList; int hr = mpeg2Data.GetTable((short)pid, (byte)tableId, null, 5000, out ppSectionList); if (ppSectionList != null) { short pidFound = -1; ppSectionList.GetProgramIdentifier(out pidFound); if (pidFound == (short)pid) { byte tableIdFound = 0; ppSectionList.GetTableIdentifier(out tableIdFound); if (tableIdFound == (byte)tableId) { short sectionCount = -1; ppSectionList.GetNumberOfSections(out sectionCount); short sectionNumber = 0; for (sectionNumber = 0; sectionNumber < sectionCount; sectionNumber++) { try { int pdwRawPacketLength; IntPtr ppSection; ppSectionList.GetSectionData(sectionNumber, out pdwRawPacketLength, out ppSection); byte[] data = new byte[pdwRawPacketLength]; Marshal.Copy(ppSection, data, 0, pdwRawPacketLength); PSISection table = ParseTable(tableId, data); Marshal.ReleaseComObject(ppSectionList); al.Add(table); } catch { } } } } Marshal.ReleaseComObject(ppSectionList); } return((PSISection[])al.ToArray(typeof(PSISection))); }
private void BuildSinkGraph(ITuningSpace tuningSpace) { this.graphBuilder = (IFilterGraph2) new FilterGraph(); this.rot = new DsROTEntry(this.graphBuilder); this.epg = new EPG(this.hostingControl); this.cookiesSink = this.hostingControl.SubscribeEvents(this as VideoControl.IVideoEventHandler, this.graphBuilder as IMediaEventEx); AddNetworkProviderFilter(this.objTuningSpace); AddMPEG2DemuxFilter(); AddMpeg2VideoStreamAnalyzerFilter(); CreateMPEG2DemuxPins(); AddAndConnectBDABoardFilters(); if (this.tuner == null && this.capture == null) { throw new ApplicationException("No BDA devices found!"); } if (this.H264DecoderDevice != null || !isH264ElecardSpecialMode) { //+++ This order is to avoid a bug from the DirectShow AddAndConnectSectionsAndTablesFilterToGraph(); IMpeg2Data mpeg2Data = this.bdaSecTab as IMpeg2Data; ISectionList ppSectionList; int hr2 = mpeg2Data.GetTable(0, 0, null, 0, out ppSectionList); AddAndConnectTIFToGraph(); //--- } ConfigureTimeShiftingRegistry(); AddStreamBufferSinkFilter(); ConnectStreamBufferSinkFilter(); this.epg.RegisterEvent(TransportInformationFilter as IConnectionPointContainer); }
private void TestGetTable() { int hr; ISectionList sectionList; 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.GetTable(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"); Marshal.ReleaseComObject(sectionList); } }
public static PSISection[] GetPSITable(int pid, int tableId, IMpeg2Data mpeg2Data) { ArrayList al = new ArrayList(); ISectionList ppSectionList; int hr = mpeg2Data.GetTable((short)pid, (byte)tableId, null, 5000, out ppSectionList); if (ppSectionList != null) { short pidFound = -1; ppSectionList.GetProgramIdentifier(out pidFound); if (pidFound == (short)pid) { byte tableIdFound = 0; ppSectionList.GetTableIdentifier(out tableIdFound); if (tableIdFound == (byte)tableId) { short sectionCount = -1; ppSectionList.GetNumberOfSections(out sectionCount); short sectionNumber = 0; for (; sectionNumber < sectionCount; sectionNumber++) { int pdwRawPacketLength; IntPtr ppSection; ppSectionList.GetSectionData(sectionNumber, out pdwRawPacketLength, out ppSection); byte[] data = new byte[pdwRawPacketLength]; Marshal.Copy(ppSection, data, 0, pdwRawPacketLength); PSISection table = ParseTable(tableId, data); Marshal.ReleaseComObject(ppSectionList); al.Add(table); } } } Marshal.ReleaseComObject(ppSectionList); } return (PSISection[])al.ToArray(typeof(PSISection)); }