示例#1
0
        public VlcPlayer()
        {
            string[] args = new string[]
            {
                "-I",
                "dumy",
                "--ignore-config",
                "--no-osd",
                "--disable-screensaver",
                "--plugin-path=./plugins",
                "--audio-filter=equalizer",
                "--equalizer-preamp=11.9",
                "--equalizer-bands=0 0 0 0 0 0 0 0 0 0"
            };

            m_factory            = new MediaPlayerFactory(args);
            m_player             = m_factory.CreatePlayer <IVideoPlayer>();
            m_media_list         = m_factory.CreateMediaList <IMediaList>();
            m_media_list_preview = m_factory.CreateMediaList <IMediaList>();

            m_presets = Implementation.Equalizer.Presets.ToDictionary(key => key.Index);

            m_equalizer = new Implementation.Equalizer(m_presets[0]);

            m_equalizer.Preamp = Equalizer.ArrBandValue[10].PreAmp / 10;

            for (int i = 0; i < Equalizer.ArrBandValue.Count() - 2; i++)
            {
                m_equalizer.Bands[i].Amplitude = Equalizer.ArrBandValue[i].Gain / 10;

                Console.WriteLine("Amplitude " + m_equalizer.Bands[i].Amplitude + " : " + m_equalizer.Preamp);
            }

            m_player.SetEqualizer(m_equalizer);
            m_equalizer.Dispose();

            //Background Video ==========
            m_list_player = m_factory.CreateMediaListPlayer <IMediaListPlayer>(m_media_list);

            m_memRender = m_list_player.InnerPlayer.CustomRenderer;
            m_memRender.SetCallback(delegate(Bitmap frame)
            {
                Video = (Bitmap)frame.Clone();
            });

            // 4:3 aspect ratio resolutions: 640×480, 800×600, 960×720, 1024×768, 1280×960, 1400×1050, 1440×1080 , 1600×1200, 1856×1392, 1920×1440, and 2048×1536
            //16:9 aspect ratio resolutions: 1024×576, 1152×648, 1280×720, 1366×768, 1600×900, 1920×1080, 2560×1440 and 3840×2160

            m_memRender.SetFormat(new BitmapFormat(1024, 576, ChromaType.RV32));
            m_list_player.PlaybackMode     = PlaybackMode.Loop;
            m_list_player.InnerPlayer.Mute = true;
            //Background Video

            //Preview Background video ==========
            m_list_preview_player = m_factory.CreateMediaListPlayer <IMediaListPlayer>(m_media_list_preview);
            m_list_preview_player.PlaybackMode     = PlaybackMode.Loop;
            m_list_preview_player.InnerPlayer.Mute = true;
            //Preview Background video

            m_player.Events.PlayerPositionChanged += new EventHandler <MediaPlayerPositionChanged>(Events_PlayerPositionChanged);
            m_player.Events.TimeChanged           += new EventHandler <MediaPlayerTimeChanged>(Events_TimeChanged);
            m_player.Events.MediaEnded            += new EventHandler(Events_MediaEnded);
            m_player.Events.PlayerStopped         += new EventHandler(Events_PlayerStopped);

            videoDir = Main_Form.iniFileHelper.Read("Video", "Video Path");

            if (videoDir == string.Empty || !Directory.Exists(videoDir))
            {
                videoDir = BGVideoPath + @"VIDEO_NATURE\";
            }

            GetVideoBG(videoDir);

            SetAudioOutputDevice();
        }