decoder/ogg: move code to SeekByte()

This commit is contained in:
Max Kellermann 2020-01-31 19:24:26 +01:00
parent 8472135859
commit 6fe4068c8e
2 changed files with 16 additions and 2 deletions

View File

@ -68,6 +68,13 @@ OggDecoder::LoadEndGranulePos() const
return packet.granulepos;
}
inline void
OggDecoder::SeekByte(offset_type offset)
{
input_stream.LockSeek(offset);
PostSeek();
}
void
OggDecoder::SeekGranulePos(ogg_int64_t where_granulepos)
{
@ -79,7 +86,6 @@ OggDecoder::SeekGranulePos(ogg_int64_t where_granulepos)
offset_type offset(where_granulepos * input_stream.GetSize()
/ end_granulepos);
input_stream.LockSeek(offset);
PostSeek();
SeekByte(offset);
}

View File

@ -22,6 +22,7 @@
#include "lib/xiph/OggVisitor.hxx"
#include "decoder/Reader.hxx"
#include "input/Offset.hxx"
class OggDecoder : public OggVisitor {
ogg_int64_t end_granulepos;
@ -53,6 +54,13 @@ protected:
return end_granulepos > 0;
}
/**
* Seek the #InputStream and update the #OggVisitor.
*
* Throws on error.
*/
void SeekByte(offset_type offset);
void SeekGranulePos(ogg_int64_t where_granulepos);
};