Esempio n. 1
0
        private 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;

            MediaPlayer1.Play();

            timer1.Enabled = true;
        }