summaryrefslogtreecommitdiffstats
path: root/src/plugins/android/src/common/qandroidvideorendercontrol.h
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@digia.com>2013-09-27 11:24:10 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-01 17:26:21 +0200
commitbe7a6241e77f67e4a19c63ac5683dd7fa566e9d2 (patch)
treeab8b66b5124d4a982d7690cf7893a40650bccc8d /src/plugins/android/src/common/qandroidvideorendercontrol.h
parent329d9d4563445d785284a02983e237ff1a07f5dd (diff)
Android: refactor video renderer.
Removed the overhead of having to create a shared OpenGL context in the GUI thread and pre-render the frame into a FBO. We now directly render the GL_TEXTURE_EXTERNAL_OES in the QtQuick render thread, using an Android-specific QSGVideoNode. We also use a callback from the render thread to create the texture from there and not have to create a separate shared OpenGL context. Change-Id: I6c8eb94b47d0a03329c912701b8af3fb5ebd1876 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
Diffstat (limited to 'src/plugins/android/src/common/qandroidvideorendercontrol.h')
-rw-r--r--src/plugins/android/src/common/qandroidvideorendercontrol.h35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/plugins/android/src/common/qandroidvideorendercontrol.h b/src/plugins/android/src/common/qandroidvideorendercontrol.h
index 25220310e..e98495ede 100644
--- a/src/plugins/android/src/common/qandroidvideorendercontrol.h
+++ b/src/plugins/android/src/common/qandroidvideorendercontrol.h
@@ -48,15 +48,23 @@
QT_BEGIN_NAMESPACE
-class QOpenGLContext;
-class QOffscreenSurface;
-class QOpenGLFramebufferObject;
-class QOpenGLShaderProgram;
class JSurfaceTextureHolder;
+class TextureDeleter : public QObject
+{
+ Q_OBJECT
+public:
+ TextureDeleter(uint id) : m_id(id) { }
+ ~TextureDeleter();
+
+private:
+ uint m_id;
+};
+
class QAndroidVideoRendererControl : public QVideoRendererControl, public QAndroidVideoOutput
{
Q_OBJECT
+ Q_INTERFACES(QAndroidVideoOutput)
public:
explicit QAndroidVideoRendererControl(QObject *parent = 0);
~QAndroidVideoRendererControl() Q_DECL_OVERRIDE;
@@ -65,38 +73,31 @@ public:
void setSurface(QAbstractVideoSurface *surface) Q_DECL_OVERRIDE;
jobject surfaceHolder() Q_DECL_OVERRIDE;
- bool isTextureReady() Q_DECL_OVERRIDE;
- void setTextureReadyCallback(TextureReadyCallback cb, void *context = 0) Q_DECL_OVERRIDE;
jobject surfaceTexture() Q_DECL_OVERRIDE;
+ bool isReady() Q_DECL_OVERRIDE;
void setVideoSize(const QSize &size) Q_DECL_OVERRIDE;
void stop() Q_DECL_OVERRIDE;
QImage toImage() Q_DECL_OVERRIDE;
- bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
+ void customEvent(QEvent *) Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void readyChanged(bool);
private Q_SLOTS:
void onFrameAvailable();
private:
bool initSurfaceTexture();
- void renderFrameToFbo();
- void createGLResources();
QAbstractVideoSurface *m_surface;
- QOffscreenSurface *m_offscreenSurface;
- QOpenGLContext *m_glContext;
- QOpenGLFramebufferObject *m_fbo;
- QOpenGLShaderProgram *m_program;
- bool m_useImage;
QSize m_nativeSize;
QJNIObjectPrivate *m_androidSurface;
JSurfaceTexture *m_surfaceTexture;
JSurfaceTextureHolder *m_surfaceHolder;
uint m_externalTex;
-
- TextureReadyCallback m_textureReadyCallback;
- void *m_textureReadyContext;
+ TextureDeleter *m_textureDeleter;
};
QT_END_NAMESPACE