isomp4: 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-16 10:26:40 +01:00
parent 713453d145
commit 2cce1247da
8 changed files with 120 additions and 41 deletions

View file

@ -0,0 +1,55 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2003> David A. Schleef <ds@schleef.org>
* Copyright (C) <2006> 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 "gst/gst-i18n-plugin.h"
#include <gst/pbutils/pbutils.h>
#include "gstisomp4elements.h"
#include "qtdemux.h"
void
isomp4_element_init (GstPlugin * plugin)
{
static gsize res = FALSE;
if (g_once_init_enter (&res)) {
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif /* ENABLE_NLS */
gst_pb_utils_init ();
/* ensure private tag is registered */
gst_tag_register (GST_QT_DEMUX_PRIVATE_TAG, GST_TAG_FLAG_META,
GST_TYPE_SAMPLE, "QT atom", "unparsed QT tag atom",
gst_tag_merge_use_first);
gst_tag_register (GST_QT_DEMUX_CLASSIFICATION_TAG, GST_TAG_FLAG_META,
G_TYPE_STRING, GST_QT_DEMUX_CLASSIFICATION_TAG,
"content classification", gst_tag_merge_use_first);
g_once_init_leave (&res, TRUE);
}
}

View file

@ -0,0 +1,43 @@
/*
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2003> David A. Schleef <ds@schleef.org>
* Copyright (C) <2006> Wim Taymans <wim@fluendo.com>
* 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_ISOMP4_ELEMENTS_H__
#define __GST_ISOMP4_ELEMENTS_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
G_BEGIN_DECLS
void isomp4_element_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (qtdemux);
GST_ELEMENT_REGISTER_DECLARE (rtpxqtdepay);
GST_ELEMENT_REGISTER_DECLARE (qtmux);
GST_ELEMENT_REGISTER_DECLARE (qtmoovrecover);
G_END_DECLS
#endif /* __GST_ISOMP4_ELEMENTS_H__ */

View file

@ -64,6 +64,7 @@
#include <glib/gstdio.h>
#include <gst/gst.h>
#include "gstisomp4elements.h"
#include "gstqtmoovrecover.h"
GST_DEBUG_CATEGORY_STATIC (gst_qt_moov_recover_debug);
@ -87,6 +88,8 @@ enum
#define gst_qt_moov_recover_parent_class parent_class
G_DEFINE_TYPE (GstQTMoovRecover, gst_qt_moov_recover, GST_TYPE_PIPELINE);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (qtmoovrecover, "qtmoovrecover",
GST_RANK_NONE, GST_TYPE_QT_MOOV_RECOVER, isomp4_element_init (plugin));
/* property functions */
static void gst_qt_moov_recover_set_property (GObject * object,
@ -375,11 +378,3 @@ gst_qt_moov_recover_change_state (GstElement * element,
}
return ret;
}
gboolean
gst_qt_moov_recover_register (GstPlugin * plugin)
{
return gst_element_register (plugin, "qtmoovrecover", GST_RANK_NONE,
GST_TYPE_QT_MOOV_RECOVER);
}

View file

@ -86,6 +86,7 @@
# include <unistd.h>
#endif
#include "gstisomp4elements.h"
#include "gstqtmux.h"
GST_DEBUG_CATEGORY_STATIC (gst_qt_mux_debug);
@ -7454,7 +7455,11 @@ gst_qt_mux_register (GstPlugin * plugin)
G_TYPE_STRING, GST_TAG_3GP_CLASSIFICATION, "content classification",
gst_tag_merge_use_first);
isomp4_element_init (plugin);
GST_LOG ("Finished registering tags");
return TRUE;
}
GST_ELEMENT_REGISTER_DEFINE_CUSTOM (qtmux, gst_qt_mux_register);

View file

@ -27,6 +27,7 @@
#include <gst/rtp/gstrtpbuffer.h>
#include <string.h>
#include "gstisomp4elements.h"
#include "gstrtpxqtdepay.h"
#define MAKE_TLV(a,b) (((a)<<8)|(b))
@ -94,6 +95,8 @@ GST_STATIC_PAD_TEMPLATE ("sink",
#define gst_rtp_xqt_depay_parent_class parent_class
G_DEFINE_TYPE (GstRtpXQTDepay, gst_rtp_xqt_depay, GST_TYPE_RTP_BASE_DEPAYLOAD);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (rtpxqtdepay, "rtpxqtdepay",
GST_RANK_MARGINAL, GST_TYPE_RTP_XQT_DEPAY, isomp4_element_init (plugin));
static void gst_rtp_xqt_depay_finalize (GObject * object);

View file

@ -24,46 +24,20 @@
#endif
#include "gst/gst-i18n-plugin.h"
#include "qtdemux.h"
#include "gstrtpxqtdepay.h"
#include "gstqtmux.h"
#include "gstqtmoovrecover.h"
#include "gstisomp4elements.h"
#include <gst/pbutils/pbutils.h>
static gboolean
plugin_init (GstPlugin * plugin)
{
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif /* ENABLE_NLS */
gboolean ret = FALSE;
gst_pb_utils_init ();
ret |= GST_ELEMENT_REGISTER (qtdemux, plugin);
ret |= GST_ELEMENT_REGISTER (rtpxqtdepay, plugin);
ret |= GST_ELEMENT_REGISTER (qtmux, plugin);
ret |= GST_ELEMENT_REGISTER (qtmoovrecover, plugin);
/* ensure private tag is registered */
gst_tag_register (GST_QT_DEMUX_PRIVATE_TAG, GST_TAG_FLAG_META,
GST_TYPE_SAMPLE, "QT atom", "unparsed QT tag atom",
gst_tag_merge_use_first);
gst_tag_register (GST_QT_DEMUX_CLASSIFICATION_TAG, GST_TAG_FLAG_META,
G_TYPE_STRING, GST_QT_DEMUX_CLASSIFICATION_TAG, "content classification",
gst_tag_merge_use_first);
if (!gst_element_register (plugin, "qtdemux",
GST_RANK_PRIMARY, GST_TYPE_QTDEMUX))
return FALSE;
if (!gst_element_register (plugin, "rtpxqtdepay",
GST_RANK_MARGINAL, GST_TYPE_RTP_XQT_DEPAY))
return FALSE;
if (!gst_qt_mux_register (plugin))
return FALSE;
if (!gst_qt_moov_recover_register (plugin))
return FALSE;
return TRUE;
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -1,5 +1,6 @@
mp4_sources = [
'isomp4-plugin.c',
'gstisomp4element.c',
'gstrtpxqtdepay.c',
'qtdemux.c',
'qtdemux_types.c',

View file

@ -59,6 +59,7 @@
#include <gst/riff/riff.h>
#include <gst/pbutils/pbutils.h>
#include "gstisomp4elements.h"
#include "qtatomparser.h"
#include "qtdemux_types.h"
#include "qtdemux_dump.h"
@ -289,6 +290,8 @@ GST_STATIC_PAD_TEMPLATE ("subtitle_%u",
#define gst_qtdemux_parent_class parent_class
G_DEFINE_TYPE (GstQTDemux, gst_qtdemux, GST_TYPE_ELEMENT);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (qtdemux, "qtdemux",
GST_RANK_PRIMARY, GST_TYPE_QTDEMUX, isomp4_element_init (plugin));
static void gst_qtdemux_dispose (GObject * object);
static void gst_qtdemux_finalize (GObject * object);