QtGstreamer 編譯


一  安裝依賴項
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)  <http://www.boost.org/>
     Required for building QtGLib
   * GStreamer (0.10.33 or higher)  <http://gstreamer.freedesktop.org/>
     Required to build QtGStreamer
   * GStreamer app library (0.10.33 or higher)  <http://gstreamer.freedesktop.org/>
     Required to build QtGStreamerUtils
   * GStreamer interfaces library (0.10.33 or higher)  <http://gstreamer.freedesktop.org/>
     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)  <http://gstreamer.freedesktop.org/>
     Required to build QtGStreamer
   * GStreamer app library (0.10.33 or higher)  <http://gstreamer.freedesktop.org/>
     Required to build QtGStreamerUtils
   * GStreamer interfaces library (0.10.33 or higher)  <http://gstreamer.freedesktop.org/>
     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)  <http://gstreamer.freedesktop.org/>
     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)  <http://qt.nokia.com/>
     Required for OpenGL acceleration in qtvideosink and QtGStreamerUi
   * OpenGLES (2.0 or higher)  <http://www.opengl.org>
     Required for OpenGLES rendering support in qtvideosink (embedded only)
   * Doxygen  <http://www.doxygen.org/>
     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 測試

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

 

rm -rf build

mkdir build

 cmake .. -DCMAKE_INSTALL_PREFIX=/opt/EmbedSky/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/tq-linaro-toolchain/ -DCMAKE_BUILD_TYPE=Release -DQT_VERSION=5
make

make install

 

 

//CMakeLists.txt

 

SET(CMAKE_SYSTEM_NAME Linux)
SET(TOOLCHAIN_DIR "/opt/EmbedSky/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/tq-linaro-toolchain")
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_DIR})
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

SET(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/bin/arm-fsl-linux-gnueabi-gcc)
SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/bin/arm-fsl-linux-gnueabi-g++)
SET(CMAKE_LIBRARY_PATH "/opt/EmbedSky/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/tq-linaro-toolchain/lib")
SET(CMAKE_PREFIX_PATH ${TOOLCHAIN_DIR}/qt-5.2.1-embedded-arm-MuliTCS/lib/cmake)
SET(CMAKE_INCLUDE_PATH ${TOOLCHAIN_DIR}/include)
SET(Boost_INCLUDE_DIR "/opt/data/E9_CD/fsl/boost_1_50_0")
SET(OPENGL_gl_LIBRARY "/opt/EmbedSky/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/tq-linaro-toolchain/lib")

project(QtGStreamer)
cmake_minimum_required(VERSION 2.8.9)
enable_testing()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)

set(QTGSTREAMER_VERSION 0.10.3)

LINK_DIRECTORIES(/opt/EmbedSky/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/tq-linaro-toolchain/lib)


option(QTGSTREAMER_STATIC "Build QtGStreamer as a static library" OFF)
option(QTGSTREAMER_TESTS "Build QtGStreamer's tests" OFF)
option(QTGSTREAMER_EXAMPLES "Build QtGStreamer's examples" ON)
option(QTGSTREAMER_CODEGEN "Build and use QtGStreamer's codegen" OFF)
option(USE_GST_PLUGIN_DIR "Install gstreamer plugins at the system location" ON)
option(USE_QT_PLUGIN_DIR "Install qt plugins at the system location" ON)

include(GNUInstallDirs)
include(MacroLogFeature)

set(Qt4_MIN_VERSION 4.7)
set(Qt5_MIN_VERSION 5.0.0)
find_package(Qt4or5 COMPONENTS Core Gui Widgets OPTIONAL_COMPONENTS OpenGL Quick1 Test)
macro_log_feature(Qt4or5_FOUND "Qt" "Required for building everything"
                               "http://qt-project.org/" TRUE "${Qt4or5_MIN_VERSION}")
