tmp: Revert "image: add stream experimental property with server-side ffmpeg backend (#259)"

This reverts commit 774416af96.
This commit is contained in:
bordun 2018-03-26 23:45:12 +02:00
parent c06c653f8d
commit 2722cf43b7
4 changed files with 1 additions and 56 deletions

View file

@ -59,37 +59,7 @@ var bindCallbacks = function(callbacks) {
}
// video streams
var rtsp = require('rtsp-ffmpeg'),
urls = settings.read('videoStreams'),
streams = {},
framerate = 10,
resolution = undefined
for (var i in urls) {
if (/framerate\s*=\s*[0-9]+/.test(urls[i])) {
framerate = Math.max(Math.min(parseInt(urls[i].split('=').pop()), 60), 0)
}
if (/resolution\s*=\s*[0-9]+x[0-9]+/.test(urls[i])) {
resolution = urls[i].split('=').pop().trim()
}
}
urls = urls.filter(item => item.indexOf('rtsp://') > -1)
for (let i = 0; i < urls.length; i++) {
streams[i] = new rtsp.FFMpeg({
input: urls[i],
rate: framerate,
resolution: resolution,
})
streams[i].on('data', (data)=>{
ipc.send('video', [i, data.toString('base64')])
})
}
///
console.log('App available at ' + appAddresses.join(' & '))

View file

@ -56,7 +56,6 @@ var options = {
true : 'examples can\'t be listed if --load is set'
}
},
'video-streams':{type:'array',describe:'video stream urls (rtsp://)'},
'url-options':{type:'array',describe:'url options (opt=value pairs)',
check: (u, argv)=>{
return (!u || !argv.n) ?
@ -121,7 +120,6 @@ var makeDefaultConfig = function(argv){
sessionFile: argv.l || false,
newSession: argv.b || false,
customModule: argv.c || false,
videoStreams: argv['video-streams'] || [],
fullScreen: argv['fullscreen'] || false,
noGui: argv.n || false,
guiOnly: typeof argv.g == 'string' ? argv.g.length ? argv.g : true : false,

View file

@ -42,7 +42,6 @@
"nanomorph": "^5.1.3",
"node-sass": "4.7.2",
"nodemon": "1.17.2",
"rtsp-ffmpeg": "0.0.12",
"scope-css": "^1.0.5",
"screenfull": "3.3.2",
"shortid": "2.2.8",

View file

@ -1,6 +1,5 @@
var {mapToScale} = require('../utils'),
Widget = require('../common/widget'),
ipc = require('../../ipc')
Widget = require('../common/widget')
module.exports = class Led extends Widget {
@ -31,7 +30,6 @@ module.exports = class Led extends Widget {
repeat: 'no-repeat',
border: true,
cache: true,
stream: '',
_value: 'value',
default: '',
@ -60,10 +58,6 @@ module.exports = class Led extends Widget {
this.widget.style.setProperty('background-position', this.getProp('position'))
this.widget.style.setProperty('background-repeat', this.getProp('repeat'))
if (this.getProp('stream') !== '') {
this.bindedOnStreamUpdate = this.onStreamUpdate.bind(this)
ipc.on('video', this.bindedOnStreamUpdate)
}
}
@ -95,20 +89,4 @@ module.exports = class Led extends Widget {
}
onStreamUpdate(event) {
console.log(event)
var [stream, data] = event
if (stream === this.getProp('stream')) {
this.setValue('data:image/jpeg;base64,' + data)
}
}
onRemove() {
if (this.bindedOnStreamUpdate) ipc.off('video', this.bindedOnStreamUpdate)
super.onRemove()
}
}