using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using skyscraper5.Mhp.Si;
using skyscraper5.Mpeg2;
using skyscraper5.Scte35;
using skyscraper5.Scte35.Descriptors;
using skyscraper5.Skyscraper.Plugins;

namespace skyscraper5.Skyscraper.Scraper.StreamAutodetection.Contestants
{
	[SkyscraperPlugin]
	class Scte35Contestant : Contestant, IScte35EventHandler, IDisposable
    {
        public Scte35Contestant(int pid) : base("SCTE35", pid)
        {
            PacketProcessor = new PsiDecoder(pid, new Scte35SiDecoder(1, this));
        }

        public void NotifySpliceInsert(ushort ProgramNumber, SpliceInsert spliceInsert)
        {
            Score++;
        }

        public void NotifyTimeSignal(ushort programNumber, TimeSignal timeSignal)
        {
            Score++;
        }

        public override void Dispose()
        {
            
        }

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

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