Check Plugin availability runtime

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Check Plugin availability runtime

Myzhar
Hi all,

how can I check runtime if a plugin is available in my C++ code?

To be more precise I would like to check if I can use omxh264enc to encode H264, if not I use xh264enc...

Thank you
Walter

--

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Walter Lucetti
www.myzhar.com
Reply | Threaded
Open this post in threaded view
|

Re: Check Plugin availability runtime

Myzhar
Well,

I found a solution using

<code>GstElementFactory* x264enc = gst_element_factory_find ( "x264enc" );

 if( x264enc==NULL )
 {
     fprintf(stderr, "***** H264 encoder not available ***** \n\n" );
     return false;
}

gst_object_unref( x264enc );</code>

Is this the best way?

Thank you
Walter
Walter Lucetti
www.myzhar.com
Reply | Threaded
Open this post in threaded view
|

Re: Check Plugin availability runtime

Nicolas Dufresne-5
In reply to this post by Myzhar


Le 4 févr. 2017 4:43 AM, "Walter Lucetti" <[hidden email]> a écrit :
Hi all,

how can I check runtime if a plugin is available in my C++ code?

To be more precise I would like to check if I can use omxh264enc to encode H264, if not I use xh264enc...

You can simply call gst_element_factory_get("omxh264dec", NULL), if the plugin is missing, it will return NULL.



Thank you
Walter

--

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Check Plugin availability runtime

Tim Müller
In reply to this post by Myzhar
On Sat, 2017-02-04 at 10:39 +0100, Walter Lucetti wrote:

how can I check runtime if a plugin is available in my C++ code?

To be more precise I would like to check if I can use omxh264enc to encode H264, if not I use xh264enc...

if (!gst_registry_check_feature_version (gst_registry_get(),
"omxh264", GST_VERSION_MAJOR, 0, 0)) {
...
}

Alternatively, you could also find H.264 encoders programmatically without knowing the names, something with:

encs = gst_element_factory_list_get_elements (GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER, GST_RANK_MARGINAL);
h264_encoders = gst_element_factory_list_filter (encs, h264_caps, GST_PAD_SRC, FALSE);

...

Cheers
-Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Check Plugin availability runtime

Myzhar
Thank you very much guys.

I'm writing a streamer that can work both on desktop and embedded systems and I would like to use HW encoder/decoder when available.

Il 05 Feb 2017 11:30, "Tim Müller" <[hidden email]> ha scritto:
On Sat, 2017-02-04 at 10:39 +0100, Walter Lucetti wrote:

how can I check runtime if a plugin is available in my C++ code?

To be more precise I would like to check if I can use omxh264enc to encode H264, if not I use xh264enc...

if (!gst_registry_check_feature_version (gst_registry_get(),
"omxh264", GST_VERSION_MAJOR, 0, 0)) {
...
}

Alternatively, you could also find H.264 encoders programmatically without knowing the names, something with:

encs = gst_element_factory_list_get_elements (GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER, GST_RANK_MARGINAL);
h264_encoders = gst_element_factory_list_filter (encs, h264_caps, GST_PAD_SRC, FALSE);

...

Cheers
-Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Walter Lucetti
www.myzhar.com