Generic PES decoder with some teletext specific sanity checks DO NOT USE TO DECODE NON-TELETEXT PES PACKETS WITHOUT REMOVING THOSE CHECKS!
    public TeletextReceiver(ITeletextSource source, IDVBTeletextDecoder ttxtDecoder)
    {
      assert(source != null, "Source is null");
      assert(ttxtDecoder != null, "Decoder is null");
      Log.Debug("Setting up teletext receiver ... ");
      eventCallback = new TeletextEventCallback(OnEvent);
      packetCallback = new TeletextPacketCallback(OnTSPacket);
      serviceInfoCallback = new TeletextServiceInfoCallback(OnServiceInfo);

      // tell the tsreader's teletext source interface to deliver ts packets to us
      // and to inform us on resets
      Log.Debug("Setting up callbacks with ITeletextSource");
      source.SetTeletextTSPacketCallback(Marshal.GetFunctionPointerForDelegate(packetCallback));
      source.SetTeletextEventCallback(Marshal.GetFunctionPointerForDelegate(eventCallback));
      source.SetTeletextServiceInfoCallback(Marshal.GetFunctionPointerForDelegate(serviceInfoCallback));

      //tsPackets = new Queue<Packet>();

      Log.Debug("Setting up ttxtdecoder and pes decoder");
      this.ttxtDecoder = ttxtDecoder;
      pesDecoder = new PESDecoder(new PESCallback(OnPesPacket));
      Log.Debug("Done setting up teletext receiver ... ");
    }
        public TeletextReceiver(ITeletextSource source, IDVBTeletextDecoder ttxtDecoder)
        {
            assert(source != null, "Source is null");
            assert(ttxtDecoder != null, "Decoder is null");
            Log.Debug("Setting up teletext receiver ... ");
            eventCallback       = new TeletextEventCallback(OnEvent);
            packetCallback      = new TeletextPacketCallback(OnTSPacket);
            serviceInfoCallback = new TeletextServiceInfoCallback(OnServiceInfo);

            // tell the tsreader's teletext source interface to deliver ts packets to us
            // and to inform us on resets
            Log.Debug("Setting up callbacks with ITeletextSource");
            source.SetTeletextTSPacketCallback(Marshal.GetFunctionPointerForDelegate(packetCallback));
            source.SetTeletextEventCallback(Marshal.GetFunctionPointerForDelegate(eventCallback));
            source.SetTeletextServiceInfoCallback(Marshal.GetFunctionPointerForDelegate(serviceInfoCallback));

            //tsPackets = new Queue<Packet>();

            Log.Debug("Setting up ttxtdecoder and pes decoder");
            this.ttxtDecoder = ttxtDecoder;
            pesDecoder       = new PESDecoder(new PESCallback(OnPesPacket));
            Log.Debug("Done setting up teletext receiver ... ");
        }