-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconntour-common.jsonnet
More file actions
75 lines (69 loc) · 2.16 KB
/
conntour-common.jsonnet
File metadata and controls
75 lines (69 loc) · 2.16 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
local conntour = {
local constants = import 'constants.jsonnet',
local common = import 'common.jsonnet',
local hdmi_input(hdmi, name) = {
"type": "rawvideo",
"name": name,
"capture": {
"type": "v4l",
"address": hdmi.input.device,
"mode": {
"pin":"Capture",
"colorspace":"YUY2",
"framerate": hdmi.input.rate,
"limit_framerate": false,
"size": hdmi.input.size,
"exposure":"auto"
}
},
"encoder": {
"type": "auto",
"dynamic": true, // true is important here so that we don't encode original stream unless anyone requests it
"quality": "small_size",
"profile": "baseline",
"preset": "veryfast"
}
},
local hdmi_viewport_geometry(source, grid, padding, col, row) =
local srcw = source[2]-source[0];
local srch = source[3]-source[1];
local viewport_w = srcw / grid[0];
local viewport_h = srch / grid[1];
local l = source[0] + viewport_w * col + padding[0] * viewport_w;
local t = source[1] + viewport_h * row + padding[1] * viewport_h;
local r = source[0] + viewport_w * (col + 1) - padding[2] * viewport_w;
local b = source[1] + viewport_h * (row + 1) - padding[3] * viewport_h;
[l, t, r, b],
local hdmi_viewport(hdmi, col, row, name) = {
"type": "renderer",
"name": name,
__orig:: {},
"refresh_rate": hdmi.input.rate,
"layout": {
"size": hdmi.viewports.size,
"viewports": [
{
"input": 0,
"dst": [0,0,1,1],
"src": hdmi_viewport_geometry(hdmi.input.source, hdmi.viewports.grid, hdmi.viewports.padding, col, row)
}
]
},
"encoder": {
"type": "auto",
"dynamic": false,
"quality": "best_quality",
"profile": "baseline",
"preset": "veryfast"
}
},
mk_hdmi(hdmi): {
local input = hdmi_input(hdmi, "raw0"),
inputs: [input],
viewports: [hdmi_viewport(hdmi, col-1, row-1, "viewport_"+col+"_"+row)
for col in std.range(1, hdmi.viewports.grid[0])
for row in std.range(1, hdmi.viewports.grid[1])],
links: [[input.name, common.namesOf(self.viewports)]]
},
};
conntour