【问题标题】:Getting a list of all GStream Syncs in Python using gi.repository使用 gi.repository 获取 Python 中所有 GStream 同步的列表
【发布时间】:2013-10-31 04:47:24
【问题描述】:

所以如果我使用 gst,我可以运行以下命令:

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

Outs 现在是 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 调用有什么问题?

【问题讨论】:

    标签: python pygobject 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)>]
    

    【讨论】:

    • 我已经在 Python 2.7.5 和 3.2.5 上尝试过这个,在这两种情况下,我仍然得到一个空的列表。 :(
    猜你喜欢
    • 2019-04-07
    • 2021-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多