Ejemplo n.º 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.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;
            });
        }
Ejemplo n.º 2
0
        private async Task RefreshSourcesAsync(bool selectDevices = false)
        {
            btnRefreshSources.Enabled = false;
            DirectShowDevices devices = null;

            await Task.Run(() =>
            {
                using (FFmpegHelper ffmpeg = new FFmpegHelper(Options))
                {
                    devices = ffmpeg.GetDirectShowDevices();
                }
            });

            if (!IsDisposed)
            {
                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());
                }

                if (selectDevices && cboVideoSource.Items.Contains(FFmpegHelper.SourceVideoDevice))
                {
                    Options.FFmpeg.VideoSource = FFmpegHelper.SourceVideoDevice;
                }

                cboVideoSource.Text = Options.FFmpeg.VideoSource;

                if (selectDevices && cboAudioSource.Items.Contains(FFmpegHelper.SourceAudioDevice))
                {
                    Options.FFmpeg.AudioSource = FFmpegHelper.SourceAudioDevice;
                }

                cboAudioSource.Text = Options.FFmpeg.AudioSource;

                btnRefreshSources.Enabled = true;
            }
        }
Ejemplo n.º 3
0
        private void RefreshSourcesAsync(bool selectDevices = false)
        {
            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());
                }

                if (selectDevices && cboVideoSource.Items.Contains(FFmpegHelper.SourceVideoDevice))
                {
                    Options.FFmpeg.VideoSource = FFmpegHelper.SourceVideoDevice;
                }

                cboVideoSource.Text = Options.FFmpeg.VideoSource;

                if (selectDevices && cboAudioSource.Items.Contains(FFmpegHelper.SourceAudioDevice))
                {
                    Options.FFmpeg.AudioSource = FFmpegHelper.SourceAudioDevice;
                }

                cboAudioSource.Text = Options.FFmpeg.AudioSource;

                btnRefreshSources.Enabled = true;
            });
        }