예제 #1
0
        protected internal virtual IntPtr Initialize(IntPtr vlcClient)
        {
            if (VlcMedia == IntPtr.Zero)
            {
                return(IntPtr.Zero);
            }
            LibVlcMethods.EventCallbackDelegate callback = OnVlcEvent;
            myEventCallback = Marshal.GetFunctionPointerForDelegate(callback);
            GC.KeepAlive(callback);

            myVlcMediaPlayerEventManager = LibVlcMethods.libvlc_media_event_manager(VlcMedia);

            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaMetaChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaSubItemAdded, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaDurationChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaParsedChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaFreed, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaStateChanged, myEventCallback, IntPtr.Zero);
            return(VlcMedia);
        }
예제 #2
0
        private void InitVlcMediaPlayer()
        {
            if (DesignMode)
            {
                return;
            }

            if (myVlcManager == null || myVlcManager.VlcClient == IntPtr.Zero || VlcMediaPlayer != IntPtr.Zero)
            {
                return;
            }

            VlcMediaPlayer = LibVlcMethods.libvlc_media_player_new(myVlcManager.VlcClient);
            LibVlcMethods.libvlc_media_player_set_hwnd(VlcMediaPlayer, Handle);
            VlcMediaPlayerEventManager = LibVlcMethods.libvlc_media_player_event_manager(VlcMediaPlayer);
            if (VlcMediaPlayerEventManager == IntPtr.Zero)
            {
                return;
            }
            LibVlcMethods.EventCallbackDelegate callback = OnVlcEvent;
            myEventCallback = Marshal.GetFunctionPointerForDelegate(callback);
            GC.KeepAlive(callback);

            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerBackward, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerBuffering, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerEncounteredError, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerEndReached, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerForward, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerLengthChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerMediaChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerOpening, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerPausableChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerPaused, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerPositionChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerSeekableChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerSnapshotTaken, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerStopped, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerTimeChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerTitleChanged, myEventCallback, IntPtr.Zero);
        }
예제 #3
0
        private void InitVlcMediaPlayer()
        {
            if (DesignMode)
                return;

            if (myVlcManager == null || myVlcManager.VlcClient == IntPtr.Zero || VlcMediaPlayer != IntPtr.Zero)
                return;

            VlcMediaPlayer = LibVlcMethods.libvlc_media_player_new(myVlcManager.VlcClient);
            LibVlcMethods.libvlc_media_player_set_hwnd(VlcMediaPlayer, Handle);
            VlcMediaPlayerEventManager = LibVlcMethods.libvlc_media_player_event_manager(VlcMediaPlayer);
            if (VlcMediaPlayerEventManager == IntPtr.Zero)
                return;
            callback = OnVlcEvent;
            myEventCallback = Marshal.GetFunctionPointerForDelegate(callback);
            GC.KeepAlive(callback);

            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerBackward, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerBuffering, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerEncounteredError, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerEndReached, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerForward, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerLengthChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerMediaChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerOpening, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerPausableChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerPaused, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerPositionChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerSeekableChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerSnapshotTaken, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerStopped, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerTimeChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(VlcMediaPlayerEventManager, libvlc_event_e.MediaPlayerTitleChanged, myEventCallback, IntPtr.Zero);
        }
예제 #4
0
        protected internal virtual IntPtr Initialize(IntPtr vlcClient)
        {
            if (VlcMedia == IntPtr.Zero)
                return IntPtr.Zero;
            callback = OnVlcEvent;
            myEventCallback = Marshal.GetFunctionPointerForDelegate(callback);
            GC.KeepAlive(callback);

            myVlcMediaPlayerEventManager = LibVlcMethods.libvlc_media_event_manager(VlcMedia);

            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaMetaChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaSubItemAdded, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaDurationChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaParsedChanged, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaFreed, myEventCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_event_attach(myVlcMediaPlayerEventManager, libvlc_event_e.MediaStateChanged, myEventCallback, IntPtr.Zero);
            return VlcMedia;
        }