Writing a Manager Managers are elements that add a function or unify the function of another (series of) element(s). Managers are generally a GstBin with one or more ghostpads. Inside them is/are the actual element(s) that matters. There is several cases where this is useful. For example: To add support for private events with custom event handling to another element. To add support for custom pad _query () or _convert () handling to another element. To add custom data handling before or after another element's data handler function (generally its _chain () function). This chapter will explain the setup of managers. As a specific example, we will try to add EOS event support to source elements. This can be used to finish capturing an audio stream to a file. Source elements normally don't do any EOS handling at all, so a manager is perfect to extend those element's functionalities. Specifically, this element will contain two child elements: the actual source element and a helper element that implement an event handler on its source pad. This event handler will respond to EOS events by storing them internally and returning the event (rather than data) on the next call to the _get () function. After that, it will go into EOS and set the parent (and thereby the contained source element) to EOS as well. Other events will be forwarded to the source element, which will handle them as usual. ..