diff mbox

[v2,2/3] qv4l2: fix qt5 compile

Message ID 1417810645-21753-2-git-send-email-ps.report@gmx.net (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Seiderer Dec. 5, 2014, 8:17 p.m. UTC
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 utils/qv4l2/capture-win-qt.cpp |  4 ++++
 utils/qv4l2/qv4l2.cpp          | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)
diff mbox

Patch

diff --git a/utils/qv4l2/capture-win-qt.cpp b/utils/qv4l2/capture-win-qt.cpp
index db85cd2..9c849a0 100644
--- a/utils/qv4l2/capture-win-qt.cpp
+++ b/utils/qv4l2/capture-win-qt.cpp
@@ -117,7 +117,11 @@  void CaptureWinQt::paintFrame()
 void CaptureWinQt::stop()
 {
 	if (m_data != NULL)
+#if QT_VERSION >= 0x050000
+		memcpy(m_image->bits(), m_data, m_image->byteCount());
+#else
 		memcpy(m_image->bits(), m_data, m_image->numBytes());
+#endif
 	m_data = NULL;
 }
 
diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp
index 0784a15..8329cbd 100644
--- a/utils/qv4l2/qv4l2.cpp
+++ b/utils/qv4l2/qv4l2.cpp
@@ -1084,8 +1084,13 @@  void ApplicationWindow::startAudio()
 	QString audOut = m_genTab->getAudioOutDevice();
 
 	if (audIn != NULL && audOut != NULL && audIn.compare("None") && audIn.compare(audOut) != 0) {
+#if QT_VERSION >= 0x050000
+		alsa_thread_startup(audOut.toLatin1().data(), audIn.toLatin1().data(),
+				    m_genTab->getAudioDeviceBufferSize(), NULL, 0);
+#else
 		alsa_thread_startup(audOut.toAscii().data(), audIn.toAscii().data(),
 				    m_genTab->getAudioDeviceBufferSize(), NULL, 0);
+#endif
 
 		if (m_genTab->isRadio())
 			statusBar()->showMessage("Capturing audio");
@@ -1582,7 +1587,11 @@  void ApplicationWindow::error(const QString &error)
 {
 	statusBar()->showMessage(error, 20000);
 	if (!error.isEmpty())
+#if QT_VERSION >= 0x050000
+		fprintf(stderr, "%s\n", error.toLatin1().data());
+#else
 		fprintf(stderr, "%s\n", error.toAscii().data());
+#endif
 }
 
 void ApplicationWindow::error(int err)
@@ -1657,7 +1666,11 @@  static bool processShortOption(const QStringList &args, int &i, QString &dev)
 		return false;
 	if (args[i].length() == 2) {
 		if (i + 1 >= args.size()) {
+#if QT_VERSION >= 0x050000
+			usageError(args[i].toLatin1());
+#else
 			usageError(args[i].toAscii());
+#endif
 			return false;
 		}
 		dev = args[++i];
@@ -1680,7 +1693,11 @@  static bool processLongOption(const QStringList &args, int &i, QString &dev)
 		return true;
 	}
 	if (i + 1 >= args.size()) {
+#if QT_VERSION >= 0x050000
+		usageError(args[i].toLatin1());
+#else
 		usageError(args[i].toAscii());
+#endif
 		return false;
 	}
 	dev = args[++i];
@@ -1734,7 +1751,11 @@  int main(int argc, char **argv)
 		} else if (args[i] == "-R" || args[i] == "--raw") {
 			raw = true;
 		} else {
+#if QT_VERSION >= 0x050000
+			printf("Invalid argument %s\n", args[i].toLatin1().data());
+#else
 			printf("Invalid argument %s\n", args[i].toAscii().data());
+#endif
 			return 0;
 		}
 	}