示例#1
0
        public void AddData(byte[] data)
        {
            if (_packetFactory == null)
            {
                _packetFactory = new TsPacketFactory();
            }

            var tsPackets = _packetFactory.GetTsPacketsFromData(data);

            if (tsPackets == null)
            {
                throw new InvalidDataException("Provided data buffer did not contain any TS packets");
            }

            foreach (var packet in tsPackets)
            {
                AddPacket(packet);
            }
        }
示例#2
0
        public void AddData(byte[] data)
        {
            // create a fatory if there isn't one already
            if (_packetFactory == null)
            {
                _packetFactory = new TsPacketFactory();
            }

            // get packets from the raw buffer
            var tsPackets = _packetFactory.GetTsPacketsFromData(data);

            if (tsPackets == null)
            {
                throw new InvalidDataException("Provided data buffer did not contain any TS packets");
            }

            // now process each packet
            foreach (var packet in tsPackets)
            {
                AddPacket(packet);
            }
        }