Example #1
0
        /// <summary>
        /// Beginnt den Empfang eines Datenstroms.
        /// </summary>
        /// <param name="stream">Der gewünschte Datenstrom.</param>
        protected override void OnStart(Hardware.StreamInformation stream)
        {
            // Validate
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            // Not started
            if (Receiver == null)
            {
                return;
            }

            // Not of interest to us
            if (stream.Consumer == null)
            {
                return;
            }

            // Attach to the data manager
            var manager = Receiver.TransportStreamAnalyser.DataManager;

            // Check mode
            var  type = stream.StreamType;
            bool siTableMode;

            switch (type)
            {
            case StreamTypes.StandardTable: siTableMode = true; break;

            case StreamTypes.ExtendedTable: siTableMode = true; break;

            case StreamTypes.UnknownPES: siTableMode = false; break;

            case StreamTypes.VideoText: siTableMode = false; break;

            case StreamTypes.SubTitle: siTableMode = false; break;

            case StreamTypes.Audio: siTableMode = false; break;

            case StreamTypes.Video: siTableMode = false; break;

            default: throw new NotSupportedException(type.ToString());
            }

            // Register callback
            manager.AddFilter(stream.Identifier, siTableMode, p => stream.Consumer(p, 0, p.Length));

            // Start filter at once
            manager.StartFilter(stream.Identifier);
        }
Example #2
0
        /// <summary>
        /// Beendet den Empfang eines Datenstroms.
        /// </summary>
        /// <param name="stream">Der betroffene Datenstrom.</param>
        protected override void OnStop(Hardware.StreamInformation stream)
        {
            // Validate
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            // Not started
            if (Receiver == null)
            {
                return;
            }

            // Not of interest to us
            if (stream.Consumer == null)
            {
                return;
            }

            // Just forward
            Receiver.TransportStreamAnalyser.DataManager.StopFilter(stream.Identifier);
        }