mpr
mpr

Reputation: 3378

Is there an easy way to get a GType from a GStreamer element name?

I have a series of bins I want to iterate through, and within each bin I want to extract the first queue element. Because the number of bins is arbitrary in this case, I won't know the name of the queue element, so I was hoping to use gst_bin_get_by_interface(), which takes a GType.

Is there a way I can go from an element name, like "queue", to a GType, without diving into the GStreamer header files?

Upvotes: 2

Views: 704

Answers (1)

mpr
mpr

Reputation: 3378

GstElementFactory class has this:

GstElementFactory* queue_factory = gst_element_factory_find("queue");
g_assert(G_IS_OBJECT(queue_factory));

GType queue_type = gst_element_factory_get_element_type(queue_factory);

Upvotes: 2

Related Questions