diff options
author | Andrew den Exter <andrew.den.exter@jollamobile.com> | 2014-04-17 22:50:13 +1000 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@digia.com> | 2014-07-18 16:03:52 +0200 |
commit | 39c269441421e1e61fbfc698b65f769db82cad56 (patch) | |
tree | f257195b0bf1a86430d04f12ac522c8c6185c2e7 /src/plugins/videonode/egl/qsgvideonode_egl.h | |
parent | 888759e334e81117843afb6d0f8991db8aec5ca8 (diff) |
Add an EGLImageKHR video node.
[ChangeLog] Added a VideoNode plugin which allows direct rendering of
EGLImageKHR backed video frames.
Change-Id: I36fb6fd27680dbe9c71a446bbd54df95488725f8
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/plugins/videonode/egl/qsgvideonode_egl.h')
-rw-r--r-- | src/plugins/videonode/egl/qsgvideonode_egl.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/src/plugins/videonode/egl/qsgvideonode_egl.h b/src/plugins/videonode/egl/qsgvideonode_egl.h new file mode 100644 index 000000000..23294a123 --- /dev/null +++ b/src/plugins/videonode/egl/qsgvideonode_egl.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Jolla Ltd. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef EGLVIDEONODE_H +#define EGLVIDEONODE_H + +#include <private/qsgvideonode_p.h> + +#include <QSGOpaqueTextureMaterial> +#include <QSGTexture> + +#include <EGL/egl.h> +#include <EGL/eglext.h> + +QT_BEGIN_NAMESPACE + +class QSGVideoMaterial_EGL : public QSGMaterial +{ +public: + QSGVideoMaterial_EGL(); + ~QSGVideoMaterial_EGL(); + + QSGMaterialShader *createShader() const; + QSGMaterialType *type() const; + int compare(const QSGMaterial *other) const; + + void setImage(EGLImageKHR image); + +private: + friend class QSGVideoMaterial_EGLShader; + + QRectF m_subrect; + EGLImageKHR m_image; + GLuint m_textureId; +}; + +class QSGVideoNode_EGL : public QSGVideoNode +{ +public: + QSGVideoNode_EGL(const QVideoSurfaceFormat &format); + ~QSGVideoNode_EGL(); + + void setCurrentFrame(const QVideoFrame &frame); + QVideoFrame::PixelFormat pixelFormat() const; + +private: + QSGVideoMaterial_EGL m_material; + QVideoFrame::PixelFormat m_pixelFormat; +}; + +class QSGVideoNodeFactory_EGL : public QSGVideoNodeFactoryPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.qt.sgvideonodefactory/5.2" FILE "egl.json") +public: + QList<QVideoFrame::PixelFormat> supportedPixelFormats( + QAbstractVideoBuffer::HandleType handleType) const; + QSGVideoNode *createNode(const QVideoSurfaceFormat &format); +}; + +QT_END_NAMESPACE + +#endif + |