lib: Introduce Clapper playback library

An easy to use media playback library (libclapper) as a GstPlayer replacement.

Previously we tried to use upstream `gstplayer` library to control playback and
pass all events from multiple threads GStreamer uses into an app main thread.
Since this caused some thread racy problems and we needed additional ABI breaking
changes to better suit our needs, we ended up with a modified fork of said library
renamed to `gstclapper` as a temporary solution.

This new library simply named `clapper` replaces our previous `gstclapper` solution
and is written completely from scratch by myself. The aim here is to have an easy to
use playback library better suited to work with (but not limited to) GTK and GObject
properties bindings by relying on "notify" signals.

Major differences include:
* Operates on a playback queue (inherits `GListModel` interface) instead of a single URI
* Uses "notify" signals for property changes always dispatched to app thread
* Time is passed/read as decimal number in seconds instead of int64 in nanoseconds
* Integrates `GstDiscoverer` to figure out media info (such as title) before playback
* Easy to use MPRIS support as part of library
* Optional playback remote controls with WebSocket messages

The new library will be distributed with Clapper player. This includes public headers
and GObject Introspection support.

Licensed under LGPL-2.1-or-later.

Enjoy
This commit is contained in:
Rafał Dzięgiel
2024-03-13 20:45:03 +01:00
parent edaba00658
commit d7f069d6c3
196 changed files with 17622 additions and 21004 deletions

View File

@@ -0,0 +1,81 @@
gst_clapper_sink_dep = dependency('', required: false)
gst_plugins_libdir = join_paths(prefix, libdir, 'gstreamer-1.0')
gst_clapper_importers_libdir = join_paths(clapper_libdir, 'gst', 'plugin', 'importers')
gst_clapper_plugin_deps = [
gtk4_dep,
gst_dep,
gst_base_dep,
gst_video_dep,
gmodule_dep,
]
build_gst_plugin = not get_option('gst-plugin').disabled()
foreach dep : gst_clapper_plugin_deps
if not dep.found()
if get_option('gst-plugin').enabled()
error('GStreamer plugin was enabled, but required dependencies were not found')
endif
build_gst_plugin = false
endif
endforeach
gst_clapper_plugin_args = [
'-DHAVE_CONFIG_H',
'-DGST_USE_UNSTABLE_API',
]
if get_option('default_library') == 'static'
gst_clapper_plugin_args += ['-DGST_STATIC_COMPILATION']
endif
cdata = configuration_data()
cdata.set_quoted('PACKAGE', meson.project_name())
cdata.set_quoted('VERSION', meson.project_version())
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
cdata.set_quoted('GST_PACKAGE_NAME', 'gst-plugin-clapper')
cdata.set_quoted('GST_PACKAGE_ORIGIN', 'https://github.com/Rafostar/clapper')
cdata.set_quoted('GST_LICENSE', 'LGPL')
cdata.set_quoted('CLAPPER_SINK_IMPORTER_PATH', gst_clapper_importers_libdir)
configure_file(
output: 'config.h',
configuration: cdata,
)
gst_plugin_conf_inc = [
include_directories('.'),
include_directories('..'),
include_directories('../..'),
]
gst_clapper_plugin_sources = [
'gstclappersink.c',
'gstclapperpaintable.c',
'gstgtkutils.c',
'gstplugin.c',
'gstclappercontexthandler.c',
'gstclapperimporter.c',
'gstclapperimporterloader.c',
]
if build_gst_plugin
gst_clapper_sink_dep = declare_dependency(
link_with: library('gstclapper',
gst_clapper_plugin_sources,
c_args: gst_clapper_plugin_args,
include_directories: gst_plugin_conf_inc,
dependencies: gst_clapper_plugin_deps,
install: true,
install_dir: gst_plugins_libdir,
),
include_directories: gst_plugin_conf_inc,
dependencies: gst_clapper_plugin_deps,
)
endif
subdir('handlers')
subdir('importers')