blob: 6df268fc89508dbfbc8794fc1d8304ecef5bbbde (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/usr/bin/ucode
import { readfile } from 'fs';
import * as uci from 'uci';
import { stream_pipeline, camera_pipeline } from './config.uc';
let state = {};
let text = readfile('/var/run/gst-rtsp/devices.json');
if (text) {
state = json(text);
if (state.boot_id != trim(readfile('/proc/sys/kernel/random/boot_id')))
state = {};
}
try {
if (ARGV[0] == 'camera-argv') {
let pipeline = camera_pipeline(uci.cursor(), ARGV[1], state);
print({ command: pipeline ? ['/usr/bin/ucode',
'/usr/share/gst-rtsp/capture.uc', ARGV[1], pipeline] : [] });
exit(0);
}
print(ARGV[0] == 'camera' ? camera_pipeline(uci.cursor(), ARGV[1], state) :
stream_pipeline(uci.cursor(), ARGV[0], state));
} catch (e) {
warn('gst-rtsp: ', e, '\n');
exit(1);
}
|