qv4l2: remove leagcy alsa_stream.h include (ENABLE_ALSA protected)
PATCH 1/11 qv4l2: remove leagcy alsa_stream.h include (ENABLE_ALSA protected)
Remove leagcy alsa_stream.h include protected by legacy/unknown '#ifdef ENABLE_ALSA'.
--- utils/qv4l2/qv4l2.cpp | 6 ------ 1 file changed, 6 deletions(-)
utils/qv4l2/qv4l2.cpp +0 -6
@@ -17,12 +17,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef ENABLE_ALSA -extern "C" { -#include "alsa_stream.h" -} -#endif - #include <QToolBar> #include <QToolButton> #include <QMenuBar>
Signature · 1 line
2.40.0
PATCH 2/11 qv4l2: fix qmake project file
- add MESON_BUILD_PATH variable (and customize hint)
- add '-include' for config.h file (as the meson build does)
- add alsa_stream.c source file
- adjust local library file paths
- add libasound dependency
--- utils/qv4l2/qv4l2.pro | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
utils/qv4l2/qv4l2.pro +13 -4
@@ -8,10 +8,16 @@ CONFIG += debug greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +# adjust to your local meson build path +MESON_BUILD_PATH = $$PWD/build-meson + # opengl: to disable opengl suppport comment out the following # line and the line '#define HAVE_QTGL 1' from ../../config.h QT += opengl +QMAKE_CFLAGS += -include $$MESON_BUILD_PATH/config.h +QMAKE_CXXFLAGS += -include $$MESON_BUILD_PATH/config.h + INCLUDEPATH += $$PWD/../.. INCLUDEPATH += $$PWD/../common INCLUDEPATH += $$PWD/../v4l2-ctl/
@@ -28,8 +34,9 @@ HEADERS += raw2sliced.h HEADERS += vbi-tab.h HEADERS += ../common/v4l2-tpg.h HEADERS += ../common/v4l2-tpg-colors.h -HEADERS += ../../config.h +HEADERS += $$MESON_BUILD_PATH/config.h +SOURCES += alsa_stream.c SOURCES += capture-win.cpp SOURCES += capture-win-gl.cpp SOURCES += capture-win-qt.cpp
@@ -42,9 +49,11 @@ SOURCES += vbi-tab.cpp SOURCES += ../v4l2-ctl/v4l2-tpg-core.c SOURCES += ../v4l2-ctl/v4l2-tpg-colors.c -LIBS += -L$$PWD/../../lib/libv4l2/.libs -lv4l2 -LIBS += -L$$PWD/../../lib/libv4lconvert/.libs -lv4lconvert -LIBS += -L$$PWD/../libv4l2util/.libs -lv4l2util +LIBS += -L$$MESON_BUILD_PATH/lib/libv4l2 -lv4l2 +LIBS += -L$$MESON_BUILD_PATH/lib/libv4lconvert -lv4lconvert +LIBS += -L$$MESON_BUILD_PATH/utils/libv4l2util -lv4l2util +LIBS += -L$$MESON_BUILD_PATH/utils/libmedia_dev -lmedia_dev +LIBS += -lasound # comment out in case alsa sound support is disabled/not available LIBS += -lrt -ldl -ljpeg RESOURCES += qv4l2.qrc
Signature · 1 line
2.40.0
PATCH 3/11 qv4l2: update qmake project file for Qt6 (core5compat module)
In reply to Peter Seiderer--- utils/qv4l2/qv4l2.pro | 1 + 1 file changed, 1 insertion(+)
utils/qv4l2/qv4l2.pro +1 -0
@@ -7,6 +7,7 @@ INCLUDEPATH += . ../libv4l2util ../../lib/include ../../include CONFIG += debug greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat # adjust to your local meson build path MESON_BUILD_PATH = $$PWD/build-meson
Signature · 1 line
2.40.0
PATCH 4/11 qv4l2: fix Qt6 compile (QDesktopWidget: No such file or directory)
In reply to Peter Seiderer- include QDesktopWidget only when needed (Qt verson < 5.10, see usage in CaptureWin::setWindowSize()
--- utils/qv4l2/capture-win.cpp | 2 ++ 1 file changed, 2 insertions(+)
utils/qv4l2/capture-win.cpp +2 -0
@@ -27,7 +27,9 @@ #include <QImage> #include <QVBoxLayout> #include <QApplication> +#if QT_VERSION < 0x050a00 #include <QDesktopWidget> +#endif #include <QScreen> #include <QWindow>
Signature · 1 line
2.40.0
PATCH 5/11 qv4l2: fix Qt6 compile (QHBoxLayout/QVBoxLayout has no member setMargin)
In reply to Peter SeidererFixes:
../qv4l2/general-tab.cpp:434:22: error: ‘class QHBoxLayout’ has no member named ‘setMargin’
434 | box->setMargin(0);
| ^~~~~~~~~
../qv4l2/capture-win.cpp:130:23: error: ‘class QVBoxLayout’ has no member named ‘setMargin’
130 | m_vboxLayout->setMargin(0);
| ^~~~~~~~~
../qv4l2/ctrl-tab.cpp:255:22: error: ‘class QHBoxLayout’ has no member named ‘setMargin’
255 | m_boxLayout->setMargin(0);
| ^~~~~~~~~--- utils/qv4l2/capture-win.cpp | 4 ++++ utils/qv4l2/ctrl-tab.cpp | 4 ++++ utils/qv4l2/general-tab.cpp | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-)
utils/qv4l2/capture-win.cpp +4 -0
@@ -127,7 +127,11 @@ void CaptureWin::buildWindow(QWidget *videoSurface) int l, t, r, b; m_vboxLayout = new QVBoxLayout(this); m_vboxLayout->getContentsMargins(&l, &t, &r, &b); +#if QT_VERSION < 0x060000 m_vboxLayout->setMargin(0); +#else + m_vboxLayout->setContentsMargins(0, 0, 0, 0); +#endif m_vboxLayout->addWidget(videoSurface, 1000, Qt::AlignCenter); setContextMenuPolicy(Qt::CustomContextMenu);
utils/qv4l2/ctrl-tab.cpp +4 -0
@@ -252,7 +252,11 @@ void ApplicationWindow::addCtrl(QGridLayout *grid, const v4l2_query_ext_ctrl &qe struct v4l2_querymenu qmenu; QWidget *wContainer = new QWidget(); QHBoxLayout *m_boxLayout = new QHBoxLayout(wContainer); +#if QT_VERSION < 0x060000 m_boxLayout->setMargin(0); +#else + m_boxLayout->setContentsMargins(0, 0, 0, 0); +#endif __u64 dif; switch (qec.type) {
utils/qv4l2/general-tab.cpp +4 -1
@@ -430,8 +430,11 @@ void GeneralTab::inputSection(v4l2_input vin) QLabel *l = new QLabel("Refresh Tuner Status", parentWidget()); QWidget *w = new QWidget(parentWidget()); QHBoxLayout *box = new QHBoxLayout(w); - +#if QT_VERSION < 0x060000 box->setMargin(0); +#else + box->setContentsMargins(0, 0, 0, 0); +#endif m_detectSubchans = new QToolButton(w); m_detectSubchans->setIcon(QIcon(":/enterbutt.png")); m_subchannels = new QLabel("", w);
Signature · 1 line
2.40.0
PATCH 6/11 qv4l2: fix Qt6 compile (ambiguous overload for operator!=)
In reply to Peter SeidererFixes:
../qv4l2/general-tab.cpp:1113:57: error: ambiguous overload for ‘operator!=’ (operand types are ‘QString’ and ‘long int’)
1113 | m_audioOutDevice->setEnabled(getAudioInDevice() != NULL ? getAudioInDevice().compare("None") : false);
| ^
../qv4l2/qv4l2.cpp:1261:19: error: ambiguous overload for ‘operator!=’ (operand types are ‘QString’ and ‘long int’)
1261 | if (audIn != NULL && audOut != NULL && audIn.compare("None") && audIn.compare(audOut) != 0) {
| ^
../qv4l2/qv4l2.cpp:1912:26: error: ambiguous overload for ‘operator!=’ (operand types are ‘QString’ and ‘long int’)
1912 | if (video_device != NULL)
| ^
../qv4l2/qv4l2.cpp:1914:29: error: ambiguous overload for ‘operator!=’ (operand types are ‘QString’ and ‘long int’)
1914 | else if (vbi_device != NULL)
| ^
../qv4l2/qv4l2.cpp:1916:31: error: ambiguous overload for ‘operator!=’ (operand types are ‘QString’ and ‘long int’)
1916 | else if (radio_device != NULL)
| ^
../qv4l2/qv4l2.cpp:1918:29: error: ambiguous overload for ‘operator!=’ (operand types are ‘QString’ and ‘long int’)
1918 | else if (sdr_device != NULL)
| ^
--- utils/qv4l2/general-tab.cpp | 2 +- utils/qv4l2/qv4l2.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
utils/qv4l2/general-tab.cpp +1 -1
@@ -1110,7 +1110,7 @@ bool GeneralTab::createAudioDeviceList() void GeneralTab::changeAudioDevice() { - m_audioOutDevice->setEnabled(getAudioInDevice() != NULL ? getAudioInDevice().compare("None") : false); + m_audioOutDevice->setEnabled(getAudioInDevice() != nullptr ? getAudioInDevice().compare("None") : false); emit audioDeviceChanged(); }
utils/qv4l2/qv4l2.cpp +5 -5
@@ -1258,7 +1258,7 @@ void ApplicationWindow::startAudio() QString audIn = m_genTab->getAudioInDevice(); QString audOut = m_genTab->getAudioOutDevice(); - if (audIn != NULL && audOut != NULL && audIn.compare("None") && audIn.compare(audOut) != 0) { + if (audIn != nullptr && audOut != nullptr && audIn.compare("None") && audIn.compare(audOut) != 0) { alsa_thread_startup(audOut.toLatin1().data(), audIn.toLatin1().data(), m_genTab->getAudioDeviceBufferSize(), NULL, 0);
@@ -1909,13 +1909,13 @@ int main(int argc, char **argv) } } - if (video_device != NULL) + if (video_device != nullptr) device = getDeviceName("/dev/video", video_device); - else if (vbi_device != NULL) + else if (vbi_device != nullptr) device = getDeviceName("/dev/vbi", vbi_device); - else if (radio_device != NULL) + else if (radio_device != nullptr) device = getDeviceName("/dev/radio", radio_device); - else if (sdr_device != NULL) + else if (sdr_device != nullptr) device = getDeviceName("/dev/swradio", sdr_device); else device = "/dev/video0";
Signature · 1 line
2.40.0
PATCH 7/11 qv4l2: fix Qt6 compile (missing QActionGroup header)
In reply to Peter SeidererFixes:
../qv4l2/qv4l2.cpp:246:36: error: invalid use of incomplete type ‘class QActionGroup’
246 | grp = new QActionGroup(menu);
| ^--- utils/qv4l2/qv4l2.cpp | 1 + 1 file changed, 1 insertion(+)
utils/qv4l2/qv4l2.cpp +1 -0
@@ -39,6 +39,7 @@ #include <QThread> #include <QCloseEvent> #include <QInputDialog> +#include <QActionGroup> #include <assert.h> #include <sys/mman.h>
Signature · 1 line
2.40.0
PATCH 8/11 qv4l2: fix Qt6 compile (no matching function for call to QString::split(QRegExp))
In reply to Peter SeidererFixes:
../qv4l2/general-tab.cpp:2396:69: error: no matching function for call to ‘QString::split(QRegExp)’
2396 | QStringList devAddr = QString(devname).split(QRegExp("[:,]"));
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~--- utils/qv4l2/general-tab.cpp | 6 ++++++ 1 file changed, 6 insertions(+)
utils/qv4l2/general-tab.cpp +6 -0
@@ -2393,8 +2393,14 @@ int GeneralTab::checkMatchAudioDevice(void *md, const char *vid, enum device_typ while ((devname = get_associated_device(md, devname, type, vid, dtype)) != NULL) { if (type == MEDIA_SND_CAP) { +#if QT_VERSION < 0x060000 QStringList devAddr = QString(devname).split(QRegExp("[:,]")); return devAddr.value(1).toInt(); +#else + QRegExp rx("[:,]"); + rx.indexIn(devname); + return rx.cap(1).toInt(); +#endif } } return -1;
Signature · 1 line
2.40.0
PATCH 9/11 qv4l2: fix Qt6 warnings (QKeyCombination operator+ is deprecated)
In reply to Peter SeidererFixes:
../qv4l2/capture-win.cpp:49:57: warning: ‘constexpr QKeyCombination operator+(Qt::Modifier, Qt::Key)’ is deprecated: Use operator| instead [-Wdeprecated-declarations]
49 | m_hotkeyScaleReset = new QShortcut(Qt::CTRL+Qt::Key_F, this);
| ^~~~~../qv4l2/capture-win.cpp:69:35: warning: ‘constexpr QKeyCombination operator+(Qt::Modifier, Qt::Key)’ is deprecated: Use operator| instead [-Wdeprecated-declarations]
69 | shortcuts << Qt::CTRL+Qt::Key_W;
| ^~~~~ ../qv4l2/qv4l2.cpp:135:43: warning: ‘constexpr QKeyCombination operator+(Qt::Modifier, Qt::Key)’ is deprecated: Use operator| instead [-Wdeprecated-declarations]
135 | openAct->setShortcut(Qt::CTRL+Qt::Key_O);
| ^~~~~
../qv4l2/qv4l2.cpp:140:46: warning: ‘constexpr QKeyCombination operator+(Qt::Modifier, Qt::Key)’ is deprecated: Use operator| instead [-Wdeprecated-declarations]
140 | openRawAct->setShortcut(Qt::CTRL+Qt::Key_R);
| ^~~~~
../qv4l2/qv4l2.cpp:147:49: warning: ‘constexpr QKeyCombination operator+(Qt::Modifier, Qt::Key)’ is deprecated: Use operator| instead [-Wdeprecated-declarations]
147 | m_capStartAct->setShortcut(Qt::CTRL+Qt::Key_V);
| ^~~~~
../qv4l2/qv4l2.cpp:172:44: warning: ‘constexpr QKeyCombination operator+(Qt::Modifier, Qt::Key)’ is deprecated: Use operator| instead [-Wdeprecated-declarations]
172 | closeAct->setShortcut(Qt::CTRL+Qt::Key_W);
| ^~~~~
../qv4l2/qv4l2.cpp:182:43: warning: ‘constexpr QKeyCombination operator+(Qt::Modifier, Qt::Key)’ is deprecated: Use operator| instead [-Wdeprecated-declarations]
182 | quitAct->setShortcut(Qt::CTRL+Qt::Key_Q);
| ^~~~~
../qv4l2/qv4l2.cpp:212:53: warning: ‘constexpr QKeyCombination operator+(Qt::Modifier, Qt::Key)’ is deprecated: Use operator| instead [-Wdeprecated-declarations]
212 | m_resetScalingAct->setShortcut(Qt::CTRL+Qt::Key_F);
| ^~~~~--- utils/qv4l2/capture-win.cpp | 4 ++-- utils/qv4l2/qv4l2.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-)
utils/qv4l2/capture-win.cpp +2 -2
@@ -46,7 +46,7 @@ CaptureWin::CaptureWin(ApplicationWindow *aw) : m_appWin(aw) { setWindowTitle("V4L2 Capture"); - m_hotkeyScaleReset = new QShortcut(Qt::CTRL+Qt::Key_F, this); + m_hotkeyScaleReset = new QShortcut(Qt::CTRL|Qt::Key_F, this); connect(m_hotkeyScaleReset, SIGNAL(activated()), this, SLOT(resetSize())); connect(aw->m_resetScalingAct, SIGNAL(triggered()), this, SLOT(resetSize())); m_hotkeyExitFullscreen = new QShortcut(Qt::Key_Escape, this);
@@ -66,7 +66,7 @@ CaptureWin::CaptureWin(ApplicationWindow *aw) : m_closeWindowAct->setStatusTip("Close"); QList<QKeySequence> shortcuts; // More standard close window shortcut - shortcuts << Qt::CTRL+Qt::Key_W; + shortcuts << (Qt::CTRL|Qt::Key_W); // Historic qv4l2 shortcut shortcuts << Qt::Key_Q; m_closeWindowAct->setShortcuts(shortcuts);
utils/qv4l2/qv4l2.cpp +6 -6
@@ -132,19 +132,19 @@ ApplicationWindow::ApplicationWindow() : QAction *openAct = new QAction(QIcon(":/fileopen.png"), "&Open Device", this); openAct->setStatusTip("Open a v4l device, use libv4l2 wrapper if possible"); - openAct->setShortcut(Qt::CTRL+Qt::Key_O); + openAct->setShortcut(Qt::CTRL|Qt::Key_O); connect(openAct, SIGNAL(triggered()), this, SLOT(opendev())); QAction *openRawAct = new QAction(QIcon(":/fileopen.png"), "Open &Raw Device", this); openRawAct->setStatusTip("Open a v4l device without using the libv4l2 wrapper"); - openRawAct->setShortcut(Qt::CTRL+Qt::Key_R); + openRawAct->setShortcut(Qt::CTRL|Qt::Key_R); connect(openRawAct, SIGNAL(triggered()), this, SLOT(openrawdev())); m_capStartAct = new QAction(QIcon(":/start.png"), "Start &Capturing", this); m_capStartAct->setStatusTip("Start capturing"); m_capStartAct->setCheckable(true); m_capStartAct->setDisabled(true); - m_capStartAct->setShortcut(Qt::CTRL+Qt::Key_V); + m_capStartAct->setShortcut(Qt::CTRL|Qt::Key_V); connect(m_capStartAct, SIGNAL(toggled(bool)), this, SLOT(capStart(bool))); m_capStepAct = new QAction(QIcon(":/step.png"), "Single Step", this);
@@ -169,7 +169,7 @@ ApplicationWindow::ApplicationWindow() : QAction *closeAct = new QAction(QIcon(":/fileclose.png"), "&Close Device", this); closeAct->setStatusTip("Close"); - closeAct->setShortcut(Qt::CTRL+Qt::Key_W); + closeAct->setShortcut(Qt::CTRL|Qt::Key_W); connect(closeAct, SIGNAL(triggered()), this, SLOT(closeDevice())); QAction *traceAct = new QAction("&Trace IOCTLs", this);
@@ -179,7 +179,7 @@ ApplicationWindow::ApplicationWindow() : QAction *quitAct = new QAction(QIcon(":/exit.png"), "&Quit", this); quitAct->setStatusTip("Exit the application"); - quitAct->setShortcut(Qt::CTRL+Qt::Key_Q); + quitAct->setShortcut(Qt::CTRL|Qt::Key_Q); connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); QMenu *fileMenu = menuBar()->addMenu("&File");
@@ -209,7 +209,7 @@ ApplicationWindow::ApplicationWindow() : m_resetScalingAct = new QAction("Resize to &Frame Size", this); m_resetScalingAct->setStatusTip("Resizes the capture window to match frame size"); - m_resetScalingAct->setShortcut(Qt::CTRL+Qt::Key_F); + m_resetScalingAct->setShortcut(Qt::CTRL|Qt::Key_F); m_overrideColorspace = -1; QMenu *menu = new QMenu("Override Colorspace");
Signature · 1 line
2.40.0
PATCH 10/11 qv4l2: fix Qt6 warning (QMenu::addAction() is deprecated)
In reply to Peter SeidererFixes:
../qv4l2/qv4l2.cpp:327:28: warning: ‘QAction* QMenu::addAction(const QString&, const QObject*, const char*, const QKeySequence&)’ is deprecated: Use addAction(text, shortcut, receiver, member) instead. [-Wdeprecated-declarations]
327 | helpMenu->addAction("&About", this, SLOT(about()), Qt::Key_F1);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- utils/qv4l2/qv4l2.cpp | 4 ++++ 1 file changed, 4 insertions(+)
utils/qv4l2/qv4l2.cpp +4 -0
@@ -324,7 +324,11 @@ ApplicationWindow::ApplicationWindow() : #endif QMenu *helpMenu = menuBar()->addMenu("&Help"); +#if QT_VERSION < 0x060000 helpMenu->addAction("&About", this, SLOT(about()), Qt::Key_F1); +#else + helpMenu->addAction("&About", Qt::Key_F1, this, SLOT(about())); +#endif QAction *whatAct = QWhatsThis::createAction(this); helpMenu->addAction(whatAct);
Signature · 1 line
2.40.0
PATCH 11/11 qvidcap: fix qmake project file
In reply to Peter Seiderer- add MESON_BUILD_PATH variable (and customize hint)
- add '-include' for config.h file (as the meson build does)
- add v4l2-convert.pl call to generate v4l2-convert.h
- add missing common/codec-v4l2-fwht.c and common/v4l2-info.cpp dependency
- adjust local library file paths
--- utils/qvidcap/qvidcap.pro | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
utils/qvidcap/qvidcap.pro +16 -4
@@ -8,29 +8,41 @@ CONFIG += debug greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +# adjust to your local meson build path +MESON_BUILD_PATH = $$PWD/build-meson + # opengl: to disable opengl suppport comment out the following # line and the line '#define HAVE_QTGL 1' from ../../config.h QT += opengl +QMAKE_CFLAGS += -include $$MESON_BUILD_PATH/config.h +QMAKE_CXXFLAGS += -include $$MESON_BUILD_PATH/config.h + INCLUDEPATH += $$PWD/../.. INCLUDEPATH += $$PWD/../common INCLUDEPATH += $$PWD/../v4l2-compliance +v4l2_convert_hook.depends = $$PWD/v4l2-convert.pl $$PWD/v4l2-convert.glsl +v4l2_convert_hook.commands = perl $$PWD/v4l2-convert.pl < $$PWD/v4l2-convert.glsl > v4l2-convert.h +QMAKE_EXTRA_TARGETS += v4l2_convert_hook + # Input HEADERS += capture.h HEADERS += qvidcap.h -HEADERS += ../../config.h +HEADERS += $$MESON_BUILD_PATH/config.h SOURCES += capture.cpp paint.cpp SOURCES += qvidcap.cpp SOURCES += ../common/v4l-stream.c SOURCES += ../common/codec-fwht.c +SOURCES += ../common/codec-v4l2-fwht.c +SOURCES += ../common/v4l2-info.cpp SOURCES += ../common/v4l2-tpg-core.c SOURCES += ../common/v4l2-tpg-colors.c -LIBS += -L$$PWD/../../lib/libv4l2/.libs -lv4l2 -LIBS += -L$$PWD/../../lib/libv4lconvert/.libs -lv4lconvert -LIBS += -L$$PWD/../libv4l2util/.libs -lv4l2util +LIBS += -L$$MESON_BUILD_PATH/lib/libv4l2 -lv4l2 +LIBS += -L$$MESON_BUILD_PATH/lib/libv4lconvert -lv4lconvert +LIBS += -L$$MESON_BUILD_PATH/utils/libv4l2util -lv4l2util LIBS += -lrt -ldl -ljpeg RESOURCES += qvidcap.qrc
Signature · 1 line
2.40.0