public CompressedDataState(ulong size) { if (size <= ManagedCompressedAV1DataMaxSize) { this.data = new ManagedCompressedAV1Data(size); } else { this.data = new UnmanagedCompressedAV1Data(size); } this.OwnsDataBuffer = true; this.NativePointer = ((IPinnableBuffer)this.data).Pin(); this.isPinned = true; }
public CompressedAV1Data GetCompressedAV1Data(IntPtr nativePointer) { VerifyNotDisposed(); CompressedAV1Data data = null; for (int i = 0; i < this.compressedData.Count; i++) { CompressedDataState state = this.compressedData[i]; if (state.NativePointer == nativePointer) { data = state.GetData(); } } if (data is null) { ExceptionUtil.ThrowInvalidOperationException("The native data was not allocated by this class."); } return(data); }