2013-10-31 28 views
0

所以,如果我用GST,我可以運行以下命令:獲取所有的Python GStream同步的列表使用gi.repository

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

而出局,現在是gst.ElementFactory對象每種類型的列表GStreamer SINK我可以使用(例如filesink,alsasink,a2dpsink等)。如果我嘗試使用gi.repository:

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

Outs返回一個空列表。我已經嘗試了Python2和Python3中的gi.repository版本。我可以從gi.repository導入Gtk並渲染Gtk窗口。我在做GStreamer調用時出了什麼問題?

回答

1

做一個Gst.init使得它爲我工作(不Gst.init我得到一個空列表):

>>> 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)>] 
+0

我已經嘗試這個關於Python 2.7.5和3.2.5,並在這兩種情況下用這個確切的代碼,我仍然得到一個空的列表。 :( – djsumdog