コード例 #1
0
        private void cbDeinterlaceCAVT_CheckedChanged(object sender, EventArgs e)
        {
            IVFVideoEffectDeinterlaceCAVT cavt;
            var effect = VideoCapture1.Video_Effects_Get("DeinterlaceCAVT");

            if (effect == null)
            {
                cavt = new VFVideoEffectDeinterlaceCAVT(cbDeinterlaceCAVT.Checked, 20);
                VideoCapture1.Video_Effects_Add(cavt);
            }
            else
            {
                cavt = effect as IVFVideoEffectDeinterlaceCAVT;
                if (cavt != null)
                {
                    cavt.Enabled = cbDeinterlaceCAVT.Checked;
                }
            }
        }
コード例 #2
0
        private void CbDeinterlaceCAVT_Checked(object sender, RoutedEventArgs e)
        {
            if (VideoCapture1 == null)
            {
                return;
            }

            IVFVideoEffectDeinterlaceCAVT cavt;
            var effect = VideoCapture1.Video_Effects_Get("DeinterlaceCAVT");

            if (effect == null)
            {
                cavt = new VFVideoEffectDeinterlaceCAVT(cbDeinterlaceCAVT.IsChecked == true, 20);
                VideoCapture1.Video_Effects_Add(cavt);
            }
            else
            {
                cavt = effect as IVFVideoEffectDeinterlaceCAVT;
                if (cavt != null)
                {
                    cavt.Enabled = cbDeinterlaceCAVT.IsChecked == true;
                }
            }
        }
