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
};
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();
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;
}
Thanks