VLC is ran with these arguments:
Code: Select all
string my_dolock_str = Marshal.GetFunctionPointerForDelegate(my_dolock).ToInt32().ToString();
string my_unlock_str = Marshal.GetFunctionPointerForDelegate(my_unlock).ToInt32().ToString();
string[] argv = new string[] { //"-I", "dummy"
"--ignore-config"
//, "--no-overlay"
//, "--noaudio"
, "--vout", "vmem"
, "--vmem-width", VideoWidth.ToString()
, "--vmem-height", VideoHeight.ToString()
, "--vmem-pitch", (VideoWidth * 4).ToString()
, "--vmem-chroma", "RV32"
, "--vmem-lock", my_dolock_str
, "--vmem-unlock", my_unlock_str
, "--vmem-data", ctx_ptr.ToInt32().ToString()
};
1- Using GDI+:
Code: Select all
public static IntPtr dolock(IntPtr ctx)
{
Rectangle rect = new Rectangle(0, 0, VideoWidth, VideoHeight);
bmpd = bmp.LockBits(rect,ImageLockMode.ReadOnly,PixelFormat.Format32bppArgb);
IntPtr tmpRes = bmpd.Scan0;
return tmpRes;
}
public static void unlock(IntPtr ctx)
{
bmp.UnlockBits(bmpd);
}
Code: Select all
static Bitmap bmp;
static BitmapData bmpd;
Code: Select all
public static IntPtr dolock(IntPtr ctx)
{
return ctx;
}
public static void unlock(IntPtr ctx)
{
}
Code: Select all
ctx_ptr = Marshal.AllocHGlobal(VideoWidth * VideoHeight * 4);
Any suggestions?The instruction at ... referenced memory at "0x000000". The memory could not be "written" .