コード例 #3
0
        private void btStart_Click(object sender, RoutedEventArgs e)
        {
            mmLog.Clear();

            VideoCapture1.Video_Sample_Grabber_Enabled = true;

            VideoCapture1.Debug_Mode = cbDebugMode.IsChecked == true;
            VideoCapture1.Debug_Dir  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\VisioForge\\";

            VideoCapture1.Audio_OutputDevice = "Default DirectSound Device";

            if (cbRecordAudio.IsChecked == true)
            {
                VideoCapture1.Audio_RecordAudio = true;
                VideoCapture1.Audio_PlayAudio   = true;
            }
            else
            {
                VideoCapture1.Audio_RecordAudio = false;
                VideoCapture1.Audio_PlayAudio   = false;
            }

            // apply capture params
            VideoCapture1.Video_Renderer.Video_Renderer = VFVideoRendererWPF.WPF;

            VideoCapture1.Video_CaptureDevice = cbVideoInputDevice.Text;
            VideoCapture1.Video_CaptureDevice_IsAudioSource = cbUseAudioInputFromVideoCaptureDevice.IsChecked == true;
            VideoCapture1.Audio_OutputDevice = cbAudioOutputDevice.Text;
            VideoCapture1.Audio_CaptureDevice_Format_UseBest = cbUseBestAudioInputFormat.IsChecked == true;
            VideoCapture1.Video_CaptureFormat         = cbVideoInputFormat.Text;
            VideoCapture1.Video_CaptureFormat_UseBest = cbUseBestVideoInputFormat.IsChecked == true;
            VideoCapture1.Audio_CaptureDevice         = cbAudioInputDevice.Text;
            VideoCapture1.Audio_CaptureDevice_Format  = cbAudioInputFormat.Text;

            if (cbFramerate.SelectedIndex != -1)
            {
                VideoCapture1.Video_FrameRate = (float)Convert.ToDouble(cbFramerate.Text);
            }

            if (cbMode.SelectedIndex == 0)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.VideoPreview;
            }
            else if (cbMode.SelectedIndex == 1)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.VideoCapture;

                VideoCapture1.Output_Filename = edOutput.Text;
                var aviOutput = new VFAVIOutput
                {
                    ACM =
                    {
                        Name       = cbAudioCodecs.Text,
                        Channels   = Convert.ToInt32(cbChannels.Text),
                        BPS        = Convert.ToInt32(cbBPS.Text),
                        SampleRate = Convert.ToInt32(cbSampleRate.Text)
                    },
                    Video_Codec = cbVideoCodecs.Text
                };

                VideoCapture1.Output_Format = aviOutput;
            }
            else if (cbMode.SelectedIndex == 2)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.VideoCapture;

                VideoCapture1.Output_Filename = edOutput.Text;

                var wmvOutput = new VFWMVOutput
                {
                    Mode = VFWMVMode.InternalProfile
                };

                if (cbWMVInternalProfile9.SelectedIndex != -1)
                {
                    wmvOutput.Internal_Profile_Name = cbWMVInternalProfile9.Text;
                }

                VideoCapture1.Output_Format = wmvOutput;
            }
            else
            {
                VideoCapture1.Mode = VFVideoCaptureMode.VideoCapture;

                VideoCapture1.Output_Filename = edOutput.Text;

                var mp4Output = new VFMP4Output();

                if (IsWindows7OrNewer())
                {
                    mp4Output.MP4Mode = VFMP4Mode.v10;
                }
                else
                {
                    mp4Output.MP4Mode = VFMP4Mode.v8;
                }

                VideoCapture1.Output_Format = mp4Output;
            }

            VideoCapture1.Video_Effects_Enabled = true;
            VideoCapture1.Video_Effects_Clear();

            IVFVideoEffectDeinterlaceCAVT cavt = new VFVideoEffectDeinterlaceCAVT(true, 20);

            VideoCapture1.Video_Effects_Add(cavt);

            VideoCapture1.Start();
        }
        public async Task Play(MediaItem channel)
        {
            try
            {
                if (visioforgePlayer.Status == VFVideoCaptureStatus.Work)
                {
                    visioforgePlayer.Stop();
                }
                else
                {
                    visioforgePlayer.RefreshLists(true, false, false);
                }
                OnOpening();
                visioforgePlayer.Mode = VFVideoCaptureMode.VideoPreview;
                visioforgePlayer.Audio_OutputDevice                = "Default WaveOut Device";
                visioforgePlayer.Video_ResizeOrCrop_Enabled        = true;
                visioforgePlayer.Audio_CaptureDevice               = string.Empty;
                visioforgePlayer.Video_CaptureDevice_IsAudioSource = true;
                visioforgePlayer.Audio_PlayAudio = true;
                visioforgePlayer.TVTuner_Mode    = VFTVTunerMode.TV;

                visioforgePlayer.Video_Renderer.Video_Renderer = VFVideoRenderer.EVR;

                visioforgePlayer.Video_Effects_Clear();
                visioforgePlayer.Audio_Effects_Enabled      = false;
                visioforgePlayer.BackColor                  = Color.Black;
                visioforgePlayer.Video_Renderer.StretchMode = VFVideoRendererStretchMode.Stretch;

                visioforgePlayer.Video_Effects_Enabled = true;
                IVFVideoEffectDeinterlaceCAVT cavt;
                var effect = visioforgePlayer.Video_Effects_Get("DeinterlaceCAVT");
                if (effect == null)
                {
                    cavt = new VFVideoEffectDeinterlaceCAVT(true, 127);
                    visioforgePlayer.Video_Effects_Add(cavt);
                }

                visioforgePlayer.Video_Resize = new VideoResizeSettings()
                {
                    Mode = VFResizeMode.Bicubic
                };
                visioforgePlayer.DV_Decoder_Video_Resolution = VFDVVideoResolution.Full;
                visioforgePlayer.TVTuner_Name = visioforgePlayer.TVTuner_Devices[0];
                var captureDevice =
                    visioforgePlayer.Video_CaptureDevicesInfo.First(d => !string.IsNullOrEmpty(d.TVTuner)).Name;
                visioforgePlayer.Video_CaptureDevice = captureDevice;
                visioforgePlayer.Video_CaptureDevice_IsAudioSource = true;
                visioforgePlayer.Audio_PlayAudio = true;
                System.Windows.Forms.Application.DoEvents();
                //visioforgePlayer.Video_Renderer_Stretch = true;
                visioforgePlayer.TVTuner_InputType = (channel as AnalogMedia).Source;
                switch ((channel as AnalogMedia).CountryCode)
                {
                case "1":
                    visioforgePlayer.TVTuner_TVFormat = VFTVTunerVideoFormat.NTSC_M;
                    //visioforgePlayer.Video_CaptureDevice_Format = VFDVVideoFormat.NTSC;
                    visioforgePlayer.TVTuner_Country = "Canada";
                    break;

                default:
                    visioforgePlayer.TVTuner_TVFormat = VFTVTunerVideoFormat.PAL_B;
                    //visioforgePlayer.DV_Capture_Video_Format = VFDVVideoFormat.PAL;
                    visioforgePlayer.TVTuner_Country = "Greece";
                    break;
                }
                var number = (channel as AnalogMedia).ChannelNumber;
                if (number > 999)
                {
                    visioforgePlayer.TVTuner_Frequency = number;

                    visioforgePlayer.TVTuner_Channel = 0;
                }
                else
                {
                    visioforgePlayer.TVTuner_Channel = number;
                }

                OnOpening();

                //var volume = _audioManager.SpeakersVolume;



                visioforgePlayer.TVTuner_Apply();



                visioforgePlayer.TVTuner_Read();



                IsPlaying = true;
                OnPlaying();
                OnNowPlaying(channel.Name);
                await Dispatcher.BeginInvoke(new Action(() =>
                {
                    visioforgePlayer.Start();

                    _logger.Debug(this, "step 4: " + visioforgePlayer.TVTuner_Channel);

                    //They had to do one thing. They couldn't. We have to do 40 things using their things...
                    //Do not remove this line
                    //_audioManager.SpeakersVolume = volume;

                    visioforgePlayer.TVTuner_Channel = number;
                }));
            }
            catch (Exception ex)
            {
                OnError(ex);
            }
        }
