示例#1
0
        public Form1(string mediafile)
        {
            InitializeComponent();
            Form1.Instance = this;
            // set window location/sizing and force to top of z index
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.WindowState     = FormWindowState.Maximized;
            this.Focus();
            this.TopMost = true;
            this.Refresh();

            vlcLibrary = new VLCLibrary();
            if (vlcLibrary.DetectVLC())
            {
                try
                {
                    vlcLibrary.SetupVLC();
                }
                catch (Exception e)
                {
                }
            }

            // activate the remote control hooks
            remoteManager      = new MCRemoteControlManager();
            remoteManager.form = this;
            remoteManager.AssignHandle(this.Handle);

            IntPtr panelHandle = panel1.Handle;

            string[] args = new string[] {
                "-I", "dummy", "--ignore-config",
                @"--plugin-path=" + MediaCenterVLCPlayer.Properties.Settings.Default.VlcPluginsPath
            };

            if (!System.IO.Directory.Exists(MediaCenterVLCPlayer.Properties.Settings.Default.VlcPluginsPath))
            {
                DialogResult result = MessageBox.Show("Error: we do NOT have a valid location for the VLC plugins folder", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
            }
            // init VLC
            try
            {
                instance = new VlcInstance(args);
            }
            catch (VlcException e)
            {
                MessageBox.Show("Error creating VLC Instance:" + e.Message);
                Environment.Exit(0);
            }

            player          = instance.CreatePlayer(mediafile);
            player.Drawable = panelHandle;
            // give the remote control lib access to the active panel so it gets keyboard/mouse/remote events
            remoteManager.playerHandle = player.Handle;

            IntPtr p_event_manager = vlcLibrary.media_player_event_manager(player.Handle);

            eventmanager = new VlcEventManager(instance, p_event_manager);
            eventmanager.InitalizeEvents();
        }
 public VlcMediaPlayer(VlcInstance instance, VlcMedia media)
 {
     this._instance = instance;
     this._media = media;
     Handle = VLCLibrary.Instance.media_player_new_from_media(media.Handle);
     if (Handle == IntPtr.Zero) throw new VlcException();
 }
示例#3
0
        public Form1(string mediafile)
        {
            InitializeComponent();
            Form1.Instance = this;
            // set window location/sizing and force to top of z index
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.WindowState = FormWindowState.Maximized;
            this.Focus();
            this.TopMost = true;
            this.Refresh();

            vlcLibrary = new VLCLibrary();
            if (vlcLibrary.DetectVLC())
            {
                try
                {
                    vlcLibrary.SetupVLC();
                }
                catch (Exception e)
                {
                }
            }

            // activate the remote control hooks
            remoteManager = new MCRemoteControlManager();
            remoteManager.form = this;
            remoteManager.AssignHandle(this.Handle);

            IntPtr panelHandle = panel1.Handle;

            string[] args = new string[] {
                "-I", "dummy", "--ignore-config",
                @"--plugin-path=" + MediaCenterVLCPlayer.Properties.Settings.Default.VlcPluginsPath
            };

            if (!System.IO.Directory.Exists(MediaCenterVLCPlayer.Properties.Settings.Default.VlcPluginsPath))
            {
                DialogResult result = MessageBox.Show("Error: we do NOT have a valid location for the VLC plugins folder", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
            }
            // init VLC
            try
            {
                instance = new VlcInstance(args);
            }
            catch (VlcException e)
            {
                MessageBox.Show("Error creating VLC Instance:" + e.Message);
                Environment.Exit(0);
            }

            player = instance.CreatePlayer(mediafile);
            player.Drawable = panelHandle;
            // give the remote control lib access to the active panel so it gets keyboard/mouse/remote events
            remoteManager.playerHandle = player.Handle;

            IntPtr p_event_manager = vlcLibrary.media_player_event_manager(player.Handle);
            eventmanager = new VlcEventManager(instance, p_event_manager);
            eventmanager.InitalizeEvents();
        }
 public VlcMediaPlayer(VlcInstance instance, VlcMedia media)
 {
     this._instance = instance;
     this._media    = media;
     Handle         = VLCLibrary.Instance.media_player_new_from_media(media.Handle);
     if (Handle == IntPtr.Zero)
     {
         throw new VlcException();
     }
 }
        public void ChangeSubtitleTrackTest()
        {
            VlcInstance instance = new VlcInstance(VlcInstanceArgs);
            VlcMediaPlayer player = instance.CreatePlayer(BaseTestFilePath + "mewmew-vorbis-ssa.mkv");
            player.Play();

            int currentSubtitleTrackId = VLCLibrary.Instance.video_get_spu(player.Handle);
            player.ChangeSubtitleTrack(3);
            Assert.AreNotEqual(currentSubtitleTrackId, VLCLibrary.Instance.video_get_spu(player.Handle));
        }
 public void AspectRatioTest()
 {
     VlcInstance instance = new VlcInstance(VlcInstanceArgs);
     VlcMediaPlayer player = instance.CreatePlayer(BaseTestFilePath + "n900_extremely_short.avi");
     player.Play();
     Assert.AreEqual("1.66", player.Media.AspectRatio);
     player.Stop();
     player.Dispose();
     instance.Dispose();
 }
        public VlcMedia(VlcInstance instance, string path)
        {
            _instance = instance;
            _defaultAspectRatio = string.Empty;
            _currentAspectRatio = string.Empty;

            Handle = VLCLibrary.Instance.media_new_path(instance.Handle, path);
            if (Handle == IntPtr.Zero)
            {
                return;
            }
        }
示例#8
0
        public VlcMedia(VlcInstance instance, string path)
        {
            _instance           = instance;
            _defaultAspectRatio = string.Empty;
            _currentAspectRatio = string.Empty;

            Handle = VLCLibrary.Instance.media_new_path(instance.Handle, path);
            if (Handle == IntPtr.Zero)
            {
                return;
            }
        }
        public void AudioTracksTest()
        {
            VlcInstance instance = null;
            VlcMediaPlayer player = null;
            instance = new VlcInstance(VlcInstanceArgs);
            player = instance.CreatePlayer(BaseTestFilePath + "mewmew-vorbis-ssa.mkv");
            Assert.IsInstanceOfType(player, typeof(VlcMediaPlayer));
            player.Play();
            Assert.AreEqual(player.Media.Length, 58183);

            player.Stop();
            player.Dispose();

            instance.Dispose();
        }
 public void VlcMediaPlayerConstructorTest()
 {
     VlcInstance instance = new VlcInstance(VlcInstanceArgs);
     VlcMediaPlayer player = instance.CreatePlayer(BaseTestFilePath + "n900_extremely_short.avi");
     Assert.IsInstanceOfType(player, typeof(VlcMediaPlayer));
     Assert.IsInstanceOfType(player.Media, typeof(VlcMedia));
 }
 public void MyTestInitialize()
 {
     instance = new VlcInstance(VlcInstanceArgs);
 }
 internal VlcEventManager(VlcInstance instance, IntPtr p_event_manager)
 {
     _instance = instance;
     _AttachedEvents = new List<VLCLibrary.VlcEventType>();
     VlcEventManager.Handle = p_event_manager;
 }
 public void SettingsControllerConstructorTest()
 {
     VlcInstance instance = new VlcInstance(VlcInstanceArgs);
     SettingsController target = new SettingsController();
     Assert.IsInstanceOfType(target, typeof(SettingsController));
 }
 public void VlcMediaConstructorTest()
 {
     VlcInstance instance = null;
     VlcMediaPlayer player = null;
     instance = new VlcInstance(VlcInstanceArgs);
     player = instance.CreatePlayer(BaseTestFilePath + "n900_extremely_short.avi");
     Assert.IsInstanceOfType(player, typeof(VlcMediaPlayer));
     player.Play();
     Assert.AreEqual(player.Media.Length, 5000);
     player.Stop();
     player.Dispose();
 }
        public void SubtitleTracksTest()
        {
            VlcInstance instance = null;
            VlcMediaPlayer player = null;
            instance = new VlcInstance(VlcInstanceArgs);
            player = instance.CreatePlayer(BaseTestFilePath + "mewmew-vorbis-ssa.mkv");
            Assert.IsInstanceOfType(player, typeof(VlcMediaPlayer));
            player.Play();
            Assert.AreEqual(player.Media.Length, 58183);
            ArrayList subtitles = player.Media.SubtitleTracks;
            Assert.AreEqual(subtitles.Count, 17);

            Assert.AreEqual("Disable", ((VLCLibrary.libvlc_track_description_t)subtitles[0]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(0));
            Assert.AreEqual("Track 1 - [English]", ((VLCLibrary.libvlc_track_description_t)subtitles[1]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(1));
            Assert.AreEqual("Track 2 - [Nederlands]", ((VLCLibrary.libvlc_track_description_t)subtitles[2]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(2));
            Assert.AreEqual("Track 3 - [English]", ((VLCLibrary.libvlc_track_description_t)subtitles[3]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(3));
            Assert.AreEqual("Track 4 - [Suomi]", ((VLCLibrary.libvlc_track_description_t)subtitles[4]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(4));
            Assert.AreEqual("Track 5 - [Français]", ((VLCLibrary.libvlc_track_description_t)subtitles[5]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(5));
            Assert.AreEqual("Track 6 - [Deutsch]", ((VLCLibrary.libvlc_track_description_t)subtitles[6]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(6));
            Assert.AreEqual("Track 7 - [עברית]", ((VLCLibrary.libvlc_track_description_t)subtitles[7]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(7));
            Assert.AreEqual("Track 8 - [Magyar]", ((VLCLibrary.libvlc_track_description_t)subtitles[8]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(8));
            Assert.AreEqual("Track 9 - [Italiano]", ((VLCLibrary.libvlc_track_description_t)subtitles[9]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(9));
            Assert.AreEqual("Track 10 - [日本語]", ((VLCLibrary.libvlc_track_description_t)subtitles[10]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(10));
            Assert.AreEqual("Track 11 - [Norsk]", ((VLCLibrary.libvlc_track_description_t)subtitles[11]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(11));
            Assert.AreEqual("Track 12 - [Polski]", ((VLCLibrary.libvlc_track_description_t)subtitles[12]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(12));
            Assert.AreEqual("Track 13 - [Português]", ((VLCLibrary.libvlc_track_description_t)subtitles[13]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(13));
            Assert.AreEqual("Track 14 - [Русский]", ((VLCLibrary.libvlc_track_description_t)subtitles[14]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(14));
            Assert.AreEqual("Track 15 - [Español]", ((VLCLibrary.libvlc_track_description_t)subtitles[15]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(15));
            Assert.AreEqual("Track 16 - [Svenska]", ((VLCLibrary.libvlc_track_description_t)subtitles[16]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(16));

            player.Stop();
            player.Dispose();

            instance.Dispose();
        }
 internal VlcEventManager(VlcInstance instance, IntPtr p_event_manager)
 {
     _instance              = instance;
     _AttachedEvents        = new List <VLCLibrary.VlcEventType>();
     VlcEventManager.Handle = p_event_manager;
 }