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

namespace skyscraper5.src.Aac
{
	internal class AacTestProgram
	{
		public AacTestProgram()
		{
			FileInfo fi = new FileInfo(@"C:\Users\Sascha Schiemann\Documents\wdr_radio_test.ts");
			fileStream = fi.OpenRead();
			tsContext = new TsContext();
		}

		private FileStream fileStream;
		private TsContext tsContext;

		public void Run()
		{
			PesDecoder pesDecoder = new PesDecoder(new PesDumper());
			tsContext.RegisterPacketProcessor(0x0277, pesDecoder);	//0x0277 -> WDR 4
			byte[] buffer = new byte[188];
			while (fileStream.Read(buffer, 0, 188) == 188)
			{
				tsContext.PushPacket(buffer);
			}
			fileStream.Close();
		}
	}
}
