lib/xiph/OggVisitor: add method ReadGranulepos()
This commit is contained in:
parent
e01bbad7bb
commit
faf149d08e
@ -108,3 +108,14 @@ OggVisitor::PostSeek(uint64_t offset)
|
||||
|
||||
post_seek = true;
|
||||
}
|
||||
|
||||
ogg_int64_t
|
||||
OggVisitor::ReadGranulepos() noexcept
|
||||
{
|
||||
ogg_packet packet;
|
||||
while (stream.PacketOut(packet) == 1)
|
||||
if (packet.granulepos >= 0)
|
||||
return packet.granulepos;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -66,6 +66,22 @@ public:
|
||||
*/
|
||||
void PostSeek(uint64_t offset);
|
||||
|
||||
/**
|
||||
* Skip packets (#ogg_packet) from the #OggStreamState until a
|
||||
* packet with a valid granulepos is found or until the stream
|
||||
* has run dry.
|
||||
*
|
||||
* Since this will discard pending packets and will disturb
|
||||
* this object, this should only be used while seeking.
|
||||
*
|
||||
* This method must not be called from within one of the
|
||||
* virtual methods.
|
||||
*
|
||||
* @return the granulepos or -1 if no valid granulepos was
|
||||
* found
|
||||
*/
|
||||
ogg_int64_t ReadGranulepos() noexcept;
|
||||
|
||||
private:
|
||||
void EndStream();
|
||||
bool ReadNextPage();
|
||||
|
Loading…
Reference in New Issue
Block a user