Skip to content

blacksoul000/qt-gstreamer

 
 

Repository files navigation

0. Maintenance Notice
---------------------

This code is unmaintained. You can use it at your own risk.

If you want to integrate video display in your QML-based UI,
you should consider using 'qmlglsink', from gst-plugins-good.
This is a well supported video sink that uses the generic
gstreamer-gl stack and is in many ways superior to 'qtquick2videosink'
that is provided by qt-gstreamer. You can use this code as an example:
https://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/qt/qmlsink

If you are not interested in using QML in your UI, then you
may use one of the other elements provided by this module
(see below). If you do that, it would be helpful to let us
know that this code is still useful to you. We may consider
adding these elements in one of the core gstreamer modules.

If you are here for the Qt-style bindings, I'm sorry to disappoint you.
The alternative is to use the C API, or the GStreamermm C++ API.
Qt-style bindings are cool, but unfortunately they are very hard
to maintain because they are written by hand. If you are interested
in continuing this project, you are welcome to implement a
generator for them, probably based on GObject-Introspection.
I am happy to provide directions if you want to pursue such a thing.


1. About
--------

QtGStreamer is a set of libraries and plugins providing C++ bindings for
GStreamer [1] with a Qt-style API plus some helper classes for integrating
GStreamer better in Qt [2] applications.

Currently, it consists of the following parts:
 * QtGLib           - Library providing C++/Qt bindings for parts of the GLib
                      and GObject APIs, a base on which QtGStreamer is built.
 * QtGStreamer      - Library providing C++/Qt bindings for GStreamer
 * QtGStreamerUi    - Library providing integration with QtWidgets. Currently,
                      it only provides a video widget that embeds GStreamer's
                      video sinks.
 * QtGStreamerUtils - Library providing some high level utility classes.
 * QtGStreamerQuick - Library providing integration with QtQuick (Qt5 only).

In addition, it provides GStreamer elements for painting video on Qt surfaces:
 * qwidgetvideosink  - For painting on QWidgets
 * qtvideosink       - For painting on any surface with QPainter
 * qtglvideosink     - For painting on any surface with QPainter and OpenGL
 * qtquick2videosink - For painting on QtQuick2 surfaces (Qt5 only)

[1]. http://gstreamer.freedesktop.org/
[2]. http://qt-project.org/

2. Building
-----------

2.1 Dependencies
----------------

QtGStreamer requires the following software to be installed in order to build:
 * CMake 2.8.9 or later <http://www.cmake.org/>
 * GStreamer 1.0.0 or later <http://gstreamer.freedesktop.org/>
   With its dependencies:
   - Glib / GObject <http://www.gtk.org/>
   and including gstreamer-plugins-base (1.0.0 or later)
 * Qt4 or Qt5 (4.7 or later / 5.0 or later) <http://qt-project.org/>
 * Boost 1.39 or later <http://www.boost.org/>
 * Flex (only if QTGSTREAMER_CODEGEN=ON, see below) <http://flex.sourceforge.net/>
 * Bison (only if QTGSTREAMER_CODEGEN=ON, see below) <http://www.gnu.org/software/bison/>

In addition, if gcc is used as the compiler, libstdc++ version 4.5 or later is
required at runtime. This is due to a bug in earlier versions of libstdc++ that
sometimes makes dynamic_cast fail under conditions where it should not.

2.2 Compiler
------------

Note: This paragraph is outdated. It was written at a time where C++11 support
was not very widespread among compilers. Nowadays, any C++11 capable compiler
should work fine.

A decent compiler with proper support for advanced templates, including features
such as partial template specialization, is required. QtGStreamer can also make
use of C++0x features (see below for details). A compiler supporting at least
some of them is recommended. Currently, only the GNU C++ compiler (g++) version
4.5 or later is known to support all the features that QtGStreamer uses. However,
other compilers can be used too, but with some limitations.

C++0x features in use:
 * static_assert(). Used to show nice error messages when the programmer is trying
   to use some template in the wrong way. If not present, the templates will still
   fail to compile if used in the wrong way, but the error messages may be quite
   weird to understand...
 * Variadic templates together with rvalue references. Used to support connecting
   and emitting GObject signals with any number of arguments. If not available, a
   hack-ish implementation using boost's preprocessor library, boost::function and
   boost::bind is used to provide support for up to 9 arguments.

2.3 Procedure
-------------

The build procedure is simple:

$ mkdir build && cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/installation/prefix
$ make
$ make install

Other options that can be passed to cmake include:

* -DCMAKE_BUILD_TYPE=[Debug|Release|RelWithDebInfo|MinSizeRel]
  Allows you to specify the type of the build. This is a standard
  cmake option, see the cmake man page for details.

