astarakastara
astarakastara

Reputation: 545

How to retrieve Property names in Gstreamer

I want to retrieve Element Property names of GstElement in C++. gst-inspect writes all of the details about plugin.

I could retrieve factory and plugin details like these on code.
Factory Details:
Plugin Details:

By writing,
gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)), gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_KLASS), gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_DESCRIPTION), gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME));

However, I couldn't find any functions about property details (Element Properties Section) in Gstreamer.

I expect C++ code like gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)), gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_KLASS), gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_DESCRIPTION), gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME)); that.

I want to retrieve all of the property names of GstElement. For instance, for openh264enc
bitrate, complexity, gop-size and etc.

Upvotes: 0

Views: 2288

Answers (1)

astarakastara
astarakastara

Reputation: 545

I solved that after I post the question... However, as it may be useful to other people I am posting the answer.

GObjectClass* objClass = G_OBJECT_GET_CLASS(*element);
guint n_props;
GParamSpec** props;
props = g_object_class_list_properties(objClass,&n_props);

if(objClass != nullptr){
    if(props != nullptr){
        for (guint i = 0; i < n_props; i++) {
            if(props[i] != nullptr)
                qInfo() << props[i]->name;
        }
    }else{
        qWarning() << "Element props are NULL!";
    }
}else{
    qWarning() << "Obj Class is NULL!";
}

Upvotes: 2

Related Questions