multifile: 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 12:04:26 +01:00
parent 859b608acf
commit 894124835f
13 changed files with 35 additions and 40 deletions

View file

@ -229,6 +229,8 @@ gst_image_sequence_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
0, "imagesequencesrc element");
G_DEFINE_TYPE_WITH_CODE (GstImageSequenceSrc, gst_image_sequence_src,
GST_TYPE_PUSH_SRC, _do_init);
GST_ELEMENT_REGISTER_DEFINE (imagesequencesrc, "imagesequencesrc",
GST_RANK_NONE, gst_image_sequence_src_get_type ());
static gboolean
is_seekable (GstBaseSrc * src)

View file

@ -49,6 +49,7 @@ struct _GstImageSequenceSrc
gint fps_n, fps_d;
};
GST_ELEMENT_REGISTER_DECLARE (imagesequencesrc);
G_END_DECLS

View file

@ -34,26 +34,19 @@
#include "gstsplitmuxsink.h"
#include "gstsplitmuxsrc.h"
#include "gstimagesequencesrc.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
gst_element_register (plugin, "multifilesrc", GST_RANK_NONE,
gst_multi_file_src_get_type ());
gst_element_register (plugin, "multifilesink", GST_RANK_NONE,
gst_multi_file_sink_get_type ());
gst_element_register (plugin, "splitfilesrc", GST_RANK_NONE,
gst_split_file_src_get_type ());
gst_element_register (plugin, "imagesequencesrc", GST_RANK_NONE,
gst_image_sequence_src_get_type ());
gboolean ret = FALSE;
if (!register_splitmuxsink (plugin))
return FALSE;
ret |= GST_ELEMENT_REGISTER (multifilesrc, plugin);
ret |= GST_ELEMENT_REGISTER (multifilesink, plugin);
ret |= GST_ELEMENT_REGISTER (splitfilesrc, plugin);
ret |= GST_ELEMENT_REGISTER (imagesequencesrc, plugin);
ret |= GST_ELEMENT_REGISTER (splitmuxsink, plugin);
ret |= GST_ELEMENT_REGISTER (splitmuxsrc, plugin);
if (!register_splitmuxsrc (plugin))
return FALSE;
return TRUE;
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -160,6 +160,8 @@ gst_multi_file_sink_next_get_type (void)
#define gst_multi_file_sink_parent_class parent_class
G_DEFINE_TYPE (GstMultiFileSink, gst_multi_file_sink, GST_TYPE_BASE_SINK);
GST_ELEMENT_REGISTER_DEFINE (multifilesink, "multifilesink", GST_RANK_NONE,
gst_multi_file_sink_get_type ());
static void
gst_multi_file_sink_class_init (GstMultiFileSinkClass * klass)

View file

@ -113,6 +113,8 @@ struct _GstMultiFileSinkClass
GType gst_multi_file_sink_get_type (void);
GST_ELEMENT_REGISTER_DECLARE (multifilesink);
G_END_DECLS
#endif /* __GST_MULTIFILESINK_H__ */

View file

@ -90,7 +90,8 @@ enum
G_DEFINE_TYPE_WITH_CODE (GstMultiFileSrc, gst_multi_file_src, GST_TYPE_PUSH_SRC,
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
gst_multi_file_src_uri_handler_init));
GST_ELEMENT_REGISTER_DEFINE (multifilesrc, "multifilesrc", GST_RANK_NONE,
gst_multi_file_src_get_type ());
static gboolean
is_seekable (GstBaseSrc * src)

View file

@ -67,6 +67,8 @@ struct _GstMultiFileSrcClass
GType gst_multi_file_src_get_type (void);
GST_ELEMENT_REGISTER_DECLARE (multifilesrc);
G_END_DECLS
#endif /* __GST_MULTIFILESRC_H__ */

View file

@ -85,6 +85,8 @@ GST_DEBUG_CATEGORY_STATIC (splitfilesrc_debug);
G_DEFINE_TYPE_WITH_CODE (GstSplitFileSrc, gst_split_file_src, GST_TYPE_BASE_SRC,
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
gst_split_file_src_uri_handler_init));
GST_ELEMENT_REGISTER_DEFINE (splitfilesrc, "splitfilesrc", GST_RANK_NONE,
gst_split_file_src_get_type ());
#ifdef G_OS_WIN32
#define WIN32_BLURB " Location string must be in UTF-8 encoding (on Windows)."

View file

@ -69,6 +69,8 @@ struct _GstSplitFileSrcClass
GType gst_split_file_src_get_type (void);
GST_ELEMENT_REGISTER_DECLARE (splitfilesrc);
G_END_DECLS
#endif /* __GST_SPLIT_FILE_SRC_H__ */

