|
Packit |
1f69a5 |
/*
|
|
Packit |
1f69a5 |
* GStreamer
|
|
Packit |
1f69a5 |
* Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
|
|
Packit |
1f69a5 |
*
|
|
Packit |
1f69a5 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
1f69a5 |
* modify it under the terms of the GNU Library General Public
|
|
Packit |
1f69a5 |
* License as published by the Free Software Foundation; either
|
|
Packit |
1f69a5 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
1f69a5 |
*
|
|
Packit |
1f69a5 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
1f69a5 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
1f69a5 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
1f69a5 |
* Library General Public License for more details.
|
|
Packit |
1f69a5 |
*
|
|
Packit |
1f69a5 |
* You should have received a copy of the GNU Library General Public
|
|
Packit |
1f69a5 |
* License along with this library; if not, write to the
|
|
Packit |
1f69a5 |
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
Packit |
1f69a5 |
* Boston, MA 02110-1301, USA.
|
|
Packit |
1f69a5 |
*/
|
|
Packit |
1f69a5 |
|
|
Packit |
1f69a5 |
#ifndef __GST_QSG_TEXTURE_H__
|
|
Packit |
1f69a5 |
#define __GST_QSG_TEXTURE_H__
|
|
Packit |
1f69a5 |
|
|
Packit |
1f69a5 |
#include <gst/gst.h>
|
|
Packit |
1f69a5 |
#include <gst/video/video.h>
|
|
Packit |
1f69a5 |
#include <gst/gl/gl.h>
|
|
Packit |
1f69a5 |
|
|
Packit |
1f69a5 |
#include "gstqtgl.h"
|
|
Packit |
1f69a5 |
#include <QtQuick/QSGTexture>
|
|
Packit |
1f69a5 |
#include <QtGui/QOpenGLFunctions>
|
|
Packit |
1f69a5 |
|
|
Packit |
1f69a5 |
class GstQSGTexture : public QSGTexture, protected QOpenGLFunctions
|
|
Packit |
1f69a5 |
{
|
|
Packit |
1f69a5 |
Q_OBJECT
|
|
Packit |
1f69a5 |
public:
|
|
Packit |
1f69a5 |
GstQSGTexture ();
|
|
Packit |
1f69a5 |
~GstQSGTexture ();
|
|
Packit |
1f69a5 |
|
|
Packit |
1f69a5 |
void setCaps (GstCaps * caps);
|
|
Packit |
1f69a5 |
gboolean setBuffer (GstBuffer * buffer);
|
|
Packit |
1f69a5 |
|
|
Packit |
1f69a5 |
/* QSGTexture */
|
|
Packit |
1f69a5 |
void bind ();
|
|
Packit |
1f69a5 |
int textureId () const;
|
|
Packit |
1f69a5 |
QSize textureSize () const;
|
|
Packit |
1f69a5 |
bool hasAlphaChannel () const;
|
|
Packit |
1f69a5 |
bool hasMipmaps () const;
|
|
Packit |
1f69a5 |
|
|
Packit |
1f69a5 |
private:
|
|
Packit |
1f69a5 |
GstBuffer * buffer_;
|
|
Packit |
1f69a5 |
GstBuffer * sync_buffer_;
|
|
Packit |
1f69a5 |
GstGLContext * qt_context_;
|
|
Packit |
1f69a5 |
GstMemory * mem_;
|
|
Packit |
1f69a5 |
GLuint dummy_tex_id_;
|
|
Packit |
1f69a5 |
GstVideoInfo v_info;
|
|
Packit |
1f69a5 |
GstVideoFrame v_frame;
|
|
Packit |
1f69a5 |
};
|
|
Packit |
1f69a5 |
|
|
Packit |
1f69a5 |
#endif /* __GST_QSG_TEXTURE_H__ */
|