Search code examples
gstreamer

Gstreamer source vs sink


I am confused by the concept of sink and source elements. Intuitively, I would expect a source to be something from which we take data, and a sink to be something where we put the results of our process. In Gstreamer tutorial 2, this seems to be right: https://gstreamer.freedesktop.org/documentation/tutorials/basic/images/figure-1.png But when I was reading tutorial 3, the definition seems to be the opposite: https://gstreamer.freedesktop.org/documentation/tutorials/basic/images/filter-element.png I am not sure why the filter element in the second image contains the sink element on the left and the src element on right, and not the opposite. I mean, I would expect the output to be sent into a sink not a source. Is it because we are looking at it from the "outside"? That is, the output of the filter is a source for us (and for the next element in the pipeline) even though, in non-gstreamer terminology, it could be seen as a sink internally for the filter. Is this correct?


Solution

  • The second picture is not about elements in a pipeline, but pads on a single element. On the first one you look at a complete pipeline, but you have figured that one out already.

    On the second one you look a single element and it's pads. The element has two pads. The one on the left is the sink pad, data goes in there and is consumed by the element. On the right side you have a source pad, the element will generate data and push it to that pad (so it is somehow a data source).

    Treat is as a vocabulary. It sure can be argued about the naming, but this is what has been agreed upon.