420019ded1a52150b97f9ae009ad78f10d48a945
[platform/upstream/gstreamer.git] / docs / random / omega / scheduling
1 0) definitions:
2
3 All pads without further specifiers are assumed to belong to the element
4 in question.  The pad's peer is always denoted with ->peer.  If there's
5 question, pads will be prefixed with self-> and other-> as necessary.
6
7 All elements in this document have at most one source and one sink pad,
8 called srcpad and sinkpad. Multi-pad cases are supposed to be simple
9 extrapolations except in a couple strange cases, to be covered elsewhere.
10
11
12 1) loop functions:
13
14 A loop function will call gst_pad_pull(sinkpad), do something, and call
15 gst_pad_push(srcpad).
16
17 gst_pad_pull first checks to see if there's a buffer in the pen.  If not,
18 it calls that pad's pullfunc handler, passing it the peer pad.  When that
19 finishes, we check again and return the buffer.  If no buffer, we squawk.
20 The pullfunc handler simply causes a cothread switch to the peer pad's
21 context;
22
23 gst_pad_push places the buffer in the peer pad's pen, and calls the local
24 pad's pushfunc.  The pushfunc simply causes a switch to the peer pad's
25 context.
26
27
28 2) chain functions
29
30 The loopfunc constructed around a chain function starts by finding all
31 sink pads.  For each sink pad, it calls gst_pad_pull.  This causes a
32 switch to the peer pad's context and a buffer to appear, which is
33 returned.  The pad is the handed off to the chain function, which
34 presumably does some processing and calls gst_pad_push(), which causes a
35 context switch to that pad's peer.
36
37
38
39 3) source
40
41 The loopfunc must repeatedly call the srcpad's pull
42
43
44
45
46
47 ---------------------------------       ---------------------------------
48  srcpad                         |       | sinkpad
49                                 |       |
50  GstPad *peer;                  | <-p-> | GstPad *peer;
51    pointer to peer pad          |       |   pointer to peer pad
52                                 |       |
53  funcptr *pushfunc;             | --s-> | funcptr *pushfunc;
54    causes switch to peer ctx    |       |   element uses buffer in pen,
55                                 |       |
56  funcptr *pullfunc;             | <-s-- | funcptr *pullfunc;
57    element puts buffer in pen,  |       |   causes switch to peer ctx
58    calls gst_pad_push()         |       |
59                                 |       |
60  funcptr *pullregion func       | <-s-- | funcptr *pullregionfunc;
61    element puts region in pen   |       |   causes switch to peer ctx
62    calls gst_pad_push()         |       |
63 ---------------------------------       ---------------------------------