/// <summary> /// Create a PMT for the program. /// </summary> /// <remarks> /// There will be a lot of randomly choosen values just to make the transport /// stream valid. Each audio stream will be reported as <i>german</i> and /// similiar defaults are attached to a teletext stream. /// </remarks> /// <returns>The table describing the related program.</returns> protected override byte[] CreateTable() { // Create buffer TableConstructor buffer = new TableConstructor(); // Append to buffer buffer.Add((byte)(0xe0 | (PCRPID / 256))); buffer.Add((byte)(PCRPID & 0xff)); buffer.Add(0xf0, 0x00); // All entries for (int ip = 0; ip < m_Streams.Count;) { // Load short pid = m_Streams[ip++]; StreamTypes type = m_Type[pid]; // Is teletext or audio bool ttx = (StreamTypes.TeleText == type); bool sub = !ttx && (StreamTypes.SubTitles == type); bool ac3 = !ttx && !sub && (StreamTypes.Private == type); bool aud = ac3 || (!ttx && !sub && (StreamTypes.Audio == type)); // Append to buffer buffer.Add((ttx || sub) ? (byte)StreamTypes.Private : m_Encoding[pid]); buffer.Add((byte)(0xe0 | (pid / 256))); buffer.Add((byte)(pid & 0xff)); buffer.Add(0xf0); // Length int lengthPos = buffer.CreateDynamicLength(); // Create stream identifier buffer.Add(new StreamIdentifier((byte)ip)); // Check for additional data if (ttx) { // Create teletext descriptor buffer.Add(new Teletext()); } else if (sub) { // Load descriptor list SubtitleInfo[] subInfos = DVBSubtitles[pid]; // Create the descriptor Subtitle subDescr = new Subtitle(); // Check mode if ((null == subInfos) || (subInfos.Length < 1)) { // Create a brand new pseudo entry subDescr.Subtitles.Add(new SubtitleInfo("deu", EPG.SubtitleTypes.DVBNormal, 1, 1)); } else { // Use as is subDescr.Subtitles.AddRange(subInfos); } // Serialize to buffer buffer.Add(subDescr); } else if (aud) { // Load language string language; if (!m_AudioNames.TryGetValue(pid, out language)) { language = "deu"; } // Create language descriptor ISOLanguage audioDescriptor = new ISOLanguage(); // Append language item audioDescriptor.Languages.Add(new LanguageItem(language, ac3 ? EPG.AudioTypes.Undefined : EPG.AudioTypes.CleanEffects)); // Append to buffer buffer.Add(audioDescriptor); // Fill AC3 descriptor if (ac3) { buffer.Add(new AC3()); } } // Finish buffer.SetDynamicLength(lengthPos); } // Report return(buffer.ToArray()); }
/// <summary> /// Takes an prepopulated IDataReader and creates an array of ISOLanguages /// </summary> public static List<ISOLanguage> PopulateObjectWithJoin(IDataReader dr) { ColumnFieldList list = new ColumnFieldList(dr); List<ISOLanguage> arr = new List<ISOLanguage>(); ISOLanguage obj; while (dr.Read()) { obj = new ISOLanguage(); if (list.IsColumnPresent("ISOLanguageID")) { obj._iSOLanguageID = (int)dr["ISOLanguageID"]; } if (list.IsColumnPresent("ISO639_1")) { obj._iSO639_1 = (string)dr["ISO639_1"]; } if (list.IsColumnPresent("ISO639_2")) { obj._iSO639_2 = (string)dr["ISO639_2"]; } if (list.IsColumnPresent("ISO639_3")) { obj._iSO639_3 = (string)dr["ISO639_3"]; } if (list.IsColumnPresent("Name")) { obj._name = (string)dr["Name"]; } arr.Add(obj); } dr.Close(); return arr; }