GStreamer gst_element_factory_make失败
我正在尝试使用GStreamer测试应用程序,但在运行时,以下行失败:
demuxer = gst_element_factory_make ("oggdemux", "ogg-demuxer"); // returns NULL
我正在使用MacOSX并通过MacPorts安装了GStreamer,libogg和vorbis-tools。 所以我不明白它失败的原因。
有关如何使其工作的任何建议?
编辑:解决了!
问题是我需要从gst-plugins-good软件包安装autodetect插件。
以下是使其有效的操作列表:
删除MacPorts安装:
sudo port uninstall gstreamer
将以下行添加到〜/ .profile
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
下载gstreamer,gstreamer-plugins-base和gstreamer-plugins-很好的资源。
构建并安装gstreamer(./configure,make,make install)
构建并安装gstreamer-plugins-base(./configure,make,make install)
对于gstreamer-plugins-good我只构建了自动检测包,因为构建所有这些都导致了一些我现在不需要或不关心的插件的错误。 我是这样做的:
./configure cd gst/autodetect/ make sudo make install
现在该程序构建并运行。 我似乎没有得到任何音频输出:(但这是另一个问题。
阅读gstelementfactory.c
(GStreamer版本0.10.25)第463行( gst_element_factory_make
函数定义),有三个错误导致NULL
返回:
- 第一个参数(’factoryname’)是
NULL
(显然在您的代码中正常) - 找不到指定的元素工厂(函数
gst_element_factory_find
返回NULL
) - 无法创建元素实例(函数
gst_element_Factory_create
返回NULL
)
代码执行大量日志记录,因此如果您能够打开它,那么您可能会获得有关潜在问题的进一步提示。
要检查oggdemux插件是否配置正确,请尝试运行:
gst-inspect oggdemux
如果这不返回结果,请尝试使用gst-register
进行注册。
如果您使用的是ubuntu系统,请执行以下操作
sudo apt-get install gstreamer1.0- *
这样可以解决问题。