Which wrapper are you referring to? Those two forum thread refers to two different wrapper? Plus, what version of videolan are you using?I noticed a memory leak with the wrapper
More details are posted here viewtopic.php?f=32&t=47385&start=90#p177639
I noticed the memory leak in both wrappersWhich wrapper are you referring to? Those two forum thread refers to two different wrapper? Plus, what version of videolan are you using?
Is VLC.exe itself using libVLC ?I guess the problem isn't in wrapper but in libVlc itself...
Code: Select all
/* Data structures */
private static int WH_MOUSE_LL = 14;
private static int wm_LButtonDown = 513;
private static int wm_LButtonUp = 514;
private static int wm_RButtonDown = 516;
private static int wm_RButtonUp = 517;
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
private static extern IntPtr GetModuleHandle(string moduleName);
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern IntPtr SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hMod, uint dwThreadId);
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool UnhookWindowsHookEx(IntPtr idHook);
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, uint wParam, IntPtr lParam);
[StructLayout(LayoutKind.Sequential)]
public class POINT
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Sequential)]
public class MouseLLHookStruct
{
public POINT pt;
public int mouseData;
public int flags;
public int time;
public int dwExtraInfo;
}
private static HookProc hookProc;
private static IntPtr hook;
private static GCHandle hookProcHandle;
private static GCHandle hookHandle;
private delegate IntPtr HookProc(int nCode, uint wParam, IntPtr lParam);
/* This code is used during window intialization. */
hookProc = new HookProc(LowLevelMouseProc);
hook = SetWindowsHookEx(WH_MOUSE_LL, hookProc, GetModuleHandle(null), 0);
hookProcHandle = GCHandle.Alloc(hookProc, GCHandleType.Normal);
hookHandle = GCHandle.Alloc(hook, GCHandleType.Normal);
/* Heres the hook code */
private static IntPtr LowLevelMouseProc(int nCode, uint wParam, IntPtr lParam)
{
if (wParam != wm_LButtonDown &&
wParam != wm_LButtonUp &&
wParam != wm_RButtonDown &&
wParam != wm_RButtonUp)
{
return CallNextHookEx(IntPtr.Zero, nCode, wParam, lParam);
}
if (wParam == wm_LButtonDown ||
wParam == wm_RButtonDown)
return (new IntPtr(1));
MouseLLHookStruct hookStruct = (MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseLLHookStruct));
if (hookStruct.pt.x > SystemParameters.WorkArea.Width ||
hookStruct.pt.y > SystemParameters.WorkArea.Height)
{
showControls(); // This routine shows my control buttons.
return (new IntPtr(1));
}
return CallNextHookEx(IntPtr.Zero, nCode, wParam, lParam);
}
Code: Select all
public class vlcWrapper
{
private VideoLan.VideoLanClient vlc;
private VideoLan.VlcMediaPlayer vlcPlayer;
private VideoLan.VlcMedia vlcMedia;
public vlcWrapper(IntPtr _videoHandle)
{
this.vlc = new VideoLan.VideoLanClient();
this.vlcPlayer = vlc.NewMediaPlayer(_videoHandle);
}
public void LoadFile(string aFilename)
{
this.vlcMedia = this.vlc.NewMedia(aFilename);
this.vlcMedia.AddOption(@":no-video-title-show");
this.vlcPlayer.Load(this.vlcMedia);
}
public void Play()
{
if (this.vlcMedia != null)
{
this.vlcPlayer.Audio.ToggleMute();
this.vlcPlayer.Play();
}
}
public void Pause()
{
this.vlcPlayer.Pause();
}
public void Stop()
{
this.vlcPlayer.Stop();
}
public string GetMediaTitle()
{
string title = "";
if (this.vlcMedia != null)
{
title = this.vlcMedia.ReadMeta(VideoLan.libvlc_meta_t.libvlc_meta_Title);
}
return title;
}
}
You can manually set the priority of a thread in .NET, but all bets are off as to whether the OS decides to honour your 'request' to change priority. Note that this requires you to be able to get a reference to the VLC thread.Hey dude,
Been playing with it a bit more, I'm only interested in audio at the moment, and it's going great.
Just a quick question, is it possible to raise the priority of the VLC thread so it has priority over everything else in the application? I get quite a big hit when I load some of the album covers in my interface which causes the music to pause momentarily. I'd like to eliminate this and giving the video priority seems to be the best way to achieve this, I just don't know enough about the interop stuff yet.
Cheers,
Nathan
Code: Select all
//cbSurfaceChanged = new D3dCallback(SurfacedChanged);
//InteropMethods.libd3d_surface_changed_callback(cbSurfaceChanged);
Hmm! I have the same problem. Did you find a solution?This wrapper is not working for me. I grabbed publicEnemy's code from here: http://www.syairin.com/SimplePlayer.7z
All I get is a blank screen. Details:
WindowsXP
VLC 0.9.8
Argh!Stupid me I was missing the plugins sub-directory below the sample programs.Hmm! I have the same problem. Did you find a solution?
Code: Select all
vlcMediaStream.AddOption("--rtsp-tcp");
vlcMediaStream.AddOption("--socks=\"localhost:1080\"");
//vlcMediaStream.AddOption(":socks=\"localhost:1080\"");
vlcMediaPlayerStream.Load(vlcMediaStream);
vlcMediaStream.Dispose();
vlcMediaPlayerStream.Play();
Return to “Development around libVLC”
Users browsing this forum: No registered users and 9 guests