Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
mediabackendutils_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef MEDIABACKENDUTILS_H
5#define MEDIABACKENDUTILS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtTest/qtestcase.h>
19#include <private/qplatformmediaintegration_p.h>
20#include <QtGui/private/qguiapplication_p.h>
21#include <QtGui/qpa/qplatformintegration.h>
22
24
25using namespace Qt::Literals;
26
28{
29 return QPlatformMediaIntegration::instance()->name() == "gstreamer"_L1;
30}
31
32inline bool isQNXPlatform()
33{
34 return QPlatformMediaIntegration::instance()->name() == "qnx"_L1;
35}
36
37inline bool isDarwinPlatform()
38{
39 return QPlatformMediaIntegration::instance()->name() == "darwin"_L1;
40}
41
42inline bool isAndroidPlatform()
43{
44 return QPlatformMediaIntegration::instance()->name() == "android"_L1;
45}
46
47inline bool isFFMPEGPlatform()
48{
49 return QPlatformMediaIntegration::instance()->name() == "ffmpeg"_L1;
50}
51
52inline bool isWindowsPlatform()
53{
54 return QPlatformMediaIntegration::instance()->name() == "windows"_L1;
55}
56
58{
59 return QGuiApplicationPrivate::platformIntegration()->hasCapability(
60 QPlatformIntegration::RhiBasedRendering);
61}
62
63inline bool isOpenGLSupported()
64{
65 return QGuiApplicationPrivate::platformIntegration()->hasCapability(
66 QPlatformIntegration::OpenGL);
67}
68
69inline bool isCI()
70{
71 return qEnvironmentVariable("QTEST_ENVIRONMENT").toLower().split(u' ').contains(u"ci"_s);
72}
73
74} // namespace BackendUtilsImpl
75
76using namespace BackendUtilsImpl;
77
78#define QSKIP_IF(checker, defaultMessage, /*messageOpt*/...)
79 do {
80 if (checker)
81 QSKIP(strlen(__VA_ARGS__ "") ? __VA_ARGS__ "" : defaultMessage);
82 } while (0)
83
84#define QSKIP_GSTREAMER(/*messageOpt*/...)
85 QSKIP_IF(isGStreamerPlatform(), "The feature is not supported on GStreamer", __VA_ARGS__)
86
87#define QSKIP_IF_NOT_FFMPEG(/*messageOpt*/...)
88 QSKIP_IF(!isFFMPEGPlatform(), "The feature is only supported on FFmpeg", __VA_ARGS__)
89
90#define QSKIP_FFMPEG(/*messageOpt*/...)
91 QSKIP_IF(isFFMPEGPlatform(), "The feature is not supported on FFmpeg", __VA_ARGS__)
92
93#define QEXPECT_FAIL_GSTREAMER(dataIndex, comment, mode)
94 do {
95 if (isGStreamerPlatform())
96 QEXPECT_FAIL(dataIndex, comment, mode);
97 } while (0)
98
99#endif // MEDIABACKENDUTILS_H
#define QSKIP_IF(checker, defaultMessage,...)