Commit 6fe4068c authored by Max Kellermann's avatar Max Kellermann

decoder/ogg: move code to SeekByte()

parent 84721358
...@@ -68,6 +68,13 @@ OggDecoder::LoadEndGranulePos() const ...@@ -68,6 +68,13 @@ OggDecoder::LoadEndGranulePos() const
return packet.granulepos; return packet.granulepos;
} }
inline void
OggDecoder::SeekByte(offset_type offset)
{
input_stream.LockSeek(offset);
PostSeek();
}
void void
OggDecoder::SeekGranulePos(ogg_int64_t where_granulepos) OggDecoder::SeekGranulePos(ogg_int64_t where_granulepos)
{ {
...@@ -79,7 +86,6 @@ 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() offset_type offset(where_granulepos * input_stream.GetSize()
/ end_granulepos); / end_granulepos);
input_stream.LockSeek(offset); SeekByte(offset);
PostSeek();
} }
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "lib/xiph/OggVisitor.hxx" #include "lib/xiph/OggVisitor.hxx"
#include "decoder/Reader.hxx" #include "decoder/Reader.hxx"
#include "input/Offset.hxx"
class OggDecoder : public OggVisitor { class OggDecoder : public OggVisitor {
ogg_int64_t end_granulepos; ogg_int64_t end_granulepos;
...@@ -53,6 +54,13 @@ protected: ...@@ -53,6 +54,13 @@ protected:
return end_granulepos > 0; 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); void SeekGranulePos(ogg_int64_t where_granulepos);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment