2015-07-06 13:10:51 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2023-07-20 11:12:55 +00:00
|
|
|
#ifndef __GST_QSG_MATERIAL_H__
|
|
|
|
#define __GST_QSG_MATERIAL_H__
|
2015-07-06 13:10:51 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/video/video.h>
|
2015-08-08 15:28:03 +00:00
|
|
|
#include <gst/gl/gl.h>
|
2015-07-06 13:10:51 +00:00
|
|
|
|
2015-09-02 13:45:07 +00:00
|
|
|
#include "gstqtgl.h"
|
2023-07-20 11:12:55 +00:00
|
|
|
#include <QtQuick/QSGMaterial>
|
|
|
|
#include <QtQuick/QSGMaterialShader>
|
2015-09-14 17:14:37 +00:00
|
|
|
#include <QtGui/QOpenGLFunctions>
|
2023-07-20 11:12:55 +00:00
|
|
|
#include <QtGui/QOpenGLShaderProgram>
|
2015-09-02 13:45:07 +00:00
|
|
|
|
2023-07-20 11:12:55 +00:00
|
|
|
class GstQSGMaterialShader;
|
|
|
|
|
|
|
|
class GstQSGMaterial : public QSGMaterial
|
2015-07-06 13:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2023-07-20 11:12:55 +00:00
|
|
|
GstQSGMaterial ();
|
|
|
|
~GstQSGMaterial ();
|
2015-07-06 13:10:51 +00:00
|
|
|
|
|
|
|
void setCaps (GstCaps * caps);
|
2015-08-08 15:28:03 +00:00
|
|
|
gboolean setBuffer (GstBuffer * buffer);
|
2020-11-03 13:58:30 +00:00
|
|
|
GstBuffer * getBuffer (gboolean * was_bound);
|
2023-07-20 11:12:55 +00:00
|
|
|
bool compatibleWith(GstVideoInfo *v_info);
|
|
|
|
|
|
|
|
void bind(GstQSGMaterialShader *);
|
2015-07-06 13:10:51 +00:00
|
|
|
|
2023-07-20 11:12:55 +00:00
|
|
|
/* QSGMaterial */
|
|
|
|
QSGMaterialType *type() const override { static QSGMaterialType type; return &type; };
|
|
|
|
QSGMaterialShader *createShader() const override;
|
2015-07-06 13:10:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
GstBuffer * buffer_;
|
2020-11-03 13:58:30 +00:00
|
|
|
gboolean buffer_was_bound;
|
2015-08-08 15:28:03 +00:00
|
|
|
GstBuffer * sync_buffer_;
|
2021-07-30 09:52:23 +00:00
|
|
|
GWeakRef qt_context_ref_;
|
2015-08-08 15:28:03 +00:00
|
|
|
GstMemory * mem_;
|
2015-07-06 13:10:51 +00:00
|
|
|
GstVideoInfo v_info;
|
|
|
|
GstVideoFrame v_frame;
|
2023-07-20 11:12:55 +00:00
|
|
|
float *cms_offset;
|
|
|
|
float *cms_ycoeff;
|
|
|
|
float *cms_ucoeff;
|
|
|
|
float *cms_vcoeff;
|
|
|
|
guint dummy_textures[GST_VIDEO_MAX_PLANES];
|
2015-07-06 13:10:51 +00:00
|
|
|
};
|
|
|
|
|
2023-07-20 11:12:55 +00:00
|
|
|
#endif /* __GST_QSG_MATERIAL_H__ */
|