vmem to SlimDX

This forum is about all development around libVLC.
DjoleReject
New Cone
New Cone
Posts: 1
Joined: 31 Mar 2010 22:43

vmem to SlimDX

Postby DjoleReject » 01 Apr 2010 00:20

Hi everybody.

I am trying to get video to be rendered to SlimDX surface (or Direct3D surface for that matter), and always I get stopped on lock problems. I tried to write to Bitmap, Direct3D.Texture, Surface... but it seams impossible to get video in anything that can be called from managed DirectX ( C# ).

This is how I create arguments for libvlc_core:

Code: Select all

string [] args = new string[] { "-I", "dummy", "--ignore-config", @"--plugin-path=C:\Program Files (x86)\VideoLAN\VLC\plugins", "--vout", "vmem", "--vmem-width", vWidth.ToString(), "--vmem-height", vHeight.ToString(), "--vmem-pitch", (vWidth * 4).ToString(), "--vmem-chroma", "RV32", "--vmem-lock", my_dolock_str, "--vmem-unlock", my_unlock_str, "--vmem-data", my_ptr_str };
now, I copied all of this from this forum, for which I'm thankful, but it appears that I don't understand locks. Here is how I do it:

Code: Select all

public static DelegateLocker delegate_dolock = new DelegateLocker(dolock); public static DelegateUnlocker delegate_unlock = new DelegateUnlocker(unlock); public static DelegatePtr delegate_ptr = new DelegatePtr(get_ptr); string my_dolock_str = Marshal.GetFunctionPointerForDelegate(delegate_dolock).ToInt32().ToString(); string my_unlock_str = Marshal.GetFunctionPointerForDelegate(delegate_unlock).ToInt32().ToString(); string my_ptr_str = Marshal.GetFunctionPointerForDelegate(delegate_ptr).ToInt32().ToString();
Which leaves one more problem - what to put to dolock and unlock functions?
I tried few things:

Code: Select all

public static IntPtr dolock(IntPtr ctx) { return ctx; } public static IntPtr dolock(IntPtr ctx) { DataRectangle data = mySurface.LockRectangle(LockFlags.None); return data.Data.DataPointer; } public static IntPtr dolock(IntPtr ctx) { Surface surf = Surface.FromPointer(ctx); DataRectangle data = surf.LockRectangle(LockFlags.None); return data.Data.DataPointer; }
I tried to unlock surfaces in cases that they were locked, but I only managed to get one or few calls to dolock functions, and no unlock whatsoever. I tried this with different objects, but couldn't do anything. Any thoughts? Every help would be appreciated...

Thanks

neonp
Blank Cone
Blank Cone
Posts: 20
Joined: 09 Jun 2011 14:07
VLC version: 2.2.0
Operating System: Raspbian/jessie
Location: Mulhouse, France

Re: vmem to SlimDX

Postby neonp » 17 Jun 2011 23:34

I managed to go a little further with the vlcdotnet library. You can get it at http://vlcdotnet.codeplex.com

Hope this helps.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 7 guests