pad: rename GstProbeType and GstProbeReturn to GstPadProbe{Type,Return}
[platform/upstream/gstreamer.git] / docs / random / mutability
1 Mutability is the property of an object that defines whether or not you
2 are allowed to modify it.  In the context of GST, that means that if you
3 want to mutilate a buffer, say to do an audio effect, you may have to do
4 this on a copy of the buffer, if someone else has a reference on it.
5
6 The simplest sequence of events in a decoder pipeline is as follows:
7
8 1) create buffer
9 2) allocate and fill data region, attach to buffer
10 3) pass to next element
11 4) decode the data into new buffer, free original buffer
12 5) pass to next element
13 6) buffer gets copied to output device (sound, video, whatever)
14
15 Both of these buffers are created from malloc()'d memory, are referenced
16 by one and only one element at a time, and are never modified in place.
17 They have no special flags, and when ref==0, they're simply free()'d.
18
19 An optimization in the case of the sound card or video double buffering,
20 where the output buffer actually comes from the output device.  In that
21 case the element will be aware of such things.
22
23 A more complex example is where the data is teed after being decoded, sent
24 to an effects or visualization object.
25
26 1) create buffer, fill from source
27 2) hand to decoder
28 3) create new buffer, decode into it, free old buffer
29 4) hand to tee
30 5) ref++, hand off to