Merge remote-tracking branch 'origin/5.4' into 5.5

Conflicts:
	qtmultimedia.pro
	src/gsttools/qgstreamervideowidget.cpp
	src/plugins/gstreamer/camerabin/camerabinservice.cpp

Change-Id: I883f20dc17924ab42514a1aa00d16675a0f13d99
This commit is contained in:
Frederik Gladhorn
2015-02-24 17:38:46 +01:00
8 changed files with 70 additions and 27 deletions

View File

@@ -15,8 +15,8 @@ win32 {
} else:qnx { } else:qnx {
qtCompileTest(mmrenderer) qtCompileTest(mmrenderer)
} else { } else {
qtCompileTest(alsa) contains(QT_CONFIG, alsa):qtCompileTest(alsa)
qtCompileTest(pulseaudio) contains(QT_CONFIG, pulseaudio):qtCompileTest(pulseaudio)
isEmpty(GST_VERSION) { isEmpty(GST_VERSION) {
contains(QT_CONFIG, gstreamer-0.10) { contains(QT_CONFIG, gstreamer-0.10) {

View File

@@ -98,6 +98,22 @@ QGstreamerVideoWidgetControl::QGstreamerVideoWidgetControl(QObject *parent)
, m_widget(0) , m_widget(0)
, m_fullScreen(false) , m_fullScreen(false)
{ {
m_videoSink = gst_element_factory_make ("xvimagesink", NULL);
if (!m_videoSink)
m_videoSink = gst_element_factory_make ("ximagesink", NULL);
if (m_videoSink) {
// Check if the xv sink is usable
if (gst_element_set_state(m_videoSink, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) {
gst_object_unref(GST_OBJECT(m_videoSink));
m_videoSink = 0;
} else {
gst_element_set_state(m_videoSink, GST_STATE_NULL);
g_object_set(G_OBJECT(m_videoSink), "force-aspect-ratio", 1, (const char*)NULL);
qt_gst_object_ref_sink(GST_OBJECT (m_videoSink)); //Take ownership
}
}
} }
QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl() QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl()
@@ -110,36 +126,17 @@ QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl()
void QGstreamerVideoWidgetControl::createVideoWidget() void QGstreamerVideoWidgetControl::createVideoWidget()
{ {
if (m_widget) if (!m_videoSink || m_widget)
return; return;
m_widget = new QGstreamerVideoWidget; m_widget = new QGstreamerVideoWidget;
m_widget->installEventFilter(this); m_widget->installEventFilter(this);
m_windowId = m_widget->winId(); m_windowId = m_widget->winId();
m_videoSink = gst_element_factory_make ("xvimagesink", NULL);
if (m_videoSink) {
// Check if the xv sink is usable
if (gst_element_set_state(m_videoSink, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) {
gst_object_unref(GST_OBJECT(m_videoSink));
m_videoSink = 0;
} else {
gst_element_set_state(m_videoSink, GST_STATE_NULL);
g_object_set(G_OBJECT(m_videoSink), "force-aspect-ratio", 1, (const char*)NULL);
}
}
if (!m_videoSink)
m_videoSink = gst_element_factory_make ("ximagesink", NULL);
qt_gst_object_ref_sink(GST_OBJECT (m_videoSink)); //Take ownership
} }
GstElement *QGstreamerVideoWidgetControl::videoSink() GstElement *QGstreamerVideoWidgetControl::videoSink()
{ {
createVideoWidget();
return m_videoSink; return m_videoSink;
} }

View File

@@ -124,8 +124,22 @@ CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *pa
#else #else
m_videoWindow = new QGstreamerVideoWindow(this); m_videoWindow = new QGstreamerVideoWindow(this);
#endif #endif
// If the GStreamer sink element is not available (xvimagesink), don't provide
// the video window control since it won't work anyway.
if (!m_videoWindow->videoSink()) {
delete m_videoWindow;
m_videoWindow = 0;
}
#if defined(HAVE_WIDGETS) #if defined(HAVE_WIDGETS)
m_videoWidgetControl = new QGstreamerVideoWidgetControl(this); m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
// If the GStreamer sink element is not available (xvimagesink or ximagesink), don't provide
// the video widget control since it won't work anyway.
// QVideoWidget will fall back to QVideoRendererControl in that case.
if (!m_videoWidgetControl->videoSink()) {
delete m_videoWidgetControl;
m_videoWidgetControl = 0;
}
#endif #endif
m_audioInputSelector = new QGstreamerAudioInputSelector(this); m_audioInputSelector = new QGstreamerAudioInputSelector(this);

View File

@@ -48,6 +48,7 @@ class CameraBinControl;
class QGstreamerMessage; class QGstreamerMessage;
class QGstreamerBusHelper; class QGstreamerBusHelper;
class QGstreamerVideoRenderer; class QGstreamerVideoRenderer;
class QGstreamerVideoWindow;
class QGstreamerVideoWidgetControl; class QGstreamerVideoWidgetControl;
class QGstreamerElementFactory; class QGstreamerElementFactory;
class CameraBinMetaData; class CameraBinMetaData;
@@ -81,7 +82,7 @@ private:
QMediaControl *m_videoOutput; QMediaControl *m_videoOutput;
QMediaControl *m_videoRenderer; QMediaControl *m_videoRenderer;
QMediaControl *m_videoWindow; QGstreamerVideoWindow *m_videoWindow;
#if defined(HAVE_WIDGETS) #if defined(HAVE_WIDGETS)
QGstreamerVideoWidgetControl *m_videoWidgetControl; QGstreamerVideoWidgetControl *m_videoWidgetControl;
#endif #endif

View File

@@ -100,10 +100,25 @@ QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObje
m_videoInput->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice())); m_videoInput->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice()));
m_videoRenderer = new QGstreamerVideoRenderer(this); m_videoRenderer = new QGstreamerVideoRenderer(this);
m_videoWindow = new QGstreamerVideoWindow(this); m_videoWindow = new QGstreamerVideoWindow(this);
// If the GStreamer sink element is not available (xvimagesink), don't provide
// the video window control since it won't work anyway.
if (!m_videoWindow->videoSink()) {
delete m_videoWindow;
m_videoWindow = 0;
}
#if defined(HAVE_WIDGETS) #if defined(HAVE_WIDGETS)
m_videoWidgetControl = new QGstreamerVideoWidgetControl(this); m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
// If the GStreamer sink element is not available (xvimagesink or ximagesink), don't provide
// the video widget control since it won't work anyway.
// QVideoWidget will fall back to QVideoRendererControl in that case.
if (!m_videoWidgetControl->videoSink()) {
delete m_videoWidgetControl;
m_videoWidgetControl = 0;
}
#endif #endif
m_imageCaptureControl = new QGstreamerImageCaptureControl(m_captureSession); m_imageCaptureControl = new QGstreamerImageCaptureControl(m_captureSession);
} }

View File

@@ -49,6 +49,7 @@ class QGstreamerCameraControl;
class QGstreamerMessage; class QGstreamerMessage;
class QGstreamerBusHelper; class QGstreamerBusHelper;
class QGstreamerVideoRenderer; class QGstreamerVideoRenderer;
class QGstreamerVideoWindow;
class QGstreamerVideoWidgetControl; class QGstreamerVideoWidgetControl;
class QGstreamerElementFactory; class QGstreamerElementFactory;
class QGstreamerCaptureMetaDataControl; class QGstreamerCaptureMetaDataControl;
@@ -82,9 +83,9 @@ private:
QMediaControl *m_videoOutput; QMediaControl *m_videoOutput;
QGstreamerVideoRenderer *m_videoRenderer; QGstreamerVideoRenderer *m_videoRenderer;
QMediaControl *m_videoWindow; QGstreamerVideoWindow *m_videoWindow;
#if defined(HAVE_WIDGETS) #if defined(HAVE_WIDGETS)
QMediaControl *m_videoWidgetControl; QGstreamerVideoWidgetControl *m_videoWidgetControl;
#endif #endif
QGstreamerImageCaptureControl *m_imageCaptureControl; QGstreamerImageCaptureControl *m_imageCaptureControl;

View File

@@ -99,9 +99,23 @@ QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent):
#else #else
m_videoWindow = new QGstreamerVideoWindow(this); m_videoWindow = new QGstreamerVideoWindow(this);
#endif #endif
// If the GStreamer sink element is not available (xvimagesink), don't provide
// the video window control since it won't work anyway.
if (!m_videoWindow->videoSink()) {
delete m_videoWindow;
m_videoWindow = 0;
}
#if defined(HAVE_WIDGETS) #if defined(HAVE_WIDGETS)
m_videoWidget = new QGstreamerVideoWidgetControl(this); m_videoWidget = new QGstreamerVideoWidgetControl(this);
// If the GStreamer sink element is not available (xvimagesink or ximagesink), don't provide
// the video widget control since it won't work anyway.
// QVideoWidget will fall back to QVideoRendererControl in that case.
if (!m_videoWidget->videoSink()) {
delete m_videoWidget;
m_videoWidget = 0;
}
#endif #endif
} }

View File

@@ -50,6 +50,7 @@ class QGstreamerPlayerSession;
class QGstreamerMetaDataProvider; class QGstreamerMetaDataProvider;
class QGstreamerStreamsControl; class QGstreamerStreamsControl;
class QGstreamerVideoRenderer; class QGstreamerVideoRenderer;
class QGstreamerVideoWindow;
class QGstreamerVideoWidgetControl; class QGstreamerVideoWidgetControl;
class QGStreamerAvailabilityControl; class QGStreamerAvailabilityControl;
class QGstreamerAudioProbeControl; class QGstreamerAudioProbeControl;
@@ -77,9 +78,9 @@ private:
QMediaControl *m_videoOutput; QMediaControl *m_videoOutput;
QMediaControl *m_videoRenderer; QMediaControl *m_videoRenderer;
QMediaControl *m_videoWindow; QGstreamerVideoWindow *m_videoWindow;
#if defined(HAVE_WIDGETS) #if defined(HAVE_WIDGETS)
QMediaControl *m_videoWidget; QGstreamerVideoWidgetControl *m_videoWidget;
#endif #endif
void increaseVideoRef(); void increaseVideoRef();