コード例 #1
0
        private async void BtStart_Click(object sender, EventArgs e)
        {
            mmLog.Text = string.Empty;

            MediaPlayer1.Debug_Mode = cbDebugMode.Checked;

            if (_videoInfoList.Count == 0)
            {
                MessageBox.Show("Please read formats first.");
                return;
            }

            MediaPlayer1.Source_Mode     = VFMediaPlayerSource.LAV;
            MediaPlayer1.Audio_PlayAudio = false;

            MediaPlayer1.Audio_AdditionalStreams_Clear();

            MediaPlayer1.FilenamesOrURL.Clear();
            MediaPlayer1.FilenamesOrURL.Add(_videoInfoList[cbVideoStream.SelectedIndex].Url);

            if (_videoInfoList[cbVideoStream.SelectedIndex].ToString().Contains("Muxed"))
            {
                MediaPlayer1.Audio_PlayAudio = true;
            }

            if (cbAudioStream.SelectedIndex > 0)
            {
                MediaPlayer1.Audio_PlayAudio = true;
                MediaPlayer1.Audio_AdditionalStreams_Add(_audioInfoList[cbAudioStream.SelectedIndex].Url);
            }

            await MediaPlayer1.PlayAsync();

            timer1.Start();
        }
コード例 #2
0
        private async void btStart_Click(object sender, EventArgs e)
        {
            MediaPlayer1.FilenamesOrURL.Add(edFilename.Text);
            MediaPlayer1.Loop                 = cbLoop.Checked;
            MediaPlayer1.Audio_PlayAudio      = true;
            MediaPlayer1.Info_UseLibMediaInfo = true;
            MediaPlayer1.Audio_OutputDevice   = "Default DirectSound Device";
            MediaPlayer1.Source_Mode          = VFMediaPlayerSource.LAV;

            if (MediaPlayer1.Filter_Supported_EVR())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.EVR;
            }
            else if (MediaPlayer1.Filter_Supported_VMR9())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VMR9;
            }
            else
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VideoRenderer;
            }

            MediaPlayer1.MultiScreen_Enabled = true;
            MediaPlayer1.MultiScreen_Clear();
            MediaPlayer1.MultiScreen_AddScreen(form2.Screen.Handle, form2.Screen.Width, form2.Screen.Height);

            await MediaPlayer1.PlayAsync();

            // set audio volume for each stream
            MediaPlayer1.Audio_OutputDevice_Balance_Set(0, tbBalance1.Value);
            MediaPlayer1.Audio_OutputDevice_Volume_Set(0, tbVolume1.Value);

            timer1.Enabled = true;
        }
コード例 #3
0
        private async void btStart_Click(object sender, EventArgs e)
        {
            mmError.Clear();

            MediaPlayer1.FilenamesOrURL.Add(edFilename.Text);
            MediaPlayer1.Loop            = cbLoop.Checked;
            MediaPlayer1.Audio_PlayAudio = true;

            MediaPlayer1.Source_Mode = VFMediaPlayerSource.DVD_DS;

            // read DVD info
            cbDVDControlTitle.Items.Clear();
            cbDVDControlChapter.Items.Clear();
            cbDVDControlAudio.Items.Clear();
            cbDVDControlSubtitles.Items.Clear();

            MediaInfo.Filename = edFilename.Text;
            MediaInfo.ReadDVDInfo();

            for (int i = 0; i < MediaInfo.DVD_Disc_NumOfTitles; i++)
            {
                cbDVDControlTitle.Items.Add("Title " + (i + 1));
            }

            MediaPlayer1.Audio_OutputDevice = "Default DirectSound Device";

            if (VideoCapture.Filter_Supported_EVR())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.EVR;
            }
            else if (VideoCapture.Filter_Supported_VMR9())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VMR9;
            }
            else
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VideoRenderer;
            }

            MediaPlayer1.Debug_Mode = cbDebugMode.Checked;

            await MediaPlayer1.PlayAsync();

            // DVD
            // select and play first title
            if (cbDVDControlTitle.Items.Count > 0)
            {
                cbDVDControlTitle.SelectedIndex = 0;
                cbDVDControlTitle_SelectedIndexChanged(null, null);
            }

            // show title menu
            MediaPlayer1.DVD_Menu_Show(VFDVDMenu.Title);

            MediaPlayer1.Audio_OutputDevice_Balance_Set(0, tbBalance1.Value);
            MediaPlayer1.Audio_OutputDevice_Volume_Set(0, tbVolume1.Value);

            timer1.Enabled = true;
        }
