gst-full: register full features in a plugin

To offer the possibility to get information at plugin
level and get it from the registry, all the
full features are now registered in 'fullstaticfeatures'
meta plugin instead of NULL plugin.
In the case of gst-inspect, the features were not displayed
at plugin level because it was a NULL plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5421>
This commit is contained in:
Stéphane Cerveau 2023-09-28 18:22:38 +02:00 committed by GStreamer Marge Bot
parent aeef97d81b
commit bdbf6e1c17
5 changed files with 37 additions and 11 deletions

View file

@ -342,8 +342,10 @@ if building_full
cdata = configuration_data() cdata = configuration_data()
cdata.set_quoted('GST_API_VERSION', apiversion) cdata.set_quoted('GST_API_VERSION', apiversion)
cdata.set_quoted('GETTEXT_PACKAGE', 'gstreamer-full-1.0') cdata.set_quoted('GETTEXT_PACKAGE', 'gstreamer-full-1.0')
cdata.set_quoted('PACKAGE_VERSION', gst_version) cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin')) cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
cdata.set_quoted('GST_FULL_LICENSE', get_option('gstreamer-full-license'))
cdata.set_quoted('GST_PLUGIN_FULL_FEATURES_NAME', 'fullstaticfeatures')
configure_file(output : 'config.h', configuration : cdata) configure_file(output : 'config.h', configuration : cdata)
configinc = include_directories('.') configinc = include_directories('.')
gst_c_args = ['-DHAVE_CONFIG_H'] gst_c_args = ['-DHAVE_CONFIG_H']
@ -441,7 +443,7 @@ if building_full
# Build shared library # Build shared library
gstfull = build_target('gstreamer-full-1.0', gstfull = build_target('gstreamer-full-1.0',
init_static_plugins_c, init_static_plugins_c,
c_args: ['-DBUILDING_GST'], c_args: ['-DBUILDING_GST'] + gst_c_args,
target_type: get_option('gst-full-target-type'), target_type: get_option('gst-full-target-type'),
link_args: gstfull_link_args, link_args: gstfull_link_args,
link_whole : exposed_libs, link_whole : exposed_libs,

View file

@ -70,3 +70,5 @@ option('glib-checks', type : 'feature', value : 'enabled', yield : true,
option('package-name', type : 'string', yield : true, option('package-name', type : 'string', yield : true,
description : 'package name to use in plugins') description : 'package name to use in plugins')
option('gstreamer-full-license', type : 'string', value : 'unknown',
description : 'gstreamer-full license (default unknown)')

View file

@ -6,6 +6,9 @@ from string import Template
TEMPLATE = Template(''' TEMPLATE = Template('''
#include <gst/gst.h> #include <gst/gst.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
$elements_declaration $elements_declaration
$typefind_funcs_declaration $typefind_funcs_declaration
@ -14,16 +17,28 @@ $dynamic_types_declaration
$plugins_declaration $plugins_declaration
$giomodules_declaration $giomodules_declaration
static
gboolean register_features_full (GstPlugin* plugin)
{
$elements_registration
$typefind_funcs_registration
$device_providers_registration
$dynamic_types_registration
return TRUE;
}
_GST_EXPORT _GST_EXPORT
void void
gst_init_static_plugins (void) gst_init_static_plugins (void)
{ {
static gsize initialization_value = 0; static gsize initialization_value = 0;
if (g_once_init_enter (&initialization_value)) { if (g_once_init_enter (&initialization_value)) {
$elements_registration
$typefind_funcs_registration gst_plugin_register_static (GST_VERSION_MAJOR, GST_VERSION_MINOR,
$device_providers_registration GST_PLUGIN_FULL_FEATURES_NAME, "features linked into the gstreamer-full library", register_features_full, PACKAGE_VERSION, GST_FULL_LICENSE,
$dynamic_types_registration "gstreamer-full", GETTEXT_PACKAGE, GST_PACKAGE_ORIGIN);
$plugins_registration $plugins_registration
$giomodules_registration $giomodules_registration
@ -57,7 +72,7 @@ def process_features(features_list, plugins, feature_prefix):
for feature in features: for feature in features:
feature = feature.replace("-", "_") feature = feature.replace("-", "_")
feature_declaration += ['%s_REGISTER_DECLARE(%s);' % (feature_prefix, feature)] feature_declaration += ['%s_REGISTER_DECLARE(%s);' % (feature_prefix, feature)]
feature_registration += ['%s_REGISTER(%s, NULL);' % (feature_prefix, feature)] feature_registration += ['%s_REGISTER(%s, plugin);' % (feature_prefix, feature)]
return (plugins_list, feature_declaration, feature_registration) return (plugins_list, feature_declaration, feature_registration)

View file

@ -1,8 +1,8 @@
dep = dependency('gstreamer-full-1.0', required: get_option('default_library') == 'static') dep = dependency('gstreamer-full-1.0', required: get_option('default_library') == 'static')
if dep.found() if dep.found()
test_gst_full_features = executable('test-gst-full-features', 'test-gst-full-features.c', dependencies : gst_full_dep) test_gst_full_features = executable('test-gst-full-features', 'test-gst-full-features.c', dependencies : gst_full_dep, c_args: ['-DHAVE_CONFIG_H'])
test('test-gst-full-features', test_gst_full_features) test('test-gst-full-features', test_gst_full_features)
test_gst_full = executable('test-gst-full', 'test-gst-full.c', dependencies : gst_full_dep) test_gst_full = executable('test-gst-full', 'test-gst-full.c', dependencies : gst_full_dep, c_args: ['-DHAVE_CONFIG_H'])
test('test-gst-full', test_gst_full) test('test-gst-full', test_gst_full)
endif endif

View file

@ -1,4 +1,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
void void
@ -14,10 +17,14 @@ assert_feature_names (gchar * names, GType feature_type, gboolean spook)
for (i = 0; split[i]; i++) { for (i = 0; split[i]; i++) {
feature = gst_registry_find_feature (gst_registry_get (), feature = gst_registry_find_feature (gst_registry_get (),
split[i], feature_type); split[i], feature_type);
if (spook) if (spook) {
g_assert_null (feature); g_assert_null (feature);
else } else {
g_assert_nonnull (feature); g_assert_nonnull (feature);
g_assert_cmpstr (gst_plugin_feature_get_plugin_name (feature), ==,
GST_PLUGIN_FULL_FEATURES_NAME);
}
if (feature) if (feature)
gst_object_unref (feature); gst_object_unref (feature);
} }