Ejemplo n.º 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();
        }
 internal bool IsAttached(VLCLibrary.VlcEventType type)
 {
     return _AttachedEvents.Contains(type);
 }
Ejemplo n.º 3
0
 public AudioOutput(VLCLibrary.libvlc_audio_output_t output)
 {
     _output = output;
     _outputDevices = new ArrayList();
 }
 internal void DetachEvent(VLCLibrary.VlcEventType type, VLCLibrary.EventCallbackDelegate callback, IntPtr userdata)
 {
     VLCLibrary.Instance.event_detach(VlcEventManager.Handle, (uint)type, callback, userdata, string.Empty);
     _AttachedEvents.Remove(type);
 }
 internal void AttachEvent(VLCLibrary.VlcEventType type, VLCLibrary.EventCallbackDelegate callback, IntPtr userdata)
 {
     VLCLibrary.Instance.event_attach(VlcEventManager.Handle, (uint)type, callback, userdata, null);
     _AttachedEvents.Add(type);
 }
 public void MediaPlayerEnded(ref VLCLibrary.VlcEventType type, IntPtr userdata)
 {
     Form1.Instance.Closeapp();
 }
 public void LogEvent(ref VLCLibrary.VlcEventType type, IntPtr userdata)
 {
     _instance.Logger.writeToLog("[Event]: " + type.ToString());
 }
Ejemplo n.º 8
0
 public VLCLibrary()
 {
     VLCLibrary.Instance = this;
 }