kate: 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-bad/-/merge_requests/2038>
This commit is contained in:
Stéphane Cerveau 2021-02-17 18:38:16 +01:00 committed by GStreamer Marge Bot
parent f7d1e607b5
commit 54ec02252f
10 changed files with 133 additions and 62 deletions

View file

@ -47,67 +47,23 @@
#include "config.h"
#endif
#include <string.h>
#include "gstkateelements.h"
#include <gst/gst.h>
#include "gstkate.h"
#include "gstkatedec.h"
#include "gstkateenc.h"
#include "gstkateparse.h"
#include "gstkatetag.h"
#undef HAVE_TIGER
#ifdef HAVE_TIGER
#include "gstkatetiger.h"
#endif
GST_DEBUG_CATEGORY (gst_katedec_debug);
GST_DEBUG_CATEGORY (gst_kateenc_debug);
GST_DEBUG_CATEGORY (gst_kateparse_debug);
GST_DEBUG_CATEGORY (gst_katetag_debug);
GST_DEBUG_CATEGORY (gst_kateutil_debug);
#ifdef HAVE_TIGER
GST_DEBUG_CATEGORY (gst_katetiger_debug);
#endif
static gboolean
plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_katedec_debug, "katedec", 0, "Kate decoder");
GST_DEBUG_CATEGORY_INIT (gst_kateenc_debug, "kateenc", 0, "Kate encoder");
GST_DEBUG_CATEGORY_INIT (gst_kateparse_debug, "kateparse", 0, "Kate parser");
GST_DEBUG_CATEGORY_INIT (gst_katetag_debug, "katetag", 0, "Kate tagger");
GST_DEBUG_CATEGORY_INIT (gst_kateutil_debug, "kateutil", 0,
"Kate utility functions");
gboolean ret = FALSE;
ret |= GST_ELEMENT_REGISTER (katedec, plugin);
ret |= GST_ELEMENT_REGISTER (kateenc, plugin);
ret |= GST_ELEMENT_REGISTER (kateparse, plugin);
ret |= GST_ELEMENT_REGISTER (katetag, plugin);
#ifdef HAVE_TIGER
GST_DEBUG_CATEGORY_INIT (gst_katetiger_debug, "tiger", 0,
"Kate Tiger renderer");
ret |= GST_ELEMENT_REGISTER (tiger, plugin);
#endif
if (!gst_element_register (plugin, "katedec", GST_RANK_PRIMARY,
GST_TYPE_KATE_DEC))
return FALSE;
if (!gst_element_register (plugin, "kateenc", GST_RANK_NONE,
GST_TYPE_KATE_ENC))
return FALSE;
if (!gst_element_register (plugin, "kateparse", GST_RANK_NONE,
GST_TYPE_KATE_PARSE))
return FALSE;
if (!gst_element_register (plugin, "katetag", GST_RANK_NONE,
GST_TYPE_KATE_TAG))
return FALSE;
#ifdef HAVE_TIGER
if (!gst_element_register (plugin, "tiger", GST_RANK_PRIMARY,
GST_TYPE_KATE_TIGER))
return FALSE;
#endif
return TRUE;
return ret;
}
/* this is the structure that gstreamer looks for to register plugins

View file

@ -79,7 +79,7 @@
#include <gst/gst.h>
#include "gstkate.h"
#include "gstkateelements.h"
#include "gstkatespu.h"
#include "gstkatedec.h"
@ -115,8 +115,15 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_KATE_SPU_MIME_TYPE)
);
GST_DEBUG_CATEGORY (gst_katedec_debug);
#define gst_kate_dec_parent_class parent_class
G_DEFINE_TYPE (GstKateDec, gst_kate_dec, GST_TYPE_ELEMENT);
#define _do_init \
kate_element_init (plugin); \
GST_DEBUG_CATEGORY_INIT (gst_katedec_debug, "katedec", 0, "Kate decoder");
GST_ELEMENT_REGISTER_DEFINE (katedec, "katedec", GST_RANK_PRIMARY,
GST_TYPE_KATE_DEC);
static void gst_kate_dec_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);

72
ext/kate/gstkateelement.c Normal file
View file

@ -0,0 +1,72 @@
/*
* GStreamer
* Copyright 2005 Thomas Vander Stichele <thomas@apestaart.org>
* Copyright 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* Copyright 2008 Vincent Penquerc'h <ogg.k.ogg.k@googlemail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Alternatively, the contents of this file may be used under the
* GNU Lesser General Public License Version 2.1 (the "LGPL"), in
* which case the following provisions apply instead of the ones
* mentioned above:
*
* 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 <string.h>
#include <gst/gst.h>
#include "gstkateelements.h"
#undef HAVE_TIGER
#ifdef HAVE_TIGER
#include "gstkatetiger.h"
#endif
GST_DEBUG_CATEGORY (gst_kateutil_debug);
void
kate_element_init (GstPlugin * plugin)
{
static gsize res = FALSE;
if (g_once_init_enter (&res)) {
GST_DEBUG_CATEGORY_INIT (gst_kateutil_debug, "kateutil", 0,
"Kate utility functions");
g_once_init_leave (&res, TRUE);
}
}

View file

@ -41,15 +41,22 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_KATE_H__
#define __GST_KATE_H__
#ifndef __GST_KATE_ELEMENT_H__
#define __GST_KATE_ELEMENT_H__
#include <gst/gst.h>
G_BEGIN_DECLS
/* nothing here any more */
void kate_element_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (katedec);
GST_ELEMENT_REGISTER_DECLARE (kateenc);
GST_ELEMENT_REGISTER_DECLARE (kateparse);
GST_ELEMENT_REGISTER_DECLARE (tiger);
GST_ELEMENT_REGISTER_DECLARE (katetag);
G_END_DECLS
#endif /* __GST_KATE_H__ */
#endif /* __GST_KATE_ELEMENT_H__ */

