GStreamer gst_element_factory_make fails

一曲冷凌霜 提交于 2019-11-30 19:24:28

问题


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

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.

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.

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

Remove the MacPorts installation:

sudo port uninstall gstreamer

Add the following line to ~/.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.

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

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

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:

./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.


回答1:


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:

  1. The first argument ('factoryname') is NULL (obviously OK in your code)
  2. The named element factory could not be found (the function gst_element_factory_find returned NULL)
  3. The element instance could not created (the function gst_element_Factory_create returned 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:

gst-inspect oggdemux

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




回答2:


If you are using the ubuntu system just do as follows

sudo apt-get install gstreamer1.0-*

this will solve the problem.



来源:https://stackoverflow.com/questions/1714168/gstreamer-gst-element-factory-make-fails

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!