Implement IAudioSource.Duration property and IAudioDecoderSettings.Open extension method.

This commit is contained in:
Grigory Chudov
2018-04-07 23:02:01 -04:00
parent be881945ac
commit deb3448a55
27 changed files with 817 additions and 75 deletions

View File

@@ -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;