InputStream: "protect" attributes

This commit is contained in:
Max Kellermann
2014-05-11 18:34:09 +02:00
parent e138e2c880
commit 0b4fa41aff
14 changed files with 53 additions and 37 deletions

View File

@@ -185,7 +185,7 @@ LoadEOSPacket(InputStream &is, Decoder *decoder, int serialno,
troubl */
return -1;
const auto old_offset = is.offset;
const auto old_offset = is.GetOffset();
if (old_offset < 0)
return -1;
@@ -332,16 +332,16 @@ bool
MPDOpusDecoder::Seek(OggSyncState &oy, double where_s)
{
assert(eos_granulepos > 0);
assert(input_stream.seekable);
assert(input_stream.size > 0);
assert(input_stream.offset >= 0);
assert(input_stream.IsSeekable());
assert(input_stream.KnownSize());
assert(input_stream.GetOffset() >= 0);
const ogg_int64_t where_granulepos(where_s * opus_sample_rate);
/* interpolate the file offset where we expect to find the
given granule position */
/* TODO: implement binary search */
InputStream::offset_type offset(where_granulepos * input_stream.size
InputStream::offset_type offset(where_granulepos * input_stream.GetSize()
/ eos_granulepos);
if (!OggSeekPageAtOffset(oy, os, input_stream, offset, SEEK_SET))