summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs/deviceintegration
diff options
context:
space:
mode:
authorBoubacar DIENE <boubacar.diene@gmail.com>2019-01-31 00:12:16 +0100
committerJohan Helsing <johan.helsing@qt.io>2019-02-06 07:36:34 +0000
commitb319d141105044f612ada1efe62685b2c5dd4514 (patch)
tree1d5ee9c5c08f3e651a42b6f59ab6f64ea1995221 /src/plugins/platforms/eglfs/deviceintegration
parenteb60877fe96d82d9d6e1a834857744799e6de4db (diff)
Fix "error: too many arguments to function media_get_entity_by_name()"
Since the official v4l-utils-1.12.0 release, media_get_entity_by_name() function expects only two arguments instead of three as in older versions thus breaking build of eglfs_kms_vsp2 backend. Cf. https://git.linuxtv.org/v4l-utils.git/tree/utils/media-ctl/mediactl.h#n253 Fixes it by creating an overloaded wrapper function that will choose the right version based on the signature of the media_get_entity_by_name function pointer argument. Fixes: QTBUG-73427 Change-Id: Idab52558b6f2f23137456c21e33ece1ef0e9aa4e Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/plugins/platforms/eglfs/deviceintegration')
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.cpp
index 25b0c39050..f77430d7a0 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.cpp
@@ -273,9 +273,30 @@ bool QLinuxMediaDevice::disableLink(struct media_link *link)
return true;
}
-media_entity *QLinuxMediaDevice::getEntity(const QString &name)
+// Between the v4l-utils 1.10 and 1.12 releases, media_get_entity_by_name changed signature,
+// i.e. breaking source compatibility. Unfortunately the v4l-utils version is not exposed
+// through anything we can use through a regular ifdef so here we do a hack and create two
+// overloads for a function based on the signature of the function pointer argument. This
+// means that by calling safeGetEntity with media_get_entity_by_name as an argument, the
+// compiler will pick the correct version.
+//
+// v4l-utils v1.12 and later
+static struct media_entity *safeGetEntity(struct media_entity *(get_entity_by_name_fn)(struct media_device *, const char *),
+ struct media_device *device, const QString &name)
{
- struct media_entity *entity = media_get_entity_by_name(m_mediaDevice, name.toStdString().c_str(), name.length());
+ return get_entity_by_name_fn(device, name.toStdString().c_str());
+}
+// v4l-utils v1.10 and earlier
+static struct media_entity *safeGetEntity(struct media_entity *(get_entity_by_name_fn)(struct media_device *, const char *, size_t),
+ struct media_device *device,
+ const QString &name)
+{
+ return get_entity_by_name_fn(device, name.toStdString().c_str(), name.length());
+}
+
+struct media_entity *QLinuxMediaDevice::getEntity(const QString &name)
+{
+ struct media_entity *entity = safeGetEntity(media_get_entity_by_name, m_mediaDevice, name);
if (!entity)
qWarning() << "Failed to get media entity:" << name;