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

namespace skyscraper5.Skyscraper.Scraper.StreamAutodetection.Contestants
{
	[SkyscraperPlugin]
	public class SdtContestant : Contestant, ISdtEventHandler, IDisposable
    {
        public SdtContestant(int pid) : base("SDT", pid)
        {
            PacketProcessor = new PsiDecoder(pid, new SdtParser(this));
        }

        public void OnSdtService(ushort transportStreamId, ushort originalNetworkId, SdtService sdtService)
        {
            Score++;
        }

        public override void Dispose()
        {
            
        }

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

        public override void Introduce(ProgramContext programContext)
        {
	        
        }

        public void SetNetworkId(ushort networkId)
        {
        }

        public void SetTransportStreamId(ushort transportStreamId)
        {
        }
    }
}
