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.
But without GST_PLUGIN_PATH
set in shell, gst.element_factory_make
fails.
I'm using gstreamer-0.10, python2.6 and 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:
$ 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=/tmp ./gstpathtest.py
/MyElem:myelem0 (__main__.MyElem)
or with GST_PLUGIN_PATH
exported in shell:
$ 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.
I even tried to add the path to os.environ['PATH']
, or directly to sys.path
but it didn't change anything.
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?
噢,愚蠢的我-如果我在导入gst
之前设置了os.environ['GST_PLUGIN_PATH']
,那么一切都会按预期进行。
Also, gst.registry.scan_path
works:
import gst
gst.registry_get_default().scan_path('/tmp')
print gst.element_factory_make('myelem')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.