public void Dispose() { if (this.compressedData != null) { for (int i = 0; i < this.compressedData.Count; i++) { CompressedDataState state = this.compressedData[i]; if (state.OwnsDataBuffer) { state.Dispose(); } } this.compressedData = null; } }
public IntPtr Allocate(UIntPtr sizeInBytes) { IntPtr nativePointer; ulong size = sizeInBytes.ToUInt64(); try { CompressedDataState state = new CompressedDataState(size); this.compressedData.Add(state); nativePointer = state.NativePointer; } catch (Exception ex) { this.ExceptionInfo = ExceptionDispatchInfo.Capture(ex); return(IntPtr.Zero); } return(nativePointer); }
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); }