NAME

Peta::Vorbis::Encode::Ogg - Ogg pages around Vorbis packets

VERSION

version 0.2610180

SYNOPSIS

my $ogg = Peta::Vorbis::Encode::Ogg->new($serial);
print $fh $ogg->packet($header, 0), $ogg->flush;
print $fh $ogg->packet($audio, $granule);
print $fh $ogg->packet($audio, $granule, 1);    # the last, on the last page

DESCRIPTION

Ogg's framing (RFC 3533) around a logical stream of packets: the lacing of each packet into segments, pages of up to 255 segments with their granule positions, sequence numbers and CRCs. Peta::Vorbis::Encode::Bits, beside it, packs the packets' bits, from the least significant, as Vorbis I writes them.

METHODS

new

new($serial): a stream of that serial number, its first page to come.

packet

packet($bytes, $granule, $last = 0): a packet onto the page being made, the granule position once it is finished; the pages it filled, and with $last the stream's last page too, which ends with it.

flush

The page being made, out now (the headers end their pages).

FUNCTIONS

crc

crc($bytes): Ogg's CRC-32 of a page.

AUTHOR

PetaMem s.r.o. <info@petamem.com>

COPYRIGHT

Copyright (c) 2026 PetaMem s.r.o.

LICENSE

This package is free software, dual-licensed under the Artistic License 2.0 and the BSD 2-Clause License. See the LICENSE file of the distribution.