コード例 #4
0
        private async void btStart_Click(object sender, EventArgs e)
        {
            mmError.Clear();

            switch (cbSourceMode.SelectedIndex)
            {
            case 0:
                MediaPlayer1.Source_Mode = VFMediaPlayerSource.LAV;
                break;

            case 1:
                MediaPlayer1.Source_Mode = VFMediaPlayerSource.File_DS;
                break;

            case 2:
                MediaPlayer1.Source_Mode = VFMediaPlayerSource.File_FFMPEG;
                break;

            case 3:
                MediaPlayer1.Source_Mode = VFMediaPlayerSource.File_VLC;
                break;
            }

            MediaPlayer1.FilenamesOrURL.Add(edFilename.Text);
            MediaPlayer1.Loop                 = cbLoop.Checked;
            MediaPlayer1.Audio_PlayAudio      = true;
            MediaPlayer1.Info_UseLibMediaInfo = true;
            MediaPlayer1.Audio_OutputDevice   = "Default DirectSound Device";

            if (MediaPlayer1.Filter_Supported_EVR())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.EVR;
            }
            else if (MediaPlayer1.Filter_Supported_VMR9())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VMR9;
            }
            else
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VideoRenderer;
            }

            MediaPlayer1.Debug_Mode = cbDebugMode.Checked;

            await MediaPlayer1.PlayAsync();

            // set audio volume for each stream
            MediaPlayer1.Audio_OutputDevice_Balance_Set(0, tbBalance1.Value);
            MediaPlayer1.Audio_OutputDevice_Volume_Set(0, tbVolume1.Value);

            timer1.Enabled = true;
        }
コード例 #5
0
        private async void VideoCapture1_OnTimeshiftFileCreated(object sender, TimeshiftFileEventArgs e)
        {
            MediaPlayer1.Debug_Mode = true;
            MediaPlayer1.Debug_Dir  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\VisioForge\\";

            string filename = e.Filename;

            MediaPlayer1.FilenamesOrURL.Clear();
            MediaPlayer1.FilenamesOrURL.Add(filename);

            MediaPlayer1.Source_Mode = VFMediaPlayerSource.Timeshift;

            await MediaPlayer1.PlayAsync();
        }
コード例 #6
0
        private async void BtStart_Click(object sender, EventArgs e)
        {
            if (_videoInfoList.Count == 0)
            {
                MessageBox.Show("Please read formats first.");
                return;
            }

            MediaPlayer1.Source_Mode = VFMediaPlayerSource.LAV;
            MediaPlayer1.FilenamesOrURL.Clear();
            MediaPlayer1.FilenamesOrURL.Add(_videoInfoList[cbFormat.SelectedIndex].Uri);

            await MediaPlayer1.PlayAsync();
        }
