0

我想构建一个 audiovisualiser 元素列表,以便能够在 python 程序中的下拉列表中提供它们,并且对于音频效果也是如此,但是如何访问 gstreamer-1.0 注册表。

4

1 回答 1

0

解决方案很简单,但花了很长时间才找到它。
这是一些示例代码来说明该方法。

#!/usr/bin/python
#Access the registry to find out what plugins are available
#list elements within a plugin
#list all elements within a Klass
from gi.repository import Gst
Gst.init()
reg = Gst.Registry.get()

print "List Available Plugins\n"
for x in reg.get_plugin_list():
    print x.get_name()
print "End Available Plugins\n"

print "List Plugins in AudioVisual\n"
for x in reg.get_feature_list_by_plugin("audiovisualizers"):
    print x.get_name(), "\t", x.get_longname()
print "END\n"

print "All Available visualisations\n"
vis_list = [filt for filt in reg.get_feature_list(Gst.ElementFactory) \
        if (filt.get_klass().find("Visualization") >= 0)]
for x in vis_list:
    short = x.get_name()
    name = x.get_longname()
    print (short + "\t\t" + name)
print "END\n"

print "All Available Audio filters\n"
audio_filter_list = [filt for filt in reg.get_feature_list(Gst.ElementFactory) \
        if (filt.get_klass().find("Filter/Effect/Audio") >= 0)]
for x in audio_filter_list:
    short = x.get_name()
    name = x.get_longname()
    print (short + "\t\t" + name)
print "END\n"
于 2015-07-17T13:38:29.020 回答