Decoder(3pm)
π Decoder(3pm) β the vibe-coded tour π
okay bestie, so this is a Perl man page β a page from the User Contributed Perl Documentation for the module Ogg::Vorbis::Decoder. Yes it's a 3pm page, yes it's for the perl peeps, and yes we're about to make it make sense. π
β¨ NAME β¨
Ogg::Vorbis::Decoder β an object-oriented Ogg Vorbis decoder. literally that's the whole job description and she does it.
β¨ SYNOPSIS β¨
here's the moment. three ways in, pick ur fighter:
use Ogg::Vorbis::Decoder;
my $decoder = Ogg::Vorbis::Decoder->open("song.ogg");
my $buffer;
while ((my $len = $decoder->read($buffer) > 0) {
# do something with the PCM stream
}
OR (same energy, different entry point):
open OGG, "song.ogg" or die $!;
my $decoder = Ogg::Vorbis::Decoder->open(\*OGG);
OR (for the fancy handle girls):
# can also be IO::Socket or any other IO::Handle subclass.
my $fh = IO::Handle->new("song.ogg");
my $decoder = Ogg::Vorbis::Decoder->open($fh);
π bestie this code is shown verbatim, so copy it exactly, quirks and all. we do not edit the synopsis. periodt.
β¨ DESCRIPTION β¨
okay so what does this module actually do? it hands you Decoder objects for Ogg Vorbis files. from the stream you can:
- read data in PCM format
- seek by raw bytes
- seek by pcm samples
- seek by time
- and gather decoding-specific info that
Ogg::Vorbis::Headerdoes not give you
and then, the disclaimer, no cap: right now there is no support for the callback mechanism provided by the Vorbisfile API. it might show up in future releases though. we're manifesting π¦
π CONSTRUCTOR π
open ($filename)
opens an Ogg Vorbis file for decoding π§. it either opens a handle to the file or uses an existing handle you already have, and then it initializes all of the internal vorbis decoding structures for you. queen behavior.
β οΈ heads up bestie: the object will maintain open file descriptors until the object is collected by the garbage handler. keep that in mind, she holds on.
returns undef on failure. π
πΈ INSTANCE METHODS πΈ
read ($buffer, [$size, $word, $signed])
reads PCM data from the Vorbis stream into $buffer. returns the number of bytes read, 0 when it reaches the end of the stream, or a value less than 0 on error. (so: positive = good, 0 = done, negative = we have a problem π)
the optional parameters include (with corresponding default values):
size = 4096word = 2signed = 1
consult the Vorbisfile API (http://www.xiph.org/ogg/vorbis/doc/vorbisfile/reference.html) for an explanation of the various values. iykyk π
sysread ($buffer, [$size, $word, $signed])
an alias for read. same girl, different name. π«Ά
raw_seek ($pos)
seeks through the compressed bitstream to the offset specified by $pos in raw bytes. returns 0 on success. β
pcm_seek ($pos, [$page])
seeks through the bitstream to the offset specified by $pos in pcm samples. the optional $page parameter is a boolean flag that, if set to true, will cause the method to seek to the closest full page preceding the specified location. returns 0 on success. β
time_seek ($pos, [$page])
seeks through the bitstream to the offset specified by $pos in seconds. the optional $page parameter is a boolean flag that, if set to true, will cause the method to seek to the closest full page preceding the specified location. returns 0 on success. β
(yes, same deal as pcm_seek, just in seconds bestie, no need to squint)
current_bitstream ()
returns the current logical bitstream of the decoder. this matches the bitstream parameter that's optionally passed to read. useful for saving a bitstream to jump to later, or to pass to the various information methods. very main character of it ngl π
bitrate ([$stream])
returns the average bitrate for the specified logical bitstream. if $stream is left out or set to -1, the average bitrate for the entire stream will be reported. π
bitrate_instant ()
returns the most recent bitrate read from the file. returns 0 if no read has been performed, or if the bitrate has not changed. (so 0 here doesn't always mean "zero bitrate", ok? don't @ me) π
streams ()
returns the number of logical bitstreams in the file. π’
seekable ()
returns a non-zero value if the file is seekable, 0 if not. vibe check on the file, essentially. π
serialnumber ([$stream])
returns the serial number of the specified logical bitstream β or, if $stream is left out or set to -1, that of the current bitstream. π
raw_total ([$stream])
returns the total number of bytes in the physical bitstream or in the specified logical bitstream. π
pcm_total ([$stream])
returns the total number of pcm samples in the physical bitstream or in the specified logical bitstream. π
time_total ([$stream])
returns the total number of seconds in the physical bitstream or in the specified logical bitstream. β±οΈ
raw_tell ()
returns the current offset in bytes. π
pcm_tell ()
returns the current offset in pcm samples. π
time_tell ()
returns the current offset in seconds. π
π§ REQUIRES π§
the prerequisites. u gotta have these, no skipping:
libogglibvorbislibogg-devlibvorbis-dev
π CURRENT AUTHOR π
- Dan Sully
<daniel@cpan.org>
π AUTHOR EMERITUS π
- Dan Pemstein
<dan@lcws.org>
β COPYRIGHT β
- Copyright (c) 2004-2010, Dan Sully. All Rights Reserved.
- Copyright (c) 2003, Dan Pemstein. All Rights Reserved.
this program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
a copy of this license is included with this module (LICENSE.GPL). π
π¦ SEE ALSO π¦
Ogg::Vorbis::Header
and that's the page, bestie, literally all of it π this was perl v5.42.3 from 2026-08-19, so big up the perl maintainers and the module docs squad β go forth and decode some Ogg Vorbis, ur doing amazing, slay πΈβ¨π
π¦ where this page comes from
- ubuntu stonking: libogg-vorbis-decoder-perl 0.9-4build7 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms