unsafe public LowLevelEncoderNative(mfxVideoParam mfxEncParams, mfxIMPL impl) { mfxStatus sts; this._session = new mfxSession(); var ver = new mfxVersion() { Major = 1, Minor = 3 }; fixed(mfxSession *s = &_session) sts = UnsafeNativeMethods.MFXInit(impl, &ver, s); QuickSyncStatic.ThrowOnBadStatus(sts, nameof(UnsafeNativeMethods.MFXInit)); h = NativeLLEncoderUnsafeNativeMethods.NativeEncoder_New(); Trace.Assert(h != IntPtr.Zero); shared = (EncoderShared *)h; shared->session = _session; shared->mfxEncParams = mfxEncParams; Trace.Assert(shared->safety == sizeof(EncoderShared)); sts = NativeLLEncoderUnsafeNativeMethods.NativeEncoder_Init(h); QuickSyncStatic.ThrowOnBadStatus(sts, nameof(NativeLLEncoderUnsafeNativeMethods.NativeEncoder_Init)); frameIntPtrs = new IntPtr[shared->nEncSurfNum]; for (int i = 0; i < frameIntPtrs.Length; i++) { frameIntPtrs[i] = (IntPtr)shared->pmfxSurfaces[i]; } GetAndPrintWarnings(); }