GStreamer: refactored widget and window control.

Instead of always using xvimagesink as GStreamer backend for the
widget and window control (works only with X11), we now try to
pick a video sink that fits the current configuration.
It first tries a set of known video sinks that can work with
the Qt platform plugin in use. If none is available, it
dynamically picks a video sink available on the system that can be
used with our backend.

Even if the video sink is now picked in a smarter way, xcb is still
the only supported platform plugin. The reason is that it's the
only Unix plugin which can provide a valid native window handle.
Additional work is needed to support other plugins like wayland
or directfb.

Change-Id: I3843dea363d6a0b85a6cc1f2952783b743e48ac6
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
This commit is contained in:
Yoann Lopes
2015-07-23 15:13:24 +02:00
parent 13e40d522f
commit cd3d540522
11 changed files with 713 additions and 452 deletions

View File

@@ -38,6 +38,7 @@
#include "qgstreamervideorendererinterface_p.h"
#include <private/qgstreamerbushelper_p.h>
#include <private/qgstreamervideooverlay_p.h>
QT_BEGIN_NAMESPACE
@@ -52,13 +53,15 @@ class QGstreamerVideoWidgetControl
Q_OBJECT
Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter QGstreamerBusMessageFilter)
public:
QGstreamerVideoWidgetControl(QObject *parent = 0);
explicit QGstreamerVideoWidgetControl(QObject *parent = 0, const QByteArray &elementName = QByteArray());
virtual ~QGstreamerVideoWidgetControl();
GstElement *videoSink();
QWidget *videoWidget();
void stopRenderer();
Qt::AspectRatioMode aspectRatioMode() const;
void setAspectRatioMode(Qt::AspectRatioMode mode);
@@ -77,27 +80,27 @@ public:
int saturation() const;
void setSaturation(int saturation);
void setOverlay();
bool eventFilter(QObject *object, QEvent *event);
bool processSyncMessage(const QGstreamerMessage &message);
bool processBusMessage(const QGstreamerMessage &message);
public slots:
void updateNativeVideoSize();
signals:
void sinkChanged();
void readyChanged(bool);
private Q_SLOTS:
void onOverlayActiveChanged();
void onNativeVideoSizeChanged();
private:
void createVideoWidget();
void windowExposed();
void updateWidgetAttributes();
GstElement *m_videoSink;
bool processSyncMessage(const QGstreamerMessage &message);
bool processBusMessage(const QGstreamerMessage &message);
QGstreamerVideoOverlay m_videoOverlay;
QGstreamerVideoWidget *m_widget;
bool m_stopped;
WId m_windowId;
Qt::AspectRatioMode m_aspectRatioMode;
bool m_fullScreen;
};