private void processChannelSections(Collection <Mpeg2Section> sections) { foreach (Mpeg2Section section in sections) { if (RunParameters.Instance.TraceIDs.Contains("DUMPCHANNELSECTIONS")) { Logger.Instance.Dump("Channel Section", section.Data, section.Length); } MediaHighway1ChannelSection channelSection = MediaHighway1ChannelSection.ProcessMediaHighwayChannelTable(section.Data); if (channelSection != null) { if (channelSection.Channels != null) { foreach (MediaHighwayChannelInfoEntry channelInfoEntry in channelSection.Channels) { MediaHighwayChannel channel = new MediaHighwayChannel(); channel.ChannelID = channelSection.Channels.IndexOf(channelInfoEntry) + 1; channel.OriginalNetworkID = channelInfoEntry.OriginalNetworkID; channel.TransportStreamID = channelInfoEntry.TransportStreamID; channel.ServiceID = channelInfoEntry.ServiceID; channel.ChannelName = channelInfoEntry.Name; channel.UserChannel = Channel.Channels.Count + 1; Channel.AddChannel(channel); } } } } }
/// <summary> /// Process an MPEG2 section from the Open TV Title table. /// </summary> /// <param name="byteData">The MPEG2 section.</param> public static MediaHighway1ChannelSection ProcessMediaHighwayChannelTable(byte[] byteData) { Mpeg2BasicHeader mpeg2Header = new Mpeg2BasicHeader(); try { mpeg2Header.Process(byteData); MediaHighway1ChannelSection channelSection = new MediaHighway1ChannelSection(); channelSection.Process(byteData, mpeg2Header.Index); channelSection.LogMessage(); return(channelSection); } catch (ArgumentOutOfRangeException e) { Logger.Instance.Write("<e> Channel section parsing failed: " + e.Message); return(null); } }
/// <summary> /// Process an MPEG2 section from the Open TV Title table. /// </summary> /// <param name="byteData">The MPEG2 section.</param> public static MediaHighway1ChannelSection ProcessMediaHighwayChannelTable(byte[] byteData) { Mpeg2BasicHeader mpeg2Header = new Mpeg2BasicHeader(); try { mpeg2Header.Process(byteData); MediaHighway1ChannelSection channelSection = new MediaHighway1ChannelSection(); channelSection.Process(byteData, mpeg2Header.Index); channelSection.LogMessage(); return (channelSection); } catch (ArgumentOutOfRangeException e) { Logger.Instance.Write("<e> Channel section parsing failed: " + e.Message); return (null); } }