[英]loading custom gstreamer plugin raises gst.ElementNotFoundError
I'm trying to set GST_PLUGIN_PATH
environment variable before loading custom gstreamer plugin in an integration test, so I need to change GST_PLUGIN_PATH
programmatically. 我正在尝试在集成测试中加载自定义gstreamer插件之前设置
GST_PLUGIN_PATH
环境变量,因此我需要以编程方式更改GST_PLUGIN_PATH
。
But without GST_PLUGIN_PATH
set in shell, gst.element_factory_make
fails. 但是,如果没有在外壳
GST_PLUGIN_PATH
设置gst.element_factory_make
,则gst.element_factory_make
失败。
I'm using gstreamer-0.10, python2.6 and linux 3.2.0 (debian 6). 我正在使用gstreamer-0.10,python2.6和linux 3.2.0(debian 6)。
Example: 例:
import gst, os
os.environ['GST_PLUGIN_PATH'] = '/tmp'
print gst.element_factory_make('myelem')
Without GST_PLUGIN_PATH
set in shell: 在shell中
GST_PLUGIN_PATH
设置GST_PLUGIN_PATH
:
$ export GST_PLUGIN_PATH=
$ ./gstpathtest.py
Traceback (most recent call last):
File "./gstpathtest.py", line 7, in <module>
print gst.element_factory_make('myelem')
gst.ElementNotFoundError: myelem
With GST_PLUGIN_PATH
set in shell: 在外壳中设置了
GST_PLUGIN_PATH
:
$ GST_PLUGIN_PATH=/tmp ./gstpathtest.py
/MyElem:myelem0 (__main__.MyElem)
or with GST_PLUGIN_PATH
exported in shell: 或在外壳中导出
GST_PLUGIN_PATH
:
$ export GST_PLUGIN_PATH=/tmp
$ ./gstpathtest.py
/MyElem:myelem0 (__main__.MyElem)
When run with GST_DEBUG=6
I noticed that myelem
gets created but is immediately unref-ed and destroyed, which is probably the cause of the error. 当以
GST_DEBUG=6
运行时,我注意到myelem
创建,但立即被未引用和破坏,这可能是错误的原因。
I even tried to add the path to os.environ['PATH']
, or directly to sys.path
but it didn't change anything. 我什至尝试将路径添加到
os.environ['PATH']
,或直接添加到sys.path
但没有任何改变。
My main question is: am I doing something wrong on python-level (and what exactly) or does it indicate some bug in the myelem plugin itself? 我的主要问题是:我在python级别上做错了什么(以及究竟是什么),或者它表明myelem插件本身存在一些错误?
噢,愚蠢的我-如果我在导入gst
之前设置了os.environ['GST_PLUGIN_PATH']
,那么一切都会按预期进行。
Also, gst.registry.scan_path
works: 此外,
gst.registry.scan_path
可以工作:
import gst
gst.registry_get_default().scan_path('/tmp')
print gst.element_factory_make('myelem')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.