mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Return correct buff.Length at all times
This commit is contained in:
@@ -108,10 +108,7 @@ namespace CUETools.Codecs.ALAC
|
|||||||
int sampleDuration;
|
int sampleDuration;
|
||||||
int sampleSize;
|
int sampleSize;
|
||||||
if (_iSample >= _sample_byte_size.Length)
|
if (_iSample >= _sample_byte_size.Length)
|
||||||
{
|
return buff.Length = offset;
|
||||||
buff.Length = offset;
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
get_sample_info(_iSample, out sampleDuration, out sampleSize);
|
get_sample_info(_iSample, out sampleDuration, out sampleSize);
|
||||||
_IO.Read(_framesBuffer, 0, sampleSize);
|
_IO.Read(_framesBuffer, 0, sampleSize);
|
||||||
decodeFrame(sampleSize);
|
decodeFrame(sampleSize);
|
||||||
@@ -127,7 +124,7 @@ namespace CUETools.Codecs.ALAC
|
|||||||
_samplesBufferOffset += sampleCount;
|
_samplesBufferOffset += sampleCount;
|
||||||
if (_samplesInBuffer == 0)
|
if (_samplesInBuffer == 0)
|
||||||
_samplesBufferOffset = 0;
|
_samplesBufferOffset = 0;
|
||||||
return offset + sampleCount;
|
return buff.Length = offset + sampleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
|||||||
@@ -249,10 +249,7 @@ namespace CUETools.Codecs.FLAKE
|
|||||||
fill_frames_buffer();
|
fill_frames_buffer();
|
||||||
|
|
||||||
if (_framesBufferLength == 0)
|
if (_framesBufferLength == 0)
|
||||||
{
|
return buff.Length = offset;
|
||||||
buff.Length = offset;
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
int bytesDecoded = DecodeFrame(_framesBuffer, _framesBufferOffset, _framesBufferLength);
|
int bytesDecoded = DecodeFrame(_framesBuffer, _framesBufferOffset, _framesBufferLength);
|
||||||
_framesBufferLength -= bytesDecoded;
|
_framesBufferLength -= bytesDecoded;
|
||||||
@@ -267,7 +264,7 @@ namespace CUETools.Codecs.FLAKE
|
|||||||
_samplesBufferOffset += sampleCount;
|
_samplesBufferOffset += sampleCount;
|
||||||
if (_samplesInBuffer == 0)
|
if (_samplesInBuffer == 0)
|
||||||
_samplesBufferOffset = 0;
|
_samplesBufferOffset = 0;
|
||||||
return offset + sampleCount;
|
return buff.Length = offset + sampleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe void fill_frames_buffer()
|
unsafe void fill_frames_buffer()
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ namespace CUETools.Codecs.WMA
|
|||||||
m_sampleCount = m_sampleOffset / PCM.BlockAlign;
|
m_sampleCount = m_sampleOffset / PCM.BlockAlign;
|
||||||
if ((buff_offset % PCM.BlockAlign) != 0)
|
if ((buff_offset % PCM.BlockAlign) != 0)
|
||||||
throw new Exception("(buff_offset % PCM.BlockAlign) != 0");
|
throw new Exception("(buff_offset % PCM.BlockAlign) != 0");
|
||||||
return buff_offset / PCM.BlockAlign;
|
return buff.Length = buff_offset / PCM.BlockAlign;
|
||||||
}
|
}
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
@@ -378,7 +378,7 @@ namespace CUETools.Codecs.WMA
|
|||||||
}
|
}
|
||||||
if ((buff_offset % PCM.BlockAlign) != 0)
|
if ((buff_offset % PCM.BlockAlign) != 0)
|
||||||
throw new Exception("(buff_offset % PCM.BlockAlign) != 0");
|
throw new Exception("(buff_offset % PCM.BlockAlign) != 0");
|
||||||
return buff_offset / PCM.BlockAlign;
|
return buff.Length = buff_offset / PCM.BlockAlign;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user