Skip to content

Commit da13710

Browse files
committed
gst-plugin: Provide option to include plugin statically
When building with -Dbuiltin-loaders=true (default false, due to some external components depending on it), the clapper gst plugin will be built as static library and linked into libclapper-gtk.
1 parent 1f3d616 commit da13710

File tree

7 files changed

+54
-4
lines changed

7 files changed

+54
-4
lines changed

meson_options.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ option('doc',
3535
description: 'Build documentation'
3636
)
3737

38+
option('builtin-loaders',
39+
type: 'boolean',
40+
value: false,
41+
description: 'Include the gst-plugin statically'
42+
)
43+
3844
# Functionalities
3945
option('enhancers-loader',
4046
type: 'feature',

src/lib/clapper-gtk/clapper-gtk-video.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@
102102
#include "clapper-gtk-buffering-animation-private.h"
103103
#include "clapper-gtk-video-placeholder-private.h"
104104

105+
#ifdef CLAPPER_GTK_STATIC_GST_PLUGIN
106+
#include "gstclapperplugin.h"
107+
#endif
108+
105109
#define PERCENTAGE_ROUND(a) (round ((gdouble) a / 0.01) * 0.01)
106110

107111
#define DEFAULT_FADE_DELAY 3000
@@ -1553,6 +1557,10 @@ clapper_gtk_video_class_init (ClapperGtkVideoClass *klass)
15531557
GObjectClass *gobject_class = (GObjectClass *) klass;
15541558
GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;
15551559

1560+
#ifdef CLAPPER_GTK_STATIC_GST_PLUGIN
1561+
GST_PLUGIN_STATIC_REGISTER (clapper);
1562+
#endif
1563+
15561564
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clappergtkvideo", GST_DEBUG_FG_MAGENTA,
15571565
"Clapper GTK Video");
15581566

src/lib/clapper-gtk/meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ if get_option('default_library') == 'static'
141141
clappergtk_c_args += ['-DCLAPPER_GTK_STATIC_COMPILATION']
142142
endif
143143

144+
if static_gst_plugin
145+
clappergtk_c_args += ['-DCLAPPER_GTK_STATIC_GST_PLUGIN']
146+
endif
147+
144148
clappergtk_headers_dir = join_paths(includedir, clapper_api_name, 'clapper-gtk')
145149

146150
clappergtk_enums = gnome.mkenums_simple(
@@ -176,6 +180,7 @@ if build_gir
176180
clappergtk_enums,
177181
],
178182
extra_args: [
183+
gir_init_section,
179184
'--quiet',
180185
'--warn-all',
181186
'-DCLAPPER_GTK_COMPILATION',
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (C) 2025 Florian "sp1rit" <[email protected]>
3+
*
4+
* This library is free software; you can redistribute it and/or
5+
* modify it under the terms of the GNU Library General Public
6+
* License as published by the Free Software Foundation; either
7+
* version 2 of the License, or (at your option) any later version.
8+
*
9+
* This library is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
* Library General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Library General Public
15+
* License along with this library; if not, see
16+
* <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
#pragma once
20+
21+
#include <glib.h>
22+
#include <gst/gst.h>
23+
24+
G_BEGIN_DECLS
25+
26+
GST_PLUGIN_STATIC_DECLARE (clapper);
27+
28+
G_END_DECLS

src/lib/gst/plugin/meson.build

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ gst_clapper_plugin_args = [
2626
'-DGST_USE_UNSTABLE_API',
2727
]
2828

29-
if get_option('default_library') == 'static'
29+
if static_gst_plugin
3030
gst_clapper_plugin_args += [
3131
'-DGST_STATIC_COMPILATION',
3232
'-DCLAPPER_GST_STATIC_COMPILATION',
@@ -73,7 +73,7 @@ gst_clapper_plugin_sources = [
7373
'gstclappersink.c',
7474
'gstclapperpaintable.c',
7575
'gstgtkutils.c',
76-
'gstplugin.c',
76+
'gstclapperplugin.c',
7777
'gstclappercontexthandler.c',
7878
'gstclapperimporter.c',
7979
'gstclapperimporterloader.c',
@@ -113,12 +113,13 @@ endif
113113

114114
if build_gst_plugin
115115
gst_clapper_sink_dep = declare_dependency(
116-
link_with: library('gstclapper',
116+
link_with: build_target('gstclapper',
117117
gst_clapper_plugin_sources,
118+
target_type: static_gst_plugin ? 'static_library' : 'shared_library',
118119
c_args: gst_clapper_plugin_args,
119120
include_directories: gst_plugin_conf_inc,
120121
dependencies: gst_clapper_plugin_deps + gst_clapper_plugin_private_deps,
121-
install: true,
122+
install: not static_gst_plugin,
122123
install_dir: gst_plugins_libdir,
123124
),
124125
include_directories: gst_plugin_conf_inc,

src/lib/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ gir_init_section = '--add-init-section=extern void gst_init(gint*,gchar**);' + \
1111
'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
1212
'gst_init(NULL,NULL);'
1313

14+
static_gst_plugin = get_option('builtin-loaders')
15+
1416
subdir('gst')
1517
subdir('clapper')
1618
subdir('clapper-gtk')

0 commit comments

Comments
 (0)