QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
gstqml6glsink.cc File Reference
#include "gstqt6elements.h"
#include "gstqml6glsink.h"
#include <QtGui/QGuiApplication>
#include <gst/gl/gstglfuncs.h>
+ Include dependency graph for gstqml6glsink.cc:

Go to the source code of this file.

Macros

#define GST_CAT_DEFAULT   gst_debug_qml6_gl_sink
 
#define DEFAULT_FORCE_ASPECT_RATIO   TRUE
 
#define DEFAULT_PAR_N   0
 
#define DEFAULT_PAR_D   1
 
#define gst_qml6_gl_sink_parent_class   parent_class
 

Enumerations

enum  { ARG_0 , PROP_WIDGET , PROP_FORCE_ASPECT_RATIO , PROP_PIXEL_ASPECT_RATIO }
 
enum  { SIGNAL_0 , LAST_SIGNAL }
 

Functions

 GST_DEBUG_CATEGORY (gst_debug_qml6_gl_sink)
 
static void gst_qml6_gl_sink_navigation_interface_init (GstNavigationInterface *iface)
 
static void gst_qml6_gl_sink_finalize (GObject *object)
 
static void gst_qml6_gl_sink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *param_spec)
 
static void gst_qml6_gl_sink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *param_spec)
 
static gboolean gst_qml6_gl_sink_stop (GstBaseSink *bsink)
 
static gboolean gst_qml6_gl_sink_query (GstBaseSink *bsink, GstQuery *query)
 
static GstStateChangeReturn gst_qml6_gl_sink_change_state (GstElement *element, GstStateChange transition)
 
static void gst_qml6_gl_sink_get_times (GstBaseSink *bsink, GstBuffer *buf, GstClockTime *start, GstClockTime *end)
 
static gboolean gst_qml6_gl_sink_set_caps (GstBaseSink *bsink, GstCaps *caps)
 
static GstFlowReturn gst_qml6_gl_sink_show_frame (GstVideoSink *bsink, GstBuffer *buf)
 
static gboolean gst_qml6_gl_sink_propose_allocation (GstBaseSink *bsink, GstQuery *query)
 
 G_DEFINE_TYPE_WITH_CODE (GstQml6GLSink, gst_qml6_gl_sink, GST_TYPE_VIDEO_SINK, GST_DEBUG_CATEGORY_INIT(gst_debug_qml6_gl_sink, "qtsink", 0, "Qt Video Sink");G_IMPLEMENT_INTERFACE(GST_TYPE_NAVIGATION, gst_qml6_gl_sink_navigation_interface_init))
 
G_BEGIN_DECLS gboolean G_PASTE (gst_element_register_, qml6glsink)(GstPlugin *plugin)
 
static void gst_qml6_gl_sink_class_init (GstQml6GLSinkClass *klass)
 
static void gst_qml6_gl_sink_init (GstQml6GLSink *qt_sink)
 
static void _reset (GstQml6GLSink *qt_sink)
 
static void gst_qml6_gl_sink_navigation_send_event (GstNavigation *navigation, GstStructure *structure)
 

Variables

static GstStaticPadTemplate gst_qt_sink_template
 
 G_END_DECLS
 

Macro Definition Documentation

◆ DEFAULT_FORCE_ASPECT_RATIO

#define DEFAULT_FORCE_ASPECT_RATIO   TRUE

Definition at line 117 of file gstqml6glsink.cc.

◆ DEFAULT_PAR_D

#define DEFAULT_PAR_D   1

Definition at line 119 of file gstqml6glsink.cc.

◆ DEFAULT_PAR_N

#define DEFAULT_PAR_N   0

Definition at line 118 of file gstqml6glsink.cc.

◆ GST_CAT_DEFAULT

#define GST_CAT_DEFAULT   gst_debug_qml6_gl_sink

SECTION:gstqml6glsink

qml6glsink provides a way to render a video stream as a Qml object inside the Qml scene graph. This is achieved by providing the incoming OpenGL textures to Qt as a scene graph object.

