blob: 5bf4771469c3afdf21e20944b98aa9130e42541d (
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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
Pinos
-----
The idea is to make a server where you can provide
and consume media to/from.
Some of the requirements are:
- must be efficient for raw video using fd passing
- must be able to provide/consume/process media from any process
- streaming media only (no seeking)
- policy to restrict access to devices and streams
Although an initial goal, the design is not limited to raw video
only and should be able to handle compressed video and other
streamable media as well.
The design is in some part inspired by pulseaudio, hence its original
name. Increasinly we also seem to add functionality of jack and
GStreamer.
Protocol
--------
The protocol is similar to wayland but with custom
serialization/deserialization of messages. This is because the datastructures
in the messages are more complicated.
fd management
-------------
Clients receive fds with buffers and memory after a format was negotiated.
Updates to these buffers are notified by a message containing the id of the
buffer.
Wire
----
The wire protocol for the node control channel is a serialization of
structures.
+-----+ +----+ +----+
| | | S | | |
| ----- ----- |
+-----+ +----+ +----+
|
|
|
|
+----+
| |
| C |
+----+
Client Proxy
| INIT
node-update |
-------------------------------------->|
port-update |
-------------------------------------->|
state-change CONFIGURE | CONFIGURE
-------------------------------------->|
|<--- enum-ports
|<--- enum-formats
|<--- add-port
|<--- remove-port
set-property |<--- set-property
<--------------------------------------|
set-format |<--- set-format
<--------------------------------------|
|
port-update |
-------------------------------------->|
state-change READY | READY
-------------------------------------->|
|<--- port memory requirements
add-mem |<--- use-buffers
<--------------------------------------|
remove-mem |
<--------------------------------------|
add-buffer |
<--------------------------------------|
remove-buffer |
<--------------------------------------|
|
pause |<--- stop
<--------------------------------------|
state-change PAUSED | PAUSED
-------------------------------------->|
|
play |<--- start
<--------------------------------------|
state-change STREAMING | STREAMING
-------------------------------------->|
|
need-input |
<------------------------------------->|
have-output |
<------------------------------------->|
process-buffer |
<------------------------------------->|
reuse-buffer |
<------------------------------------->|
1) Update config C->S INIT
node-update
port-update
state change CONFIGURE
2) Set formats S->C CONFIGURE
set-property
enumerate ports
add-port
remove-port
enumerate formats
set-format
3) Buffer requirements update C->S
Update port status
state change READY if enough formats are set
4) Start S->C READY
read port memory requirements
add_mem
remove_mem
add_buffer
remove_buffer
command START/PAUSE
5) Pause S->C PAUSED
state change STREAMING
set-format to NULL -> state change to CONFIGURE
5) data transfer C->S STREAMING
need-input
have-output
process_buffer
reuse_buffer
state change PAUSED
6) data transfer S->C
process_buffer
reuse_buffer
7) format change C->S
port-update
state change CONFIGURE
8) format change S->C
Send set-format change on ports -> READY if new memory requirements
-> PAUSED/STREAMING if all ok
9) format-change to NULL
state change CONFIGURE
10) ERROR
|