tee: Check for the removed pad flag also in the slow pushing path
[platform/upstream/gstreamer.git] / docs / random / eos
1 OUTDATED
2 --------
3
4
5 case 1) 
6
7  (--------)         (--------)         (--------)
8  ! fakesrc!         !identity!         !fakesink!
9  !       src ----- sink     src ---- sink       !
10  (--------)         (--------)         (--------)
11
12
13
14   fakesrc detects the end of stream. It just sent the last buffer
15   and sets the srcpad to EOS with gst_pad_eos ().
16
17   gst_pad_eos() will notify the parent about the plugins attempt to
18   signal eos. the parent adds the element to its possible EOS 
19   providers.
20   
21   gst_pad_eos() will by default propagate to identy and to fakesink.
22   none of these plugins override the default behaviour so gst_pad_eos
23   returns TRUE and fakesrc signals EOS with the value TRUE.
24
25   The parent looks in the list of EOS providers and finds the faksrc
26   element that is now signaling EOS. all EOS providers are now in EOS
27   and so the bin fires EOS.
28
29
30
31 case 2) 
32                                                      (---------------)
33                                                      !thread         !
34  (--------)         (--------)         (--------)    !     (--------)!
35  ! fakesrc!         !identity!         !  queue !    !     !fakesink!!
36  !       src ----- sink     src ---- sink       src ---- sink       !!
37  (--------)         (--------)         (--------)    !     (--------)!
38                                                      (---------------)
39
40
41   fakesrc detects the end of stream. It just sent the last buffer
42   and sets the srcpad to EOS with gst_pad_eos ().
43
44   gst_pad_eos() will notify the parent about the plugins attempt to
45   signal eos. the parent adds the element to its possible EOS 
46   providers.
47
48   gst_pad_eos() will by default propagate to identy and to queue.
49   queue overrides the eos handler and returns false on the eos
50   request. fakesrc signals EOS with a value of false and the parent
51   bin removes the EOS provider from its list.
52
53   after the queue has sent out the last buffer, its calls eos on its
54   src pad. queue is added to the top level bin as an eos provider and
55   the default eos handler signals EOS with a value of TRUE to the parent.
56
57   the parent sees that all the eos providers are in eos now and signals
58   EOS.
59
60
61 case 3) 
62                                                      (---------------)
63                                                      !thread         !
64  (--------)         (--------)         (--------)    !     (--------)!
65  ! fakesrc!         !  tee   !         ! queue1 !    !     !fakesink!!
66  !       src ----- sink     src ---- sink       src ---- sink       !!
67  (--------)         !        !         (--------)    !     (--------)!
68                     !        !                       (---------------)
69                     !        !
70                     !        !                       (---------------)
71                     !        !                       !thread         !
72                     !        !         (--------)    !     (--------)!
73                     !        !         ! queue2 !    !     !fakesink!!
74                     !       src ---- sink       src ---- sink       !!
75                     !        !         (--------)    !     (--------)!
76                     (--------)                       (---------------)
77
78
79   fakesrc detects the end of stream. It just sent the last buffer
80   and sets the srcpad to EOS with gst_pad_eos ().
81
82   the eos handler returns false because both queues return false on the
83   eos request. the parent removes fakesrc as an EOS provider.
84
85   queue1 and queue2 were responsible for the EOS delay and so they get
86   added to the bin as possible EOS providers.
87
88   after the queues have sent out their last buffer, they calls eos on their
89   src pads.
90   the parent already has the two queues in the EOS provider list so they dont
91   get added twice.
92   the two queues perform gst_pad_eos () on their pads when the queue is empty,
93   the parent removes the EOS providers from its list, when the list is empty,
94   the parent fires EOS.
95   
96   
97 case 4) 
98
99                                                      (---------------)
100                                                      !thread         !
101  (--------)       (----------)         (--------)    !     (--------)!
102  ! fakesrc!       !mpeg1parse!         ! queue1 !    !     !fakesink!!
103  !       src -- sink        src ---- sink       src ---- sink       !!
104  (--------)       !          !         (--------)    !     (--------)!
105                   !          !                       (---------------)
106                   !          !
107                   !          !                       (---------------)
108                   !          !                       !thread         !
109                   !          !         (--------)    !     (--------)!
110                   !          !         ! queue2 !    !     !fakesink!!
111                   !         src ---- sink       src ---- sink       !!
112                   !          !         (--------)    !     (--------)!
113                   (----------)                       (---------------)
114
115
116   this case differs from case3 in that one of the queues can be empty
117   while the other isn't. we assume queue1 is empty while queue2 isn't yet.
118
119   fakesrc detects the end of stream. It just sent the last buffer
120   and sets the srcpad to EOS with gst_pad_eos ().
121
122   the eos handler returns false because queue2 returns false on the
123   eos request. the parent removes fakesrc as an EOS provider.
124
125   queue2 was responsible for the EOS delay and so it gets added to the bin
126   as a possible EOS provider.
127
128   after the queue2 has sent its last buffer, it performs gst_pad_eos on its
129   src pad.
130   the parent already has the queue2 in the list of EOS providers so it does not
131   get added twice.
132   queue2 finally fires the EOS signal and the parent removes the EOS provider 
133   from its list, when the list is empty, the parent fires EOS.
134
135   
136
137 case 5) 
138
139  (--------)         (--------)         (--------) 
140  ! disksrc!         !  mad   !         !filesink! 
141  !       src ----- sink     src ---- sink       ! 
142  (--------)         (--------)         (--------)
143
144
145   disksrc detects the end of stream. It just sent the last buffer
146   and sets the srcpad to EOS with gst_pad_eos ().
147
148   the eos handler returns false because mad returns false on the
149   eos request. the parent removes mad as an EOS provider.
150
151   mad was responsible for the EOS delay and so it gets added to the bin 
152   as a possible EOS provider.
153
154   After mad has sent its last buffer, it performs gst_pad_eos on its
155   src pad.
156   the parent already has mad in the list of EOS providers so it does not
157   get added twice.
158   mad finally fires the EOS signal.  This time, filesink returns false on
159   the eos request.  the parent removes mad as an EOS provider. 
160   
161   filesink was responsible for the EOS delay and gets added to the bin
162   as a possible EOS provider.
163   When filesink has written all of it's data and closed the output file,
164   it fires EOS.
165   The parent already has filesink in the list of EOS providers so it does
166   not get added twice.
167   The parent removes the EOS provider 
168   from its list, and since the list is empty, the parent fires EOS.
169
170 case 6) 
171
172  (--------)         (--------)         (--------) 
173  !disksrc1!         !  mad1  !         ! mixer  ! 
174  !       src ----- sink     src ---- sink1      !        (--------)
175  (--------)         (--------)         !        !        !filesink!
176                                        !       src ---- sink      !
177  (--------)         (--------)         !        !        (--------)
178  !disksrc2!         !  mad2  !         !        ! 
179  !       src ----- sink     src ---- sink2      ! 
180  (--------)         (--------)         (--------)
181
182   In this case, we want to make sure the pipeline keeps running after one
183   of the two sources reaches eos.  Suppose in this case that disksrc1 will
184   reach eos first.
185
186   disksrc1 detects the end of stream. It sets eos, mad1 will return false,
187   and mad1 will be responsible for eos.  When mad1 had sent out the last
188   buffer, it sends out eos.
189
190   The mixer intercepts eos and returns false.  mad1 is removed from the
191   eos providers and mixer is added.
192
193   (At this point, the mixer might choose to disconnect mad1->src and
194   mixer->sink1 pads, since it's received eos on mad1->src)
195
196   mixer will not send out eos since it hasn't received eos from 
197   mad2->src.
198
199   After a while, disksrc2 will detect end of stream, and eos will finally
200   propagate to mixer.  mixer might disconnect mad->src2, and after
201   realizing all of it's sources have reached eos, it sends out the final
202   buffer and fires EOS.
203
204   At this point, filesink will return false, mixer will be removed as an
205   eos provider, and filesink will write out it's final buffer and close
206   the file on disk.  At this point, it fires eos, and since it's the last
207   eos provider, the parent can fire eos.
208
209