public static void SetFormat(ref AMMediaType mt, ref VideoInfoHeader vih) { if (vih != null) { int cb = Marshal.SizeOf(vih); IntPtr _ptr = Marshal.AllocCoTaskMem(cb); try { Marshal.StructureToPtr(vih, _ptr, true); SetFormat(ref mt, _ptr, cb); if (mt != null) { mt.formatType = FormatType.VideoInfo; } } finally { Marshal.FreeCoTaskMem(_ptr); } } }
public void SetFormat(VideoInfoHeader vih) { if (vih != null) { int cb = Marshal.SizeOf(vih); IntPtr _ptr = Marshal.AllocCoTaskMem(cb); try { Marshal.StructureToPtr(vih, _ptr, true); SetFormat(_ptr, cb); formatType = FormatType.VideoInfo; } finally { Marshal.FreeCoTaskMem(_ptr); } } }