summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-05-12 11:26:29 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2021-05-14 08:18:27 +0000
commit9a4822037def3b9d48abea8bbfd7ea20fd19849b (patch)
treec4dc47b1752bb69774f7b62376d2f3ec174c8a9f
parent34976a67b51b4b0db14ce2093aafd8f6b4e6bee6 (diff)
Fix a number of compiler warnings/errors when using gcc
Change-Id: Ifa7bcd4507948cd61909a11af203852ee1586787 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--examples/multimedia/audiodevices/audiodevices.cpp5
-rw-r--r--examples/multimedia/devices/main.cpp9
-rw-r--r--src/multimedia/audio/qaudiobuffer.h2
-rw-r--r--src/multimedia/audio/qaudioformat.h2
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstappsrc.cpp2
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstreamermediaplayer.cpp2
-rw-r--r--src/multimedia/platform/gstreamer/mediacapture/qgstreamercamerafocus.cpp7
-rw-r--r--src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing.cpp17
-rw-r--r--src/multimedia/qmediadevices.h2
-rw-r--r--src/multimedia/qmediametadata.h2
-rw-r--r--src/multimedia/video/qvideotexturehelper.cpp10
-rw-r--r--src/multimediawidgets/qvideowidget.cpp1
12 files changed, 27 insertions, 34 deletions
diff --git a/examples/multimedia/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp
index b3c8dea44..5ec944013 100644
--- a/examples/multimedia/audiodevices/audiodevices.cpp
+++ b/examples/multimedia/audiodevices/audiodevices.cpp
@@ -56,9 +56,6 @@
static QString toString(QAudioFormat::SampleFormat sampleFormat)
{
switch (sampleFormat) {
- case QAudioFormat::Unknown:
- case QAudioFormat::NSampleFormats:
- return "Unknown";
case QAudioFormat::UInt8:
return "Unsigned 8 bit";
case QAudioFormat::Int16:
@@ -67,6 +64,8 @@ static QString toString(QAudioFormat::SampleFormat sampleFormat)
return "Signed 32 bit";
case QAudioFormat::Float:
return "Float";
+ default:
+ return "Unknown";
}
}
diff --git a/examples/multimedia/devices/main.cpp b/examples/multimedia/devices/main.cpp
index cfdd28116..ce43c7079 100644
--- a/examples/multimedia/devices/main.cpp
+++ b/examples/multimedia/devices/main.cpp
@@ -61,9 +61,6 @@
QString formatToString(QAudioFormat::SampleFormat sampleFormat)
{
switch (sampleFormat) {
- case QAudioFormat::Unknown:
- case QAudioFormat::NSampleFormats:
- return "Unknown";
case QAudioFormat::UInt8:
return "UInt8";
case QAudioFormat::Int16:
@@ -72,18 +69,20 @@ QString formatToString(QAudioFormat::SampleFormat sampleFormat)
return "Int32";
case QAudioFormat::Float:
return "Float";
+ default:
+ return "Unknown";
}
}
QString positionToString(QCameraInfo::Position position)
{
switch (position) {
- case QCameraInfo::UnspecifiedPosition:
- return "Unspecified";
case QCameraInfo::BackFace:
return "BackFace";
case QCameraInfo::FrontFace:
return "FrontFace";
+ default:
+ return "Unspecified";
}
}
diff --git a/src/multimedia/audio/qaudiobuffer.h b/src/multimedia/audio/qaudiobuffer.h
index ed6b478f3..e7360522e 100644
--- a/src/multimedia/audio/qaudiobuffer.h
+++ b/src/multimedia/audio/qaudiobuffer.h
@@ -140,7 +140,7 @@ private:
template <> struct QAudioBuffer::StereoFrameDefault<unsigned char> { enum { Default = 128 }; };
template <> struct QAudioBuffer::StereoFrameDefault<unsigned short> { enum { Default = 32768 }; };
-Q_DECLARE_METATYPE(QAudioBuffer);
+Q_DECLARE_METATYPE(QAudioBuffer)
QT_END_NAMESPACE
diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h
index ee33ab5d8..bc17be847 100644
--- a/src/multimedia/audio/qaudioformat.h
+++ b/src/multimedia/audio/qaudioformat.h
@@ -126,7 +126,7 @@ Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QAudioFormat &);
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QAudioFormat::SampleFormat);
#endif
-Q_DECLARE_METATYPE(QAudioFormat);
+Q_DECLARE_METATYPE(QAudioFormat)
QT_END_NAMESPACE
diff --git a/src/multimedia/platform/gstreamer/common/qgstappsrc.cpp b/src/multimedia/platform/gstreamer/common/qgstappsrc.cpp
index 5ee92612b..7ff9b177f 100644
--- a/src/multimedia/platform/gstreamer/common/qgstappsrc.cpp
+++ b/src/multimedia/platform/gstreamer/common/qgstappsrc.cpp
@@ -182,7 +182,7 @@ void QGstAppSrc::pushData()
GstBuffer* buffer = gst_buffer_new_and_alloc(size);
- if (m_sequential)
+ if (m_sequential && m_stream)
buffer->offset = bytesReadSoFar;
else
buffer->offset = m_stream->pos();
diff --git a/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer.cpp b/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer.cpp
index 7f1e5d5ce..d006e3871 100644
--- a/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer.cpp
+++ b/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer.cpp
@@ -375,6 +375,7 @@ bool QGstreamerMediaPlayer::processBusMessage(const QGstreamerMessage &message)
qint64 position = (*p)/1000000;
emit positionChanged(position);
}
+ break;
}
case GST_MESSAGE_ELEMENT: {
QGstStructure structure(gst_message_get_structure(gm));
@@ -383,6 +384,7 @@ bool QGstreamerMediaPlayer::processBusMessage(const QGstreamerMessage &message)
topology.free();
topology = structure.copy();
}
+ break;
}
default:
diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamerafocus.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamerafocus.cpp
index e566bb205..beb09a897 100644
--- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamerafocus.cpp
+++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercamerafocus.cpp
@@ -82,12 +82,9 @@ void QGstreamerCameraFocus::setFocusMode(QCameraFocus::FocusMode mode)
#if QT_CONFIG(gstreamer_photography)
auto photography = m_camera->photography();
if (photography) {
- GstPhotographyFocusMode photographyMode;
+ GstPhotographyFocusMode photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL;
switch (mode) {
- case QCameraFocus::FocusModeAuto:
- photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL;
- break;
case QCameraFocus::FocusModeAutoNear:
photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_MACRO;
break;
@@ -103,6 +100,8 @@ void QGstreamerCameraFocus::setFocusMode(QCameraFocus::FocusMode mode)
case QCameraFocus::FocusModeManual:
photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_MANUAL;
break;
+ default: // QCameraFocus::FocusModeAuto:
+ break;
}
if (gst_photography_set_focus_mode(photography, photographyMode)) {
diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing.cpp
index cddb6cd76..936271870 100644
--- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing.cpp
+++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercameraimageprocessing.cpp
@@ -128,11 +128,8 @@ bool QGstreamerImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::Whit
return false;
#if QT_CONFIG(gstreamer_photography)
if (auto *photography = m_camera->photography()) {
- GstPhotographyWhiteBalanceMode gstMode;
+ GstPhotographyWhiteBalanceMode gstMode = GST_PHOTOGRAPHY_WB_MODE_AUTO;
switch (mode) {
- case QCameraImageProcessing::WhiteBalanceAuto:
- gstMode = GST_PHOTOGRAPHY_WB_MODE_AUTO;
- break;
case QCameraImageProcessing::WhiteBalanceSunlight:
gstMode = GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT;
break;
@@ -151,11 +148,11 @@ bool QGstreamerImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::Whit
case QCameraImageProcessing::WhiteBalanceFluorescent:
gstMode = GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT;
break;
+ case QCameraImageProcessing::WhiteBalanceAuto:
default:
- Q_ASSERT(false);
break;
}
- if (gst_photography_set_white_balance_mode(m_camera->photography(), gstMode)) {
+ if (gst_photography_set_white_balance_mode(photography, gstMode)) {
m_whiteBalanceMode = mode;
return true;
}
@@ -201,11 +198,8 @@ bool QGstreamerImageProcessing::setColorFilter(QCameraImageProcessing::ColorFilt
{
#if QT_CONFIG(gstreamer_photography)
if (GstPhotography *photography = m_camera->photography()) {
- GstPhotographyColorToneMode mode;
+ GstPhotographyColorToneMode mode = GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL;
switch (filter) {
- case QCameraImageProcessing::ColorFilterNone:
- mode = GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL;
- break;
case QCameraImageProcessing::ColorFilterSepia:
mode = GST_PHOTOGRAPHY_COLOR_TONE_MODE_SEPIA;
break;
@@ -230,6 +224,9 @@ bool QGstreamerImageProcessing::setColorFilter(QCameraImageProcessing::ColorFilt
case QCameraImageProcessing::ColorFilterAqua:
mode = GST_PHOTOGRAPHY_COLOR_TONE_MODE_AQUA;
break;
+ case QCameraImageProcessing::ColorFilterNone:
+ default:
+ break;
}
if (gst_photography_set_color_tone_mode(photography, mode)) {
m_colorFilter = filter;
diff --git a/src/multimedia/qmediadevices.h b/src/multimedia/qmediadevices.h
index 27a45763a..93067b33a 100644
--- a/src/multimedia/qmediadevices.h
+++ b/src/multimedia/qmediadevices.h
@@ -73,7 +73,7 @@ public:
static QAudioDeviceInfo defaultAudioOutput();
static QCameraInfo defaultVideoInput();
-signals:
+Q_SIGNALS:
void audioInputsChanged();
void audioOutputsChanged();
void videoInputsChanged();
diff --git a/src/multimedia/qmediametadata.h b/src/multimedia/qmediametadata.h
index b55cc547a..87de56fdb 100644
--- a/src/multimedia/qmediametadata.h
+++ b/src/multimedia/qmediametadata.h
@@ -93,7 +93,7 @@ public:
};
Q_ENUM(Key)
- static constexpr int NumMetaData = LeadPerformer + 1;
+ static constexpr int NumMetaData = Resolution + 1;
// QMetaType typeForKey(Key k);
Q_INVOKABLE QVariant value(Key k) const { return data.value(k); }
diff --git a/src/multimedia/video/qvideotexturehelper.cpp b/src/multimedia/video/qvideotexturehelper.cpp
index 70238a50c..850cba5f9 100644
--- a/src/multimedia/video/qvideotexturehelper.cpp
+++ b/src/multimedia/video/qvideotexturehelper.cpp
@@ -152,7 +152,7 @@ static const TextureDescription descriptions[QVideoFrameFormat::NPixelFormats] =
[](int stride, int height) {
// IMC1 requires that U and V components are aligned on a multiple of 16 lines
int h = (height + 15) & ~15;
- h += 2*((h/2) + 15 & ~15);
+ h += 2*(((h/2) + 15) & ~15);
return stride * h;
},
{ QRhiTexture::R8, QRhiTexture::R8, QRhiTexture::R8 },
@@ -169,7 +169,7 @@ static const TextureDescription descriptions[QVideoFrameFormat::NPixelFormats] =
[](int stride, int height) {
// IMC3 requires that U and V components are aligned on a multiple of 16 lines
int h = (height + 15) & ~15;
- h += 2*((h/2) + 15 & ~15);
+ h += 2*(((h/2) + 15) & ~15);
return stride * h;
},
{ QRhiTexture::R8, QRhiTexture::R8, QRhiTexture::R8 },
@@ -243,10 +243,6 @@ QString vertexShaderFileName(QVideoFrameFormat::PixelFormat /*format*/)
QString fragmentShaderFileName(QVideoFrameFormat::PixelFormat format)
{
switch (format) {
- case QVideoFrameFormat::Format_Invalid:
- case QVideoFrameFormat::Format_Jpeg:
- return QString();
-
case QVideoFrameFormat::Format_Y8:
case QVideoFrameFormat::Format_Y16:
return QStringLiteral(":/qt-project.org/multimedia/shaders/y.frag.qsb");
@@ -285,6 +281,8 @@ QString fragmentShaderFileName(QVideoFrameFormat::PixelFormat format)
return QStringLiteral(":/qt-project.org/multimedia/shaders/nv12.frag.qsb");
case QVideoFrameFormat::Format_NV21:
return QStringLiteral(":/qt-project.org/multimedia/shaders/nv21.frag.qsb");
+ default:
+ return QString();
}
}
diff --git a/src/multimediawidgets/qvideowidget.cpp b/src/multimediawidgets/qvideowidget.cpp
index f6a6d6f0c..4b0aba7ea 100644
--- a/src/multimediawidgets/qvideowidget.cpp
+++ b/src/multimediawidgets/qvideowidget.cpp
@@ -420,4 +420,3 @@ bool QVideoWidget::nativeEvent(const QByteArray &eventType, void *message, qintp
QT_END_NAMESPACE
#include "moc_qvideowidget.cpp"
-#include "moc_qvideowidget_p.cpp"