mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-03 15:06:34 +00:00
qt: allow per feature registration
Split plugin into features including dynamic types which can be indiviually registered during a static build. More details here: https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199 https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/876>
This commit is contained in:
parent
801a2243e5
commit
6cbba1e470
8 changed files with 100 additions and 18 deletions
|
@ -22,32 +22,22 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gstqtoverlay.h"
|
#include "gstqtelements.h"
|
||||||
#include "gstqtsink.h"
|
#include "qtitem.h"
|
||||||
#include "gstqtsrc.h"
|
|
||||||
#include <QtQml/QQmlApplicationEngine>
|
#include <QtQml/QQmlApplicationEngine>
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
if (!gst_element_register (plugin, "qmlglsink",
|
gboolean ret = FALSE;
|
||||||
GST_RANK_NONE, GST_TYPE_QT_SINK)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "qmlglsrc",
|
ret |= GST_ELEMENT_REGISTER (qmlglsink, plugin);
|
||||||
GST_RANK_NONE, GST_TYPE_QT_SRC)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "qmlgloverlay",
|
ret |= GST_ELEMENT_REGISTER (qmlglsrc, plugin);
|
||||||
GST_RANK_NONE, GST_TYPE_QT_OVERLAY)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
/* this means the plugin must be loaded before the qml engine is loaded */
|
|
||||||
qmlRegisterType<QtGLVideoItem> ("org.freedesktop.gstreamer.GLVideoItem", 1, 0, "GstGLVideoItem");
|
|
||||||
|
|
||||||
return TRUE;
|
ret |= GST_ELEMENT_REGISTER (qmlgloverlay, plugin);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GST_PACKAGE_NAME
|
#ifndef GST_PACKAGE_NAME
|
||||||
|
|
39
ext/qt/gstqtelement.cc
Normal file
39
ext/qt/gstqtelement.cc
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gstqtelements.h"
|
||||||
|
#include "qtitem.h"
|
||||||
|
#include <QtQml/QQmlApplicationEngine>
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
qt5_element_init (GstPlugin * plugin)
|
||||||
|
{
|
||||||
|
static gsize res = FALSE;
|
||||||
|
if (g_once_init_enter (&res)) {
|
||||||
|
/* this means the plugin must be loaded before the qml engine is loaded */
|
||||||
|
qmlRegisterType<QtGLVideoItem> ("org.freedesktop.gstreamer.GLVideoItem", 1, 0, "GstGLVideoItem");
|
||||||
|
g_once_init_leave (&res, TRUE);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
35
ext/qt/gstqtelements.h
Normal file
35
ext/qt/gstqtelements.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Huawei Technologies Co., Ltd.
|
||||||
|
* @Author: Julian Bouzas <julian.bouzas@collabora.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 __GST_QT_ELEMENTS_H__
|
||||||
|
#define __GST_QT_ELEMENTS_H__
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
gboolean qt5_element_init (GstPlugin * plugin);
|
||||||
|
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (qmlglsink);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (qmlglsrc);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (qmlgloverlay);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GST_QT_ELEMENTS_H__ */
|
|
@ -79,6 +79,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "gstqtelements.h"
|
||||||
#include "gstqtoverlay.h"
|
#include "gstqtoverlay.h"
|
||||||
#include "qtglrenderer.h"
|
#include "qtglrenderer.h"
|
||||||
#include "gstqtglutility.h"
|
#include "gstqtglutility.h"
|
||||||
|
@ -131,6 +132,10 @@ static guint gst_qt_overlay_signals[LAST_SIGNAL] = { 0 };
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstQtOverlay, gst_qt_overlay,
|
G_DEFINE_TYPE_WITH_CODE (GstQtOverlay, gst_qt_overlay,
|
||||||
GST_TYPE_GL_FILTER, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
|
GST_TYPE_GL_FILTER, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
|
||||||
"qtoverlay", 0, "Qt Video Overlay"));
|
"qtoverlay", 0, "Qt Video Overlay"));
|
||||||
|
#define _do_init \
|
||||||
|
ret |= qt5_element_init (plugin);
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (qmlgloverlay, "qmlgloverlay",
|
||||||
|
GST_RANK_NONE, GST_TYPE_QT_OVERLAY, _do_init);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_qt_overlay_class_init (GstQtOverlayClass * klass)
|
gst_qt_overlay_class_init (GstQtOverlayClass * klass)
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "gstqtelements.h"
|
||||||
#include "gstqtsink.h"
|
#include "gstqtsink.h"
|
||||||
#include <QtGui/QGuiApplication>
|
#include <QtGui/QGuiApplication>
|
||||||
|
|
||||||
|
@ -134,6 +135,10 @@ enum
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstQtSink, gst_qt_sink,
|
G_DEFINE_TYPE_WITH_CODE (GstQtSink, gst_qt_sink,
|
||||||
GST_TYPE_VIDEO_SINK, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
|
GST_TYPE_VIDEO_SINK, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
|
||||||
"qtsink", 0, "Qt Video Sink"));
|
"qtsink", 0, "Qt Video Sink"));
|
||||||
|
#define _do_init \
|
||||||
|
ret |= qt5_element_init (plugin);
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (qmlglsink, "qmlglsink",
|
||||||
|
GST_RANK_NONE, GST_TYPE_QT_SINK, _do_init);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_qt_sink_class_init (GstQtSinkClass * klass)
|
gst_qt_sink_class_init (GstQtSinkClass * klass)
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "gstqtelements.h"
|
||||||
#include "gstqtsrc.h"
|
#include "gstqtsrc.h"
|
||||||
#include <QtGui/QGuiApplication>
|
#include <QtGui/QGuiApplication>
|
||||||
|
|
||||||
|
@ -76,6 +77,10 @@ enum
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstQtSrc, gst_qt_src,
|
G_DEFINE_TYPE_WITH_CODE (GstQtSrc, gst_qt_src,
|
||||||
GST_TYPE_PUSH_SRC, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
|
GST_TYPE_PUSH_SRC, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
|
||||||
"qtsrc", 0, "Qt Video Src"));
|
"qtsrc", 0, "Qt Video Src"));
|
||||||
|
#define _do_init \
|
||||||
|
ret |= qt5_element_init (plugin);
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (qmlglsrc, "qmlglsrc",
|
||||||
|
GST_RANK_NONE, GST_TYPE_QT_SRC, _do_init);
|
||||||
|
|
||||||
static const gfloat vertical_flip_matrix[] = {
|
static const gfloat vertical_flip_matrix[] = {
|
||||||
1.0f, 0.0f, 0.0f, 0.0f,
|
1.0f, 0.0f, 0.0f, 0.0f,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
sources = [
|
sources = [
|
||||||
'gstplugin.cc',
|
'gstplugin.cc',
|
||||||
|
'gstqtelement.cc',
|
||||||
'gstqsgtexture.cc',
|
'gstqsgtexture.cc',
|
||||||
'gstqtglutility.cc',
|
'gstqtglutility.cc',
|
||||||
'gstqtoverlay.cc',
|
'gstqtoverlay.cc',
|
||||||
|
|
|
@ -79,6 +79,7 @@ versionAtLeast(QT_VERSION, "5.5") {
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
gstplugin.cc \
|
gstplugin.cc \
|
||||||
|
gstqtelement.cc \
|
||||||
gstqtglutility.cc \
|
gstqtglutility.cc \
|
||||||
gstqsgtexture.cc \
|
gstqsgtexture.cc \
|
||||||
gstqtoverlay.cc \
|
gstqtoverlay.cc \
|
||||||
|
@ -89,6 +90,7 @@ SOURCES += \
|
||||||
qtitem.cc
|
qtitem.cc
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
gstqtelements.h \
|
||||||
gstqsgtexture.h \
|
gstqsgtexture.h \
|
||||||
gstqtgl.h \
|
gstqtgl.h \
|
||||||
gstqtglutility.h \
|
gstqtglutility.h \
|
||||||
|
|
Loading…
Reference in a new issue