Codebase list kmscube / 76d2b93
gst-decoder.c: Use element factory name to detect V4L2 video decoder Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org> Carlos Rafael Giani authored 7 years ago Rob Clark committed 7 years ago
1 changed file(s) with 13 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
114114 static void
115115 element_added_cb(GstBin *bin, GstElement *element, gpointer user_data)
116116 {
117 GstElementFactory *elem_factory;
118 gchar const *factory_name;
119
117120 (void)user_data;
118121 (void)bin;
119122
120 printf("added: %s\n", GST_OBJECT_NAME(element));
121
122 // XXX is there a better way to do this, like match class name?
123 if (strstr(GST_OBJECT_NAME(element), "v4l2video0dec") == GST_OBJECT_NAME(element)) {
123 elem_factory = gst_element_get_factory(element);
124 factory_name = gst_plugin_feature_get_name(elem_factory);
125
126 GST_DEBUG("added element %s (created with factory %s)", GST_OBJECT_NAME(element), factory_name);
127
128 /* v4l2 video decoder factories are generated by the GStreamer v4l probe.
129 * The format is v4l2videoNdec, where N is an integer. So, check if the
130 * element's factory name fits this pattern. */
131 if (g_str_has_prefix(factory_name, "v4l2video") && g_str_has_suffix(factory_name, "dec")) {
124132 /* yes, "capture" rather than "output" because v4l2 is bonkers */
125133 gst_util_set_object_arg(G_OBJECT(element), "capture-io-mode", "dmabuf");
134 printf("found GStreamer V4L2 video decoder element with name \"%s\"\n", GST_OBJECT_NAME(element));
126135 }
127136 }
128137