Any way of creating global value (protected by mutex maybe ?) in pipeline?

Hi, I’m trying to implement a plugin using an external transport library.

I am trying to develop a system where multiple plugins in the same pipeline can “access” the same library handle and would love to have them “check” a global value in GStreamer if the handle “exists” instead of initializing the library multiple times due to the huge performance drop in that scenario.

Is there a way for pipelines to “register” a global value? Is there a way for other pipelines to check if such a value exists during class initialization?

And is there any mutex mechanism where I can just tell other pipelines to wait in the _start until the main handle value wakes them up?

Huge thanks to anyone able to help me with this.

I feel like my post is all over the place

Creating a Global Value in a GStreamer Pipeline

Question:

Hi, I’m developing a GStreamer plugin using an external transport library. I want multiple plugins in the same pipeline to share a single library handle to avoid performance issues from initializing the library multiple times.

Goals:

  1. Register a Global Value: Have a global value that plugins can check to see if the library handle already exists.
  2. Mutex Protection: Use a mutex to protect this global value and ensure thread safety.
  3. Synchronization: Make other plugins wait until the main handle is available.

Example Scenario:

  • Multiple plugins need to access the same library handle.
  • If the handle exists, use it.
  • If not, initialize it and make it available to others.

Questions:

  1. How can I register a global value in a GStreamer pipeline?
  2. How can other plugins check if this value exists during class initialization?
  3. Is there a mutex mechanism to synchronize access to this global value?

Thanks for any help!