예제 #1
0
 /** Stops video rendering.
  * <b>NB!</b> Calling SktVideo.SetRemoteRendererId(0) method to reset the frame transport is <b>not neccessary</b>.
  * SktVideoRenderer.Stop does this for you. That part of the SktVideo documentation applies to the C++ wrapper (the docs
  * are generated from the same base source file, mostly).
  */
 public void Stop()
 {
     if (!isRunning) return;
     isRunning = false;
     timer.Stop();
     timer = null;
     videoObject.SetRemoteRendererId(0);
     frameTransport = null;
 }
예제 #2
0
        /** Starts video rendering.
         * <b>NB!</b> Calling SktVideo.SetRemoteRendererId method to associate the video object with renderer is <b>not neccessary</b>.
         * SktVideoRenderer.Start does this for you. That part of the SktVideo documentation applies to the C++ wrapper (the docs
         * are generated from the same base source file, mostly).
         */
        public void Start()
        {
            if (isRunning) return;
            if (videoObject == null) throw new Exception("Error: cannot start rendering when the associated video object is null.");
            isRunning = true;

            frameTransport = new FrameTransport();

            timer = new Timer();
            timer.Interval = updateInterval;
            timer.Enabled = false;
            timer.Tick += TimerTick;

            Int32[] preferences = new Int32[1];
            preferences[0] = MakeFourcc('B', 'I', '2', '4');
            frameTransport.SetPreferences(1, preferences);
            key = frameTransport.Key();
            videoObject.SetRemoteRendererId(key);
            lastFrameTimestamp = DateTime.Now;
            timer.Start();
        }