macro_log_feature(Qt4or5_OpenGL_FOUND "QtOpenGL"
                                "Required for OpenGL acceleration in qtvideosink and QtGStreamerUi"
                                "http://qt-project.org/" FALSE "${Qt4or5_MIN_VERSION}")
macro_log_feature(Qt4or5_Quick1_FOUND "QtQuick1 (QtDeclarative)"
                                "Required for building QtQuick1 support"
                                "http://qt-project.org/" FALSE "${Qt4or5_MIN_VERSION}")

if (QTGSTREAMER_TESTS)
    macro_log_feature(Qt4or5_Test_FOUND "QtTest" "Required for building unit tests"
                                      "http://qt-project.org/" FALSE "${Qt4or5_MIN_VERSION}")
    if (NOT Qt4or5_Test_FOUND)
        set(QTGSTREAMER_TESTS OFF)
    endif()
endif()

find_package(Boost 1.39)
macro_log_feature(Boost_FOUND "Boost" "Required for building QtGLib" "http://www.boost.org/" TRUE "1.39")

# set the QTGSTREAMER_* cmake variables
set(BUILDING_QTGSTREAMER TRUE)
if (${QT_VERSION} STREQUAL "5")
    set(USE_QT5 TRUE)
    set(QTGLIB_LIBRARY Qt5GLib)
    set(QTGSTREAMER_LIBRARY Qt5GStreamer)
    set(QTGSTREAMER_UI_LIBRARY Qt5GStreamerUi)
    set(QTGSTREAMER_UTILS_LIBRARY Qt5GStreamerUtils)
    set(QTGSTREAMER_PACKAGE_NAME Qt5GStreamer)
    set(QTVIDEOSINK_NAME qt5videosink)
    set(QTGLVIDEOSINK_NAME qt5glvideosink)
    set(QWIDGETVIDEOSINK_NAME qwidget5videosink)
elseif (${QT_VERSION} STREQUAL "4")
    set(USE_QT4 TRUE)
    set(QTGLIB_LIBRARY QtGLib)
    set(QTGSTREAMER_LIBRARY QtGStreamer)
    set(QTGSTREAMER_UI_LIBRARY QtGStreamerUi)
    set(QTGSTREAMER_UTILS_LIBRARY QtGStreamerUtils)
    set(QTGSTREAMER_PACKAGE_NAME QtGStreamer)
    set(QTVIDEOSINK_NAME qtvideosink)
    set(QTGLVIDEOSINK_NAME qtglvideosink)
    set(QWIDGETVIDEOSINK_NAME qwidgetvideosink)
endif()
set(QTGSTREAMER_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src)
include(QtGStreamerConfigCommon)

find_package(GStreamer 0.10.33 COMPONENTS base)
macro_log_feature(GSTREAMER_FOUND "GStreamer" "Required to build QtGStreamer"
                                  "http://gstreamer.freedesktop.org/" TRUE "0.10.33")
macro_log_feature(GSTREAMER_BASE_LIBRARY_FOUND "GStreamer base library"
                                               "Used for building the ${QTVIDEOSINK_NAME} element"
                                               "http://gstreamer.freedesktop.org/" FALSE "0.10.33")

find_package(GStreamerPluginsBase 0.10.36 COMPONENTS app interfaces video pbutils)
macro_log_feature(GSTREAMER_APP_LIBRARY_FOUND "GStreamer app library"
                                              "Required to build QtGStreamerUtils"
                                              "http://gstreamer.freedesktop.org/" TRUE "0.10.33")
macro_log_feature(GSTREAMER_INTERFACES_LIBRARY_FOUND "GStreamer interfaces library"
                                                "Required to build QtGStreamer"
                                                "http://gstreamer.freedesktop.org/" TRUE "0.10.33")
macro_log_feature(GSTREAMER_VIDEO_LIBRARY_FOUND "GStreamer video library"
                                                "Used for building the ${QTVIDEOSINK_NAME} element"
                                                "http://gstreamer.freedesktop.org/" FALSE "0.10.33")
