summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-13 03:01:49 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-13 03:01:49 +0200
commit97213e13cd7f2ccae1d5215bbb503f8f59c0ad22 (patch)
treef5586f079726cf909b48bd9e55fa1b5e18381801 /src
parent2da4e162516830f4976f30c789a3fd9511dde932 (diff)
parent075fa6203856bdf9f58e737ee2f5d2a843a85cad (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'src')
-rw-r--r--src/gsttools/qgstcodecsinfo.cpp11
-rw-r--r--src/gsttools/qgstreamerplayercontrol.cpp6
-rw-r--r--src/gsttools/qgstvideorenderersink.cpp24
-rw-r--r--src/multimediawidgets/qpaintervideosurface_p.h2
-rw-r--r--src/plugins/avfoundation/camera/avfcamerautility.mm13
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm7
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.cpp6
7 files changed, 59 insertions, 10 deletions
diff --git a/src/gsttools/qgstcodecsinfo.cpp b/src/gsttools/qgstcodecsinfo.cpp
index 512bb828d..c6e61f824 100644
--- a/src/gsttools/qgstcodecsinfo.cpp
+++ b/src/gsttools/qgstcodecsinfo.cpp
@@ -263,7 +263,16 @@ GList *QGstCodecsInfo::elementFactories(ElementType elementType) const
break;
}
- return gst_element_factory_list_get_elements(gstElementType, GST_RANK_MARGINAL);
+ GList *list = gst_element_factory_list_get_elements(gstElementType, GST_RANK_MARGINAL);
+ if (elementType == AudioEncoder) {
+ // Manually add "audioconvert" to the list
+ // to allow linking with various containers.
+ auto factory = gst_element_factory_find("audioconvert");
+ if (factory)
+ list = g_list_prepend(list, factory);
+ }
+
+ return list;
#else
GList *result = gst_registry_feature_filter(gst_registry_get_default(),
element_filter,
diff --git a/src/gsttools/qgstreamerplayercontrol.cpp b/src/gsttools/qgstreamerplayercontrol.cpp
index 73f43f0b9..d49b09af4 100644
--- a/src/gsttools/qgstreamerplayercontrol.cpp
+++ b/src/gsttools/qgstreamerplayercontrol.cpp
@@ -225,6 +225,10 @@ void QGstreamerPlayerControl::pause()
qDebug() << Q_FUNC_INFO;
#endif
m_userRequestedState = QMediaPlayer::PausedState;
+ // If the playback has not been started yet but pause is requested.
+ // Seek to the beginning to show first frame.
+ if (m_pendingSeekPosition == -1 && m_session->position() == 0)
+ m_pendingSeekPosition = 0;
playOrPause(QMediaPlayer::PausedState);
}
@@ -354,7 +358,7 @@ void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice *
m_currentState = QMediaPlayer::StoppedState;
QMediaContent oldMedia = m_currentResource;
- m_pendingSeekPosition = 0;
+ m_pendingSeekPosition = -1;
m_session->showPrerollFrames(false); // do not show prerolled frames until pause() or play() explicitly called
m_setMediaPending = false;
diff --git a/src/gsttools/qgstvideorenderersink.cpp b/src/gsttools/qgstvideorenderersink.cpp
index c3a7a5988..597b97410 100644
--- a/src/gsttools/qgstvideorenderersink.cpp
+++ b/src/gsttools/qgstvideorenderersink.cpp
@@ -486,13 +486,35 @@ void QGstVideoRendererSink::base_init(gpointer g_class)
GST_ELEMENT_CLASS(g_class), gst_static_pad_template_get(&sink_pad_template));
}
+struct NullSurface : QAbstractVideoSurface
+{
+ NullSurface(QObject *parent = nullptr) : QAbstractVideoSurface(parent) { }
+
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType) const override
+ {
+ return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_RGB32;
+ }
+
+ bool present(const QVideoFrame &) override
+ {
+ return true;
+ }
+};
+
void QGstVideoRendererSink::instance_init(GTypeInstance *instance, gpointer g_class)
{
+ Q_UNUSED(g_class);
VO_SINK(instance);
- Q_UNUSED(g_class);
+ if (!current_surface) {
+ qWarning() << "Using qtvideosink element without video surface";
+ static NullSurface nullSurface;
+ current_surface = &nullSurface;
+ }
+
sink->delegate = new QVideoSurfaceGstDelegate(current_surface);
sink->delegate->moveToThread(current_surface->thread());
+ current_surface = nullptr;
}
void QGstVideoRendererSink::finalize(GObject *object)
diff --git a/src/multimediawidgets/qpaintervideosurface_p.h b/src/multimediawidgets/qpaintervideosurface_p.h
index bf0a0ac5c..990d20cbe 100644
--- a/src/multimediawidgets/qpaintervideosurface_p.h
+++ b/src/multimediawidgets/qpaintervideosurface_p.h
@@ -68,7 +68,7 @@ QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
-class QVideoSurfacePainter
+class Q_AUTOTEST_EXPORT QVideoSurfacePainter
{
public:
virtual ~QVideoSurfacePainter();
diff --git a/src/plugins/avfoundation/camera/avfcamerautility.mm b/src/plugins/avfoundation/camera/avfcamerautility.mm
index e68fc703b..8c743dcbc 100644
--- a/src/plugins/avfoundation/camera/avfcamerautility.mm
+++ b/src/plugins/avfoundation/camera/avfcamerautility.mm
@@ -47,6 +47,7 @@
#include <functional>
#include <algorithm>
#include <limits>
+#include <tuple>
QT_BEGIN_NAMESPACE
@@ -85,14 +86,18 @@ inline bool qt_area_sane(const QSize &size)
&& std::numeric_limits<int>::max() / size.width() >= size.height();
}
-struct ResolutionPredicate : std::binary_function<AVCaptureDeviceFormat *, AVCaptureDeviceFormat *, bool>
+template <template <typename...> class Comp> // std::less or std::greater (or std::equal_to)
+struct ByResolution
{
bool operator() (AVCaptureDeviceFormat *f1, AVCaptureDeviceFormat *f2)const
{
Q_ASSERT(f1 && f2);
const QSize r1(qt_device_format_resolution(f1));
const QSize r2(qt_device_format_resolution(f2));
- return r1.width() < r2.width() || (r2.width() == r1.width() && r1.height() < r2.height());
+ // use std::tuple for lexicograpical sorting:
+ const Comp<std::tuple<int, int>> op = {};
+ return op(std::make_tuple(r1.width(), r1.height()),
+ std::make_tuple(r2.width(), r2.height()));
}
};
@@ -143,7 +148,7 @@ QVector<AVCaptureDeviceFormat *> qt_unique_device_formats(AVCaptureDevice *captu
if (!formats.size())
return formats;
- std::sort(formats.begin(), formats.end(), ResolutionPredicate());
+ std::sort(formats.begin(), formats.end(), ByResolution<std::less>());
QSize size(qt_device_format_resolution(formats[0]));
FourCharCode codec = CMVideoFormatDescriptionGetCodecType(formats[0].formatDescription);
@@ -309,7 +314,7 @@ AVCaptureDeviceFormat *qt_find_best_framerate_match(AVCaptureDevice *captureDevi
QVector<AVCaptureDeviceFormat *>sorted(qt_unique_device_formats(captureDevice, filter));
// Sort formats by their resolution in decreasing order:
- std::sort(sorted.begin(), sorted.end(), std::not2(ResolutionPredicate()));
+ std::sort(sorted.begin(), sorted.end(), ByResolution<std::greater>());
// We can use only formats with framerate ranges:
sorted.erase(std::remove_if(sorted.begin(), sorted.end(), FormatHasNoFPSRange()), sorted.end());
diff --git a/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm b/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm
index 392960e4d..51f961729 100644
--- a/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm
+++ b/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm
@@ -159,6 +159,13 @@ QOpenGLFramebufferObject *AVFVideoFrameRenderer::initRenderer(AVPlayerLayer *lay
qWarning("failed to create QOpenGLContext");
return nullptr;
}
+
+ // CARenderer must be re-created with different current context, so release it now.
+ // See lines below where m_videoLayerRenderer is constructed.
+ if (m_videoLayerRenderer) {
+ [m_videoLayerRenderer release];
+ m_videoLayerRenderer = nullptr;
+ }
}
//Need current context
diff --git a/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.cpp b/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.cpp
index 6ca1dbe94..46b9e4616 100644
--- a/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.cpp
@@ -124,7 +124,8 @@ QVariant CameraBinV4LImageProcessing::parameter(
QMap<ProcessingParameter, SourceParameterValueInfo>::const_iterator sourceValueInfo =
m_parametersInfo.constFind(parameter);
if (sourceValueInfo == m_parametersInfo.constEnd()) {
- qWarning() << "Unable to get the parameter value: the parameter is not supported.";
+ if (!m_parametersInfo.empty())
+ qWarning() << "Unable to get the unsupported parameter:" << parameter;
return QVariant();
}
@@ -178,7 +179,8 @@ void CameraBinV4LImageProcessing::setParameter(
QMap<ProcessingParameter, SourceParameterValueInfo>::const_iterator sourceValueInfo =
m_parametersInfo.constFind(parameter);
if (sourceValueInfo == m_parametersInfo.constEnd()) {
- qWarning() << "Unable to set the parameter value: the parameter is not supported.";
+ if (!m_parametersInfo.empty())
+ qWarning() << "Unable to set the unsupported parameter:" << parameter;
return;
}