View file

@ -206,11 +206,15 @@ _do_init (void)
PAD_CONTEXT = g_quark_from_static_string ("pad-context");
EOS_FROM_US = g_quark_from_static_string ("eos-from-us");
RUNNING_TIME = g_quark_from_static_string ("running-time");
GST_DEBUG_CATEGORY_INIT (splitmux_debug, "splitmuxsink", 0,
"Split File Muxing Sink");
}
#define gst_splitmux_sink_parent_class parent_class
G_DEFINE_TYPE_EXTENDED (GstSplitMuxSink, gst_splitmux_sink, GST_TYPE_BIN, 0,
_do_init ());
GST_ELEMENT_REGISTER_DEFINE (splitmuxsink, "splitmuxsink", GST_RANK_NONE,
GST_TYPE_SPLITMUX_SINK);
static gboolean create_muxer (GstSplitMuxSink * splitmux);
static gboolean create_sink (GstSplitMuxSink * splitmux);
@ -3688,16 +3692,6 @@ beach:
return ret;
}
gboolean
register_splitmuxsink (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (splitmux_debug, "splitmuxsink", 0,
"Split File Muxing Sink");
return gst_element_register (plugin, "splitmuxsink", GST_RANK_NONE,
GST_TYPE_SPLITMUX_SINK);
}
static void
gst_splitmux_sink_ensure_max_files (GstSplitMuxSink * splitmux)
{

View file

@ -34,7 +34,6 @@ typedef struct _GstSplitMuxSink GstSplitMuxSink;
typedef struct _GstSplitMuxSinkClass GstSplitMuxSinkClass;
GType gst_splitmux_sink_get_type (void);
gboolean register_splitmuxsink (GstPlugin * plugin);
typedef enum _SplitMuxInputState
{
@ -220,5 +219,7 @@ struct _GstSplitMuxSinkClass
void (*split_at_running_time) (GstSplitMuxSink * splitmux, GstClockTime split_time);
};
GST_ELEMENT_REGISTER_DECLARE (splitmuxsink);
G_END_DECLS
#endif /* __GST_SPLITMUXSINK_H__ */

View file

@ -125,11 +125,14 @@ static gboolean gst_splitmux_src_activate_part (GstSplitMuxSrc * splitmux,
guint part, GstSeekFlags extra_flags);
#define _do_init \
G_IMPLEMENT_INTERFACE(GST_TYPE_URI_HANDLER, splitmux_src_uri_handler_init);
G_IMPLEMENT_INTERFACE(GST_TYPE_URI_HANDLER, splitmux_src_uri_handler_init); \
GST_DEBUG_CATEGORY_INIT (splitmux_debug, "splitmuxsrc", 0, "Split File Demuxing Source");
#define gst_splitmux_src_parent_class parent_class
G_DEFINE_TYPE_EXTENDED (GstSplitMuxSrc, gst_splitmux_src, GST_TYPE_BIN, 0,
_do_init);
GST_ELEMENT_REGISTER_DEFINE (splitmuxsrc, "splitmuxsrc", GST_RANK_NONE,
GST_TYPE_SPLITMUX_SRC);
static GstURIType
splitmux_src_uri_get_type (GType type)
@ -1539,14 +1542,3 @@ splitmux_src_pad_query (GstPad * pad, GstObject * parent, GstQuery * query)
}
return ret;
}
gboolean
register_splitmuxsrc (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (splitmux_debug, "splitmuxsrc", 0,
"Split File Demuxing Source");
return gst_element_register (plugin, "splitmuxsrc", GST_RANK_NONE,
GST_TYPE_SPLITMUX_SRC);
}

View file

@ -104,7 +104,6 @@ struct _SplitMuxSrcPadClass
};
GType gst_splitmux_src_get_type (void);
gboolean register_splitmuxsrc (GstPlugin * plugin);
#define SPLITMUX_SRC_LOCK(s) g_mutex_lock(&(s)->lock)
#define SPLITMUX_SRC_UNLOCK(s) g_mutex_unlock(&(s)->lock)
@ -117,6 +116,8 @@ gboolean register_splitmuxsrc (GstPlugin * plugin);
#define SPLITMUX_SRC_PADS_RLOCK(s) g_rw_lock_reader_lock(&(s)->pads_rwlock)
#define SPLITMUX_SRC_PADS_RUNLOCK(s) g_rw_lock_reader_unlock(&(s)->pads_rwlock)
GST_ELEMENT_REGISTER_DECLARE (splitmuxsrc);
G_END_DECLS
#endif /* __GST_SPLITMUX_SRC_H__ */