/// <summary> /// Create a new program instance. /// </summary> /// <param name="table">The related <see cref="Tables.PMT"/> table.</param> /// <param name="offset">The first byte of this program in the <see cref="EPG.Table.Section"/> /// for the related <see cref="Table"/>.</param> /// <param name="length">The maximum number of bytes available. If this number /// is greater than the <see cref="Length"/> of this program another event will /// follow in the same table.</param> internal ProgramEntry(Table table, int offset, int length) : base(table) { // Access section Section section = Section; // Load ElementaryPID = (ushort)(0x1fff & Tools.MergeBytesToWord(section[offset + 2], section[offset + 1])); StreamType = (StreamTypes)section[offset + 0]; // Read the length int descrLength = 0xfff & Tools.MergeBytesToWord(section[offset + 4], section[offset + 3]); // Caluclate the total length Length = 5 + descrLength; // Verify if (Length > length) { return; } // Try to load descriptors Descriptors = Descriptor.Load(this, offset + 5, descrLength); // Can use it IsValid = true; }
/// <summary> /// Erzeugt eine neue Verwaltung. /// </summary> /// <param name="hardware">Das zu verwendende DVB.NET Gerät.</param> /// <param name="pid">Die gewünschte Datenstromkennung.</param> /// <param name="type">Die Art des Datenstroms.</param> /// <param name="name">Der Name dieses Eintrags.</param> /// <param name="videoType">Gesetzt, wenn es sich um ein HDTV Bildsignal handelt. Ist der /// Datenstrom kein Bildsignal, so wird <i>null</i> verwendet.</param> public StreamItem( Hardware hardware, ushort pid, StreamTypes type, string name, bool? videoType ) : base( string.Format( "{0} ({1})", name, pid ) ) { // Create rate indicator SubItems.Add( "?" ); SubItems.Add( string.Empty ); // Reset m_Total = (long) 0; // Remember m_Hardware = hardware; // Register m_ConsumerId = m_Hardware.AddConsumer( pid, type, OnData ); // Create decoder if (videoType.HasValue) if (videoType.Value) m_StreamDecoder = new HDTVStream( this, 512, true ); else m_StreamDecoder = new VideoStream( this, 512, true ); // Start it m_Hardware.SetConsumerState( m_ConsumerId, true ); }
/// <summary> /// Create a new program instance. /// </summary> /// <param name="table">The related <see cref="Tables.PMT"/> table.</param> /// <param name="offset">The first byte of this program in the <see cref="EPG.Table.Section"/> /// for the related <see cref="Table"/>.</param> /// <param name="length">The maximum number of bytes available. If this number /// is greater than the <see cref="Length"/> of this program another event will /// follow in the same table.</param> internal ProgramEntry(Table table, int offset, int length) : base(table) { // Access section Section section = Section; // Load ElementaryPID = (ushort)(0x1fff & Tools.MergeBytesToWord(section[offset + 2], section[offset + 1])); StreamType = (StreamTypes)section[offset + 0]; // Read the length int descrLength = 0xfff & Tools.MergeBytesToWord(section[offset + 4], section[offset + 3]); // Caluclate the total length Length = 5 + descrLength; // Verify if ( Length > length ) return; // Try to load descriptors Descriptors = Descriptor.Load(this, offset + 5, descrLength); // Can use it IsValid = true; }
/// <summary> /// Erzeugt eine neue Verwaltung. /// </summary> /// <param name="hardware">Das zu verwendende DVB.NET Gerät.</param> /// <param name="pid">Die gewünschte Datenstromkennung.</param> /// <param name="type">Die Art des Datenstroms.</param> /// <param name="name">Der Name dieses Eintrags.</param> /// <param name="videoType">Gesetzt, wenn es sich um ein HDTV Bildsignal handelt. Ist der /// Datenstrom kein Bildsignal, so wird <i>null</i> verwendet.</param> public StreamItem(Hardware hardware, ushort pid, StreamTypes type, string name, bool?videoType) : base(string.Format("{0} ({1})", name, pid)) { // Create rate indicator SubItems.Add("?"); SubItems.Add(string.Empty); // Reset m_Total = (long)0; // Remember m_Hardware = hardware; // Register m_ConsumerId = m_Hardware.AddConsumer(pid, type, OnData); // Create decoder if (videoType.HasValue) { if (videoType.Value) { m_StreamDecoder = new HDTVStream(this, 512, true); } else { m_StreamDecoder = new VideoStream(this, 512, true); } } // Start it m_Hardware.SetConsumerState(m_ConsumerId, true); }
public SocksRequest(StreamTypes type, AddressType addrtype, string address, int port) { Type = addrtype; StreamType = type; Address = address; Port = port; }
public SocksRequest(StreamTypes type, AddressType addrtype, string address, int port) { Type = addrtype; StreamType = type; Address = address; Port = port; Error = SocksError.Granted; IPAddress p = this.IP; //get Error on the stack. }
/// <summary> /// Create a new PES packet manager. /// </summary> /// <param name="other">Template manager.</param> public Packet(Packet other) : this(other.m_Manager, other.PID) { // Clone the type m_Video = other.m_Video; // Copy flags IgnorePTS = other.IgnorePTS; }
public IEnumerable <Status> ResultStream(StreamTypes type = StreamTypes.Tracker, int maxResets = 5) { Status tweet = null; IEnumerator <Status> tweetEnumerator = null; while (StreamResetAttempts <= maxResets) { try { if (tweetEnumerator == null) { tweetEnumerator = type == StreamTypes.Tracker ? TrackerStream(track).GetEnumerator() : UserStream().GetEnumerator(); } tweetEnumerator.MoveNext(); tweet = tweetEnumerator.Current; if (tweet == null) { throw new Exception("Null Tweet"); } } catch (Exception ex) { if (tweetEnumerator != null) { tweetEnumerator.Dispose(); } if (log != null) { log.WriteLine("{0}: Error: {1}", DateTime.Now, ex.ToString()); } if (StreamResetAttempts >= maxResets) { throw new Exception("Max Reset Attempts Reached!"); } else { StreamResetAttempts++; if (log != null) { log.WriteLine("{0}: Sleeping for {1} seconds before next attempt.", DateTime.Now, StreamResetAttempts * 2); } Thread.Sleep(2000 * StreamResetAttempts); } } yield return(tweet); } }
public void AddLogRecord(StreamTypes streamType, ChannelStreamTypes channelStreamType, string info) { if (!isWritingConnectionLog) { return; } string typeOfData = string.Empty; switch (channelStreamType) { case ChannelStreamTypes.MainVideo: case ChannelStreamTypes.AlternativeVideo: typeOfData = "видео"; break; case ChannelStreamTypes.MainSound: case ChannelStreamTypes.AlternativeSound: typeOfData = "звук"; break; case ChannelStreamTypes.MotionDetection: typeOfData = "детектор движения"; break; } string streamTypeName = string.Empty; if (streamType == StreamTypes.Main) { streamTypeName = "основной поток"; } else { streamTypeName = "альтернативный поток"; } string str = string.Format("[{0}, {1}, {2}] {3}", DateTime.Now.ToLongTimeString(), typeOfData, streamTypeName, info); lock (connectionLog) { connectionLog.Add(str); if (connectionLog.Count > maxLinesInConnectionLog) { connectionLog.RemoveAt(0); } } //уведомляем хоста о том, что содержимое лога изменилось NewLogRecord(this, new EventArgs()); }
/// <summary> /// Erzeugt eine neue Dateninstanz. /// </summary> /// <param name="stream">Die eindeutige Nummer (PID) des Datenstroms.</param> /// <param name="type">Die Art der Daten zu diesem Datenstrom.</param> /// <param name="callback">Die Methode, die beim Eintreffen von Daten aktiviert werden soll.</param> /// <param name="primaryIdentifier">Die eindeutige Kennung der ersten Registrierung eines Verbrauchers.</param> public StreamInformation(ushort stream, StreamTypes type, Action <byte[], int, int> callback, out Guid primaryIdentifier) { // Register consumer m_Consumers = new[] { new StreamRegistration(callback) }; // Report generated identifier primaryIdentifier = m_Consumers[0].UniqueIdentifier; // Remember Consumer = Dispatcher; Identifier = stream; StreamType = type; }
/// <summary> /// Meldet einen Verbraucher für den Inhalt eines bestimmten Datenstroms an. /// <seealso cref="SetConsumerState"/> /// </summary> /// <param name="stream">Die eindeutige Nummer (PID) des Datenstroms in der aktiven /// <see cref="SourceGroup"/>.</param> /// <param name="type">Die Art der Daten im Datenstrom.</param> /// <param name="consumer">Der Empfänger für die Nutzdaten. Die Angabe von <i>null</i> /// wird zur Abmeldung verwendet.</param> /// <returns>Die eindeutige Kennung des neuen Verbrauchers. Diese Kennung wird benutzt, um /// den Datenempfang zu aktivieren, deaktivieren oder den Verbraucher wieder abzumelden.</returns> public Guid AddConsumer(ushort stream, StreamTypes type, Action <byte[], int, int> consumer) { // Report if (ConsumerTraceSwitch.Enabled) { Trace.WriteLine(string.Format(Properties.Resources.Trace_Consumer_Register, stream, type), ConsumerTraceSwitch.DisplayName); } // Unique identifier of the new registration Guid consumerId; // Must synchronize lock (InstanceSynchronizer) { // Load the stream information StreamInformation info; if (m_streamsByPID.TryGetValue(stream, out info)) { // Report if (ConsumerTraceSwitch.Enabled) { Trace.WriteLine(Properties.Resources.Trace_Consumer_RegisterReuse, ConsumerTraceSwitch.DisplayName); } // Just add to existing registration consumerId = info.AddConsumer(consumer); } else { // Create a brand new one info = new StreamInformation(stream, type, consumer, out consumerId); // Remember it m_streamsByPID[stream] = info; } // Add to lookup map m_streamsById[consumerId] = info; } // Report if (ConsumerTraceSwitch.Enabled) { Trace.WriteLine(string.Format(Properties.Resources.Trace_Consumer_Identifier, consumerId), ConsumerTraceSwitch.DisplayName); } // Done return(consumerId); }
public IEnumerable<Status> ResultStream(StreamTypes type = StreamTypes.Tracker, int maxResets = 5) { Status tweet = null; IEnumerator<Status> tweetEnumerator = null; while (StreamResetAttempts <= maxResets) { try { if(tweetEnumerator == null) tweetEnumerator = type == StreamTypes.Tracker ? TrackerStream(track).GetEnumerator() : UserStream().GetEnumerator(); tweetEnumerator.MoveNext(); tweet = tweetEnumerator.Current; if (tweet == null) throw new Exception("Null Tweet"); } catch (Exception ex) { if (tweetEnumerator != null) tweetEnumerator.Dispose(); if (log != null) log.WriteLine("{0}: Error: {1}", DateTime.Now, ex.ToString()); if (StreamResetAttempts >= maxResets) throw new Exception("Max Reset Attempts Reached!"); else { StreamResetAttempts++; if (log != null) log.WriteLine("{0}: Sleeping for {1} seconds before next attempt.", DateTime.Now, StreamResetAttempts * 2); Thread.Sleep(2000 * StreamResetAttempts); } } yield return tweet; } }
private string StreamTypeToString(StreamTypes value) { switch (value) { case StreamTypes.MPEG2Video: return("MPEG-2 Video"); case StreamTypes.MPEG1LayerIIAudio: return("MPEG-1 Layer II Audio"); case StreamTypes.AC3Audio: return("Dolby AC-3 Audio"); case StreamTypes.DVBSubtitle: return("DVB Subtitle"); case StreamTypes.MPEG1Video: return("MPEG-1 Video"); } return("Undefined"); }
public StreamListItem(string fileName) : base() { streamType = FileNameToType(fileName); Text = StreamTypeToString(streamType); TransportMux.AC3Stream ac3Stream = null; TransportMux.MPEG2VideoStream mpeg2VideoStream = null; TransportMux.SubtitleStream subtitleStream = null; TransportMux.MPEGAudioStream mpegAudioStream = null; switch (streamType) { case StreamTypes.AC3Audio: ac3Stream = new TransportMux.AC3Stream(fileName); InputStream = ac3Stream; bitRate = ac3Stream.BitRate * 1000; break; case StreamTypes.MPEG2Video: mpeg2VideoStream = new TransportMux.MPEG2VideoStream(fileName); if (!mpeg2VideoStream.SequenceExtensionPresent) { Text = StreamTypeToString(StreamTypes.MPEG1Video); } InputStream = mpeg2VideoStream; bitRate = DetectMPEGBitRate(fileName); break; case StreamTypes.MPEG1LayerIIAudio: mpegAudioStream = new TransportMux.MPEGAudioStream(fileName); InputStream = mpegAudioStream; bitRate = (uint)mpegAudioStream.BitRate * 1000; break; case StreamTypes.DVBSubtitle: subtitleStream = new TransportMux.SubtitleStream(fileName); InputStream = subtitleStream; bitRate = 192000; break; case StreamTypes.Undefined: throw new Exception("unknown stream type encountered"); } SubItems.Add("0x000"); SubItems.Add("Unknown"); SubItems.Add(bitRate.ToString()); SubItems.Add(""); if (streamType == StreamTypes.MPEG2Video) { SubItems.Add(""); } else { SubItems.Add("0ms"); } FileName = fileName; }
/// <summary> /// Erzeugt eine neue Verwaltung. /// </summary> /// <param name="hardware">Das zu verwendende DVB.NET Gerät.</param> /// <param name="pid">Die gewünschte Datenstromkennung.</param> /// <param name="type">Die Art des Datenstroms.</param> /// <param name="name">Der Name dieses Eintrags.</param> public StreamItem( Hardware hardware, ushort pid, StreamTypes type, string name ) : this( hardware, pid, type, name, null ) { }
/// <summary> /// Add a stream to this program. /// </summary> /// <param name="type">Type of the stream.</param> /// <param name="pid">Transport stream identifier of this stream.</param> /// <param name="noPCR">Set when adding a video stream to disable PCR /// from PTS generation.</param> /// <param name="encoding">Encoding used - <i>255</i> means that the encoding is /// unknown or irrelevant.</param> /// <param name="info">Extended information on the contents of a subtitle stream.</param> /// <returns>Set if the first video stream is added and it is used as the PCR /// source. Currently this function always reports <i>false</i> since no /// PCR will be registered in the transport stream for the only program.</returns> public bool Add(StreamTypes type, byte encoding, short pid, bool noPCR, SubtitleInfo[] info) { // Validate if ((pid < 0) || (pid >= 0x1fff)) { throw new ArgumentOutOfRangeException("pid", pid, "only 13 bits allowed"); } // Must be unique if (m_Streams.Contains(pid)) { throw new ArgumentException("Duplicate PID " + pid.ToString(), "pid"); } // Disable PCR generation if (!m_AllowPCR) { noPCR = true; } // Carries PCR bool isPCR = false; // Remember m_Streams.Add(pid); // Connect m_Encoding[pid] = (255 == encoding) ? (byte)type : encoding; m_Type[pid] = type; // Count switch (type) { case StreamTypes.Audio: ++AudioStreams; break; case StreamTypes.Private: ++AudioStreams; ++AC3Streams; break; case StreamTypes.TeleText: ++TextStreams; break; case StreamTypes.SubTitles: DVBSubtitles[pid] = info; break; case StreamTypes.Video: break; } // Enforce PCR on first stream if (!noPCR) { isPCR = (0x1fff == PCRPID); } // Load PCR if (isPCR) { PCRPID = pid; } // Require new Changed(); // Report return(isPCR); }
/// <summary> /// Reads an E-AC-3 header from a bitstream. /// </summary> /// <remarks>Has to read a calculated number of bytes from the source stream.</remarks> /// <returns>A <see cref="BitExtractor"/> that continues at the beginning of the audio frame.</returns> public BitExtractor Decode(BlockBuffer <byte> reader) { BitExtractor extractor = new BitExtractor(reader.Read(mustDecode)); if (!extractor.Readable) { return(extractor); } if (extractor.Read(16) != syncWord) { throw new SyncException(); } StreamType = (StreamTypes)extractor.Read(2); SubstreamID = extractor.Read(3); WordsPerSyncframe = extractor.Read(11) + 1; SampleRateCode = extractor.Read(2); Blocks = numberOfBlocks[extractor.Read(2)]; ChannelMode = extractor.Read(3); LFE = extractor.ReadBit(); Decoder = ParseDecoder(extractor.Read(5)); if (Decoder != EnhancedAC3.Decoders.EAC3) { StreamType = StreamTypes.Repackaged; SubstreamID = 0; Blocks = 6; SampleRateCode = extractor[4] >> 6; frmsizecod = extractor[4] & 63; WordsPerSyncframe = frameSizes[frmsizecod >> 1]; if (SampleRateCode == 1) // 44.1 kHz { WordsPerSyncframe = WordsPerSyncframe * 1393 / 1280; if ((frmsizecod & 1) == 1) { ++WordsPerSyncframe; } } else if (SampleRateCode == 2) { WordsPerSyncframe = WordsPerSyncframe * 3 / 2; } bsmod = extractor.Read(3); ChannelMode = extractor.Read(3); } extractor.Expand(reader.Read(WordsPerSyncframe * 2 - mustDecode)); if (StreamType == StreamTypes.Dependent) { SubstreamID += 8; // There can be 8 dependent and independent substreams, both start at 0 } if (StreamType == StreamTypes.Reserved) { throw new ReservedValueException("strmtyp"); } if (SampleRateCode == 3) { throw new ReservedValueException("fscod"); } SampleRate = sampleRates[SampleRateCode]; channelMapping = null; switch (Decoder) { case EnhancedAC3.Decoders.AlternateAC3: case EnhancedAC3.Decoders.AC3: BitStreamInformation(extractor); break; case EnhancedAC3.Decoders.EAC3: BitStreamInformationEAC3(extractor); break; } return(extractor); }
/// <summary> /// Create a new PES packet manager. /// </summary> /// <param name="other">Template manager.</param> public Packet( Packet other ) : this( other.m_Manager, other.PID ) { // Clone the type m_Video = other.m_Video; // Copy flags IgnorePTS = other.IgnorePTS; }
/// <summary> /// Add a stream to this program. /// </summary> /// <param name="type">Type of the stream.</param> /// <param name="pid">Transport stream identifier of this stream.</param> /// <param name="noPCR">Set when adding a video stream to disable PCR /// from PTS generation.</param> /// <param name="encoding">Encoding used - <i>255</i> means that the encoding is /// unknown or irrelevant.</param> /// <returns>Set if the first video stream is added and it is used as the PCR /// source. Currently this function always reports <i>false</i> since no /// PCR will be registered in the transport stream for the only program.</returns> public bool Add(StreamTypes type, byte encoding, short pid, bool noPCR) { // Forward return(Add(type, encoding, pid, noPCR, null)); }
public void AddLogRecord(StreamTypes subType, ChannelStreamTypes subChannelType, string format, params object[] args) { AddLogRecord(subType, subChannelType, string.Format(format, args)); }
/// <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> /// Call to mark this as a holder of video packets. /// </summary> /// <param name="isVideo">Set to indicate a video stream, unset for an audio stream. /// Do not call this method for any other stream type.</param> public void SetAudioVideo(bool isVideo) { // Remember m_Video = isVideo ? StreamTypes.Video : StreamTypes.Audio; }
/// <summary> /// Meldet einen Datenstrom zum Datenempfang an. /// </summary> /// <param name="pid">Die gewünschte Datestromkennung (PID).</param> /// <param name="type">Die Art der Nutzdaten im Datenstrom.</param> /// <param name="stream">Der Empfänger der Daten.</param> private void AddConsumer(ushort pid, StreamTypes type, StreamBase stream) => m_Consumers.Add(Hardware.AddConsumer(pid, type, stream.AddPayload));
/// <summary> /// Add a stream to this program. /// </summary> /// <param name="type">Type of the stream.</param> /// <param name="pid">Transport stream identifier of this stream.</param> /// <param name="noPCR">Set when adding a video stream to disable PCR /// from PTS generation.</param> /// <param name="encoding">Encoding used - <i>255</i> means that the encoding is /// unknown or irrelevant.</param> /// <param name="info">Extended information on the contents of a subtitle stream.</param> /// <returns>Set if the first video stream is added and it is used as the PCR /// source. Currently this function always reports <i>false</i> since no /// PCR will be registered in the transport stream for the only program.</returns> public bool Add( StreamTypes type, byte encoding, short pid, bool noPCR, SubtitleInfo[] info ) { // Validate if ((pid < 0) || (pid >= 0x1fff)) throw new ArgumentOutOfRangeException( "pid", pid, "only 13 bits allowed" ); // Must be unique if (m_Streams.Contains( pid )) throw new ArgumentException( "Duplicate PID " + pid.ToString(), "pid" ); // Disable PCR generation if (!m_AllowPCR) noPCR = true; // Carries PCR bool isPCR = false; // Remember m_Streams.Add( pid ); // Connect m_Encoding[pid] = (255 == encoding) ? (byte) type : encoding; m_Type[pid] = type; // Count switch (type) { case StreamTypes.Audio: ++AudioStreams; break; case StreamTypes.Private: ++AudioStreams; ++AC3Streams; break; case StreamTypes.TeleText: ++TextStreams; break; case StreamTypes.SubTitles: DVBSubtitles[pid] = info; break; case StreamTypes.Video: break; } // Enforce PCR on first stream if (!noPCR) isPCR = (0x1fff == PCRPID); // Load PCR if (isPCR) PCRPID = pid; // Require new Changed(); // Report return isPCR; }
/// <summary> /// Meldet eine Analyseinstanz auf einem Datenstrom von SI Tabellen an. /// </summary> /// <param name="provider">Die zu aktuelle Hardware Abstraktion.</param> /// <param name="stream">Die eindeutige Nummer (PID) des Datenstroms in der aktuellen <see cref="SourceGroup"/>.</param> /// <param name="parser">Die zu verwendene Analyseeinheit.</param> /// <param name="streamType">Die Art der Tabellenkennungen, die verwendet werden.</param> /// <returns>Die eindeutige Kennung der neu angemeldeten Analyseeinheit.</returns> /// <exception cref="ArgumentNullException">Die Hardware Abstraktion und / oder die Analyseinstanz /// sind nicht gesetzt.</exception> public static Guid AddConsumer(this Hardware provider, ushort stream, TableParser parser, StreamTypes streamType) { // Validate if (null == provider) { throw new ArgumentNullException("provider"); } if (null == parser) { throw new ArgumentNullException("parser"); } // Register return(provider.AddConsumer(stream, streamType, parser.AddPayload)); }
/// <summary> /// Call to mark this as a holder of video packets. /// </summary> /// <param name="isVideo">Set to indicate a video stream, unset for an audio stream. /// Do not call this method for any other stream type.</param> public void SetAudioVideo( bool isVideo ) { // Remember m_Video = isVideo ? StreamTypes.Video : StreamTypes.Audio; }
/// <summary> /// Create a new transport stream identifier for a new stream /// in this transport stream. /// </summary> /// <param name="type">Type of the stream.</param> /// <param name="encoding">Encoding type of the stream.</param> /// <param name="isPCR">Set if the stream will be the PCR reference.</param> /// <param name="noPTS">Set if the stream should not participate in PTS synchronisation.</param> /// <param name="info">Information on the contents of a subtitle stream.</param> /// <param name="noPCR">Set to disable PCR from PTS generation.</param> /// <returns>A randomly choosen but unique transport stream identifier.</returns> private short AddStream( StreamTypes type, byte encoding, bool noPCR, bool noPTS, EPG.SubtitleInfo[] info, out bool isPCR ) { // Create pid short pid = NextPID++; // Make key int keyPID = pid; // Forward isPCR = ProgramMap.Add( type, encoding, pid, noPCR, info ); // Reload lock (m_Queue) { // Force PAT change PATSent = false; // Load Packet buffers = (Packet) m_Buffers[keyPID]; // Create new if (null == buffers) { // Create new buffers = new Packet( this, keyPID ); // Remember m_Buffers[keyPID] = buffers; } // Set up if (StreamTypes.Video == type) buffers.SetAudioVideo( true ); else if ((StreamTypes.Audio == type) || (StreamTypes.Private == type)) buffers.SetAudioVideo( false ); // May disable PTS synchronisation (e.g. for TeleText streams) buffers.IgnorePTS = noPTS; } // Report return pid; }
/// <summary> /// Add a stream to this program. /// </summary> /// <param name="type">Type of the stream.</param> /// <param name="pid">Transport stream identifier of this stream.</param> /// <param name="encoding">Encoding used - <i>255</i> means that the encoding is /// unknown or irrelevant.</param> /// <returns>Set if the first video stream is added and it is used as the PCR /// source. Currently this function always reports <i>false</i> since no /// PCR will be registered in the transport stream for the only program.</returns> public bool Add(StreamTypes type, byte encoding, short pid) { // Forward return(Add(type, encoding, pid, false, null)); }
/// <summary> /// Add a stream to this program. /// </summary> /// <param name="type">Type of the stream.</param> /// <param name="pid">Transport stream identifier of this stream.</param> /// <param name="encoding">Encoding used - <i>255</i> means that the encoding is /// unknown or irrelevant.</param> /// <returns>Set if the first video stream is added and it is used as the PCR /// source. Currently this function always reports <i>false</i> since no /// PCR will be registered in the transport stream for the only program.</returns> public bool Add( StreamTypes type, byte encoding, short pid ) { // Forward return Add( type, encoding, pid, false, null ); }
/// <summary> /// Erzeugt eine neue Verwaltung. /// </summary> /// <param name="hardware">Das zu verwendende DVB.NET Gerät.</param> /// <param name="pid">Die gewünschte Datenstromkennung.</param> /// <param name="type">Die Art des Datenstroms.</param> /// <param name="name">Der Name dieses Eintrags.</param> public StreamItem(Hardware hardware, ushort pid, StreamTypes type, string name) : this(hardware, pid, type, name, null) { }
/// <summary> /// Meldet einen Datenstrom zum Datenempfang an. /// </summary> /// <param name="pid">Die gewünschte Datestromkennung (PID).</param> /// <param name="type">Die Art der Nutzdaten im Datenstrom.</param> /// <param name="stream">Der Empfänger der Daten.</param> private void AddConsumer( ushort pid, StreamTypes type, StreamBase stream ) => m_Consumers.Add( Hardware.AddConsumer( pid, type, stream.AddPayload ) );
/// <summary> /// Add a stream to this program. /// </summary> /// <param name="type">Type of the stream.</param> /// <param name="pid">Transport stream identifier of this stream.</param> /// <param name="noPCR">Set when adding a video stream to disable PCR /// from PTS generation.</param> /// <param name="encoding">Encoding used - <i>255</i> means that the encoding is /// unknown or irrelevant.</param> /// <returns>Set if the first video stream is added and it is used as the PCR /// source. Currently this function always reports <i>false</i> since no /// PCR will be registered in the transport stream for the only program.</returns> public bool Add( StreamTypes type, byte encoding, short pid, bool noPCR ) { // Forward return Add( type, encoding, pid, noPCR, null ); }