Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ogg-packet

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ogg-packet

Manually construct `ogg_packet` struct instances

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
986
decreased by-7.33%
Maintainers
1
Weekly downloads
 
Created
Source

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');

// create an `ogg_packet` struct instance
var packet = new ogg_packet();

// the contents of the "packet"
var buf = new Buffer('hello world');
packet.packet = buf;
packet.bytes = buf.length;

// this will be the first packet in the ogg stream
packet.b_o_s = 1;

// there will be more `ogg_packet`s after this one in the ogg stream
packet.e_o_s = 0;

// the "granulepos" is a time-constant value used by the codec decoder
packet.granulepos = 12345;

// the "packetno" should increment by one for each packet in the ogg stream
packet.packetno = 0;

// now send the packet off to an `ogg.Encoder` or
// a codec-specific decoder like `vorbis.Decoder`...

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;

Keywords

FAQs

Package last updated on 02 Dec 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc