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

namespace skyscraper5.Dvb.Psi
{
    class Pid0x11Decoder : IPsiProcessor
    {

        public Pid0x11Decoder(IBatEventHandler batEventHandler, ISdtEventHandler sdtEventHandler)
        {
            BatParser = new BatParser(batEventHandler);
            SdtParser = new SdtParser(sdtEventHandler);
        }

        public BatParser BatParser { get; }
        public SdtParser SdtParser { get; }

        public void GatherPsi(PsiSection section, int sourcePid)
        {
            switch (section.TableId)
            {
                case 0x42:  //SDT for current TS
                    SdtParser.GatherPsi(section, sourcePid);
                    break;
                case 0x46:  //SDT for other TS
                    SdtParser.GatherPsi(section, sourcePid);
                    break;
                case 0x4a:  //BAT
                    BatParser.GatherPsi(section, sourcePid);
                    break;
                default:
                    return;
            }
        }
    }
}