コード例 #5
0
        private void btStart_Click(object sender, RoutedEventArgs e)
        {
            mmLog.Clear();

            VideoCapture1.Video_Sample_Grabber_Enabled = true;

            VideoCapture1.Debug_Mode = cbDebugMode.IsChecked == true;
            VideoCapture1.Debug_Dir  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\VisioForge\\";

            VideoCapture1.Audio_OutputDevice = "Default DirectSound Device";

            if (cbRecordAudio.IsChecked == true)
            {
                VideoCapture1.Audio_RecordAudio = true;
                VideoCapture1.Audio_PlayAudio   = true;
            }
            else
            {
                VideoCapture1.Audio_RecordAudio = false;
                VideoCapture1.Audio_PlayAudio   = false;
            }

            // apply capture params
            VideoCapture1.Video_Renderer.Video_Renderer = VFVideoRendererWPF.WPF;

            VideoCapture1.Video_CaptureDevice = cbVideoInputDevice.Text;
            VideoCapture1.Video_CaptureDevice_IsAudioSource = cbUseAudioInputFromVideoCaptureDevice.IsChecked == true;
            VideoCapture1.Audio_OutputDevice = cbAudioOutputDevice.Text;
            VideoCapture1.Audio_CaptureDevice_Format_UseBest = cbUseBestAudioInputFormat.IsChecked == true;
            VideoCapture1.Video_CaptureFormat         = cbVideoInputFormat.Text;
            VideoCapture1.Video_CaptureFormat_UseBest = cbUseBestVideoInputFormat.IsChecked == true;
            VideoCapture1.Audio_CaptureDevice         = cbAudioInputDevice.Text;
            VideoCapture1.Audio_CaptureDevice_Format  = cbAudioInputFormat.Text;

            if (cbFramerate.SelectedIndex != -1)
            {
                VideoCapture1.Video_FrameRate = (float)Convert.ToDouble(cbFramerate.Text);
            }

            if (cbMode.SelectedIndex == 0)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.VideoPreview;
            }
            else if (cbMode.SelectedIndex == 1)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.VideoCapture;

                VideoCapture1.Output_Filename = edOutput.Text;
                var aviOutput = new VFAVIOutput();

                aviOutput.ACM.Name       = cbAudioCodecs.Text;
                aviOutput.ACM.Channels   = Convert.ToInt32(cbChannels.Text);
                aviOutput.ACM.BPS        = Convert.ToInt32(cbBPS.Text);
                aviOutput.ACM.SampleRate = Convert.ToInt32(cbSampleRate.Text);

                aviOutput.Video_Codec = cbVideoCodecs.Text;

                VideoCapture1.Output_Format = aviOutput;
            }
            else if (cbMode.SelectedIndex == 2)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.VideoCapture;

                VideoCapture1.Output_Filename = edOutput.Text;

                var wmvOutput = new VFWMVOutput();

                wmvOutput.Mode = VFWMVMode.InternalProfile;

                if (cbWMVInternalProfile9.SelectedIndex != -1)
                {
                    wmvOutput.Internal_Profile_Name = cbWMVInternalProfile9.Text;
                }

                VideoCapture1.Output_Format = wmvOutput;
            }
            else
            {
                VideoCapture1.Mode = VFVideoCaptureMode.VideoCapture;

                VideoCapture1.Output_Filename = edOutput.Text;

                var mp4Output = new VFMP4Output();

                int tmp;

                // Main settings
                mp4Output.MP4Mode = VFMP4Mode.v10;

                // Video H264 settings
                switch (cbH264Profile.SelectedIndex)
                {
                case 0:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileAuto;
                    break;

                case 1:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileBaseline;
                    break;

                case 2:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileMain;
                    break;

                case 3:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileHigh;
                    break;

                case 4:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileHigh10;
                    break;

                case 5:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileHigh422;
                    break;
                }

                switch (cbH264Level.SelectedIndex)
                {
                case 0:
                    mp4Output.Video_H264.Level = VFH264Level.LevelAuto;
                    break;

                case 1:
                    mp4Output.Video_H264.Level = VFH264Level.Level1;
                    break;

                case 2:
                    mp4Output.Video_H264.Level = VFH264Level.Level11;
                    break;

                case 3:
                    mp4Output.Video_H264.Level = VFH264Level.Level12;
                    break;

                case 4:
                    mp4Output.Video_H264.Level = VFH264Level.Level13;
                    break;

                case 5:
                    mp4Output.Video_H264.Level = VFH264Level.Level2;
                    break;

                case 6:
                    mp4Output.Video_H264.Level = VFH264Level.Level21;
                    break;

                case 7:
                    mp4Output.Video_H264.Level = VFH264Level.Level22;
                    break;

                case 8:
                    mp4Output.Video_H264.Level = VFH264Level.Level3;
                    break;

                case 9:
                    mp4Output.Video_H264.Level = VFH264Level.Level31;
                    break;

                case 10:
                    mp4Output.Video_H264.Level = VFH264Level.Level32;
                    break;

                case 11:
                    mp4Output.Video_H264.Level = VFH264Level.Level4;
                    break;

                case 12:
                    mp4Output.Video_H264.Level = VFH264Level.Level41;
                    break;

                case 13:
                    mp4Output.Video_H264.Level = VFH264Level.Level42;
                    break;

                case 14:
                    mp4Output.Video_H264.Level = VFH264Level.Level5;
                    break;

                case 15:
                    mp4Output.Video_H264.Level = VFH264Level.Level51;
                    break;
                }

                switch (cbH264TargetUsage.SelectedIndex)
                {
                case 0:
                    mp4Output.Video_H264.TargetUsage = VFH264TargetUsage.Auto;
                    break;

                case 1:
                    mp4Output.Video_H264.TargetUsage = VFH264TargetUsage.BestQuality;
                    break;

                case 2:
                    mp4Output.Video_H264.TargetUsage = VFH264TargetUsage.Balanced;
                    break;

                case 3:
                    mp4Output.Video_H264.TargetUsage = VFH264TargetUsage.BestSpeed;
                    break;
                }

                mp4Output.Video_H264.PictureType = VFH264PictureType.Auto;

                mp4Output.Video_H264.RateControl = (VFH264RateControl)cbH264RateControl.SelectedIndex;
                mp4Output.Video_H264.GOP         = cbH264GOP.IsChecked == true;
                mp4Output.Video_H264.BitrateAuto = cbH264AutoBitrate.IsChecked == true;

                int.TryParse(edH264Bitrate.Text, out tmp);
                mp4Output.Video_H264.Bitrate = tmp;

                // Audio AAC settings
                int.TryParse(cbAACBitrate.Text, out tmp);
                mp4Output.Audio_AAC.Bitrate = tmp;

                mp4Output.Audio_AAC.Version = (VFAACVersion)cbAACMPEGVersion.SelectedIndex;
                mp4Output.Audio_AAC.Output  = (VFAACOutput)cbAACOutput.SelectedIndex;
                mp4Output.Audio_AAC.Object  = (VFAACObject)(cbAACObject.SelectedIndex + 1);

                VideoCapture1.Output_Format = mp4Output;
            }

            VideoCapture1.Video_Effects_Enabled = true;
            VideoCapture1.Video_Effects_Clear();

            IVFVideoEffectDeinterlaceCAVT cavt = new VFVideoEffectDeinterlaceCAVT(true, 20);

            VideoCapture1.Video_Effects_Add(cavt);

            VideoCapture1.Start();
        }
