using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using skyscraper5.Mpeg2;

namespace skyscraper5.Skyscraper.Scraper.Utils
{
    class PesDumper : IPesProcessor
    {
        public PesDumper()
        {

        }


        public void ProcessPesPacket(PesPacket packet)
        {
            DirectoryInfo outDi = new DirectoryInfo("dumped_pes_packets");
            if (!outDi.Exists)
                outDi.Create();
            string outFileName = Path.Combine(outDi.FullName, string.Format("{0:X16}.bin", packet.PTS));
            File.WriteAllBytes(outFileName, packet.Payload);
        }
    }
}
