mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
03cf7f6445
In qml6glsrc, we capture the application by copying the back buffer into our own FBO. The afterRendering() signal is too soon as from the apitrace, the application has been rendered into a QT internal buffer, to be used as a cache for refresh. Use afterFrameEnd() signal instead. This works with no delay on GLES. With GL it seems to reduce from 2 to 1 frame delay (this may be platform specific). A different recording technique would need to be used to completely remove this delay. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7351>
69 lines
2.4 KiB
C++
69 lines
2.4 KiB
C++
/*
|
|
* GStreamer
|
|
* Copyright (C) 2016 Freescale Semiconductor, Inc. All rights reserved.
|
|
* Copyright (C) 2022 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.
|
|
*/
|
|
|
|
#ifndef __QT6_GL_WINDOW_H__
|
|
#define __QT6_GL_WINDOW_H__
|
|
|
|
#include <gst/gst.h>
|
|
#include <gst/gl/gl.h>
|
|
|
|
#include "gstqt6gl.h"
|
|
#include <QtQuick/QQuickWindow>
|
|
#include <QtGui/QOpenGLContext>
|
|
#include <QtGui/QOpenGLFunctions>
|
|
|
|
typedef struct _Qt6GLWindowPrivate Qt6GLWindowPrivate;
|
|
|
|
class Qt6GLWindow : public QQuickWindow, protected QOpenGLFunctions
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
Qt6GLWindow (QWindow * parent = NULL, QQuickWindow *source = NULL);
|
|
~Qt6GLWindow ();
|
|
bool getGeometry (int * width, int * height);
|
|
|
|
/* private for C interface ... */
|
|
Qt6GLWindowPrivate *priv;
|
|
|
|
private Q_SLOTS:
|
|
void beforeRendering ();
|
|
void afterFrameEnd ();
|
|
void onSceneGraphInitialized ();
|
|
void onSceneGraphInvalidated ();
|
|
|
|
private:
|
|
QQuickWindow * source;
|
|
};
|
|
|
|
extern "C"
|
|
{
|
|
GstBuffer * qt6_gl_window_take_buffer (Qt6GLWindow * qt6_window, GstCaps ** updated_caps);
|
|
GstGLContext * qt6_gl_window_get_qt_context (Qt6GLWindow * qt6_window);
|
|
GstGLContext * qt6_gl_window_get_context (Qt6GLWindow * qt6_window);
|
|
gboolean qt6_gl_window_set_context (Qt6GLWindow * qt6_window, GstGLContext * context);
|
|
GstGLDisplay * qt6_gl_window_get_display (Qt6GLWindow * qt6_window);
|
|
gboolean qt6_gl_window_is_scenegraph_initialized (Qt6GLWindow * qt6_window);
|
|
void qt6_gl_window_use_default_fbo (Qt6GLWindow * qt6_window, gboolean useDefaultFbo);
|
|
void qt6_gl_window_unlock(Qt6GLWindow* qt6_window);
|
|
void qt6_gl_window_unlock_stop(Qt6GLWindow* qt6_window);
|
|
}
|
|
|
|
#endif /* __QT6_GL_WINDOW_H__ */
|