dturing / node-gstreamer-superficial

Superficial gstreamer binding
MIT License
130 stars 45 forks source link

Add setPad method #34

Closed maruware closed 4 years ago

maruware commented 4 years ago

Motivation of this PR is to use input-selector, and to set "active-pad".

It works like below.

const gstreamer = require('gstreamer-superficial');

const pipeline = new gstreamer.Pipeline([
    'input-selector name=sel',
    '! autovideosink',
    'videotestsrc pattern=0',
    '! sel.sink_0',
    'videotestsrc pattern=1',
    '! sel.sink_1'
].join(' '));
pipeline.play();

let t = 0;
setInterval( function() {
    t++;
    console.log('t: %d', t)

    if (t % 2 === 0) {
        pipeline.setPad('sel', 'active-pad', 'sink_0')
    }
    else {
        pipeline.setPad('sel', 'active-pad', 'sink_1')
    }

}, 1000 );
chrisspiegl commented 4 years ago

This looks very promising and would be a great addition to NMS. Thank you maruware.

dturing commented 4 years ago

released on npm with version 1.4.0, thanks @maruware !