Hi! I have a quick question about gstreamer-rs bindings.
I’m trying to wrap my mind around how gstreamer Elements are memory-managed in the rust api. I’ve used the C native interface and Python bindings before, where each element was referenced counted either automatically or manually.
How about in rust? When I create an element, do I get ownership of that element? Or do I get ownership of a “Rc”? I’d assume the former, but many places in the examples (for example linking many elements in a pipeline) expect only a reference and the following works: pipeline.rs · GitHub
Clearly the src
and sink
elements were dropped, and only references to them were used, meaning something was copied out of them for the pipeline to work (side note, the first function calls init and creates a mainloop)
Now, I’d like to have multiple ownership of an element. Do I need Rc? The past example leads me to believe I can just clone()
it, but I’m not quite sure. I don’t think this would matter for “regular” elements, but I’m playing with AppSink and AppSrc where state matters at all time, not just the declarative state when the element is out of the factory.