Commit 76d2b93f authored by Carlos Rafael Giani's avatar Carlos Rafael Giani Committed by Rob Clark

gst-decoder.c: Use element factory name to detect V4L2 video decoder

Signed-off-by: 's avatarCarlos Rafael Giani <>
parent a07e4dab
......@@ -115,15 +115,24 @@ gst_thread_func(void *args)
static void
element_added_cb(GstBin *bin, GstElement *element, gpointer user_data)
GstElementFactory *elem_factory;
gchar const *factory_name;
printf("added: %s\n", GST_OBJECT_NAME(element));
elem_factory = gst_element_get_factory(element);
factory_name = gst_plugin_feature_get_name(elem_factory);
GST_DEBUG("added element %s (created with factory %s)", GST_OBJECT_NAME(element), factory_name);
// XXX is there a better way to do this, like match class name?
if (strstr(GST_OBJECT_NAME(element), "v4l2video0dec") == GST_OBJECT_NAME(element)) {
/* v4l2 video decoder factories are generated by the GStreamer v4l probe.
* The format is v4l2videoNdec, where N is an integer. So, check if the
* element's factory name fits this pattern. */
if (g_str_has_prefix(factory_name, "v4l2video") && g_str_has_suffix(factory_name, "dec")) {
/* yes, "capture" rather than "output" because v4l2 is bonkers */
gst_util_set_object_arg(G_OBJECT(element), "capture-io-mode", "dmabuf");
printf("found GStreamer V4L2 video decoder element with name \"%s\"\n", GST_OBJECT_NAME(element));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment