mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Implement IAudioSource.Duration property and IAudioDecoderSettings.Open extension method.
This commit is contained in:
@@ -20,7 +20,7 @@ namespace CUETools.Codecs.libFLAC
|
||||
public string Name => "libFLAC";
|
||||
|
||||
[Browsable(false)]
|
||||
public Type DecoderType => typeof(Reader);
|
||||
public Type DecoderType => typeof(AudioDecoder);
|
||||
|
||||
[Browsable(false)]
|
||||
public int Priority => 1;
|
||||
@@ -37,9 +37,9 @@ namespace CUETools.Codecs.libFLAC
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe class Reader : IAudioSource
|
||||
public unsafe class AudioDecoder : IAudioSource
|
||||
{
|
||||
public Reader(DecoderSettings settings, string path, Stream IO)
|
||||
public AudioDecoder(DecoderSettings settings, string path, Stream IO)
|
||||
{
|
||||
m_settings = settings;
|
||||
|
||||
@@ -306,6 +306,8 @@ namespace CUETools.Codecs.libFLAC
|
||||
|
||||
public string Path => m_path;
|
||||
|
||||
public TimeSpan Duration => Length < 0 ? TimeSpan.Zero : TimeSpan.FromSeconds((double)Length / PCM.SampleRate);
|
||||
|
||||
public long Length => m_sampleCount;
|
||||
|
||||
private int SamplesInBuffer => m_bufferLength - m_bufferOffset;
|
||||
|
||||
Reference in New Issue
Block a user