Exemplo n.º 1
0
    /// <summary>
    /// This method renders the picture content into an avi file.
    /// </summary>
    private void RenderGazeVideo()
    {
      this.newSplash.Header = "Rendering gaze and mouse video";
      this.newSplash.IsPreviewVisible = true;

      var imageHandler =
        new ImageFromVectorGraphics(
        this.videoExportProperties.OutputVideoProperties,
        this.videoExportProperties.GazeVideoProperties.StreamStartTime,
        this.videoExportProperties.GazeVideoProperties.StreamEndTime,
        this.videoFramePusher,
        this.replayPicture.RenderFrame);
      imageHandler.Progress += this.imageHandler_Progress;
      imageHandler.Finished += this.imageHandler_Finished;
      // Setup usercam video filename.
      this.directShowInterface = new DSRecord(
        imageHandler,
        this.videoExportProperties,
        this.newSplash.PreviewWindow);

      this.directShowInterface.Completed += this.directShowInterface_Completed;

      this.replayPicture.ResetPicture();

      if (this.replayPicture.InitDrawingElements())
      {
        // Update pictures properties
        this.replayPicture.ReplayPosition = this.currentTrialTime;
        this.replayPicture.BeginUpdate();

        this.Cursor = Cursors.Default;

        this.directShowInterface.Start();
      }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Unregister custom events.
    /// </summary>
    protected override void CustomDispose()
    {
      if (this.videoFramePusher != null)
      {
        this.videoFramePusher.VideoFrameAvailable -= new BitmapEventHandler(this.videoFramePusher_VideoFrameAvailable);
        this.videoFramePusher.Dispose();
      }

      // DO not dispose the usercam, because its just a copy of the context panels UserCam.
      // this.usercamVideoPlayer.Dispose();
      if (this.directShowInterface != null)
      {
        this.directShowInterface.Stop();
        this.directShowInterface.Dispose();
        this.directShowInterface = null;
      }

      base.CustomDispose();
      this.cbbSpeed.ComboBox.SelectionChangeCommitted -= new EventHandler(this.cbbSpeed_SelectionChangeCommitted);
    }
Exemplo n.º 3
0
    /// <summary>
    /// The <see cref="DSRecord.Completed"/> event handler for the video
    /// export.
    /// </summary>
    /// <param name="sender">Source of the event.</param>
    /// <param name="e">An empty <see cref="EventArgs"/>.</param>
    private void directShowInterface_Completed(object sender, EventArgs e)
    {
      try
      {
        if (this.directShowInterface != null)
        {
          this.directShowInterface.Completed -= this.directShowInterface_Completed;
          this.directShowInterface.Dispose();
          this.directShowInterface = null;
        }

        this.ShowVideoExportResult();
      }
      catch (Exception ex)
      {
        ExceptionMethods.HandleException(ex);
      }
    }