-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode_input.go
More file actions
69 lines (57 loc) · 1.27 KB
/
node_input.go
File metadata and controls
69 lines (57 loc) · 1.27 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
package spireav
import "fmt"
type inputNode struct {
graph *implGraph
inputIndex int
filename string
}
func (in *inputNode) Stream(index int) Stream {
return &inputNodeStream{
node: in,
index: index,
}
}
func (in *inputNode) Video(index int) Stream {
return &inputNodeStream{
node: in,
typeLabel: "v",
index: index,
}
}
func (in *inputNode) Audio(index int) Stream {
return &inputNodeStream{
node: in,
typeLabel: "a",
index: index,
}
}
func (in *inputNode) Pipe(to Node, toIndex int) {
in.Stream(0).Pipe(to, toIndex)
}
type inputNodeStream struct {
node *inputNode
index int
typeLabel string
}
func (ins *inputNodeStream) Node() Node {
return ins.node
}
func (ins *inputNodeStream) Index() int {
return ins.index
}
func (ins *inputNodeStream) Label() string {
if ins.typeLabel != "" {
return fmt.Sprintf("%d:%s:%d", ins.node.inputIndex, ins.typeLabel, ins.index)
}
return fmt.Sprintf("%d:%d", ins.node.inputIndex, ins.index)
}
func (ins *inputNodeStream) MapLabel() string {
return ins.Label()
}
func (ins *inputNodeStream) Pipe(to Node, toIndex int) {
if toPipeline, ok := to.(*implPipeline); ok {
ins.node.graph.addLink(ins, toPipeline.left, toIndex)
} else {
ins.node.graph.addLink(ins, to, toIndex)
}
}