Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
coreelements: allow per features 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/gstreamer/-/merge_requests/661>
  • Loading branch information
Stéphane Cerveau committed Dec 10, 2020
1 parent a41f37d commit 783e19b
Show file tree
Hide file tree
Showing 26 changed files with 193 additions and 137 deletions.
3 changes: 3 additions & 0 deletions plugins/elements/gstcapsfilter.c
Expand Up @@ -42,6 +42,7 @@

#include "../../gst/gst-i18n-lib.h"
#include "gstcapsfilter.h"
#include "gstcoreelementselements.h"

enum
{
Expand Down Expand Up @@ -93,6 +94,8 @@ gst_caps_filter_caps_change_mode_get_type (void)
G_DEFINE_TYPE_WITH_CODE (GstCapsFilter, gst_capsfilter, GST_TYPE_BASE_TRANSFORM,
_do_init);

GST_ELEMENT_REGISTER_DEFINE (capsfilter, "capsfilter", GST_RANK_NONE,
GST_TYPE_CAPS_FILTER);

static void gst_capsfilter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
Expand Down
3 changes: 3 additions & 0 deletions plugins/elements/gstclocksync.c
Expand Up @@ -48,6 +48,7 @@
#include <gst/gst.h>

#include "gstclocksync.h"
#include "gstcoreelementselements.h"

GST_DEBUG_CATEGORY_STATIC (gst_clock_sync_debug);
#define GST_CAT_DEFAULT gst_clock_sync_debug
Expand Down Expand Up @@ -80,6 +81,8 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
#define gst_clock_sync_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstClockSync, gst_clock_sync, GST_TYPE_ELEMENT,
_do_init);
GST_ELEMENT_REGISTER_DEFINE (clocksync, "clocksync", GST_RANK_NONE,
GST_TYPE_CLOCKSYNC);

static void gst_clock_sync_finalize (GObject * object);

Expand Down
2 changes: 2 additions & 0 deletions plugins/elements/gstconcat.c
Expand Up @@ -50,6 +50,7 @@
#endif

#include "gstconcat.h"
#include "gstcoreelementselements.h"

GST_DEBUG_CATEGORY_STATIC (gst_concat_debug);
#define GST_CAT_DEFAULT gst_concat_debug
Expand Down Expand Up @@ -118,6 +119,7 @@ enum
GST_DEBUG_CATEGORY_INIT (gst_concat_debug, "concat", 0, "concat element");
#define gst_concat_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstConcat, gst_concat, GST_TYPE_ELEMENT, _do_init);
GST_ELEMENT_REGISTER_DEFINE (concat, "concat", GST_RANK_NONE, GST_TYPE_CONCAT);

static void gst_concat_dispose (GObject * object);
static void gst_concat_finalize (GObject * object);
Expand Down
54 changes: 54 additions & 0 deletions plugins/elements/gstcoreelementselements.h
@@ -0,0 +1,54 @@
/*
* 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_CORE_ELEMENTS_ELEMENTS_H__
#define __GST_CORE_ELEMENTS_ELEMENTS_H__

#include <gst/gst.h>

G_BEGIN_DECLS

GST_ELEMENT_REGISTER_DECLARE (capsfilter);
GST_ELEMENT_REGISTER_DECLARE (clocksync);
GST_ELEMENT_REGISTER_DECLARE (concat);
GST_ELEMENT_REGISTER_DECLARE (dataurisrc);
GST_ELEMENT_REGISTER_DECLARE (downloadbuffer);
GST_ELEMENT_REGISTER_DECLARE (fakesink);
GST_ELEMENT_REGISTER_DECLARE (fakesrc);
#if defined(HAVE_SYS_SOCKET_H) || defined(_MSC_VER)
GST_ELEMENT_REGISTER_DECLARE (fdsrc);
GST_ELEMENT_REGISTER_DECLARE (fdsink);
#endif
GST_ELEMENT_REGISTER_DECLARE (filesink);
GST_ELEMENT_REGISTER_DECLARE (filesrc);
GST_ELEMENT_REGISTER_DECLARE (funnel);
GST_ELEMENT_REGISTER_DECLARE (identity);
GST_ELEMENT_REGISTER_DECLARE (input_selector);
GST_ELEMENT_REGISTER_DECLARE (multiqueue);
GST_ELEMENT_REGISTER_DECLARE (output_selector);
GST_ELEMENT_REGISTER_DECLARE (queue);
GST_ELEMENT_REGISTER_DECLARE (queue2);
GST_ELEMENT_REGISTER_DECLARE (streamiddemux);
GST_ELEMENT_REGISTER_DECLARE (tee);
GST_ELEMENT_REGISTER_DECLARE (typefind);
GST_ELEMENT_REGISTER_DECLARE (valve);

G_END_DECLS

#endif /* __GST_CORE_ELEMENTS_ELEMENTS_H__ */
72 changes: 72 additions & 0 deletions plugins/elements/gstcoreelementsplugin.c
@@ -0,0 +1,72 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstelementsplugin.c:
*
* 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.
*/
/**
* plugin-coreelements:
*
* GStreamer core elements
*/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <gst/gst.h>

#include "gstcoreelementselements.h"


static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean ret = FALSE;

