public unsafe void AllocFrames(mfxFrameAllocRequest *req, mfxFrameAllocResponse *resp) { // if ( req->Type) var sts = VideoAccelerationSupportPInvoke.VideoAccelerationSupport_Alloc(acceleratorHandle, req, resp); QuickSyncStatic.ThrowOnBadStatus(sts, "VideoAccelerationSupport_Alloc"); }
public unsafe IntPtr FrameGetHandle(IntPtr mid) { IntPtr handle; mfxStatus sts; sts = VideoAccelerationSupportPInvoke.VideoAccelerationSupport_GetFrameHDL(acceleratorHandle, mid, &handle); QuickSyncStatic.ThrowOnBadStatus(sts, "VideoAccelerationSupport_GetFrameHDL"); return(handle); }
public unsafe IntPtr DeviceGetHandle(mfxHandleType type) { mfxStatus sts; IntPtr handle; sts = VideoAccelerationSupportPInvoke.VideoAccelerationSupport_DeviceGetHandle(acceleratorHandle, type, &handle); QuickSyncStatic.ThrowOnBadStatus(sts, "VideoAccelerationSupport_DeviceGetHandle"); return(handle); }
public unsafe void UnlockFrame(IntPtr memid, mfxFrameData *ptr = null) { if (ptr == null) { ptr = &(((mfxFrameSurface1 *)memid)->Data); } mfxStatus sts; // fixed (mfxFrameData* p = &ptr) sts = VideoAccelerationSupportPInvoke.VideoAccelerationSupport_UnlockFrame(acceleratorHandle, memid, ptr); QuickSyncStatic.ThrowOnBadStatus(sts, "VideoAccelerationSupport_UnlockFrame"); }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects). } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. VideoAccelerationSupportPInvoke.VideoAccelerationSupport_Release(acceleratorHandle); disposedValue = true; } }
public unsafe VideoAccelerationSupport(mfxSession session, bool forceSystemMemory = false) { mfxStatus sts; mfxVersion versionMinimum = new mfxVersion() { Major = 1, Minor = 3 }; acceleratorHandle = VideoAccelerationSupportPInvoke.VideoAccelerationSupport_New(); Trace.Assert(acceleratorHandle != IntPtr.Zero); if (sizeof(IntPtr) != 8) { throw new Exception("only x64 supported at this time"); } mfxIMPL ii; sts = UnsafeNativeMethods.MFXQueryIMPL(session, &ii); QuickSyncStatic.ThrowOnBadStatus(sts, "MFXQueryIMPL"); // if (Environment.OSVersion.Platform == PlatformID.Win32NT) mfxIMPL viaMask = (mfxIMPL.MFX_IMPL_VIA_D3D9 | mfxIMPL.MFX_IMPL_VIA_D3D11 | mfxIMPL.MFX_IMPL_VIA_VAAPI); if ((ii & viaMask) == mfxIMPL.MFX_IMPL_VIA_D3D11) { isDirectX11 = true; memType = FrameMemType.D3D11_MEMORY; } else if ((ii & viaMask) == mfxIMPL.MFX_IMPL_VIA_D3D9) { memType = FrameMemType.D3D9_MEMORY; } else if ((ii & viaMask) == mfxIMPL.MFX_IMPL_VIA_VAAPI) { memType = FrameMemType.VAAPI_MEMORY; } //if (Environment.OSVersion.Platform == PlatformID.Win32NT) //{ // if (Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 2) // memType = MemType.D3D11_MEMORY; // else // memType = MemType.D3D9_MEMORY; //} //else //{ // memType = MemType.VAAPI_MEMORY; //} if (forceSystemMemory) { memType = FrameMemType.SYSTEM_MEMORY; } sts = VideoAccelerationSupportPInvoke.VideoAccelerationSupport_Init(acceleratorHandle, session, false, memType); QuickSyncStatic.ThrowOnBadStatus(sts, "VideoAccelerationSupport_Init"); }