* -DQT_VERSION=[4|5]
  Allows you to specify the Qt version that you want to build against.
  The default is 4.

* -DQTGSTREAMER_STATIC=[ON|OFF]
  Allows you to choose whether to build static or dynamic libraries.
  ON means static, OFF means dynamic.

* -DQTGSTREAMER_EXAMPLES=[ON|OFF]
  Allows you to choose whether to build the examples shipped with QtGStreamer or not.
  Note that the examples can also be built independently outside the source tree.

* -DQTGSTREAMER_TESTS=[ON|OFF]
  Allows you to choose whether to build tests or not.

* -DQTGSTREAMER_CODEGEN=[ON|OFF]
  Allows you to choose whether to build and use the QtGStreamer code generator or not.
  This code generator generates some extra code based on the QtGlib/QtGStreamer
  headers. This extra code is required, but it is also shipped in the source tree,
  so it is not necessary to regenerate it, unless you are developing QtGStreamer and
  you are making changes to the headers. If you are crosscompiling, you should make
  sure to turn this feature off, since this will compile codegen for the target
  architecture and then try to run it, which will fail.

* -DUSE_GST_PLUGIN_DIR=[ON|OFF]
  Allows you to choose whether to install plugin together with the rest of the
  gstreamer plugins or whether to install them in the same prefix as QtGStreamer.
  You will probably want to set this to OFF if you are installing in a prefix
  different than GStreamer (say somewhere in $HOME) while GStreamer is installed
  in a system location and you don't want to gain root privileges to do "make install".

* -DUSE_QT_PLUGIN_DIR=[ON|OFF]
  Same as USE_GST_PLUGIN_DIR, but for Qt (QML) plugins.

* -DGST_PACKAGE_NAME="some string"
  Allows you to specify the name that gst-inspect will show as the "Binary package"
  name for all the element plugins that are build from this source package.

* -DGST_PACKAGE_ORIGIN="http://some.url"
  Allows you to specify the url that gst-inspect will show as the "Origin URL"
  for all the element plugins that are build from this source package.

2.4 Parallel installation
-------------------------

QtGStreamer can be built both with Qt4 and Qt5. Installing both versions in
parallel is possible, since all the libraries, directories and plugins are
named differently.

Parallel installation is also possible, to a certain extent, between the
GStreamer-0.10 based version and the GStreamer-1.0 based version. The libraries
and the GStreamer plugins are co-installable, however the QML plugins as well
as the headers are NOT.

2.5 Generating documentation
----------------------------

QtGStreamer uses doxygen for documentation. To generate the documentation you need
to install doxygen and run "make doc" after you have run cmake. This will generate
the documentation in <builddir>/doc/html/.

2.6 Running tests
-----------------

QtGStreamer comes with a suite of automatic unit tests that ensure QtGStreamer
is working properly. To run them you will need ctest, a tool that comes with cmake,
plus some gstreamer plugins from the base and good sets.

To run them, simply invoke "make test" or "ctest" in the build directory.
For advanced usage, refer to the ctest manual page.

2.7 Checking build system integrity
-----------------------------------

In order to check if the installed build system files (QtGStreamerConfig.cmake,
pkg-config files, etc) are correct and usable externally, you can run:

$ make examples_distcheck

This checks compilation of the examples with both cmake and qmake.

Note that you should also set your environment accordingly for cmake and qmake
to be able to find QtGStreamer. For example, on my debian system where I have
installed the Qt5 version of QtGStreamer in /home/gkiagia/install, I would
have to do:

$ export QT_SELECT=5            # for debian's qmake wrapper to work with Qt5
$ export PKG_CONFIG_PATH=/home/gkiagia/install/lib/x86_64-linux-gnu/pkgconfig/
$ export CMAKE_PREFIX_PATH=/home/gkiagia/install/
$ make examples_distcheck

3. Links & Contact information
------------------------------

Web:
    http://gstreamer.freedesktop.net
    http://gstreamer.freedesktop.org/wiki/QtGStreamer

Mailing list:
    mailto:[email protected]

Irc channels:
    irc://irc.freenode.net/gstreamer

Git repository:
    http://cgit.freedesktop.org/gstreamer/qt-gstreamer/

Bugs, feature requests & patches should be sent at:
    https://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer&component=qt-gstreamer
  **Note**: This component has been closed as of May 5, 2018.
            See the maintenance notice at the top of this file

--
George Kiagiadakis <[email protected]>
Last updated: May 5, 2018

About

Qt bindings for GStreamer

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 81.6%
  • CMake 16.8%
  • C 0.6%
  • Yacc 0.4%
  • Lex 0.4%
  • Shell 0.2%