pango: 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-base/-/merge_requests/1029>
This commit is contained in:
Stéphane Cerveau 2020-12-11 18:47:41 +01:00 committed by GStreamer Marge Bot
parent d41e8c68bf
commit 59163a107d
9 changed files with 154 additions and 32 deletions

View file

@ -43,9 +43,6 @@
* clipped properly during blitting (if wrapping is disabled)
*/
GST_DEBUG_CATEGORY (pango_debug);
#define GST_CAT_DEFAULT pango_debug
#define DEFAULT_PROP_TEXT ""
#define DEFAULT_PROP_SHADING FALSE
#define DEFAULT_PROP_VALIGNMENT GST_BASE_TEXT_OVERLAY_VALIGN_BASELINE
@ -3075,28 +3072,3 @@ gst_base_text_overlay_change_state (GstElement * element,
return ret;
}
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "textoverlay", GST_RANK_NONE,
GST_TYPE_TEXT_OVERLAY) ||
!gst_element_register (plugin, "timeoverlay", GST_RANK_NONE,
GST_TYPE_TIME_OVERLAY) ||
!gst_element_register (plugin, "clockoverlay", GST_RANK_NONE,
GST_TYPE_CLOCK_OVERLAY) ||
!gst_element_register (plugin, "textrender", GST_RANK_NONE,
GST_TYPE_TEXT_RENDER)) {
return FALSE;
}
/*texttestsrc_plugin_init(module, plugin); */
GST_DEBUG_CATEGORY_INIT (pango_debug, "pango", 0, "Pango elements");
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
pango, "Pango-based text rendering and overlay", plugin_init,
VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -49,10 +49,11 @@
#include "config.h"
#endif
#include "gstclockoverlay.h"
#include <gst/video/video.h>
#include <time.h>
#include "gstclockoverlay.h"
#include "gstpangoelements.h"
#define DEFAULT_PROP_TIMEFORMAT "%H:%M:%S"
@ -65,6 +66,8 @@ enum
#define gst_clock_overlay_parent_class parent_class
G_DEFINE_TYPE (GstClockOverlay, gst_clock_overlay, GST_TYPE_BASE_TEXT_OVERLAY);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (clockoverlay, "clockoverlay",
GST_RANK_NONE, GST_TYPE_CLOCK_OVERLAY, pango_element_init (plugin));
static void gst_clock_overlay_finalize (GObject * object);
static void gst_clock_overlay_set_property (GObject * object, guint prop_id,

View file

@ -0,0 +1,45 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2003> David Schleef <ds@schleef.org>
* Copyright (C) <2006> Julien Moutte <julien@moutte.net>
* Copyright (C) <2006> Zeeshan Ali <zeeshan.ali@nokia.com>
* Copyright (C) <2006-2008> Tim-Philipp Müller <tim centricular net>
* Copyright (C) <2009> Young-Ho Cha <ganadist@gmail.com>
* Copyright (C) 2020 Huawei Technologies Co., Ltd.
* @Author: Stéphane Cerveau <scerveau@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.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "gstpangoelements.h"
GST_DEBUG_CATEGORY (pango_debug);
#define GST_CAT_DEFAULT pango_debug
void
pango_element_init (GstPlugin * plugin)
{
static gsize res = FALSE;
if (g_once_init_enter (&res)) {
/*texttestsrc_plugin_init(module, plugin); */
GST_DEBUG_CATEGORY_INIT (pango_debug, "pango", 0, "Pango elements");
g_once_init_leave (&res, TRUE);
}
}

View file

@ -0,0 +1,43 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2003> David Schleef <ds@schleef.org>
* Copyright (C) <2006> Julien Moutte <julien@moutte.net>
* Copyright (C) <2006> Zeeshan Ali <zeeshan.ali@nokia.com>
* Copyright (C) <2006-2008> Tim-Philipp Müller <tim centricular net>
* Copyright (C) <2009> Young-Ho Cha <ganadist@gmail.com>
* Copyright (C) 2020 Huawei Technologies Co., Ltd.
* @Author: Stéphane Cerveau <scerveau@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_PANGO_ELEMENTS_H__
#define __GST_PANGO_ELEMENTS_H__
#include <gst/gst.h>
G_BEGIN_DECLS
G_GNUC_INTERNAL void pango_element_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (textoverlay);
GST_ELEMENT_REGISTER_DECLARE (timeoverlay);
GST_ELEMENT_REGISTER_DECLARE (clockoverlay);
GST_ELEMENT_REGISTER_DECLARE (textrender);
G_END_DECLS
#endif /* __GST_PANGO_ELEMENTS_H__ */

View file

@ -0,0 +1,48 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2003> David Schleef <ds@schleef.org>
* Copyright (C) <2006> Julien Moutte <julien@moutte.net>
* Copyright (C) <2006> Zeeshan Ali <zeeshan.ali@nokia.com>
* Copyright (C) <2006-2008> Tim-Philipp Müller <tim centricular net>
* Copyright (C) <2009> Young-Ho Cha <ganadist@gmail.com>
* Copyright (C) 2020 Huawei Technologies Co., Ltd.
* @Author: Stéphane Cerveau <scerveau@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.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "gstpangoelements.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean ret = FALSE;
ret |= GST_ELEMENT_REGISTER (textoverlay, plugin);
ret |= GST_ELEMENT_REGISTER (timeoverlay, plugin);
ret |= GST_ELEMENT_REGISTER (clockoverlay, plugin);
ret |= GST_ELEMENT_REGISTER (textrender, plugin);
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
pango, "Pango-based text rendering and overlay", plugin_init,
VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -75,7 +75,8 @@
#include "config.h"
#endif
#include <gsttextoverlay.h>
#include "gsttextoverlay.h"
#include "gstpangoelements.h"
static GstStaticPadTemplate text_sink_template_factory =
GST_STATIC_PAD_TEMPLATE ("text_sink",
@ -85,6 +86,8 @@ GST_STATIC_PAD_TEMPLATE ("text_sink",
);
G_DEFINE_TYPE (GstTextOverlay, gst_text_overlay, GST_TYPE_BASE_TEXT_OVERLAY);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (textoverlay, "textoverlay",
GST_RANK_NONE, GST_TYPE_TEXT_OVERLAY, pango_element_init (plugin));
static void
gst_text_overlay_class_init (GstTextOverlayClass * klass)

View file

@ -42,12 +42,13 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include "gsttextrender.h"
#include <string.h>
#include "gstpangoelements.h"
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
# define CAIRO_ARGB_A 3
@ -165,6 +166,8 @@ static void gst_text_render_adjust_values_with_fontdesc (GstTextRender *
#define gst_text_render_parent_class parent_class
G_DEFINE_TYPE (GstTextRender, gst_text_render, GST_TYPE_ELEMENT);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (textrender, "textrender",
GST_RANK_NONE, GST_TYPE_TEXT_RENDER, pango_element_init (plugin));
static void gst_text_render_finalize (GObject * object);
static void gst_text_render_set_property (GObject * object,

View file

@ -51,6 +51,7 @@
#include <gst/video/video.h>
#include "gsttimeoverlay.h"
#include "gstpangoelements.h"
#define DEFAULT_TIME_LINE GST_TIME_OVERLAY_TIME_LINE_BUFFER_TIME
#define DEFAULT_SHOW_TIMES_AS_DATES FALSE
@ -67,6 +68,8 @@ enum
#define gst_time_overlay_parent_class parent_class
G_DEFINE_TYPE (GstTimeOverlay, gst_time_overlay, GST_TYPE_BASE_TEXT_OVERLAY);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (timeoverlay, "timeoverlay",
GST_RANK_NONE, GST_TYPE_TIME_OVERLAY, pango_element_init (plugin));
static void gst_time_overlay_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);

View file

@ -1,4 +1,6 @@
pango_sources = [
'gstpangoelement.c',
'gstpangoplugin.c',
'gstbasetextoverlay.c',
'gstclockoverlay.c',
'gsttextoverlay.c',