[gtk/wip/otte/no-media-modules] media: Don't build media modules as modules
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/no-media-modules] media: Don't build media modules as modules
- Date: Tue, 10 Aug 2021 21:04:51 +0000 (UTC)
commit 27f44aa595bd715d8b312cf0e82f0857871b5d1d
Author: Benjamin Otte <otte redhat com>
Date: Tue Aug 10 23:03:28 2021 +0200
media: Don't build media modules as modules
Instead, include them in libgtk.
gtk/gtkmediafile.c | 20 ++++++++++++++++++++
gtk/meson.build | 4 ++--
meson.build | 1 +
modules/media/gtkffmediafile.c | 40 ++++------------------------------------
modules/media/gtkgstmediafile.c | 29 -----------------------------
modules/media/meson.build | 17 +++++++----------
modules/meson.build | 2 --
7 files changed, 34 insertions(+), 79 deletions(-)
---
diff --git a/gtk/gtkmediafile.c b/gtk/gtkmediafile.c
index 33b56a2cf5..0c856e80fd 100644
--- a/gtk/gtkmediafile.c
+++ b/gtk/gtkmediafile.c
@@ -26,6 +26,13 @@
#include "gtkmodulesprivate.h"
#include "gtknomediafileprivate.h"
+#ifdef HAVE_FFMPEG
+#include "modules/media/gtkffmediafileprivate.h"
+#endif
+#ifdef HAVE_GSTREAMER
+#include "modules/media/gtkgstmediafileprivate.h"
+#endif
+
/**
* GtkMediaFile:
*
@@ -621,6 +628,19 @@ gtk_media_file_extension_init (void)
g_type_ensure (GTK_TYPE_NO_MEDIA_FILE);
+#ifdef HAVE_FFMPEG
+ g_io_extension_point_implement (GTK_MEDIA_FILE_EXTENSION_POINT_NAME,
+ GTK_TYPE_FF_MEDIA_FILE,
+ "ffmpeg",
+ 0);
+#endif
+#ifdef HAVE_GSTREAMER
+ g_io_extension_point_implement (GTK_MEDIA_FILE_EXTENSION_POINT_NAME,
+ GTK_TYPE_GST_MEDIA_FILE,
+ "gstreamer",
+ 10);
+#endif
+
scope = g_io_module_scope_new (G_IO_MODULE_SCOPE_BLOCK_DUPLICATES);
paths = _gtk_get_module_path ("media");
diff --git a/gtk/meson.build b/gtk/meson.build
index 18fbe6ac61..eb9e5c0102 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -1114,7 +1114,7 @@ libgtk_static = static_library('gtk',
c_args: gtk_cargs + common_cflags,
include_directories: [confinc, gdkinc, gskinc, gtkinc],
dependencies: gtk_deps + [libgtk_css_dep, libgdk_dep, libgsk_dep],
- link_with: [libgtk_css, libgdk, libgsk ],
+ link_with: [libgtk_css, libgdk, libgsk, media_ffmpeg, media_gstreamer ],
)
# `link_whole:` is actually only supported on Visual Studio 2015 Update 2
@@ -1126,7 +1126,7 @@ whole_archives = []
gtk4_objs = []
if cc.get_id() == 'msvc' and cc.version().split('.').get(0) < '19'
- foreach target : [ libgtk_static, libgtk_css, libgdk, libgdk_win32, libgsk, libgsk_f16c ]
+ foreach target : [ libgtk_static, libgtk_css, libgdk, libgdk_win32, libgsk, libgsk_f16c, media_ffmpeg,
media_gstreamer ]
gtk4_objs += target.extract_all_objects(recursive: false)
endforeach
else
diff --git a/meson.build b/meson.build
index 5a19806e55..74005a6487 100644
--- a/meson.build
+++ b/meson.build
@@ -732,6 +732,7 @@ project_build_root = meson.current_build_dir()
subdir('gtk/css')
subdir('gdk')
subdir('gsk')
+subdir('modules/media')
subdir('gtk')
subdir('modules')
if get_option('demos')
diff --git a/modules/media/gtkffmediafile.c b/modules/media/gtkffmediafile.c
index ff5225e845..c659e49c7b 100644
--- a/modules/media/gtkffmediafile.c
+++ b/modules/media/gtkffmediafile.c
@@ -171,42 +171,6 @@ G_DEFINE_TYPE_EXTENDED (GtkFfMediaFile, gtk_ff_media_file, GTK_TYPE_MEDIA_FILE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_ff_media_file_paintable_init))
-G_MODULE_EXPORT
-void
-g_io_module_load (GIOModule *module)
-{
- g_type_module_use (G_TYPE_MODULE (module));
-
-#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT (58, 9, 100)
- av_register_all ();
-#endif
-
- g_io_extension_point_implement (GTK_MEDIA_FILE_EXTENSION_POINT_NAME,
- GTK_TYPE_FF_MEDIA_FILE,
- "ffmpeg",
- 0);
-}
-
-G_MODULE_EXPORT
-G_GNUC_NORETURN
-void
-g_io_module_unload (GIOModule *module)
-{
- g_assert_not_reached ();
-}
-
-G_MODULE_EXPORT
-char **
-g_io_module_query (void)
-{
- char *eps[] = {
- (char *) GTK_MEDIA_FILE_EXTENSION_POINT_NAME,
- NULL
- };
-
- return g_strdupv (eps);
-}
-
static void
gtk_ff_media_file_set_ffmpeg_error (GtkFfMediaFile *video,
int av_errnum)
@@ -762,6 +726,10 @@ gtk_ff_media_file_class_init (GtkFfMediaFileClass *klass)
stream_class->seek = gtk_ff_media_file_seek;
gobject_class->dispose = gtk_ff_media_file_dispose;
+
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT (58, 9, 100)
+ av_register_all ();
+#endif
}
static void
diff --git a/modules/media/gtkgstmediafile.c b/modules/media/gtkgstmediafile.c
index 6f09d1dbc8..74ccb789d0 100644
--- a/modules/media/gtkgstmediafile.c
+++ b/modules/media/gtkgstmediafile.c
@@ -97,35 +97,6 @@ G_DEFINE_TYPE_EXTENDED (GtkGstMediaFile, gtk_gst_media_file, GTK_TYPE_MEDIA_FILE
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_gst_media_file_paintable_init))
-void
-g_io_module_load (GIOModule *module)
-{
- g_type_module_use (G_TYPE_MODULE (module));
-
- g_io_extension_point_implement (GTK_MEDIA_FILE_EXTENSION_POINT_NAME,
- GTK_TYPE_GST_MEDIA_FILE,
- "gstreamer",
- 10);
-}
-
-G_GNUC_NORETURN
-void
-g_io_module_unload (GIOModule *module)
-{
- g_assert_not_reached ();
-}
-
-char **
-g_io_module_query (void)
-{
- char *eps[] = {
- (char *) GTK_MEDIA_FILE_EXTENSION_POINT_NAME,
- NULL
- };
-
- return g_strdupv (eps);
-}
-
static void
gtk_gst_media_file_ensure_prepared (GtkGstMediaFile *self)
{
diff --git a/modules/media/meson.build b/modules/media/meson.build
index 1bd91821d8..2615b3aa31 100644
--- a/modules/media/meson.build
+++ b/modules/media/meson.build
@@ -31,13 +31,11 @@ endforeach
if ffmpeg_found
media_backends += 'ffmpeg'
cdata.set('HAVE_FFMPEG', 1)
- shared_module('media-ffmpeg',
+ media_ffmpeg = static_library('media-ffmpeg',
sources: 'gtkffmediafile.c',
+ include_directories: [ confinc, gtkinc ],
c_args: extra_c_args,
- dependencies: [ libgtk_dep, ffmpeg_deps ],
- name_suffix: module_suffix,
- install_dir: media_install_dir,
- install: true,
+ dependencies: [ gdk_deps, ffmpeg_deps ],
)
endif
@@ -64,16 +62,15 @@ if gstplayer_dep.found() and gstgl_dep.found()
media_backends += 'gstreamer'
cdata.set('HAVE_GSTREAMER', 1)
- shared_module('media-gstreamer',
+
+ media_gstreamer = static_library('media-gstreamer',
sources: [
'gtkgstmediafile.c',
'gtkgstpaintable.c',
'gtkgstsink.c',
],
+ include_directories: [ confinc, gtkinc ],
c_args: extra_c_args + extra_win_cflags,
- dependencies: [ libm, libgtk_dep, gstplayer_dep, gstgl_dep ],
- name_suffix: module_suffix,
- install_dir: media_install_dir,
- install: true,
+ dependencies: [ libm, gdk_deps, gstplayer_dep, gstgl_dep ],
)
endif
diff --git a/modules/meson.build b/modules/meson.build
index 4bd67114f8..ba02d2e72d 100644
--- a/modules/meson.build
+++ b/modules/meson.build
@@ -4,5 +4,3 @@ if os_unix
else
print_backends = []
endif
-
-subdir('media')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]