GStreamer gst_element_factory_make失败

时间:2021-09-09 06:04:34

I'm trying out a GStreamer test application, but at runtime the following line fails:

我正在尝试一个GStreamer测试应用程序,但是在运行时,下面的行失败了:

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

I am using MacOSX and installed GStreamer, libogg and vorbis-tools through MacPorts. So I don't see why it fails.

我使用MacOSX,通过MacPorts安装GStreamer, libogg和vorbis工具。所以我不明白为什么会失败。

Any suggestions on how to make it work?

有什么建议吗?

EDIT: SOLVED!

编辑:解决!

The problem was that I needed to install the autodetect plugin from the gst-plugins-good package.

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

Here's a list of actions that made it work:

下面列出了一些让它起作用的行动:

Remove the MacPorts installation:

删除MacPorts安装:

sudo port uninstall gstreamer

sudo港口卸载gstreamer

Add the following line to ~/.profile

添加以下行到~/.profile。

export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig

Download gstreamer, gstreamer-plugins-base and gstreamer-plugins-good sources.

下载gstreamer, gstreamerl -plugins-base和gstreamer-plugins-good sources。

Build and install gstreamer (./configure, make, make install)

构建和安装gstreamer(。/配置,让,让安装)

Build and install gstreamer-plugins-base (./configure, make, make install)

构建和安装gstreamerl -plugin -base(。/配置,让,让安装)

And for gstreamer-plugins-good I only built the autodetect package because building all resulted in errors for some plugins that I don't need or care about now. I did it like this:

对于gstreamerl -plugin -good,我只构建了自动检测包,因为构建所有的结果都会导致一些我现在不需要或不关心的插件的错误。我这样做了:

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

Right now the program builds and runs. I don't seem to be getting any audio output however :( but that's another issue.

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

2 个解决方案

#1


3  

Reading gstelementfactory.c (GStreamer version 0.10.25) line 463 (gst_element_factory_make function definition), there are three errors which cause a NULL return:

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

  1. The first argument ('factoryname') is NULL (obviously OK in your code)
  2. 第一个参数(“factoryname”)为NULL(在代码中显然可以)
  3. The named element factory could not be found (the function gst_element_factory_find returned NULL)
  4. 无法找到命名的元素工厂(函数gst_element_factory_find返回NULL)
  5. The element instance could not created (the function gst_element_Factory_create returned NULL)
  6. 无法创建元素实例(函数gst_element_Factory_create返回NULL)

The code performs substantial logging so if you are able to turn this on then you may get further hints as to the underlying problem.

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

To check that the oggdemux plugin is configured correctly, try running:

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

gst-inspect oggdemux

If this doesn't return a result, try using gst-register to register it.

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

#2


2  

If you are using the ubuntu system just do as follows

如果你正在使用ubuntu系统,请按以下步骤操作。

sudo apt-get install gstreamer1.0-*

sudo apt-get安装gstreamer1.0 - *

this will solve the problem.

这将解决问题。

#1


3  

Reading gstelementfactory.c (GStreamer version 0.10.25) line 463 (gst_element_factory_make function definition), there are three errors which cause a NULL return:

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

  1. The first argument ('factoryname') is NULL (obviously OK in your code)
  2. 第一个参数(“factoryname”)为NULL(在代码中显然可以)
  3. The named element factory could not be found (the function gst_element_factory_find returned NULL)
  4. 无法找到命名的元素工厂(函数gst_element_factory_find返回NULL)
  5. The element instance could not created (the function gst_element_Factory_create returned NULL)
  6. 无法创建元素实例(函数gst_element_Factory_create返回NULL)

The code performs substantial logging so if you are able to turn this on then you may get further hints as to the underlying problem.

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

To check that the oggdemux plugin is configured correctly, try running:

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

gst-inspect oggdemux

If this doesn't return a result, try using gst-register to register it.

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

#2


2  

If you are using the ubuntu system just do as follows

如果你正在使用ubuntu系统,请按以下步骤操作。

sudo apt-get install gstreamer1.0-*

sudo apt-get安装gstreamer1.0 - *

this will solve the problem.

这将解决问题。