qml6glsink will attempt to retrieve the windowing system display connection that Qt is using (#GstGLDisplay). This may be different to any already existing window system display connection already in use in the pipeline for a number of reasons. A couple of examples of this are:

  1. Adding qml6glsink to an already running pipeline
  2. Not having any qml6glsink element start up before any other OpenGL-based element in the pipeline.

If one of these scenarios occurs, then there will be multiple OpenGL contexts in use in the pipeline. This means that either the pipeline will fail to start up correctly, a downstream element may reject buffers, or a complete GPU->System memory->GPU transfer is performed for every buffer.

The requirement to avoid this is that all elements share the same #GstGLDisplay object and as Qt cannot currently share an existing window system display connection, GStreamer must use the window system display connection provided by Qt. This window system display connection can be retrieved by either a qmlglsink element or a qmlgloverlay element. The recommended usage is to have either element (qmlglsink or qmlgloverlay) be the first to propagate the #GstGLDisplay for the entire pipeline to use by setting either element to the READY element state before any other OpenGL element in the pipeline.

In a dynamically adding qmlglsink (or qmlgloverlay) to a pipeline case, there are some considerations for ensuring that the window system display and OpenGL contexts are compatible with Qt. When the qmlgloverlay (or qmlglsink) element is added and brought up to READY, it will propagate it's own #GstGLDisplay using the #GstContext mechanism regardless of any existing #GstGLDisplay used by the pipeline previously. In order for the new #GstGLDisplay to be used, the application must then set the provided #GstGLDisplay containing #GstContext on the pipeline. This may effectively cause each OpenGL element to replace the window system display and also the OpenGL context it is using. As such this process may take a significant amount of time and resources as objects are recreated in the new OpenGL context.

All instances of qmlglsink and qmlgloverlay will return the exact same #GstGLDisplay object while the pipeline is running regardless of whether any qmlglsink or qmlgloverlay elements are added or removed from the pipeline.

Definition at line 81 of file gstqml6glsink.cc.

◆ gst_qml6_gl_sink_parent_class

#define gst_qml6_gl_sink_parent_class   parent_class

Definition at line 135 of file gstqml6glsink.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ARG_0 
PROP_WIDGET 
PROP_FORCE_ASPECT_RATIO 
PROP_PIXEL_ASPECT_RATIO 

Definition at line 121 of file gstqml6glsink.cc.

◆ anonymous enum

anonymous enum
Enumerator
SIGNAL_0 
LAST_SIGNAL 

Definition at line 129 of file gstqml6glsink.cc.

Function Documentation

◆ _reset()

static void _reset ( GstQml6GLSink *  qt_sink)
static

Definition at line 247 of file gstqml6glsink.cc.

Referenced by gst_qml6_gl_sink_finalize().

◆ G_DEFINE_TYPE_WITH_CODE()

G_DEFINE_TYPE_WITH_CODE ( GstQml6GLSink  ,
gst_qml6_gl_sink  ,
GST_TYPE_VIDEO_SINK  ,
GST_DEBUG_CATEGORY_INIT(gst_debug_qml6_gl_sink, "qtsink", 0, "Qt Video Sink");G_IMPLEMENT_INTERFACE(GST_TYPE_NAVIGATION, gst_qml6_gl_sink_navigation_interface_init  
)

◆ G_PASTE()

G_BEGIN_DECLS gboolean G_PASTE ( gst_element_register_  ,
qml6glsink   
)

Definition at line 141 of file gstqml6glsink.cc.

References qt6_element_init().

◆ GST_DEBUG_CATEGORY()

GST_DEBUG_CATEGORY ( gst_debug_qml6_gl_sink  )

◆ gst_qml6_gl_sink_change_state()

static GstStateChangeReturn gst_qml6_gl_sink_change_state ( GstElement element,
GstStateChange  transition 
)
static

Definition at line 344 of file gstqml6glsink.cc.

Referenced by gst_qml6_gl_sink_class_init().

◆ gst_qml6_gl_sink_class_init()

◆ gst_qml6_gl_sink_finalize()

static void gst_qml6_gl_sink_finalize ( GObject *  object)
static

Definition at line 266 of file gstqml6glsink.cc.

References _reset().

Referenced by gst_qml6_gl_sink_class_init().

◆ gst_qml6_gl_sink_get_property()

static void gst_qml6_gl_sink_get_property ( GObject *  object,
guint  prop_id,
GValue *  value,
GParamSpec *  param_spec 
)
static

◆ gst_qml6_gl_sink_get_times()

static void gst_qml6_gl_sink_get_times ( GstBaseSink *  bsink,
GstBuffer *  buf,
GstClockTime *  start,
GstClockTime *  end 
)
static

Definition at line 425 of file gstqml6glsink.cc.

Referenced by gst_qml6_gl_sink_class_init().

◆ gst_qml6_gl_sink_init()

static void gst_qml6_gl_sink_init ( GstQml6GLSink *  qt_sink)
static

Definition at line 205 of file gstqml6glsink.cc.

◆ gst_qml6_gl_sink_navigation_interface_init()

static void gst_qml6_gl_sink_navigation_interface_init ( GstNavigationInterface *  iface)
static

Definition at line 573 of file gstqml6glsink.cc.

References gst_qml6_gl_sink_navigation_send_event().

◆ gst_qml6_gl_sink_navigation_send_event()

static void gst_qml6_gl_sink_navigation_send_event ( GstNavigation *  navigation,
GstStructure *  structure 
)
static

Definition at line 564 of file gstqml6glsink.cc.

Referenced by gst_qml6_gl_sink_navigation_interface_init().

◆ gst_qml6_gl_sink_propose_allocation()

static gboolean gst_qml6_gl_sink_propose_allocation ( GstBaseSink *  bsink,
GstQuery *  query 
)
static

Definition at line 475 of file gstqml6glsink.cc.

Referenced by gst_qml6_gl_sink_class_init().

◆ gst_qml6_gl_sink_query()

static gboolean gst_qml6_gl_sink_query ( GstBaseSink *  bsink,
GstQuery *  query 
)
static

Definition at line 315 of file gstqml6glsink.cc.

Referenced by gst_qml6_gl_sink_class_init().

◆ gst_qml6_gl_sink_set_caps()

gboolean gst_qml6_gl_sink_set_caps ( GstBaseSink *  bsink,
GstCaps *  caps 
)
static

Definition at line 446 of file gstqml6glsink.cc.

Referenced by gst_qml6_gl_sink_class_init().

◆ gst_qml6_gl_sink_set_property()

static void gst_qml6_gl_sink_set_property ( GObject *  object,
guint  prop_id,
const GValue *  value,
GParamSpec *  param_spec 
)
static

◆ gst_qml6_gl_sink_show_frame()

static GstFlowReturn gst_qml6_gl_sink_show_frame ( GstVideoSink *  bsink,
GstBuffer *  buf 
)
static

Definition at line 462 of file gstqml6glsink.cc.

Referenced by gst_qml6_gl_sink_class_init().

◆ gst_qml6_gl_sink_stop()

static gboolean gst_qml6_gl_sink_stop ( GstBaseSink *  bsink)
static

Definition at line 338 of file gstqml6glsink.cc.

Referenced by gst_qml6_gl_sink_class_init().

Variable Documentation

◆ G_END_DECLS

G_END_DECLS

Definition at line 150 of file gstqml6glsink.cc.

◆ gst_qt_sink_template

GstStaticPadTemplate gst_qt_sink_template
static
Initial value:
=
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
"format = (string) { RGB, RGBA }, "
"width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", "
"framerate = " GST_VIDEO_FPS_RANGE ", "
"texture-target = (string) 2D"))

Definition at line 106 of file gstqml6glsink.cc.

Referenced by gst_qml6_gl_sink_class_init().