File indexing completed on 2025-01-19 03:57:02
0001 /********************************************************* 0002 * Copyright (C) 2020, Val Doroshchuk <valbok@gmail.com> * 0003 * * 0004 * This file is part of QtAVPlayer. * 0005 * Free Qt Media Player based on FFmpeg. * 0006 *********************************************************/ 0007 0008 #ifndef QAVANDROIDSURFACETEXTURE_H 0009 #define QAVANDROIDSURFACETEXTURE_H 0010 0011 // 0012 // W A R N I N G 0013 // ------------- 0014 // 0015 // This file is not part of the Qt API. It exists purely as an 0016 // implementation detail. This header file may change from version to 0017 // version without notice, or even be removed. 0018 // 0019 // We mean it. 0020 // 0021 0022 #include <qobject.h> 0023 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 0024 #include <QtCore/private/qjni_p.h> 0025 #include <QtCore/private/qjnihelpers_p.h> 0026 using JniObject = QJNIObjectPrivate; 0027 using JniEnvironment = QJNIEnvironmentPrivate; 0028 #else 0029 #include <QtCore/qjniobject.h> 0030 using JniObject = QJniObject; 0031 using JniEnvironment = QJniEnvironment; 0032 #endif 0033 0034 #include <QMatrix4x4> 0035 0036 QT_BEGIN_NAMESPACE 0037 0038 class QAVAndroidSurfaceTexture 0039 { 0040 public: 0041 explicit QAVAndroidSurfaceTexture(quint32 texName = 0); 0042 ~QAVAndroidSurfaceTexture(); 0043 0044 jobject surfaceTexture(); 0045 jobject surface(); 0046 inline bool isValid() const { return m_surfaceTexture.isValid(); } 0047 0048 void release(); // API level 14 0049 void updateTexImage(); 0050 0051 void attachToGLContext(quint32 texName); // API level 16 0052 void detachFromGLContext(); // API level 16 0053 0054 private: 0055 JniObject m_surfaceTexture; 0056 JniObject m_surface; 0057 }; 0058 0059 QT_END_NAMESPACE 0060 0061 #endif // QAVANDROIDSURFACETEXTURE_H