コード例 #7
0
        private async void btStart_Click(object sender, EventArgs e)
        {
            mmError.Clear();

            MediaPlayer1.Source_Mode = VFMediaPlayerSource.LAV;

            MediaPlayer1.FilenamesOrURL.Add(edFilename.Text);
            MediaPlayer1.Audio_PlayAudio      = true;
            MediaPlayer1.Info_UseLibMediaInfo = true;
            MediaPlayer1.Audio_OutputDevice   = "Default DirectSound Device";

            if (MediaPlayer1.Filter_Supported_EVR())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.EVR;
            }
            else if (MediaPlayer1.Filter_Supported_VMR9())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VMR9;
            }
            else
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VideoRenderer;
            }

            MediaPlayer1.Debug_Mode = cbDebugMode.Checked;


            MediaPlayer1.Video_Effects_GPU_Enabled = true;
            MediaPlayer1.Video_Effects_GPU_Clear();

            if (rbVRCubemap.Checked)
            {
                vr = new VFGPUVideoEffectEquiangularCubemap360(true, 0, 0, 0, 80, "VR");
            }
            else
            {
                vr = new VFGPUVideoEffectEquirectangular360(true, 0, 0, 0, 80, "VR");
            }

            MediaPlayer1.Video_Effects_GPU_Add(vr);
            // MediaPlayer1.Video_Effects_GPU_Add(new VFGPUVideoEffectEquirectangular360(true));

            await MediaPlayer1.PlayAsync();

            // set audio volume for each stream
            MediaPlayer1.Audio_OutputDevice_Balance_Set(0, tbBalance1.Value);
            MediaPlayer1.Audio_OutputDevice_Volume_Set(0, tbVolume1.Value);

            timer1.Enabled = true;
        }
コード例 #8
0
        private async void btStart_Click(object sender, EventArgs e)
        {
            mmLog.Clear();
            tcMain.SelectedIndex = 4;

            if (rbVideoFile.Checked)
            {
                ConfigureMediaPlayer();
            }
            else
            {
                ConfigureVideoCapture();
            }

            // add face detection
            if (cbFDEnabled.Checked)
            {
                FaceDetectionAdd();
            }

            // add car counter
            if (cbCCEnabled.Checked)
            {
                CarCounterAdd();
            }

            // add car counter
            if (cbPDEnabled.Checked)
            {
                PedestrianDetectionAdd();
            }

            //this.MediaPlayer1.Video_Effects_Enabled = true;
            //    this.MediaPlayer1.Video_Effects_Clear();
            //    this.MediaPlayer1.Video_Effects_Add(new VFVideoEffectMosaic(true, 500));

            if (rbVideoFile.Checked)
            {
                MediaPlayer1.Show();
                VideoCapture1.Hide();
                await MediaPlayer1.PlayAsync();
            }
            else
            {
                MediaPlayer1.Hide();
                VideoCapture1.Show();
                await VideoCapture1.StartAsync();
            }
        }
コード例 #9
0
        private async void btStart_Click(object sender, EventArgs e)
        {
            MediaPlayer1.Debug_Mode           = cbDebugMode.Checked;
            MediaPlayer1.Info_UseLibMediaInfo = true;

            mmLog.Clear();

            MediaPlayer1.Video_Renderer.Zoom_Ratio  = 0;
            MediaPlayer1.Video_Renderer.Zoom_ShiftX = 0;
            MediaPlayer1.Video_Renderer.Zoom_ShiftY = 0;

            MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VMR9;
            MediaPlayer1.Source_Mode = VFMediaPlayerSource.LAV;

            await MediaPlayer1.PlayAsync();

            await MediaPlayer1.PIP_Sources_SetSourcePositionAsync(0, _pipInfos[0].Rect, 1.0f);

            lbSourceFiles.SelectedIndex = 0;

            timer1.Start();
        }
