Added status of the documents
[platform/upstream/gstreamer.git] / docs / random / wtay / eos3
1 OUTDATED
2 --------
3
4
5 case 1) 
6
7 (--------------------------------------------------)
8 ! bin                                              !
9 ! (--------)         (--------)         (--------) !
10 ! ! fakesrc!         !identity!         !fakesink! !
11 ! !       src ----- sink     src ---- sink       ! !
12 ! (--------)         (--------)         (--------) !
13 (--------------------------------------------------)
14
15 .scheduling.
16   
17   case1 has just one scheduled entity (chain) no problem here.
18
19 .eos.
20
21   fakesrc detects the end of stream. It just returned the last buffer.
22   The next _pull will cause the srcpad to trigger gst_pad_set_eos ().
23   After that it will return a NULL buffer.
24
25   gst_pad_set_eos() will notify the parent about the plugins attempt to
26   signal eos. the parent disables scheduling for the chain containing
27   fakesrc.
28   
29   no more chains are being scheduled so the bin fires EOS.
30
31
32 case 2) 
33
34
35 (-----------------------------------------------------------------------)
36 ! bin                                                                   !
37 !                                                     (---------------) !
38 !                                                     !thread         ! !
39 ! (--------)         (--------)         (--------)    !     (--------)! !
40 ! ! fakesrc!         !identity!         !  queue !    !     !fakesink!! !
41 ! !       src ----- sink     src ---- sink       src ---- sink       !! !
42 ! (--------)         (--------)         (--------)    !     (--------)! !
43 !                                                     (---------------) !
44 (-----------------------------------------------------------------------)
45
46 .scheduling.
47
48   case2 has two scheduled entities: fsr-i-q, q-fsk.
49   The first one is scheduled by the bin, the second one by the thread.
50   
51 .eos.
52
53   fakesrc detects the end of stream. It just returned the last buffer.
54   The next _pull will cause the srcpad to trigger gst_pad_set_eos ().
55   After that it will return a NULL buffer.
56
57   gst_pad_set_eos() will notify the parent about the plugins attempt to
58   signal eos. the parent will take chain1 out if its scheduled chains.
59
60   the bin does not fire EOS yet because the thread has not yet signaled 
61   EOS.
62
63   after the queue has sent out the last buffer, its calls eos on its
64   src pad. the chain with the queue is removed from the threads scheduled
65   chains. there are no more chains to schedule, the thread fires EOS.
66
67   The bin now has no more scheduled chains and no more pending subbins,
68   it fires EOS.
69
70
71 case 3) 
72
73 (-----------------------------------------------------------------------)
74 ! bin                                                                   !
75 !                                                     (---------------) !
76 !                                                     !thread         ! !
77 ! (--------)         (--------)         (--------)    !     (--------)! !
78 ! ! fakesrc!         !  tee   !         ! queue1 !    !     !fakesink!! !
79 ! !       src ----- sink     src ---- sink       src ---- sink       !! !
80 ! (--------)         !        !         (--------)    !     (--------)! !
81 !                    !        !                       (---------------) !
82 !                    !        !                                         !
83 !                    !        !                       (---------------) !
84 !                    !        !                       !thread         ! !
85 !                    !        !         (--------)    !     (--------)! !
86 !                    !        !         ! queue2 !    !     !fakesink!! !
87 !                    !       src ---- sink       src ---- sink       !! !
88 !                    !        !         (--------)    !     (--------)! !
89 !                    (--------)                       (---------------) !
90 (-----------------------------------------------------------------------)
91
92 .scheduling.
93
94   case3 has tree scheduled entities: fsr-t(-q1,-q2), q1-fsk. q2-fsk
95   the first one is managed by the bin, the second two are managed by the
96   threads.
97   
98 .eos.
99
100   fakesrc detects the end of stream. It just returned the last buffer.
101   The next _pull will cause the srcpad to trigger gst_pad_set_eos ().
102   After that it will return a NULL buffer.
103
104   chain1 is taken out of the scheduling algorithm of the bin.
105
106   after a while, the threads finish their scheduling and fire EOS too.
107
108   The bin now has no more scheduled chains and no more pending subbins,
109   it fires EOS.
110   
111   
112 case 4) 
113
114 (-----------------------------------------------------------------------)
115 ! bin                                                                   !
116 !                                                     (---------------) !
117 !                                                     !thread         ! !
118 ! (--------)       (----------)         (--------)    !     (--------)! !
119 ! ! fakesrc!       !mpeg1parse!         ! queue1 !    !     !fakesink!! !
120 ! !       src -- sink        src ---- sink       src ---- sink       !! !
121 ! (--------)       !          !         (--------)    !     (--------)! !
122 !                  !          !                       (---------------) !
123 !                  !          !                                         !
124 !                  !          !                       (---------------) !
125 !                  !          !                       !thread         ! !
126 !                  !          !         (--------)    !     (--------)! !
127 !                  !          !         ! queue2 !    !     !fakesink!! !
128 !                  !         src ---- sink       src ---- sink       !! !
129 !                  !          !         (--------)    !     (--------)! !
130 !                  (----------)                       (---------------) !
131 (-----------------------------------------------------------------------)
132
133   this case differs from case3 in that one of the queues can be empty
134   while the other isn't. we assume queue1 is empty while queue2 isn't yet.
135
136 .scheduling.
137
138   case3 has tree scheduled entities: fsr-t(-q1,-q2), q1-fsk. q2-fsk
139   the first one is managed by the bin, the second two are managed by the
140   threads.
141   
142 .eos.
143
144   fakesrc detects the end of stream. It just returned the last buffer.
145   The next _pull will cause the srcpad to trigger gst_pad_set_eos ().
146   After that it will return a NULL buffer.
147
148   chain1 is taken out of the scheduling algorithm of the bin.
149
150   after a while, the threads finish their scheduling and fire EOS too.
151   chain2 (with  queue1) is taken out of the scheduling first because it
152   is empty.
153
154   chain3 (with queue2) finally removes its last scheduled chain and
155   fires EOS.
156
157   The bin now has no more scheduled chains and no more pending subbins,
158   it fires EOS.
159   
160   
161 case 5) 
162
163 (-----------------------------------------------------------------------)
164 ! bin                                                                   !
165 !                                                     (---------------) !
166 !                                                     !audiosink      ! !
167 ! (--------)       (----------)         (--------)    !               ! !
168 ! !disksrc1!       ! effect   !         ! mixer  !    !               ! !
169 ! !       src -- sink        src ---- sink     src -- sink            ! !
170 ! (--------)       (----------)         !        !    !               ! !
171 !                                       !        !    (---------------) !
172 ! (--------)       (----------)         !        !                      !
173 ! !disksrc2!       ! effect   !         !        !                      !
174 ! !       src -- sink        src ---- sink       !                      !
175 ! (--------)       (----------)         (--------)                      !
176 (-----------------------------------------------------------------------)
177
178   This is a simple audio mixer (mp3audio mixer).
179   We assume disksrc1 is going to be in EOS while disksrc2 is still in !EOS
180
181
182 .scheduling.
183
184   two chains are detected: disksrc1-effect-mixer-audiosink, 
185   disksrc2-effect-mixer-audiosink
186
187 .eos.
188
189   disksrc1 has passed the last buffer in the _get function. with its next 
190   call to _get, it will return a NULL buffer and set the src pad to EOS.
191
192   the EOS call travels up till the mixer element because it has overridden
193   the handler. The first chain is disabled from the scheduler.
194
195   finally disksrc2 run into EOS, same procedure as with disksrc1, except
196   now the mixer also sets EOS to its src pad, chain2 becomes inactive too
197   and the bin fires EOS because there are no more chains to schedule.
198   
199   somebody sets the location of disksrc1 to a new mp3 file, the srcpad 
200   is set to !EOS, chain1 is scheduled again, mixer is activated again too
201   and audio is playing again...
202
203
204 case 6) 
205
206 (-------------------------------------------------------------------------------------)
207 ! bin                                                                                 !
208 !                                                                   (---------------) !
209 ! (---------------------------------------------)                   !audiosink      ! !
210 ! ! thread1                                     !                   !               ! !
211 ! ! (--------)       (----------)      (-----)  !   (--------)      !               ! !
212 ! ! !disksrc1!       ! effect   !      !queue!  !   ! mixer  !      !               ! !
213 ! ! !       src -- sink        src -- sink  src -- sink     src -- sink             ! !
214 ! ! (--------)       (----------)      (-----)  !   !        !      !               ! !
215 ! (---------------------------------------------)   !        !      !               ! !
216 !                                                   !        !      (---------------) !
217 ! (---------------------------------------------)   !        !                        !
218 ! ! thread2                                     !   !        !                        !
219 ! ! (--------)       (----------)      (-----)  !   !        !                        !
220 ! ! !disksrc2!       ! effect   !      !queue!  !   !        !                        !
221 ! ! !       src -- sink        src -- sink  src -- sink      !                        !
222 ! ! (--------)       (----------)      (-----)  !   (--------)                        !
223 ! (---------------------------------------------)                                     !
224 (-------------------------------------------------------------------------------------)
225
226   This is a simple audio mixer (mp3audio mixer).
227   We assume disksrc1 is going to be in EOS while disksrc2 is still in !EOS
228
229 .scheduling.
230
231   Scheduling is a bit tricky here: we have two threads with each one chain ds1-e-q and
232   ds2-e-q. the mixer element is loop based and forms a third chain, mixer-audiosink
233
234 .eos.
235
236   disksrc1 has passed the last buffer in the _get function. with its next 
237   call to _get, it will return a NULL buffer and set the src pad to EOS.
238
239   the EOS call travels up till the queue element because it has overridden
240   the handler. The first chain is disabled from the scheduler. thread1 fires EOS
241   because it does not have any chains to schedule.
242
243   the mixer element pulls buffers from queue1 until queue1 is empty. At that time,
244   queue1 sets the pad to EOS, mixer now knows that it does not have to request
245   another buffer from that pad again.
246
247   disksrc2 finally sets its pad to EOS, rendering chain2 unscheduled which makes
248   the thread2 fire an EOS.
249
250   the mixer element pulls buffers from queue2 until queue2 is empty. At that time,
251   queue2 sets the pad to EOS, mixer now knows that it does not have to request
252   another buffer from that pad again. all pads for the mixer are in EOS now so
253   it sets the src pad to EOS. the last chain now also becomes unscheduled and
254   the bin fires EOS.
255
256