コード例 #6
0
        private void btStart_Click(object sender, RoutedEventArgs e)
        {
            VideoCapture1.Video_Sample_Grabber_Enabled = true;

            mmLog.Clear();

            VideoCapture1.Debug_Mode = cbDebugMode.IsChecked == true;
            VideoCapture1.Debug_Dir  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\VisioForge\\";

            if (cbRecordAudio.IsChecked == true)
            {
                VideoCapture1.Audio_RecordAudio = true;
                VideoCapture1.Audio_PlayAudio   = false;
            }
            else
            {
                VideoCapture1.Audio_RecordAudio = false;
                VideoCapture1.Audio_PlayAudio   = false;
            }

            VideoCapture1.Video_Renderer.Video_Renderer = VFVideoRendererWPF.WPF;

            VideoCapture1.Video_CaptureDevice = cbVideoInputDevice.Text;
            VideoCapture1.Video_CaptureDevice_IsAudioSource = true;
            VideoCapture1.Audio_OutputDevice = cbAudioOutputDevice.Text;
            VideoCapture1.Audio_CaptureDevice_Format_UseBest = true;
            VideoCapture1.Video_CaptureFormat         = cbVideoInputFormat.Text;
            VideoCapture1.Video_CaptureFormat_UseBest = cbUseBestVideoInputFormat.IsChecked == true;

            if (cbFramerate.SelectedIndex != -1)
            {
                VideoCapture1.Video_FrameRate = (float)Convert.ToDouble(cbFramerate.Text);
            }

            if (rbPreview.IsChecked == true)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.VideoPreview;
            }
            else
            {
                VideoCapture1.Mode            = VFVideoCaptureMode.VideoCapture;
                VideoCapture1.Output_Filename = edOutput.Text;

                if (rbAVI.IsChecked == true)
                {
                    var aviOutput = new VFAVIOutput();

                    aviOutput.ACM.Name       = cbAudioCodecs.Text;
                    aviOutput.ACM.Channels   = Convert.ToInt32(cbChannels.Text);
                    aviOutput.ACM.BPS        = Convert.ToInt32(cbBPS.Text);
                    aviOutput.ACM.SampleRate = Convert.ToInt32(cbSampleRate.Text);

                    aviOutput.Video_Codec = cbVideoCodecs.Text;

                    VideoCapture1.Output_Format = aviOutput;
                }
                else if (rbWMV.IsChecked == true)
                {
                    var wmvOutput = new VFWMVOutput();

                    wmvOutput.Mode = VFWMVMode.InternalProfile;

                    if (cbWMVInternalProfile9.SelectedIndex != -1)
                    {
                        wmvOutput.Internal_Profile_Name = cbWMVInternalProfile9.Text;
                    }

                    VideoCapture1.Output_Format = wmvOutput;
                }
                else if (rbDVDirectstream.IsChecked == true)
                {
                    var dvDirectcaptureOutput = new VFDirectCaptureDVOutput();
                    VideoCapture1.Output_Format = dvDirectcaptureOutput;
                }
                else
                {
                    var dvOutput = new VFDVOutput();

                    dvOutput.Audio_Channels   = Convert.ToInt32(cbDVChannels.Text);
                    dvOutput.Audio_SampleRate = Convert.ToInt32(cbDVSampleRate.Text);

                    if (rbDVPAL.IsChecked == true)
                    {
                        dvOutput.Video_Format = VFDVVideoFormat.PAL;
                    }
                    else
                    {
                        dvOutput.Video_Format = VFDVVideoFormat.NTSC;
                    }

                    dvOutput.Type2 = rbDVType2.IsChecked == true;

                    VideoCapture1.Output_Format = dvOutput;
                }
            }

            VideoCapture1.Video_Effects_Enabled = true;
            VideoCapture1.Video_Effects_Clear();

            IVFVideoEffectDeinterlaceCAVT cavt = new VFVideoEffectDeinterlaceCAVT(true, 20);

            VideoCapture1.Video_Effects_Add(cavt);

            VideoCapture1.Start();
        }