PacketizedElementalStream.cs 735 B

12345678910111213141516171819202122
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Linq;
  5. using System.Text;
  6. namespace MatrixIO.IO.MpegTs.Streams
  7. {
  8. public class PacketizedElementalStream : TsStream<PesPacket>
  9. {
  10. protected override PesPacket ProcessUnit(TsUnit unit)
  11. {
  12. // TODO: We should think about passing the unit payload in as an IList for speed. It complicates copying chunks of data, however.
  13. var unitPayload = new byte[unit.Payload.Count];
  14. unit.Payload.CopyTo(unitPayload, 0);
  15. var pesPacket = new PesPacket(unitPayload);
  16. Debug.WriteLine("PES Identifier is " + pesPacket.StreamIdentifier);
  17. return pesPacket;
  18. }
  19. }
  20. }