我想构建一个audiovisualiser元素列表,以便能够在python程序的下拉列表中提供它们,同样用于音频效果,但是如何访问gstreamer-1.0注册表。
答案 0 :(得分: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"