ret |= GST_ELEMENT_REGISTER (capsfilter, plugin);
ret |= GST_ELEMENT_REGISTER (clocksync, plugin);
ret |= GST_ELEMENT_REGISTER (concat, plugin);
ret |= GST_ELEMENT_REGISTER (dataurisrc, plugin);
ret |= GST_ELEMENT_REGISTER (downloadbuffer, plugin);
ret |= GST_ELEMENT_REGISTER (fakesrc, plugin);
ret |= GST_ELEMENT_REGISTER (fakesink, plugin);
#if defined(HAVE_SYS_SOCKET_H) || defined(_MSC_VER)
ret |= GST_ELEMENT_REGISTER (fdsrc, plugin);
ret |= GST_ELEMENT_REGISTER (fdsink, plugin);
#endif
ret |= GST_ELEMENT_REGISTER (filesrc, plugin);
ret |= GST_ELEMENT_REGISTER (funnel, plugin);
ret |= GST_ELEMENT_REGISTER (identity, plugin);
ret |= GST_ELEMENT_REGISTER (input_selector, plugin);
ret |= GST_ELEMENT_REGISTER (output_selector, plugin);
ret |= GST_ELEMENT_REGISTER (queue, plugin);
ret |= GST_ELEMENT_REGISTER (queue2, plugin);
ret |= GST_ELEMENT_REGISTER (filesink, plugin);
ret |= GST_ELEMENT_REGISTER (tee, plugin);
ret |= GST_ELEMENT_REGISTER (typefind, plugin);
ret |= GST_ELEMENT_REGISTER (multiqueue, plugin);
ret |= GST_ELEMENT_REGISTER (valve, plugin);
ret |= GST_ELEMENT_REGISTER (streamiddemux, plugin);

return ret;
}

GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, coreelements,
"GStreamer core elements", plugin_init, VERSION, GST_LICENSE,
GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
3 changes: 3 additions & 0 deletions plugins/elements/gstdataurisrc.c
Expand Up @@ -38,6 +38,7 @@
#endif

#include "gstdataurisrc.h"
#include "gstcoreelementselements.h"

#include <string.h>
#include <gst/base/gsttypefindhelper.h>
Expand Down Expand Up @@ -82,6 +83,8 @@ static gboolean gst_data_uri_src_set_uri (GstURIHandler * handler,
G_DEFINE_TYPE_WITH_CODE (GstDataURISrc, gst_data_uri_src, GST_TYPE_BASE_SRC,
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
gst_data_uri_src_handler_init));
GST_ELEMENT_REGISTER_DEFINE (dataurisrc, "dataurisrc", GST_RANK_PRIMARY,
GST_TYPE_DATA_URI_SRC);

static void
gst_data_uri_src_class_init (GstDataURISrcClass * klass)
Expand Down
3 changes: 3 additions & 0 deletions plugins/elements/gstdownloadbuffer.c
Expand Up @@ -53,6 +53,7 @@
#endif

#include "gstdownloadbuffer.h"
#include "gstcoreelementselements.h"

#include <glib/gstdio.h>

Expand Down Expand Up @@ -170,6 +171,8 @@ enum
#define gst_download_buffer_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstDownloadBuffer, gst_download_buffer,
GST_TYPE_ELEMENT, _do_init);
GST_ELEMENT_REGISTER_DEFINE (downloadbuffer, "downloadbuffer", GST_RANK_NONE,
GST_TYPE_DOWNLOAD_BUFFER);

static GstMessage *update_buffering (GstDownloadBuffer * dlbuf);

Expand Down
134 changes: 0 additions & 134 deletions plugins/elements/gstelements.c

This file was deleted.

6 changes: 5 additions & 1 deletion plugins/elements/gstfakesink.c
Expand Up @@ -37,9 +37,11 @@
# include "config.h"
#endif

#include <string.h>

#include "gstelements_private.h"
#include "gstfakesink.h"
#include <string.h>
#include "gstcoreelementselements.h"

static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
Expand Down Expand Up @@ -116,6 +118,8 @@ gst_fake_sink_state_error_get_type (void)
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_fake_sink_debug, "fakesink", 0, "fakesink element");
#define gst_fake_sink_parent_class parent_class
GST_ELEMENT_REGISTER_DEFINE (fakesink, "fakesink", GST_RANK_NONE,
GST_TYPE_FAKE_SINK);
G_DEFINE_TYPE_WITH_CODE (GstFakeSink, gst_fake_sink, GST_TYPE_BASE_SINK,
_do_init);

Expand Down
3 changes: 3 additions & 0 deletions plugins/elements/gstfakesrc.c
Expand Up @@ -51,6 +51,7 @@

#include "gstelements_private.h"
#include "gstfakesrc.h"
#include "gstcoreelementselements.h"

static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
Expand Down Expand Up @@ -203,6 +204,8 @@ gst_fake_src_filltype_get_type (void)
GST_DEBUG_CATEGORY_INIT (gst_fake_src_debug, "fakesrc", 0, "fakesrc element");
#define gst_fake_src_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstFakeSrc, gst_fake_src, GST_TYPE_BASE_SRC, _do_init);
GST_ELEMENT_REGISTER_DEFINE (fakesrc, "fakesrc", GST_RANK_NONE,
GST_TYPE_FAKE_SRC);

static void gst_fake_src_finalize (GObject * object);
static void gst_fake_src_set_property (GObject * object, guint prop_id,
Expand Down

0 comments on commit 783e19b

Please sign in to comment.