I narrowed down a bug in my own program, and found that the following works, but if I swap the enabled and disabled code, I get a blank screen instead of a window showing my webcam:
def create_pipeline(self, gst_element_names):
gst_elements = list(map(Gst.ElementFactory.make, gst_element_names))
gst_pipeline = Gst.Pipeline()
# for some reason, map() doesn't work here
#map(gst_pipeline.add, gst_elements)
# ... so
for element in gst_elements:
gst_pipeline.add(element)
for i in range(0, len(gst_elements) - 1):
gst_elements[i].link(gst_elements[i + 1])
sink = gst_elements[-1]
self.video_container.append(sink.props.widget)
sink.set_state(Gst.State.READY)
gst_pipeline.set_state(Gst.State.PLAYING)
help(Gst.Pipeline)
...
| ----------------------------------------------------------------------
| Data and other attributes inherited from Bin:
|
| add = gi.FunctionInfo(add)
help(Gst.Pipeline.add)
...
add = class FunctionInfo(CallableInfo)
| Method resolution order:
| FunctionInfo
| CallableInfo
| BaseInfo
| builtins.object
|
| Methods defined here:
I might be missing something obvious here, but would appreciate if anyone could help to shed light on the difference between the two. Thanks : )