summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-01-04 21:40:02 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-01-04 21:40:02 +0100
commit34d15785600f98faa4a51827b452d6c488e4c10c (patch)
treee4dd1b11602f0b13bedd895df254a69fa9187fc0 /src
parent46b10ce610cfa3957ed4be719b9a7f3f1f39dcf0 (diff)
parent8c26502e386e76fa7db6ce8c4d073e9dabf00b44 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'src')
-rw-r--r--src/gsttools/qgstreamerplayercontrol.cpp1
-rw-r--r--src/gsttools/qgstutils.cpp7
-rw-r--r--src/multimediawidgets/qvideowidget.cpp18
-rw-r--r--src/multimediawidgets/qvideowidget.h3
-rw-r--r--src/plugins/common/evr/evrcustompresenter.cpp4
-rw-r--r--src/plugins/common/evr/evrvideowindowcontrol.cpp3
-rw-r--r--src/plugins/directshow/camera/dscamerasession.cpp72
-rw-r--r--src/plugins/directshow/camera/dscamerasession.h3
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.cpp1
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h2
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturedestination.h2
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinexposure.h2
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinflash.h2
-rw-r--r--src/plugins/wmf/player/mfmetadatacontrol.cpp2
14 files changed, 76 insertions, 46 deletions
diff --git a/src/gsttools/qgstreamerplayercontrol.cpp b/src/gsttools/qgstreamerplayercontrol.cpp
index 053e5e408..73f43f0b9 100644
--- a/src/gsttools/qgstreamerplayercontrol.cpp
+++ b/src/gsttools/qgstreamerplayercontrol.cpp
@@ -52,7 +52,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <unistd.h>
//#define DEBUG_PLAYBIN
diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp
index ab037d959..6960ff8f4 100644
--- a/src/gsttools/qgstutils.cpp
+++ b/src/gsttools/qgstutils.cpp
@@ -1308,7 +1308,8 @@ void QGstUtils::setMetaData(GstBin *bin, const QMap<QByteArray, QVariant> &data)
GstCaps *QGstUtils::videoFilterCaps()
{
- static GstStaticCaps staticCaps = GST_STATIC_CAPS(
+ static GstStaticCaps staticCaps = {
+ NULL,
#if GST_CHECK_VERSION(1,2,0)
"video/x-raw(ANY);"
#elif GST_CHECK_VERSION(1,0,0)
@@ -1320,7 +1321,9 @@ GstCaps *QGstUtils::videoFilterCaps()
"video/x-android-buffer;"
#endif
"image/jpeg;"
- "video/x-h264");
+ "video/x-h264",
+ GST_PADDING_INIT
+ };
return gst_caps_make_writable(gst_static_caps_get(&staticCaps));
}
diff --git a/src/multimediawidgets/qvideowidget.cpp b/src/multimediawidgets/qvideowidget.cpp
index e9977c5a8..ab552b90d 100644
--- a/src/multimediawidgets/qvideowidget.cpp
+++ b/src/multimediawidgets/qvideowidget.cpp
@@ -324,6 +324,7 @@ QWindowVideoWidgetBackend::QWindowVideoWidgetBackend(
control->setWinId(widget->winId());
#if defined(Q_OS_WIN)
+ // Disable updates to avoid flickering while resizing/moving.
m_widget->setUpdatesEnabled(false);
#endif
}
@@ -1001,6 +1002,23 @@ void QVideoWidget::paintEvent(QPaintEvent *event)
}
}
+#if defined(Q_OS_WIN)
+bool QVideoWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)
+{
+ Q_D(QVideoWidget);
+ Q_UNUSED(eventType);
+ Q_UNUSED(result);
+
+ MSG *mes = reinterpret_cast<MSG *>(message);
+ if (mes->message == WM_PAINT || mes->message == WM_ERASEBKGND) {
+ if (d->windowBackend)
+ d->windowBackend->showEvent();
+ }
+
+ return false;
+}
+#endif
+
#include "moc_qvideowidget.cpp"
#include "moc_qvideowidget_p.cpp"
QT_END_NAMESPACE
diff --git a/src/multimediawidgets/qvideowidget.h b/src/multimediawidgets/qvideowidget.h
index b1e2da46b..2a08b6fbd 100644
--- a/src/multimediawidgets/qvideowidget.h
+++ b/src/multimediawidgets/qvideowidget.h
@@ -81,6 +81,9 @@ public:
int saturation() const;
QSize sizeHint() const override;
+#if defined(Q_OS_WIN)
+ bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
+#endif
public Q_SLOTS:
void setFullScreen(bool fullScreen);
diff --git a/src/plugins/common/evr/evrcustompresenter.cpp b/src/plugins/common/evr/evrcustompresenter.cpp
index dd03791ea..fdaedea7a 100644
--- a/src/plugins/common/evr/evrcustompresenter.cpp
+++ b/src/plugins/common/evr/evrcustompresenter.cpp
@@ -1927,12 +1927,12 @@ void EVRCustomPresenter::presentSample(IMFSample *sample)
return;
}
- if (!m_surface || !m_surface->isActive() || !m_presentEngine->videoSurfaceFormat().isValid())
+ if (!m_surface || !m_presentEngine->videoSurfaceFormat().isValid())
return;
QVideoFrame frame = m_presentEngine->makeVideoFrame(sample);
- if (m_surface->isActive() && m_surface->surfaceFormat() != m_presentEngine->videoSurfaceFormat()) {
+ if (!m_surface->isActive() || m_surface->surfaceFormat() != m_presentEngine->videoSurfaceFormat()) {
m_surface->stop();
if (!m_surface->start(m_presentEngine->videoSurfaceFormat()))
return;
diff --git a/src/plugins/common/evr/evrvideowindowcontrol.cpp b/src/plugins/common/evr/evrvideowindowcontrol.cpp
index ce837c553..95f63c2e7 100644
--- a/src/plugins/common/evr/evrvideowindowcontrol.cpp
+++ b/src/plugins/common/evr/evrvideowindowcontrol.cpp
@@ -158,6 +158,9 @@ void EvrVideoWindowControl::setDisplayRect(const QRect &rect)
} else {
m_displayControl->SetVideoPosition(NULL, &displayRect);
}
+
+ // To refresh content immediately.
+ repaint();
}
}
diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp
index 8d0c72057..d23b7f1e2 100644
--- a/src/plugins/directshow/camera/dscamerasession.cpp
+++ b/src/plugins/directshow/camera/dscamerasession.cpp
@@ -44,6 +44,7 @@
#include <QtMultimedia/qvideosurfaceformat.h>
#include <QtMultimedia/qcameraimagecapture.h>
#include <private/qmemoryvideobuffer_p.h>
+#include <private/qvideoframe_p.h>
#include "dscamerasession.h"
#include "dsvideorenderer.h"
@@ -67,6 +68,7 @@ DSCameraSession::DSCameraSession(QObject *parent)
, m_previewStarted(false)
, m_surface(nullptr)
, m_previewPixelFormat(QVideoFrame::Format_Invalid)
+ , m_stride(-1)
, m_readyForCapture(false)
, m_imageIdCounter(0)
, m_currentImageId(-1)
@@ -502,7 +504,7 @@ failed:
if (m_surface && m_surface->isActive())
m_surface->stop();
disconnectGraph();
- setError(QCamera::CameraError, errorString);
+ setError(QCamera::CameraError, errorString, hr);
return false;
}
@@ -541,12 +543,13 @@ bool DSCameraSession::stopPreview()
return true;
failed:
- setError(QCamera::CameraError, errorString);
+ setError(QCamera::CameraError, errorString, hr);
return false;
}
-void DSCameraSession::setError(int error, const QString &errorString)
+void DSCameraSession::setError(int error, const QString &errorString, HRESULT hr)
{
+ qErrnoWarning(hr, "[0x%x] %s", hr, qPrintable(errorString));
emit cameraError(error, errorString);
setStatus(QCamera::UnloadedStatus);
}
@@ -608,16 +611,9 @@ void DSCameraSession::onFrameAvailable(double time, const QByteArray &data)
m_presentMutex.lock();
- // If no frames provided from ISampleGrabber for some time
- // the device might be potentially unplugged.
- m_deviceLostEventTimer.start(100);
-
- // (We should be getting only RGB32 data)
- int stride = m_previewSize.width() * 4;
-
// In case the source produces frames faster than we can display them,
// only keep the most recent one
- m_currentFrame = QVideoFrame(new QMemoryVideoBuffer(data, stride),
+ m_currentFrame = QVideoFrame(new QMemoryVideoBuffer(data, m_stride),
m_previewSize,
m_previewPixelFormat);
@@ -641,6 +637,10 @@ void DSCameraSession::onFrameAvailable(double time, const QByteArray &data)
void DSCameraSession::presentFrame()
{
+ // If no frames provided from ISampleGrabber for some time
+ // the device might be potentially unplugged.
+ m_deviceLostEventTimer.start(100);
+
m_presentMutex.lock();
if (m_currentFrame.isValid() && m_surface) {
@@ -656,17 +656,11 @@ void DSCameraSession::presentFrame()
m_captureMutex.lock();
if (m_capturedFrame.isValid()) {
- Q_ASSERT(m_previewPixelFormat == QVideoFrame::Format_RGB32);
-
- m_capturedFrame.map(QAbstractVideoBuffer::ReadOnly);
- captureImage = QImage(m_capturedFrame.bits(),
- m_previewSize.width(), m_previewSize.height(),
- QImage::Format_RGB32);
+ captureImage = qt_imageFromVideoFrame(m_capturedFrame);
- captureImage = captureImage.mirrored(m_needsHorizontalMirroring); // also causes a deep copy of the data
-
- m_capturedFrame.unmap();
+ const bool needsVerticalMirroring = m_previewSurfaceFormat.scanLineDirection() != QVideoSurfaceFormat::TopToBottom;
+ captureImage = captureImage.mirrored(m_needsHorizontalMirroring, needsVerticalMirroring); // also causes a deep copy of the data
QtConcurrent::run(this, &DSCameraSession::processCapturedImage,
m_currentImageId, m_captureDestinations, captureImage, m_imageCaptureFileName);
@@ -816,7 +810,7 @@ bool DSCameraSession::createFilterGraph()
if (!m_previewSampleGrabber) {
m_previewSampleGrabber = new DirectShowSampleGrabber;
connect(m_previewSampleGrabber, &DirectShowSampleGrabber::bufferAvailable,
- this, &DSCameraSession::onFrameAvailable);
+ this, &DSCameraSession::onFrameAvailable, Qt::DirectConnection);
}
@@ -839,7 +833,7 @@ failed:
SAFE_RELEASE(m_nullRendererFilter);
SAFE_RELEASE(m_filterGraph);
SAFE_RELEASE(m_graphBuilder);
- setError(QCamera::CameraError, errorString);
+ setError(QCamera::CameraError, errorString, hr);
return false;
}
@@ -877,22 +871,34 @@ bool DSCameraSession::configurePreviewFormat()
VIDEOINFOHEADER *videoInfo = reinterpret_cast<VIDEOINFOHEADER*>(m_sourceFormat->pbFormat);
videoInfo->AvgTimePerFrame = 10000000 / resolvedViewfinderSettings.maximumFrameRate();
- // We only support RGB32, if the capture source doesn't support
- // that format, the graph builder will automatically insert a
- // converter.
+ m_previewPixelFormat = resolvedViewfinderSettings.pixelFormat();
+ const AM_MEDIA_TYPE *resolvedGrabberFormat = &m_sourceFormat;
- if (m_surface && !m_surface->supportedPixelFormats(QAbstractVideoBuffer::NoHandle)
- .contains(QVideoFrame::Format_RGB32)) {
- qWarning() << "Video surface needs to support RGB32 pixel format";
- return false;
+ if (m_surface) {
+ const auto surfaceFormats = m_surface->supportedPixelFormats(QAbstractVideoBuffer::NoHandle);
+ if (!surfaceFormats.contains(m_previewPixelFormat)) {
+ if (surfaceFormats.contains(QVideoFrame::Format_RGB32)) {
+ // As a fallback, we support RGB32, if the capture source doesn't support
+ // that format, the graph builder will automatically insert a
+ // converter (when possible).
+
+ static const AM_MEDIA_TYPE rgb32GrabberFormat { MEDIATYPE_Video, MEDIASUBTYPE_ARGB32, 0, 0, 0, FORMAT_VideoInfo, nullptr, 0, nullptr};
+ resolvedGrabberFormat = &rgb32GrabberFormat;
+ m_previewPixelFormat = QVideoFrame::Format_RGB32;
+
+ } else {
+ qWarning() << "Video surface needs to support at least RGB32 pixel format";
+ return false;
+ }
+ }
}
- m_previewPixelFormat = QVideoFrame::Format_RGB32;
m_previewSize = resolvedViewfinderSettings.resolution();
m_previewSurfaceFormat = QVideoSurfaceFormat(m_previewSize,
m_previewPixelFormat,
QAbstractVideoBuffer::NoHandle);
- m_previewSurfaceFormat.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
+ m_previewSurfaceFormat.setScanLineDirection(DirectShowMediaType::scanLineDirection(m_previewPixelFormat, videoInfo->bmiHeader));
+ m_stride = DirectShowMediaType::bytesPerLine(m_previewSurfaceFormat);
HRESULT hr;
IAMStreamConfig* pConfig = 0;
@@ -913,9 +919,7 @@ bool DSCameraSession::configurePreviewFormat()
return false;
}
- // Set sample grabber format
- static const AM_MEDIA_TYPE grabberFormat { MEDIATYPE_Video, MEDIASUBTYPE_ARGB32, 0, 0, 0, FORMAT_VideoInfo, nullptr, 0, nullptr};
- if (!m_previewSampleGrabber->setMediaType(&grabberFormat))
+ if (!m_previewSampleGrabber->setMediaType(resolvedGrabberFormat))
return false;
m_previewSampleGrabber->start(DirectShowSampleGrabber::CallbackMethod::BufferCB);
diff --git a/src/plugins/directshow/camera/dscamerasession.h b/src/plugins/directshow/camera/dscamerasession.h
index 361a0220e..18fc0cca7 100644
--- a/src/plugins/directshow/camera/dscamerasession.h
+++ b/src/plugins/directshow/camera/dscamerasession.h
@@ -173,7 +173,7 @@ private:
void updateSourceCapabilities();
bool configurePreviewFormat();
void updateImageProcessingParametersInfos();
- void setError(int error, const QString &errorString);
+ void setError(int error, const QString &errorString, HRESULT hr);
// These static functions are used for scaling of adjustable parameters,
// which have the ranges from -1.0 to +1.0 in the QCameraImageProcessing API.
@@ -207,6 +207,7 @@ private:
QVideoSurfaceFormat m_previewSurfaceFormat;
QVideoFrame::PixelFormat m_previewPixelFormat;
QSize m_previewSize;
+ int m_stride;
QCameraViewfinderSettings m_viewfinderSettings;
QCameraViewfinderSettings m_actualViewfinderSettings;
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.cpp b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.cpp
index 4b0e7afa4..e9a7a5332 100644
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.cpp
+++ b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.cpp
@@ -48,7 +48,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <unistd.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
index a6cdc5297..7051913a7 100644
--- a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
+++ b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
@@ -52,7 +52,7 @@ class CameraBinSession;
QT_USE_NAMESPACE
-class Q_MULTIMEDIA_EXPORT CameraBinCaptureBufferFormat : public QCameraCaptureBufferFormatControl
+class CameraBinCaptureBufferFormat : public QCameraCaptureBufferFormatControl
{
Q_OBJECT
public:
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturedestination.h b/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
index 460fd1aa3..bc24a23d8 100644
--- a/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
+++ b/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
@@ -49,7 +49,7 @@ class CameraBinSession;
QT_USE_NAMESPACE
-class Q_MULTIMEDIA_EXPORT CameraBinCaptureDestination : public QCameraCaptureDestinationControl
+class CameraBinCaptureDestination : public QCameraCaptureDestinationControl
{
Q_OBJECT
public:
diff --git a/src/plugins/gstreamer/camerabin/camerabinexposure.h b/src/plugins/gstreamer/camerabin/camerabinexposure.h
index c30da25ad..db16bed24 100644
--- a/src/plugins/gstreamer/camerabin/camerabinexposure.h
+++ b/src/plugins/gstreamer/camerabin/camerabinexposure.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
class CameraBinSession;
-class Q_MULTIMEDIA_EXPORT CameraBinExposure : public QCameraExposureControl
+class CameraBinExposure : public QCameraExposureControl
{
Q_OBJECT
diff --git a/src/plugins/gstreamer/camerabin/camerabinflash.h b/src/plugins/gstreamer/camerabin/camerabinflash.h
index 84177f122..0efd100a7 100644
--- a/src/plugins/gstreamer/camerabin/camerabinflash.h
+++ b/src/plugins/gstreamer/camerabin/camerabinflash.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
class CameraBinSession;
-class Q_MULTIMEDIA_EXPORT CameraBinFlash : public QCameraFlashControl
+class CameraBinFlash : public QCameraFlashControl
{
Q_OBJECT
public:
diff --git a/src/plugins/wmf/player/mfmetadatacontrol.cpp b/src/plugins/wmf/player/mfmetadatacontrol.cpp
index ac57ccfb5..74063f7d1 100644
--- a/src/plugins/wmf/player/mfmetadatacontrol.cpp
+++ b/src/plugins/wmf/player/mfmetadatacontrol.cpp
@@ -299,7 +299,7 @@ void MFMetaDataControl::updateSource(IMFPresentationDescriptor* sourcePD, IMFMed
m_availableMetaDatas.push_back(QMediaMetaData::SubTitle);
} else if (key == PKEY_ParentalRating) {
m_availableMetaDatas.push_back(QMediaMetaData::ParentalRating);
- } else if (key == PKEY_Comment) {
+ } else if (key == PKEY_Media_EncodingSettings) {
m_availableMetaDatas.push_back(QMediaMetaData::Description);
} else if (key == PKEY_Copyright) {
m_availableMetaDatas.push_back(QMediaMetaData::Copyright);