32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
using Microsoft.Win32.SafeHandles;
|
|||
|
|
|
||
|
|
namespace VoiceCat.Codec;
|
||
|
|
|
||
|
|
internal sealed class OpusEncoderHandle : SafeHandleZeroOrMinusOneIsInvalid
|
||
|
|
{
|
||
|
|
public OpusEncoderHandle() : base(true) { }
|
||
|
|
internal OpusEncoderHandle(nint value) : this() => SetHandle(value);
|
||
|
|
protected override bool ReleaseHandle() { NativeMethods.EncoderDestroy(handle); return true; }
|
||
|
|
}
|
||
|
|
|
||
|
|
internal sealed class OpusDecoderHandle : SafeHandleZeroOrMinusOneIsInvalid
|
||
|
|
{
|
||
|
|
public OpusDecoderHandle() : base(true) { }
|
||
|
|
internal OpusDecoderHandle(nint value) : this() => SetHandle(value);
|
||
|
|
protected override bool ReleaseHandle() { NativeMethods.DecoderDestroy(handle); return true; }
|
||
|
|
}
|
||
|
|
|
||
|
|
internal sealed class DredDecoderHandle : SafeHandleZeroOrMinusOneIsInvalid
|
||
|
|
{
|
||
|
|
public DredDecoderHandle() : base(true) { }
|
||
|
|
internal DredDecoderHandle(nint value) : this() => SetHandle(value);
|
||
|
|
protected override bool ReleaseHandle() { NativeMethods.DredDecoderDestroy(handle); return true; }
|
||
|
|
}
|
||
|
|
|
||
|
|
internal sealed class DredHandle : SafeHandleZeroOrMinusOneIsInvalid
|
||
|
|
{
|
||
|
|
public DredHandle() : base(true) { }
|
||
|
|
internal DredHandle(nint value) : this() => SetHandle(value);
|
||
|
|
protected override bool ReleaseHandle() { NativeMethods.DredDestroy(handle); return true; }
|
||
|
|
}
|