Revision control
+ // Copyright (C) 2026 The Qt Company Ltd.
+ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+ #ifndef QEGLIMAGEFUNCTIONS_P_H
+ #define QEGLIMAGEFUNCTIONS_P_H
+
+ //
+ // W A R N I N G
+ // -------------
+ //
+ // This file is not part of the Qt API. It exists purely as an
+ // implementation detail. This header file may change from version to
+ // version without notice, or even be removed.
+ //
+ // We mean it.
+ //
+
+ #include <QtMultimedia/private/qtmultimediaglobal_p.h>
+ #include <QtGui/qopengl.h>
+ #include <QtCore/qspan.h>
+
+ #include <EGL/egl.h>
+ #include <EGL/eglext.h>
+
+ QT_BEGIN_NAMESPACE
+
+ namespace QtMultimediaPrivate {
+
+ class Q_MULTIMEDIA_EXPORT QEglImageFunctions
+ {
+ QEglImageFunctions();
+
+ public:
+ static const QEglImageFunctions &instance();
+
+ bool isValid() const;
+
+ void glEGLImageTargetTexture2DOES(GLenum, GLeglImageOES) const;
+
+ EGLImage eglCreateImage(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer,
+ QSpan<const EGLAttrib> attribs = {}) const;
+ EGLBoolean eglDestroyImage(EGLDisplay, EGLImage) const;
+
+ private:
+ #ifdef GL_OES_EGL_image
+ const PFNGLEGLIMAGETARGETTEXTURE2DOESPROC m_glEGLImageTargetTexture2DOES = nullptr;
+ #endif
+
+ #ifdef EGL_VERSION_1_5
+ // egl.h declares eglCreateImage/eglDestroyImage, but the egl library may not provide the
+ // symbols, so we need to resolve them at run-time.
+
+ // NB: android does not declare these function pointer types
+ typedef EGLImage(EGLAPIENTRYP PFNEGLCREATEIMAGEPROC)(EGLDisplay, EGLContext, EGLenum,
+ EGLClientBuffer, const EGLAttrib *);
+ typedef EGLBoolean(EGLAPIENTRYP PFNEGLDESTROYIMAGEPROC)(EGLDisplay, EGLImage);
+
+ const PFNEGLCREATEIMAGEPROC m_eglCreateImage = nullptr;
+ const PFNEGLDESTROYIMAGEPROC m_eglDestroyImage = nullptr;
+ #endif
+ #if defined(EGL_KHR_image)
+ const PFNEGLCREATEIMAGEKHRPROC m_eglCreateImageKHR = nullptr;
+ const PFNEGLDESTROYIMAGEKHRPROC m_eglDestroyImageKHR = nullptr;
+ #endif
+ };
+
+ } // namespace QtMultimediaPrivate
+
+ QT_END_NAMESPACE
+
+ #endif // QEGLIMAGEFUNCTIONS_P_H