public void SetSource(ARKitStream src, VideoStream video_src)
        {
            source = src;
            N      = source.Frames.Count;

            video_source = video_src;
        }
    void simulate_ar()
    {
        if (FakeStream != null)
        {
            FakeStream.Stop(true);
        }

        //string sFilename = "/Users/rms/scratch/ARStream_15-7-2017-20-23-23.txt";
        // 5mb
        //string sFilename = "/Users/rms/scratch/ARStream_15-7-2017-18-21-12.txt";
        string sFilename = "/Users/rms/scratch/ARStream_16-7-2017-22-25-2.txt";

        // w/ video
        //string sFilename = "/Users/rms/scratch/ARStream_15-7-2017-22-27-22.txt";
        //string sFilename = "/Users/rms/scratch/ARStream_15-7-2017-23-11-48.txt";

        if (current_filename != sFilename)
        {
            gs.ARKitStream stream = new gs.ARKitStream();
            stream.InitializeFromFileAscii(sFilename);

            string sVideoFilename = sFilename.Replace("ARStream", "VideoStream");
            sVideoFilename = sVideoFilename.Replace(".txt", ".bin");
            gs.VideoStream video_stream = null;
            if (File.Exists(sVideoFilename))
            {
                video_stream = new gs.VideoStream();
                video_stream.InitializeRead(sVideoFilename, true);
            }

            FakeStream = new gs.ARKitStreamPlayback();
            FakeStream.SetSource(stream, video_stream);

            current_filename = sFilename;
        }


        samplesParent = new GameObject("samples_parent");
        GameObject videoPlane = UnityUtil.FindGameObjectByName("VideoPlane");

        videoPlane.SetVisible(true);
        Material  videoMaterial = videoPlane.GetMaterial();
        Texture2D video_texture = null;

        FakeStream.NewFrameF = (time) => {
            GameObject.Destroy(samplesParent);
            samplesParent = new GameObject("samples_parent");
        };
        FakeStream.UpdateCameraF = (pos, rot) => {
            Camera.main.transform.position = pos;
            Camera.main.transform.rotation = rot;
        };
        FakeStream.EmitSamplePointF = (pos, screenPos, color) => {
            GameObject go = DebugUtil.EmitDebugSphere("pt", pos, 0.01f, color, null, true);
            samplesParent.AddChild(go, true);

            if (ParticleGridVizGO != null)
            {
                ParticleGridVizGO.GetComponent <ParticleGridViz>().InjectSample(pos, color);
            }
        };
        FakeStream.EmitVideoFrameF = (frame) => {
            if (video_texture == null)
            {
                video_texture = new Texture2D(frame.width, frame.height);
            }
            video_texture.LoadImage(frame.rgb);
            videoMaterial.SetTexture("_MainTex", video_texture);
        };

        FakeStream.Start(Time.realtimeSinceStartup);
    }