gpt4 book ai didi

c++ - GStreamer gst_element_factory_make 失败

转载 作者:太空狗 更新时间:2023-10-29 20:49:06 25 4
gpt4 key购买 nike

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

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

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

关于如何让它发挥作用有什么建议吗?

编辑:已解决!

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

以下是使其发挥作用的操作列表:

删除 MacPorts 安装:

sudo 端口卸载 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

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

最佳答案

阅读gstelementfactory.c (GStreamer version 0.10.25) line 463 (gst_element_factory_make function definition), 有三个错误导致NULL 返回:

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

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

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

gst-inspect oggdemux

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

关于c++ - GStreamer gst_element_factory_make 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1714168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com