Skip to content

Latest commit

 

History

History
90 lines (74 loc) · 2.41 KB

File metadata and controls

90 lines (74 loc) · 2.41 KB

Gstreamer C++ modal

Links

Prerequisites

  • gstreamer
  • bindings npm i bindings
  • node-addon-api npm i node-addon-api

Build

  • run npm i to create a new build of the c++

DEBUG c++ addons

Prerequisites

  • Need to cd into server/gst_module/SrtVideoInput

Build dependencies

  • node-gyp sudo npm -g install node-gyp
  • node-addon-api npm install node-addon-api
  • bindings npm install bindings
  • gstreamer
Configure build
  • run node-gyp configure
  • run npm i

Runtime dependencies

  • node-addon-api npm install node-addon-api
  • bindings npm install bindings
  • gstreamer

Dev dependencies

Run in debug mode

  • Need to cd into server/gst_module
  • npm run build:gst:dev

Build for production

  • Need to cd into server/gst_module
  • npm run build:gst

Example

// ------------------
// Initialization
// ------------------
const { _SrtVideoPlayer } = require('bindings')('build/Release/gstreamer.node');

const example = new _SrtVideoPlayer(
    "srt://srt.invalid:1234",                               // SRT Url
    "alsa_output.platform-bcm2835_audio.analog-stereo",     // Pulse audio sink 
    50,                                                     // Pulse audio latency (ms)
)

// ------------------
// Setters
// ------------------
// Set srt url
example.SetUri("srt://srt.invalid:1233");
// Set pulse sink
example.SetSink("sink");
// Set pulse latency
example.SetPALatency(50);

// ------------------
// Control functions
// ------------------
/**
 * Start SRT Player
 * Callback: 
 * level: Serverity level
 * message: Message
*/
example.Start((level, message) => {
    // your code
})

/**
 * Stop SRT Player
*/
example.Stop();