コード例 #1
0
        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;
            });
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
ファイル: FFmpegOptionsForm.cs プロジェクト: tanjil/ShareX
        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);
            }
        }
コード例 #5
0
 private void btnDownload_Click(object sender, EventArgs e)
 {
     FFmpegHelper.DownloadFFmpeg(true, DownloaderForm_InstallRequested);
 }
コード例 #6
0
ファイル: FFmpegOptionsForm.cs プロジェクト: barsv/ShareX
        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;
            });
        }
コード例 #7
0
ファイル: ScreenRecorder.cs プロジェクト: Edison6351/ShareX
        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;
            }
        }