コード例 #10
0
        private async void btStart_Click(object sender, EventArgs e)
        {
            mmError.Text = string.Empty;

            if (rbSTreamTypeFile.Checked)
            {
                _fileStream = new FileStream(edFilename.Text, FileMode.Open);
                _stream     = new ManagedIStream(_fileStream);

                // specifying settings
                MediaPlayer1.Source_Stream      = _stream;
                MediaPlayer1.Source_Stream_Size = _fileStream.Length;
            }
            else
            {
                _memorySource = File.ReadAllBytes(edFilename.Text);
                _memoryStream = new MemoryStream(_memorySource);
                _stream       = new ManagedIStream(_memoryStream);

                // specifying settings
                MediaPlayer1.Source_Stream      = _stream;
                MediaPlayer1.Source_Stream_Size = _memoryStream.Length;
            }

            // video and audio present in file. tune this settings to play audio files or video files without audio
            if (rbVideoWithAudio.Checked)
            {
                MediaPlayer1.Source_Stream_VideoPresent = true;
                MediaPlayer1.Source_Stream_AudioPresent = true;
            }
            else if (rbVideoWithoutAudio.Checked)
            {
                MediaPlayer1.Source_Stream_VideoPresent = true;
                MediaPlayer1.Source_Stream_AudioPresent = false;
            }
            else
            {
                MediaPlayer1.Source_Stream_VideoPresent = false;
                MediaPlayer1.Source_Stream_AudioPresent = true;
            }

            MediaPlayer1.Source_Mode = VFMediaPlayerSource.Memory_DS;

            MediaPlayer1.Audio_OutputDevice = "Default DirectSound Device";

            if (VideoCapture.Filter_Supported_EVR())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.EVR;
            }
            else if (VideoCapture.Filter_Supported_VMR9())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VMR9;
            }
            else
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VideoRenderer;
            }

            MediaPlayer1.Debug_Mode = cbDebugMode.Checked;
            await MediaPlayer1.PlayAsync();

            tbTimeline.Maximum = (int)MediaPlayer1.Duration_Time().TotalSeconds;
            timer1.Enabled     = true;
        }
コード例 #11
0
        private async void btStart_Click(object sender, EventArgs e)
        {
            MediaPlayer1.Debug_Mode = cbDebugMode.Checked;

            mmLog.Clear();

            MediaPlayer1.Video_Renderer.Zoom_Ratio  = 0;
            MediaPlayer1.Video_Renderer.Zoom_ShiftX = 0;
            MediaPlayer1.Video_Renderer.Zoom_ShiftY = 0;

            var info = new MediaInfoReader
            {
                Filename = edFilenameOrURL.Text
            };

            info.ReadFileInfo(true);

            MediaPlayer1.Multiple_Video_Streams_Mappings_Clear();
            if (info.Video_Streams_Count() > 1)
            {
                for (int i = 0; i < info.Video_Streams_Count() - 1; i++)
                {
                    if (i > 3)
                    {
                        break;
                    }

                    Panel panel = null;
                    switch (i)
                    {
                    case 0:
                        panel = pnScreen1;
                        break;

                    case 1:
                        panel = pnScreen2;
                        break;

                    case 2:
                        panel = pnScreen3;
                        break;

                    case 3:
                        panel = pnScreen4;
                        break;
                    }

                    if (panel != null)
                    {
                        MediaPlayer1.Multiple_Video_Streams_Mappings_Add(i, panel.Handle, panel.Width, panel.Height);
                    }
                }
            }

            MediaPlayer1.FilenamesOrURL.Clear();
            MediaPlayer1.FilenamesOrURL.Add(edFilenameOrURL.Text);

            MediaPlayer1.Audio_PlayAudio      = true;
            MediaPlayer1.Info_UseLibMediaInfo = true;

            MediaPlayer1.Source_Mode = VFMediaPlayerSource.File_DS;

            if (MediaPlayer1.Filter_Supported_EVR())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.EVR;
            }
            else if (MediaPlayer1.Filter_Supported_VMR9())
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VMR9;
            }
            else
            {
                MediaPlayer1.Video_Renderer.Video_Renderer = VFVideoRenderer.VideoRenderer;
            }

            MediaPlayer1.Video_Sample_Grabber_UseForVideoEffects = false;

            await MediaPlayer1.PlayAsync();

            timer1.Enabled = true;
        }