示例#1
0
        public SaveResult StartRecord(string filename, double interval, ImageRotation rotation)
        {
            //-----------------------
            // Runs on the UI thread.
            //-----------------------

            if (imageDescriptor == null)
            {
                throw new NotSupportedException("ImageDescriptor must be set before prepare.");
            }

            this.filename = filename;

            if (writer != null)
            {
                writer.Dispose();
            }

            writer = new MJPEGWriter();

            VideoInfo info = new VideoInfo();

            info.OriginalSize = new Size(imageDescriptor.Width, imageDescriptor.Height);

            bool   uncompressed = PreferencesManager.CapturePreferences.SaveUncompressedVideo && imageDescriptor.Format != ImageFormat.JPEG;
            string formatString = FilenameHelper.GetFormatStringCapture(uncompressed);
            double fileInterval = CalibrationHelper.ComputeFileFrameInterval(interval);

            log.DebugFormat("Frame budget for writer [{0}]: {1:0.000} ms.", shortId, interval);

            SaveResult result = writer.OpenSavingContext(filename, info, formatString, imageDescriptor.Format, uncompressed, interval, fileInterval, rotation);

            recording = true;

            return(result);
        }