vpx: 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-15 11:00:46 +01:00
parent a047a1144b
commit 96f59cd7cf
8 changed files with 95 additions and 17 deletions

View file

@ -44,6 +44,7 @@
#include <string.h>
#include "gstvpxelements.h"
#include "gstvp8dec.h"
#include "gstvp8utils.h"
@ -77,6 +78,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
#define parent_class gst_vp8_dec_parent_class
G_DEFINE_TYPE (GstVP8Dec, gst_vp8_dec, GST_TYPE_VPX_DEC);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vp8dec, "vp8dec", GST_RANK_PRIMARY,
gst_vp8_dec_get_type (), vpx_element_init (plugin));
static void
gst_vp8_dec_class_init (GstVP8DecClass * klass)

View file

@ -62,6 +62,7 @@
#include <gst/video/video.h>
#include <string.h>
#include "gstvpxelements.h"
#include "gstvp8utils.h"
#include "gstvp8enc.h"
@ -139,6 +140,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
#define parent_class gst_vp8_enc_parent_class
G_DEFINE_TYPE (GstVP8Enc, gst_vp8_enc, GST_TYPE_VPX_ENC);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vp8enc, "vp8enc", GST_RANK_PRIMARY,
gst_vp8_enc_get_type (), vpx_element_init (plugin));
static void
gst_vp8_enc_class_init (GstVP8EncClass * klass)

View file

@ -44,6 +44,7 @@
#include <string.h>
#include "gstvpxelements.h"
#include "gstvp8utils.h"
#include "gstvp9dec.h"
@ -80,6 +81,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
#define parent_class gst_vp9_dec_parent_class
G_DEFINE_TYPE (GstVP9Dec, gst_vp9_dec, GST_TYPE_VPX_DEC);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vp9dec, "vp9dec", GST_RANK_PRIMARY,
gst_vp9_dec_get_type (), vpx_element_init (plugin));
static void
gst_vp9_dec_class_init (GstVP9DecClass * klass)

View file

@ -62,6 +62,7 @@
#include <gst/video/video.h>
#include <string.h>
#include "gstvpxelements.h"
#include "gstvp8utils.h"
#include "gstvp9enc.h"
@ -99,6 +100,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
#define parent_class gst_vp9_enc_parent_class
G_DEFINE_TYPE (GstVP9Enc, gst_vp9_enc, GST_TYPE_VPX_ENC);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vp9enc, "vp9enc", GST_RANK_PRIMARY,
gst_vp9_enc_get_type (), vpx_element_init (plugin));
static vpx_codec_iface_t *gst_vp9_enc_get_algo (GstVPXEnc * enc);
static gboolean gst_vp9_enc_enable_scaling (GstVPXEnc * enc);

39
ext/vpx/gstvpxelement.c Normal file
View file

@ -0,0 +1,39 @@
/* VPX
* Copyright (C) 2006 David Schleef <ds@schleef.org>
* Copyright (C) 2010 Entropy Wave Inc
*
* 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 "gstvpxelements.h"
#include <gst/tag/tag.h>
void
vpx_element_init (GstPlugin * plugin)
{
static gsize res = FALSE;
static const gchar *tags[] = { NULL };
if (g_once_init_enter (&res)) {
gst_meta_register_custom ("GstVP8Meta", tags, NULL, NULL, NULL);
g_once_init_leave (&res, TRUE);
}
}

36
ext/vpx/gstvpxelements.h Normal file
View file

@ -0,0 +1,36 @@
/*
* 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_VPX_ELEMENTS_H__
#define __GST_VPX_ELEMENTS_H__
#include <gst/gst.h>
G_BEGIN_DECLS
void vpx_element_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (vp8dec);
GST_ELEMENT_REGISTER_DECLARE (vp8enc);
GST_ELEMENT_REGISTER_DECLARE (vp9dec);
GST_ELEMENT_REGISTER_DECLARE (vp9enc);
G_END_DECLS
#endif /* __GST_VPX_ELEMENTS_H__ */

View file

@ -6,6 +6,7 @@ vpx_sources = [
'gstvp9enc.c',
'gstvpxdec.c',
'gstvpxenc.c',
'gstvpxelement.c',
'plugin.c',
]

View file

@ -25,40 +25,30 @@
#include <gst/gst.h>
#include "gstvp8dec.h"
#include "gstvp8enc.h"
#include "gstvp9dec.h"
#include "gstvp9enc.h"
#include "gstvpxelements.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
static const gchar *tags[] = { NULL };
gboolean ret = FALSE;
#ifdef HAVE_VP8_DECODER
gst_element_register (plugin, "vp8dec", GST_RANK_PRIMARY,
gst_vp8_dec_get_type ());
ret |= GST_ELEMENT_REGISTER (vp8dec, plugin);
#endif
#ifdef HAVE_VP8_ENCODER
gst_element_register (plugin, "vp8enc", GST_RANK_PRIMARY,
gst_vp8_enc_get_type ());
ret |= GST_ELEMENT_REGISTER (vp8enc, plugin);
#endif
#ifdef HAVE_VP9_DECODER
gst_element_register (plugin, "vp9dec", GST_RANK_PRIMARY,
gst_vp9_dec_get_type ());
ret |= GST_ELEMENT_REGISTER (vp9dec, plugin);
#endif
#ifdef HAVE_VP9_ENCODER
gst_element_register (plugin, "vp9enc", GST_RANK_PRIMARY,
gst_vp9_enc_get_type ());
ret |= GST_ELEMENT_REGISTER (vp9enc, plugin);
#endif
if (!gst_meta_register_custom ("GstVP8Meta", tags, NULL, NULL, NULL))
return FALSE;
return TRUE;
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,