一 安装依赖项
1 安装cmake
hdhuang@hdh-UBT:~/gstreamer/qt-gstreamer-0.10.2/build$ sudo apt-get install cmake
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会安装下列额外的软件包:
cmake-data
下列软件包将被升级:
cmake cmake-data
2 glib
查看glib的banb
pkg-config --modversion glib-2.0
2.32.1
3 安装Automoc
hdhuang@hdh-UBT:~/gstreamer/qt-gstreamer-0.10.2/build$ sudo apt-get install automoc
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列【新】软件包将被安装:
automoc
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 702 个软件包未被升级。
4 安装 Qt
sudo apt-get install libqt4-dev libqt4-debug libqt4-gui libqt4-sql qt4-dev-tools qt4-doc qt4-designer qt4-qtconfig
sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos qt4-designer
sudo apt-get install qt4-dev-tools qt4-examples qt4-designer qt4-assistant python-qt4 qt4-demos qt4-qtconfig qt4-linguist
hdhuang@hdh-UBT:~/gstreamer/qt-gstreamer-0.10.2/build$ sudo apt-get install qt4-dev-tools
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会安装下列额外的软件包:
libqt4-dbus libqt4-declarative libqt4-designer libqt4-dev libqt4-help
libqt4-network libqt4-opengl libqt4-qt3support libqt4-script
libqt4-scripttools libqt4-sql libqt4-sql-sqlite libqt4-svg libqt4-test
libqt4-xml libqt4-xmlpatterns libqtcore4 libqtgui4 qdbus qt4-designer
qt4-doc qt4-linguist-tools qt4-qmake
建议安装的软件包:
libqt4-declarative-folderlistmodel libqt4-declarative-gestures
libqt4-declarative-particles libqt4-declarative-shaders qt4-qmlviewer
libmysqlclient-dev libpq-dev libsqlite3-dev unixodbc-dev qt4-qtconfig
qt4-doc-html
推荐安装的软件包:
libqt4-opengl-dev libqtwebkit-dev
下列【新】软件包将被安装:
qt4-designer qt4-dev-tools qt4-doc
下列软件包将被升级:
libqt4-dbus libqt4-declarative libqt4-designer libqt4-dev libqt4-help
libqt4-network libqt4-opengl libqt4-qt3support libqt4-script
libqt4-scripttools libqt4-sql libqt4-sql-sqlite libqt4-svg libqt4-test
libqt4-xml libqt4-xmlpatterns libqtcore4 libqtgui4 qdbus qt4-linguist-tools
qt4-qmake
升级了 21 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 681 个软件包未被升级。
正在设置 libqtcore4 (4:4.8.1-0ubuntu4.4) ...
4.8.1版本,ok
二 编译
mkdir build
cd build
sudo cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/gtstreamer
-----------------------------------------------------------------------------
-- The following REQUIRED packages could NOT be located on your system.
-- You must install these packages before continuing.
-----------------------------------------------------------------------------
* Boost (1.39 or higher)
Required for building QtGLib
* GStreamer (0.10.33 or higher)
Required to build QtGStreamer
* GStreamer app library (0.10.33 or higher)
Required to build QtGStreamerUtils
* GStreamer interfaces library (0.10.33 or higher)
Required to build QtGStreamer
-----------------------------------------------------------------------------
A 安装 boost
sudo apt-get install libboost-dev
sudo cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/gtstreamer
-----------------------------------------------------------------------------
-- The following REQUIRED packages could NOT be located on your system.
-- You must install these packages before continuing.
-----------------------------------------------------------------------------
* GStreamer (0.10.33 or higher)
Required to build QtGStreamer
* GStreamer app library (0.10.33 or higher)
Required to build QtGStreamerUtils
* GStreamer interfaces library (0.10.33 or higher)
Required to build QtGStreamer
2 Gstreamer
为什么说Gstreamer没有安装呢?
只有这个库我是自己安装而没有采用apt-get install 的方法,就是因为这样而找不到这个库。
gedit ~/.branshrc
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
sourc ~/.branshrc
运行命令查看:
pkg-config --libs gstreamer-1.0
-L/usr/local/lib -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0
这样能找到,所以路径配置已经是没有问题了。
pkg-config --libs gstreamer
Package gstreamer was not found in the pkg-config search path.
Perhaps you should add the directory containing `gstreamer.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gstreamer' found
这样是找不到的。
安装文件是安装在usr\lib 下面的。
usr\lib\pkgconfig
目录usr\lib 下面有gstreamer-0.10但是
pkg-config --libs gstreamer-0.10
也是找不到的。
将qt-gstreamer-0.10.2\cmake\modules\的gstreamer的版本改为1.0.
从新编译
checking for module 'gstreamer-interfaces-1.0'
-- package 'gstreamer-interfaces-1.0' not found
* GStreamer interfaces library (0.10.33 or higher)
Required to build QtGStreamer
那个这个gstreamer-interfaces是只那个gstreamer组件呢?应该是我没有安装这个组件导致的。
不清楚是那个组件了!
安装组件gst-plugins-ugly 还是不可以!这个到底是那个组件呢?
网上查找了一下,应该是在gst-plugins-base组件里面的。
应该四0.10的版本有,单色1.0的版本就没有了!
我还算用0.10的版本从新编译一个好了!
1 安装0.10的版本
sudo apt-get install gstreamer0.10
报错:
gstreamer0.10-fluendo-plugins-mp3-partner : 冲突: gstreamer0.10-fluendo-mp3
先卸载它好了:
sudo apt-get remove gstreamer0.10
sudo apt-get install gstreamer0.10
还是不行
下载源代码,编译运行。
2 再次编译看
A sudo cmake .. -sudo cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/qtgtstreamer
-----------------------------------------------------------------------------
-- The following external packages were located on your system.
-- This installation will have the extra features provided by these packages.
-----------------------------------------------------------------------------
* Qt 4 - Required for building everything
* QtDeclarative - Required for building QML support
* Boost - Required for building QtGLib
* GStreamer - Required to build QtGStreamer
* GStreamer base library - Used for building the qwidgetvideosink element
* GStreamer app library - Required to build QtGStreamerUtils
* GStreamer interfaces library - Required to build QtGStreamer
* GStreamer video library - Used for building the qwidgetvideosink element
* GLib - Required to build QtGLib
* GObject - Required to build QtGLib
* OpenGL - Required for OpenGL rendering support in qtvideosink (desktop only)
-----------------------------------------------------------------------------
-- The following OPTIONAL packages could NOT be located on your system.
-- Consider installing them to enable more features from this software.
-----------------------------------------------------------------------------
* QtOpenGL (4.7 or higher)
Required for OpenGL acceleration in qtvideosink and QtGStreamerUi
* OpenGLES (2.0 or higher)
Required for OpenGLES rendering support in qtvideosink (embedded only)
* Doxygen
Used to generate the API documentation
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hdhuang/Gstreamer0.10/qt-gstreamer-0.10.2/build
B sudo make
C sudo make install
3 测试
A
sudo gst-launch-0.10 -v playbin uri=file:///home/hdhuang/realize.ogg
ok可以正常播放。
B examples
要在控制台使用sudo ./player 运行。
可以出声音,但是视频有问题,估计是编译时候渲染出问题了,从新编译一下渲染。
C 安装opengl
sudo apt-get install libqt4-opengl-dev
还是没有图形呢?
4 安装路径有点问题
从新安装一下:
sudo cmake .. -sudo cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/
sudo make
sudo make install