Beispiel #1
0
        public void Stop()
        {
            LibVlc.libvlc_media_player_stop(Handle);

            playing = false;
            paused  = false;
        }
Beispiel #2
0
 public VlcMedia(VlcInstance instance, string url)
 {
     Handle = LibVlc.libvlc_media_new_location(instance.Handle, url);
     if (Handle == IntPtr.Zero)
     {
         throw new VlcException();
     }
 }
Beispiel #3
0
        public VlcException()
            : base()
        {
            IntPtr errorPointer = LibVlc.libvlc_errmsg();

            _err = errorPointer == IntPtr.Zero ? "VLC Exception"
                : Marshal.PtrToStringAuto(errorPointer);
        }
Beispiel #4
0
 public VlcInstance(string[] args)
 {
     Handle = LibVlc.libvlc_new(args.Length, args);
     if (Handle == IntPtr.Zero)
     {
         throw new VlcException();
     }
 }
Beispiel #5
0
 public void Dispose()
 {
     Stop();
     LibVlc.libvlc_media_player_release(Handle);
     if (--Core.Players == 0)
     {
         Core.Instance.Dispose();
     }
 }
Beispiel #6
0
 public void Open(VlcMedia media, IntPtr hwnd)
 {
     Handle = LibVlc.libvlc_media_player_new_from_media(media.Handle);
     if (Handle == IntPtr.Zero)
     {
         throw new VlcException();
     }
     Drawable = hwnd;
 }
Beispiel #7
0
        public void Pause()
        {
            LibVlc.libvlc_media_player_pause(Handle);

            if (playing)
            {
                paused ^= true;
            }
        }
Beispiel #8
0
        public void Play()
        {
            int ret = LibVlc.libvlc_media_player_play(Handle);

            if (ret == -1)
            {
                throw new VlcException();
            }

            playing = true;
            paused  = false;
        }
Beispiel #9
0
 public void Open(string path, IntPtr hwnd)
 {
     using (VlcMedia media = new VlcMedia(Core.Instance, path))
     {
         Handle = LibVlc.libvlc_media_player_new_from_media(media.Handle);
         if (Handle == IntPtr.Zero)
         {
             throw new VlcException();
         }
     }
     Drawable = hwnd;
 }
Beispiel #10
0
 public VlcMediaPlayer(VlcMedia media)
 {
     string[] args = new string[] {
         "-I", "dummy", "--ignore-config",
         @"--plugin-path=\plugins"
         //,"--vout-filter=deinterlace", "--deinterlace-mode=blend"
     };
     Core.Players++;
     Core.Instance = new VlcInstance(args);
     Handle        = LibVlc.libvlc_media_player_new_from_media(media.Handle);
     if (Handle == IntPtr.Zero)
     {
         throw new VlcException();
     }
 }
Beispiel #11
0
 public void Dispose()
 {
     LibVlc.libvlc_media_release(Handle);
 }