node-ogg-packet
ogg_packet
struct instances
Manually construct This module lets you construct your own ogg_packet
struct instances using
JavaScript and Buffers. You'll most likely not need to use this module for any
practical purposes, but it is useful for testing purposes.
The more common way to get proper ogg_packet
structs is via a decoded OGG file
and node-ogg's ogg.Decoder
class, or one of the codec's encoder classes like
node-vorbis' vorbis.Encoder
class.
Installation
$ npm install ogg-packet
Example
var ogg_packet = ;// create an `ogg_packet` struct instancevar packet = ;// the contents of the "packet"var buf = 'hello world';packetpacket = buf;packetbytes = buflength;// this will be the first packet in the ogg streampacketb_o_s = 1;// there will be more `ogg_packet`s after this one in the ogg streampackete_o_s = 0;// the "granulepos" is a time-constant value used by the codec decoderpacketgranulepos = 12345;// the "packetno" should increment by one for each packet in the ogg streampacketpacketno = 0;// now send the packet off to an `ogg.Encoder` or// a codec-specific decoder like `vorbis.Decoder`...stream;
API
ogg_packet class
A ref-struct
class that mirrors the ogg_packet
fields in the ogg.h
file.
typedef structogg_packet;