View file

@ -83,7 +83,7 @@
#include <gst/gsttagsetter.h>
#include <gst/tag/tag.h>
#include "gstkate.h"
#include "gstkateelements.h"
#include "gstkateutil.h"
#include "gstkatespu.h"
#include "gstkateenc.h"
@ -144,9 +144,16 @@ static gboolean gst_kate_enc_sink_event (GstPad * pad, GstObject * parent,
static gboolean gst_kate_enc_source_query (GstPad * pad, GstObject * parent,
GstQuery * query);
GST_DEBUG_CATEGORY (gst_kateenc_debug);
#define gst_kate_enc_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstKateEnc, gst_kate_enc, GST_TYPE_ELEMENT,
G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL));
#define _do_init \
kate_element_init (plugin); \
GST_DEBUG_CATEGORY_INIT (gst_kateenc_debug, "kateenc", 0, "Kate encoder");
GST_ELEMENT_REGISTER_DEFINE (kateenc, "kateenc", GST_RANK_NONE,
GST_TYPE_KATE_ENC);
/* initialize the plugin's class */
static void

View file

@ -57,7 +57,7 @@
# include "config.h"
#endif
#include "gstkate.h"
#include "gstkateelements.h"
#include "gstkateutil.h"
#include "gstkateparse.h"
@ -78,8 +78,15 @@ static GstStaticPadTemplate gst_kate_parse_src_factory =
GST_STATIC_CAPS ("subtitle/x-kate; application/x-kate")
);
GST_DEBUG_CATEGORY (gst_kateparse_debug);
#define gst_kate_parse_parent_class parent_class
G_DEFINE_TYPE (GstKateParse, gst_kate_parse, GST_TYPE_ELEMENT);
#define _do_init \
kate_element_init (plugin); \
GST_DEBUG_CATEGORY_INIT (gst_kateparse_debug, "kateparse", 0, "Kate parser");
GST_ELEMENT_REGISTER_DEFINE (kateparse, "kateparse", GST_RANK_NONE,
GST_TYPE_KATE_PARSE);
static GstFlowReturn gst_kate_parse_chain (GstPad * pad, GstObject * parent,
GstBuffer * buffer);

View file

@ -69,6 +69,7 @@
#include <kate/kate.h>
#include "gstkateelements.h"
#include "gstkatetag.h"
@ -92,9 +93,15 @@ static void gst_kate_tag_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_kate_tag_dispose (GObject * object);
GST_DEBUG_CATEGORY (gst_katetag_debug);
#define gst_kate_tag_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstKateTag, gst_kate_tag, GST_TYPE_KATE_PARSE,
G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL));
#define _do_init \
kate_element_init (plugin); \
GST_DEBUG_CATEGORY_INIT (gst_katetag_debug, "katetag", 0, "Kate tagger");
GST_ELEMENT_REGISTER_DEFINE (katetag, "katetag", GST_RANK_NONE,
GST_TYPE_KATE_TAG);
static void
gst_kate_tag_class_init (GstKateTagClass * klass)

View file

@ -80,7 +80,7 @@
#include <gst/glib-compat-private.h>
#include <gst/video/video.h>
#include "gstkate.h"
#include "gstkateelements.h"
#include "gstkatetiger.h"
GST_DEBUG_CATEGORY_EXTERN (gst_katetiger_debug);
@ -174,7 +174,15 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_ALWAYS,
GST_STATIC_CAPS (TIGER_VIDEO_CAPS));
GST_DEBUG_CATEGORY (gst_katetiger_debug);
GST_BOILERPLATE (GstKateTiger, gst_kate_tiger, GstElement, GST_TYPE_ELEMENT);
#define _do_init \
kate_element_init (plugin); \
GST_DEBUG_CATEGORY_INIT (gst_katetiger_debug, "tiger", 0, \
"Kate Tiger renderer");
GST_ELEMENT_REGISTER_DEFINE (tiger, "tiger", GST_RANK_NONE,
GST_TYPE_KATE_TIGER);
static GType
gst_kate_tiger_font_effect_get_type (void)

View file

@ -28,7 +28,6 @@
#include <tiger/tiger.h>
#endif
#include <gst/tag/tag.h>
#include "gstkate.h"
#include "gstkateutil.h"
GST_DEBUG_CATEGORY_EXTERN (gst_kateutil_debug);

View file

@ -1,5 +1,6 @@
kate_sources = [
'gstkate.c',
'gstkateelement.c',
'gstkatedec.c',
'gstkateenc.c',
'gstkateparse.c',