Ejemplo n.º 1
0
        private void OpenConfigDialog_FileOk(object sender, CancelEventArgs e)
        {
            try {
                config = Configuration.LoadFromFile(OpenConfigDialog.FileName);
            } catch {
                config = null;
            }

            if (config == null) {
                ToggleEncoder.Enabled = false;
                MessageBox.Show("Sorry, can't open that file.\r\nPlease check that it is valid, or recreate using the configuration tool.", "HCS Encoder Demo");
            } else {
                ToggleEncoder.Enabled = true;
                this.Text = "HCS Encoder: "+ Path.GetFileNameWithoutExtension(OpenConfigDialog.FileName);
            }
        }
        /// <summary>
        /// Create and initialise a new encoder job with the given config
        /// </summary>
        public EncoderController(Configuration Config)
        {
            UseAbsoluteTime = false;
            DryRun = false;
            AbandonTime = 0.0;
            MinimumBufferPopulation = 1;
            if (Config == null) throw new ArgumentException("Config must not be null", "Config");
            config = Config;
            if (config.Video.InputFrameRate < 1) config.Video.InputFrameRate = 1;
            EncoderRunning = false;

            outputRouter = new Outputs.OutputRouter(config);
            CaptureSetup();
            EncoderSetup();
            outputRouter.Prepare(Packages);

            EnableOutput = true;
            CleanupDeliveredChunks = true;
        }