private void RefreshSourcesAsync() { btnRefreshSources.Enabled = false; DirectShowDevices devices = null; TaskEx.Run(() => { using (FFmpegHelper ffmpeg = new FFmpegHelper(Options)) { devices = ffmpeg.GetDirectShowDevices(); } }, () => { cboVideoSource.Items.Clear(); cboVideoSource.Items.Add(FFmpegHelper.GDIgrab); cboAudioSource.Items.Clear(); cboAudioSource.Items.Add("None"); if (devices != null) { cboVideoSource.Items.AddRange(devices.VideoDevices.ToArray()); cboAudioSource.Items.AddRange(devices.AudioDevices.ToArray()); } cboVideoSource.Text = Options.FFmpeg.VideoSource; cboAudioSource.Text = Options.FFmpeg.AudioSource; btnRefreshSources.Enabled = true; }); }
public ScreenRecorder(ScreencastOptions options, Rectangle captureRectangle, ScreenRecordOutput outputType) { if (string.IsNullOrEmpty(options.OutputPath)) { throw new Exception("Screen recorder cache path is empty."); } FPS = outputType == ScreenRecordOutput.GIF ? options.GIFFPS : options.ScreenRecordFPS; DurationSeconds = options.Duration; CaptureRectangle = captureRectangle; CachePath = options.OutputPath; OutputType = outputType; Options = options; switch (OutputType) { case ScreenRecordOutput.AVI: imgCache = new AVICache(Options); break; case ScreenRecordOutput.FFmpeg: ffMpegCli = new FFmpegHelper(Options); break; case ScreenRecordOutput.GIF: imgCache = new HardDiskCache(Options); break; } }
private void DownloaderForm_InstallRequested(string filePath) { string extractPath = DefaultToolsPath ?? "ffmpeg.exe"; bool result = FFmpegHelper.ExtractFFmpeg(filePath, extractPath); if (result) { this.InvokeSafe(() => { txtFFmpegPath.Text = extractPath; RefreshSourcesAsync(); UpdateUI(); }); MessageBox.Show("Successfully downloaded FFmpeg.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Download of FFmpeg failed.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void DownloaderForm_InstallRequested(string filePath) { string extractPath = DefaultToolsPath ?? "ffmpeg.exe"; bool result = FFmpegHelper.ExtractFFmpeg(filePath, extractPath); if (result) { this.InvokeSafe(() => { txtFFmpegPath.Text = extractPath; RefreshSourcesAsync(); UpdateUI(); }); MessageBox.Show(Resources.FFmpegOptionsForm_DownloaderForm_InstallRequested_Successfully_downloaded_FFmpeg_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(Resources.FFmpegOptionsForm_DownloaderForm_InstallRequested_Download_of_FFmpeg_failed_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnDownload_Click(object sender, EventArgs e) { FFmpegHelper.DownloadFFmpeg(true, DownloaderForm_InstallRequested); }
private void RefreshSourcesAsync() { btnRefreshSources.Enabled = false; DirectShowDevices devices = null; TaskEx.Run(() => { using (FFmpegHelper ffmpeg = new FFmpegHelper(Options)) { devices = ffmpeg.GetDirectShowDevices(); } }, () => { cboVideoSource.Items.Clear(); cboVideoSource.Items.Add(FFmpegHelper.SourceNone); cboVideoSource.Items.Add(FFmpegHelper.SourceGDIGrab); cboAudioSource.Items.Clear(); cboAudioSource.Items.Add(FFmpegHelper.SourceNone); if (devices != null) { cboVideoSource.Items.AddRange(devices.VideoDevices.ToArray()); cboAudioSource.Items.AddRange(devices.AudioDevices.ToArray()); } cboVideoSource.Text = Options.FFmpeg.VideoSource; cboAudioSource.Text = Options.FFmpeg.AudioSource; btnRefreshSources.Enabled = true; }); }