macro_log_feature(GSTREAMER_PBUTILS_LIBRARY_FOUND "GStreamer pbutils library"
                                                "Used for building the Discoverer API"
                                                "http://gstreamer.freedesktop.org/" TRUE "0.10.36")

find_package(GLIB2)
macro_log_feature(GLIB2_FOUND "GLib" "Required to build QtGLib" "http://www.gtk.org/" TRUE)

find_package(GObject)
macro_log_feature(GOBJECT_FOUND "GObject" "Required to build QtGLib" "http://www.gtk.org/" TRUE)

set(CMAKE_REQUIRED_INCLUDES ${QTGSTREAMER_INCLUDES})
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <QtCore/QtGlobal>
#if !defined(QT_OPENGL_ES)
#error \"No OpenGLES\"
#endif
int main() {}
" USE_OPENGLES)

if (USE_OPENGLES)
    find_package(OpenGLES2)
    macro_log_feature(OPENGLES2_FOUND "OpenGLES"
                          "Required for OpenGLES rendering support in ${QTVIDEOSINK_NAME}"
                          "http://www.opengl.org" FALSE "2.0")
else()
    find_package(OpenGL)
    macro_log_feature(OPENGL_FOUND "OpenGL"
                          "Required for OpenGL rendering support in ${QTVIDEOSINK_NAME}"
                          "http://www.opengl.org" FALSE)
endif()

if (QTGSTREAMER_CODEGEN AND CMAKE_CROSSCOMPILING)
    message(WARNING "Codegen use requested, but we are crosscompiling. Disabling...")
    set(QTGSTREAMER_CODEGEN OFF)
endif()

if (QTGSTREAMER_CODEGEN)
    find_package(FLEX)
    macro_log_feature(FLEX_FOUND "Flex" "Required to build codegen, a helper code generator"
                                 "http://flex.sourceforge.net/" TRUE)

    find_package(BISON)
    macro_log_feature(BISON_FOUND "Bison" "Required to build codegen, a helper code generator"
                                  "http://www.gnu.org/software/bison/" TRUE)
endif()


if (CMAKE_COMPILER_IS_GNUCXX)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat-security -Wundef -Wpointer-arith -fno-common")
endif ()


set(QTGSTREAMER_INSTALL_TARGET_DEFAULT_ARGS
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
set(QTGSTREAMER_PC_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
set(QTGSTREAMER_CMAKE_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${QTGSTREAMER_PACKAGE_NAME})
set(QTGSTREAMER_INCLUDES_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/${QTGSTREAMER_PACKAGE_NAME})

if (USE_GST_PLUGIN_DIR)
    set(QTGSTREAMER_GST_PLUGINS_INSTALL_DIR ${GSTREAMER_PLUGIN_DIR})
else()
    set(QTGSTREAMER_GST_PLUGINS_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/gstreamer-0.10)
endif()

if (USE_QT_PLUGIN_DIR)
    set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${QT_IMPORTS_DIR})
else()
    if (USE_QT5)
        set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/qt5/imports)
    else()
        set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/qt4/imports)
    endif()
endif()


if (QTGSTREAMER_CODEGEN AND FLEX_FOUND AND BISON_FOUND)
    add_subdirectory(codegen)
endif()

add_subdirectory(src)
add_subdirectory(elements)

if (QTGSTREAMER_TESTS)
    add_subdirectory(tests)
endif()

if (QTGSTREAMER_EXAMPLES)
    add_subdirectory(examples)
endif()

# Add uninstall target. Taken from the KDE4 scripts
configure_file("${CMAKE_SOURCE_DIR}/cmake/modules/cmake_uninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" @ONLY)
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")

# Add doc target
include(UseDoxygen)
macro_log_feature(DOXYGEN_FOUND "Doxygen" "Used to generate the API documentation"
                                "http://www.doxygen.org/" FALSE)

macro_display_feature_log()

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM