dv: 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:
Stéphane Cerveau 2021-02-11 18:57:03 +01:00
parent c428f0080b
commit 0b257dd1d5
6 changed files with 90 additions and 11 deletions

View file

@ -22,23 +22,17 @@
#include "config.h"
#endif
#include "gstdvdec.h"
#include "gstdvdemux.h"
#include "gstdvelements.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
dv_init (0, 0);
gboolean ret = FALSE;
if (!gst_element_register (plugin, "dvdemux", GST_RANK_PRIMARY,
gst_dvdemux_get_type ()))
return FALSE;
ret |= GST_ELEMENT_REGISTER (dvdemux, plugin);
ret |= GST_ELEMENT_REGISTER (dvdec, plugin);
if (!gst_element_register (plugin, "dvdec", GST_RANK_MARGINAL,
gst_dvdec_get_type ()))
return FALSE;
return TRUE;
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -45,6 +45,7 @@
#include <gst/video/gstvideometa.h>
#include <gst/video/gstvideopool.h>
#include "gstdvelements.h"
#include "gstdvdec.h"
/* sizes of one input buffer */
@ -131,6 +132,8 @@ gst_dvdec_quality_get_type (void)
#define gst_dvdec_parent_class parent_class
G_DEFINE_TYPE (GstDVDec, gst_dvdec, GST_TYPE_ELEMENT);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dvdec, "dvdec", GST_RANK_MARGINAL,
GST_TYPE_DVDEC, dv_element_init (plugin));
static GstFlowReturn gst_dvdec_chain (GstPad * pad, GstObject * parent,
GstBuffer * buffer);

View file

@ -26,6 +26,7 @@
#include <math.h>
#include <gst/audio/audio.h>
#include "gstdvelements.h"
#include "gstdvdemux.h"
#include "gstsmptetimecode.h"
@ -130,6 +131,8 @@ static GstStaticPadTemplate audio_src_temp = GST_STATIC_PAD_TEMPLATE ("audio",
#define gst_dvdemux_parent_class parent_class
G_DEFINE_TYPE (GstDVDemux, gst_dvdemux, GST_TYPE_ELEMENT);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dvdemux, "dvdemux", GST_RANK_PRIMARY,
GST_TYPE_DVDEMUX, dv_element_init (plugin));
static void gst_dvdemux_finalize (GObject * object);

36
ext/dv/gstdvelement.c Normal file
View file

@ -0,0 +1,36 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* <2005> Wim Taymans <wim@fluendo.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 <libdv/dv.h>
#include "gstdvelements.h"
void
dv_element_init (GstPlugin * plugin)
{
static gsize res = FALSE;
if (g_once_init_enter (&res)) {
dv_init (0, 0);
g_once_init_leave (&res, TRUE);
}
}

42
ext/dv/gstdvelements.h Normal file
View file

@ -0,0 +1,42 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* 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_DV_ELEMENTS_H__
#define __GST_DV_ELEMENTS_H__
#include <gst/gst.h>
#include <gst/video/video.h>
G_BEGIN_DECLS
void dv_element_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (dvdemux);
GST_ELEMENT_REGISTER_DECLARE (dvdec);
G_END_DECLS
#endif /* __GST_DV_ELEMENTS_H__ */

View file

@ -1,5 +1,6 @@
dv_sources = [
'gstdv.c',
'gstdvelement.c',
'gstdvdec.c',
'gstdvdemux.c',
'gstsmptetimecode.c',