using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using skyscraper5.Mpeg2;
using skyscraper5.Mpeg2.Psi;
using skyscraper5.Mpeg2.Psi.Model;
using skyscraper5.Skyscraper.Plugins;

namespace skyscraper5.Skyscraper.Scraper.StreamAutodetection.Contestants
{
	[SkyscraperPlugin]
	class PmtContestant : Contestant, IPmtEventHandler, IDisposable
    {
        public PmtContestant(int pid) : base("PMT", pid)
        {
            PacketProcessor = new PsiDecoder(pid, new PmtParser(this));
        }

        public void PmtEvent(ProgramMapping result, int pmtPid)
        {
            Score++;
        }

        public override void Dispose()
        {
            
        }

        public override void DeclareWinner(SkyscraperContext skyscraperContext, int pid, ProgramContext programContext)
        {
			skyscraperContext.DvbContext.RegisterPacketProcessor(pid, new PsiDecoder(pid, new PmtParser(skyscraperContext)));
		}

        public override void Introduce(ProgramContext programContext)
        {
	        
        }
    }
}
