node-ogg-packet
Manually construct ogg_packet
struct instances
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 = require('ogg-packet');
var packet = new ogg_packet();
var buf = new Buffer('hello world');
packet.packet = buf;
packet.bytes = buf.length;
packet.b_o_s = 1;
packet.e_o_s = 0;
packet.granulepos = 12345;
packet.packetno = 0;
API
ogg_packet class
A ref-struct
class that mirrors the ogg_packet
fields in the ogg.h
file.
typedef struct {
unsigned char *packet;
long bytes;
long b_o_s;
long e_o_s;
ogg_int64_t granulepos;
ogg_int64_t packetno;
} ogg_packet;