gst/gstpad.c: Remove handling of filtered caps. Fix/merge functions that handle...
[platform/upstream/gstreamer.git] / docs / random / ds / negotiation
1
2
3 Properties:
4
5   "template_caps"
6     The union of all possible caps that a pad might have in any
7     condition.  Is a class property, and doesn't change over the
8     life of an object.  Set by the element during class init.
9
10   "internal_caps"
11     The caps that the element will allow on a pad, given its current
12     state and the external_caps of all the other pads of the element.
13     Set by the element.
14
15   "external_caps"
16     The caps representing what the core will allow on a pad.  This is
17     a combination of the peer's allowed caps, and filtering caps, and
18     any in-process negotiation restrictions.  Set by the core.
19
20   "negotiated_caps"
21     The format that the element will use.  Set by the core.
22
23   "filter_caps"
24     The caps intersected with everything else during negotiation.  Set
25     by the application.
26
27   "negotiable"
28     A boolean that indicates that the pad is ready to negotiate.  Set
29     by the element.
30
31
32
33 Negotiation steps, from the element perspective:
34
35  - During object initialization, an element must set template_caps
36    and allowed_caps for each pad.
37
38  - In response to changes in the internal state of the element or in
39    the peer_allowed_caps of any other pad owned by the element, the
40    element should update allowed_caps of a pad.
41
42  - Pads are initially created with negotiable as FALSE.  When an
43    element wants to indicate that negotiation is allowable, it should
44    set negotiable to TRUE.
45
46  - In response to a negotiate signal, an element should copy the caps
47    in "allowed_caps" to "negotiated_caps", and extract any information
48    needed to handle the format.  At this point, "allowed_caps" is
49    guaranteed to be fixed.
50
51
52 Negotiation steps, from the core perspective:
53
54  
55
56
57
58
59
60 <ds> I'd like to split it up into manageable "projects"
61 <ds> hopefully some of which we can recruit others to do
62 <Company> i'd like a decision about if we drop threads
63 <ds> in what sense?
64 <ds> threads being not required?
65 <Company> threads being not part of the API
66 <ds> or threads being not used
67 <Company> so no thread safety considerations
68 <ds> I would like threads to not be part of the API
69 <ds> requiring apps/plugins to be written thread-safely is insane
70 <Company> the question is this: If someone calls gst_element_set_state (element, state), does he have to marshal it into the correct thread himself or not?
71 <ds> no
72 <ds> reason being: we already have to deal with subthreads
73 <ds> we == the core
74 <Company> then you'll have a lot of problems
75 <Company> i'd like to just drop subthreads and be done with it
76 --> StyXman (~mdione@200.59.114.71) has joined #gstreamer
77 <ds> and run everything in one thread?
78 <Company> yes
79 <Company> schedulers are free to use threads though
80 <ds> this is obviously a retreat
81 <Company> right
82 <ds> but perhaps a strategic one
83 <Company> otherwise you have to guarantee that you get no races
84 <ds> I've seen this as a viable option for some time
85 <Company> there's stuff that just does not work as is currently
86 <ds> it always seemed difficult to convince other people that it's the right thing to do
87 <ds> for example, wtay
88 <Company> like setting xwindow ids, changing states or app-events
89 <Company> like seeks
90 <-- iain has quit ("leaving")
91 <Company> all of this has the typical thread issues currently: it sometimes works and sometimes crashes the app
92 <Company> and that's not acceptable to me
93 <ds> let's do it
94 <Company> if you look at my 0.10 code, I've tried to have GstObjects belong to a "context"
95 <ds> this all fits into the idea that I think we should be a lot more like gtk architecturally
96 <ds> for example, gtk doesn't have anything like caps negotiation, where elements call each other recursively
97 <Company> and have functions ensure they're in the right context or otherwise marshal
98 <Company> yes it does
99 <ds> ?
100 <Company> size requests and allocations
101 <ds> but that's more like how I want it -- setting a property and firing a signal telling others that it's updated
102 <ds> as i understand it
103 <Company> though gtk has the bonus of being a tree which we don't have, we have a directed, maybe cyclic graph
104 <Company> and for caps, the graph isn't even directed
105 <Company> gtk is far too simple for gst
106 <ds> true
107 <Company> i can't even come up with an analogy to a video transcoder
108 <ds> but we do some relatively simple stuff in a complicated way
109 <-- StyXman (~mdione@200.59.114.71) has left #gstreamer
110 <Company> like?
111 <ds> caps negotiation
112 <Company> that's not simple
113 <ds> passing around the data should be
114 <ds> was it you or thomasvs that wanted to split core headers into app headers and plugin headers?
115 <Company> I definitely wanted that
116 <Company> app/plugin/registry to be exact
117 <ds> registry?
118 <ds> for functions that access "internal" stuff?
119 <Company> stuff an app normally doesn't touch
120 <Company> so we can do something like declare the "app" stuff supported for a longer time
121 <ds> oooh, good call
122 <ds> I'm sold
123 <Company> so, now that threads are gone, what are the biggies I want in 0.10?
124 <Company> 1) non-blocking main-loop integrated processing
125 <ds> that's rather important if you don't have threads :)
126 <Company> right
127 <Company> but it works in my gst-01.0 stuff already
128 <Company> minus the elements that need to be ported of cause
129 <Company> which aren't that many fortunately
130 <Company> though some are hard (like gnomevfs), because they have no non-blocking API
131 <ds> a subclass of GstElement that fires up a helper thread?
132 <ds> (dirty, but it works)
133 <Company> probably
134 <ds> - autopluggers would be easier to write if there was a core method
135 <ds>   to do what plugidentities do.
136 <Company> no clue how to implement that
137 <ds> there's also a note about bins being more involved with negotiation
138 <Company> that's the next biggie: 2) fix the negotiation process to allow good autoplugging
139 <ds> that was something I thought about last time around
140 <Company> bins?
141 <ds> that sounds like something I'd work on
142 <ds> GstBin
143 <Company> the only reason bhins still exist for me is to group elements
144 <ds> so that a bin subclass could override how its children are negotiated
145 <ds> much like GtkBin, actually
146 <ds> and allocation
147 <Company> hum
148 <Company> how do you solve that issue with links that are only partly inside the bin and partly inside another one?
149 <ds> that would be up to the parent (grandparent?)
150 <Company> so all links must be in the same toplevel bin?
151 <ds> yes
152 <ds> isn't that the case currently?
153 <ds> probably not checked
154 <Company> pfff
155 <Company> currently you can do anything
156 <ds> heh
157 <ds> what about state changes?
158 <Company> dunno
159 <Company> it's not really important for me
160 <Company> apart from the EOS stuff
161 <ds> I'd like states to be split into "what state does the app want me to be in" and "what state am I in"
162 <ds> with the latter being under control of the element
163 <Company> yeah, that'd be nice
164 <ds> that way, you don't have multiple people trying to control the state
165 <Company> we definitely need to fix EOS
166 <Company> i'm not sure how we should handle errors
167 <ds> element errors?
168 <Company> yeah, if we want to explicitly unset errors or not
169 <Company> currently on error the element goes to paused
170 <ds> it's easier with actual_state
171 <Company> in theory i just set it to PLAYING again and continue?
172 <ds> the actual_state goes to PAUSED and fires a signal
173 <Company> dunno, maybe actual_state should go to ERROR
174 <ds> yeah
175 <Company> that'd require gst_element_unset_error though
176 <ds> with actual_state, we can add states without thinking too hard
177 <Company> but if you can just unset it, why not just do it and continue
178 <ds> the app may want to be involved
179 <ds> especially to get the error message
180 <ds> do we want a separate api section for autopluggers?
181 <Company> why would we want that?
182 <ds> or make it part of registry
183 <Company> maybe s/registry/internal/ or some other name
184 <ds> because autopluggers may want to access internal information that we wouldn't expose to apps or plugins
185 <ds> could you add gst/gstcompat.c to your arch repo?
186 <Company> hm
187 <Company> what internal info would an autoplugger need
188 <ds> depends
189 <ds> whatever replaces plugidentities
190 <Company> a simple one (decoder) just needs caps and ranks
191 <ds> I meant for negotiation information
192 <Company> hm
193 <Company> no, i don't want a seperate section for it
194 <Company> just put it in "internal", "extended" or whatever
195 <ds> ok
196 <ds> do we want to plan for the app api to be ABI compatible past 0.10?
197 <ds> er, that's silly
198 <ds> er, kinda silly
199 <Company> API compat
200 <Company> you could achieve ABI compat if you expose all objects just as typedefs
201 <Company> lemme reboot into linux so i can add gstcompat.c
202 <Company> brb
203 <-- Company has quit (Read error: 104 (Connection reset by peer))
204 --> Company (~Company@pD95D53D9.dip.t-dialin.net) has joined #gstreamer
205 --> ploum (~ploum@21-4.CampusNet.ucl.ac.be) has joined #gstreamer
206 <-- marv has quit (Read error: 104 (Connection reset by peer))
207 <ds> so do you still support caps registration?
208 <-- ploum has quit (Client Quit)
209 <ds> registering media types, fields, descriptions, and default fixate functions?
210 <ds> and validation
211 <Company> yes
212 <Company> that's an important thing we need
213 <Company> otherwise people mess up by either carelessly doing stuff wrong or not understanding what they're supposed to do
214 <ds> whose responsibility is it to register these?
215 <ds> libgstplugins?
216 <ds> a plugin?
217 <ds> do we want this info in the registry so that a plugin can automatically be loaded to provide registration for video/x-raw-rgb?
218 <Company> haven't really thought about that part yet
219 <ds> it's somewhat similar to typefind functions
220 <Company> yeah
221 --> ultrafunk (~pd@eth779.vic.adsl.internode.on.net) has joined #gstreamer
222 <Company> i'd probably have a seperate Factory for caps info
223 <Company> and have the system load them when you use the caps info stuff
224 <ds> should caps info be manditory?
225 <ds> have you synced your repo?
226 <Company> i'm trying to, but some commit was interrupted last time...
227 <ds> how does one sync a local repository to fd.o?
228 <ds> rsync?
229 <Company> tla archive-mirror
230 <ds> ah
231 <Company> see rhythmbox.org => developers for how it works
232 <Company> and _never_ press ctrl-c in arch
233 <-- Misirlou has quit (Remote closed the connection)
234 --> Misirlou (~asdf@c-24-125-118-27.va.client2.attbi.com) has joined #gstreamer
235 <ds> is there a reason why a pad might know (and set) allowed_caps, but not be ready to negotiate?
236 <Company> i don't know a good one
237 <ds> know a bad one?
238 <Company> "arch-mirror: unable to acquire revision lock (internal error in archive-pfs.c(pfs_lock_revision))"
239 <Company> stupidly ordered code
240 <Company> no, don't know one
241 <ds> here's a good question:
242 <ds> should the core negotiate links in a pipeline that are negotiatable, even though some other links are not negotiatable?
243 <ds> this ends up making us negotiate some things multiple times
244 <ds> filesrc ! mad ! audioconvert ! audioscale ! osssink
245 <Company> the core doesn't know if links are negotiable
246 <ds> it will in the future :)
247 <Company> sinesrc ! identity ! osssink
248 <Company> how does it know if sinesrc ! identity is negotiable?
249 <ds> because the allowed_caps on the two pads intersect
250 --> marv (~ilovekimm@host-216-76-232-134.hsv.bellsouth.net) has joined #gstreamer
251 <ds> I'm pretty sure that I don't want gst_pad_link() to return negotiation errors
252 <ds> ever
253 <Company> you can't avoid that
254 <ds> I want to separate "linkable" from "negotiable"
255 <Company> ah, gst_pad_link
256 <ds> so you can link videotestsrc ! identity ! osssink
257 <Company> i confused it with GstPadLink
258 <Company> yeah, i was thinking about that, too
259 <ds> vts ! osssink won't link, since the pad templates don't intersect
260 <Company> http://web.ics.purdue.edu/~kuliniew/wp/archives/2004/08/07/error-handling/
261 <Company> :)
262 <ds> right now the vts ! id ! osssink pipeline fails to link
263 <Company> yeah
264 <Company> and goom ! xvimagesink only fails when xvimagesink is at least READY
265 <Company> (assuming your xv can't do RGB)
266
267
268