【问题标题】:GStreamer gst_element_factory_make failsGStreamer gst_element_factory_make 失败
【发布时间】:2009-11-11 09:55:50
【问题描述】:

我正在试用 GStreamer 测试应用程序,但在运行时以下行失败:

demuxer = gst_element_factory_make ("oggdemux", "ogg-demuxer"); // returns NULL

我使用 MacOSX 并通过 MacPorts 安装了 GStreamer、libogg 和 vorbis-tools。所以我不明白为什么它会失败。

关于如何使它工作的任何建议?

编辑:已解决!

问题是我需要从 gst-plugins-good 包中安装自动检测插件。

以下是使它起作用的操作列表:

删除 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-good 源代码。

构建和安装 gstreamer(./configure、make、make install)

构建和安装 gstreamer-plugins-base(./configure、make、make install)

对于 gstreamer-plugins-good,我只构建了 autodetect 包,因为构建所有这些都会导致一些我现在不需要或不关心的插件出现错误。我是这样做的:

./configure
cd gst/autodetect/
make
sudo make install

现在程序构建并运行。但是,我似乎没有得到任何音频输出 :( 但这是另一个问题。

【问题讨论】:

  • 您是否尝试过将NULL 作为第二个参数传递(它应该为您生成一个唯一的名称)?
  • @Matthew Murdoch:刚刚试过,但函数仍然返回 NULL...

标签: c++ c gstreamer


【解决方案1】:

读取gstelementfactory.c(GStreamer 版本0.10.25)第463行(gst_element_factory_make函数定义),有三个错误导致NULL返回:

  1. 第一个参数('factoryname')是NULL(在您的代码中显然可以)
  2. 找不到命名元素工厂(函数gst_element_factory_find返回NULL
  3. 无法创建元素实例(函数gst_element_Factory_create返回NULL

代码执行大量日志记录,因此如果您能够打开它,那么您可能会获得有关潜在问题的进一步提示。

要检查 oggdemux 插件是否配置正确,请尝试运行:

gst-inspect oggdemux

如果这没有返回结果,请尝试使用gst-register 注册它。

【讨论】:

  • gst-inspect oggdemux => 没有这样的元素或插件'oggdemux'。我怎样才能安装这个插件?在文档中,我可以找到现有插件的概述,但我没有找到任何有关如何获取它们的说明...
  • 好的,我想我知道发生了什么。 MacPorts 可能没有同时安装 ogg 支持。 gstreamer.org/data/doc/gstreamer/head/faq/html/…
【解决方案2】:

如果您使用的是ubuntu系统,请按照以下方式操作

sudo apt-get install gstreamer1.0-*

这将解决问题。

【讨论】:

    猜你喜欢
    • 2015-04-13
    • 1970-01-01
    • 2019-11-04
    • 1970-01-01
    • 2019-01-09
    • 1970-01-01
    • 1970-01-01
    • 2018-07-16
    • 1970-01-01
    相关资源
    最近更新 更多