static unsafe int AVISaveOptions(IntPtr stream, ref Win32.AVICOMPRESSOPTIONS opts, IntPtr owner) { fixed(Win32.AVICOMPRESSOPTIONS *_popts = &opts) { IntPtr *pStream = &stream; Win32.AVICOMPRESSOPTIONS * popts = _popts; Win32.AVICOMPRESSOPTIONS **ppopts = &popts; return(Win32.AVISaveOptions(owner, 0, 1, (void *)pStream, (void *)ppopts)); } }
static int AVISaveOptions(IntPtr stream, ref Win32.AVICOMPRESSOPTIONS opts, IntPtr owner) { IntPtr mem = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Win32.AVICOMPRESSOPTIONS))); Marshal.StructureToPtr(opts, mem, false); IntPtr[] streams = new[] { stream }; IntPtr[] infPtrs = new[] { mem }; int ret = Win32.AVISaveOptions(owner, 0, 1, streams, infPtrs); opts = (Win32.AVICOMPRESSOPTIONS)Marshal.PtrToStructure(mem, typeof(Win32.AVICOMPRESSOPTIONS)); Marshal.FreeHGlobal(mem); return(ret); }