0

So if I use gst, I can run the following:

import gst
outs = gst.element_factory_list_get_elements(gst.ELEMENT_FACTORY_TYPE_SINK,gst.RANK_NONE)

And outs is now a list of gst.ElementFactory objects which each of type of GStreamer SINK I can use (e.g. filesink, alsasink, a2dpsink, etc). If I try this using gi.repository:

from gi.repository import Gst
outs = Gst.ElementFactory().list_get_elements(Gst.ELEMENT_FACTORY_TYPE_SINK,Gst.Rank.NONE)

Outs returns an empty list. I've tried the gi.repository version in both Python2 and Python3. I can import Gtk from gi.repository and render a Gtk Window fine. What am I doing wrong with my GStreamer call?

djsumdog
  • 2,560
  • 1
  • 29
  • 55

1 Answers1

1

Doing a Gst.init makes it works for me (without Gst.init I get an empty list):

>>> from gi.repository import Gst
>>> Gst.init(None)
[]
>>> outs = Gst.ElementFactory().list_get_elements(Gst.ELEMENT_FACTORY_TYPE_SINK,Gst.Rank.NONE)
>>> outs
[<ElementFactory object at 0x7f3d2c6249b0 (GstElementFactory at 0x1327230)>, <ElementFactory object at 0x7f3d2c624a00 (GstElementFactory at 0x1315490)>, <ElementFactory object at 0x7f3d2c624a50 (GstElementFactory at 0x12f06a0)>, <ElementFactory object at 0x7f3d2c624aa0 (GstElementFactory at 0x132aaf0)>, <ElementFactory object at 0x7f3d2c624af0 (GstElementFactory at 0x12b6ee0)>, <ElementFactory object at 0x7f3d2c624b40 (GstElementFactory at 0x129e0b0)>, <ElementFactory object at 0x7f3d2c624b90 (GstElementFactory at 0x12f52c0)>, <ElementFactory object at 0x7f3d2c624be0 (GstElementFactory at 0x12b8bb0)>, <ElementFactory object at 0x7f3d2c624c30 (GstElementFactory at 0x12ae270)>, <ElementFactory object at 0x7f3d2c624c80 (GstElementFactory at 0x130a590)>, <ElementFactory object at 0x7f3d2c624cd0 (GstElementFactory at 0x12bb250)>, <ElementFactory object at 0x7f3d2c624d20 (GstElementFactory at 0x12bb090)>, <ElementFactory object at 0x7f3d2c624d70 (GstElementFactory at 0x12f80e0)>, <ElementFactory object at 0x7f3d2c624dc0 (GstElementFactory at 0x12a75c0)>, <ElementFactory object at 0x7f3d2c624e10 (GstElementFactory at 0x12a1550)>, <ElementFactory object at 0x7f3d2c624e60 (GstElementFactory at 0x130a670)>, <ElementFactory object at 0x7f3d2c624eb0 (GstElementFactory at 0x12bb4f0)>, <ElementFactory object at 0x7f3d2c624f00 (GstElementFactory at 0x1271c70)>, <ElementFactory object at 0x7f3d2c624f50 (GstElementFactory at 0x12bb410)>, <ElementFactory object at 0x7f3d2c624fa0 (GstElementFactory at 0x12bce30)>, <ElementFactory object at 0x7f3d2c1b1050 (GstElementFactory at 0x12bcc70)>, <ElementFactory object at 0x7f3d2c1b10a0 (GstElementFactory at 0x12bcab0)>, <ElementFactory object at 0x7f3d2c1b10f0 (GstElementFactory at 0x12f5480)>, <ElementFactory object at 0x7f3d2c1b1140 (GstElementFactory at 0x12c0e50)>, <ElementFactory object at 0x7f3d2c1b1190 (GstElementFactory at 0x1316ae0)>, <ElementFactory object at 0x7f3d2c1b11e0 (GstElementFactory at 0x1313510)>, <ElementFactory object at 0x7f3d2c1b1230 (GstElementFactory at 0x1313350)>, <ElementFactory object at 0x7f3d2c1b1280 (GstElementFactory at 0x130c860)>, <ElementFactory object at 0x7f3d2c1b12d0 (GstElementFactory at 0x1316a00)>, <ElementFactory object at 0x7f3d2c1b1320 (GstElementFactory at 0x12aa380)>, <ElementFactory object at 0x7f3d2c1b1370 (GstElementFactory at 0x12aa540)>, <ElementFactory object at 0x7f3d2c1b13c0 (GstElementFactory at 0x12c0bb0)>]
  • I've attempted this on Python 2.7.5 and 3.2.5 and in both cases with that exact code, I still get an empty list for outs. :( – djsumdog Jan 07 '14 at 07:47